@apolitical/component-library 5.5.0 → 5.5.1-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/index.js CHANGED
@@ -18,67 +18,67 @@
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 uu;function dm(){return uu||(uu=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"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function v(R){if(R===null||typeof R!="object")return null;var oe=g&&R[g]||R[f];return typeof oe=="function"?oe:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(R){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];k("error",R,ce)}}function k(R,oe,ce){{var De=b.ReactDebugCurrentFrame,Oe=De.getStackAddendum();Oe!==""&&(oe+="%s",ce=ce.concat([Oe]));var qe=ce.map(function(je){return String(je)});qe.unshift("Warning: "+oe),Function.prototype.apply.call(console[R],console,qe)}}var T=!1,D=!1,C=!1,S=!1,L=!1,N;N=Symbol.for("react.module.reference");function q(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===i||L||R===a||R===u||R===d||S||R===p||T||D||C||typeof R=="object"&&R!==null&&(R.$$typeof===m||R.$$typeof===h||R.$$typeof===s||R.$$typeof===o||R.$$typeof===l||R.$$typeof===N||R.getModuleId!==void 0))}function $(R,oe,ce){var De=R.displayName;if(De)return De;var Oe=oe.displayName||oe.name||"";return Oe!==""?ce+"("+Oe+")":ce}function F(R){return R.displayName||"Context"}function _(R){if(R==null)return null;if(typeof R.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){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 R=="object")switch(R.$$typeof){case o:var oe=R;return F(oe)+".Consumer";case s:var ce=R;return F(ce._context)+".Provider";case l:return $(R,R.render,"ForwardRef");case h:var De=R.displayName||null;return De!==null?De:_(R.type)||"Memo";case m:{var Oe=R,qe=Oe._payload,je=Oe._init;try{return _(je(qe))}catch{return null}}}return null}var P=Object.assign,j=0,W,V,se,re,w,ee,K;function A(){}A.__reactDisabledLog=!0;function B(){{if(j===0){W=console.log,V=console.info,se=console.warn,re=console.error,w=console.group,ee=console.groupCollapsed,K=console.groupEnd;var R={configurable:!0,enumerable:!0,value:A,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}j++}}function O(){{if(j--,j===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},R,{value:W}),info:P({},R,{value:V}),warn:P({},R,{value:se}),error:P({},R,{value:re}),group:P({},R,{value:w}),groupCollapsed:P({},R,{value:ee}),groupEnd:P({},R,{value:K})})}j<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var M=b.ReactCurrentDispatcher,z;function Y(R,oe,ce){{if(z===void 0)try{throw Error()}catch(Oe){var De=Oe.stack.trim().match(/\n( *(at )?)/);z=De&&De[1]||""}return`
22
- `+z+R}}var U=!1,ne;{var le=typeof WeakMap=="function"?WeakMap:Map;ne=new le}function J(R,oe){if(!R||U)return"";{var ce=ne.get(R);if(ce!==void 0)return ce}var De;U=!0;var Oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var qe;qe=M.current,M.current=null,B();try{if(oe){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(Gt){De=Gt}Reflect.construct(R,[],je)}else{try{je.call()}catch(Gt){De=Gt}R.call(je.prototype)}}else{try{throw Error()}catch(Gt){De=Gt}R()}}catch(Gt){if(Gt&&De&&typeof Gt.stack=="string"){for(var Se=Gt.stack.split(`
21
+ */var uu;function dm(){return uu||(uu=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"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function v(R){if(R===null||typeof R!="object")return null;var oe=g&&R[g]||R[f];return typeof oe=="function"?oe:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(R){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];k("error",R,ce)}}function k(R,oe,ce){{var De=b.ReactDebugCurrentFrame,Oe=De.getStackAddendum();Oe!==""&&(oe+="%s",ce=ce.concat([Oe]));var qe=ce.map(function(je){return String(je)});qe.unshift("Warning: "+oe),Function.prototype.apply.call(console[R],console,qe)}}var T=!1,D=!1,w=!1,S=!1,L=!1,M;M=Symbol.for("react.module.reference");function q(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===i||L||R===a||R===u||R===d||S||R===p||T||D||w||typeof R=="object"&&R!==null&&(R.$$typeof===m||R.$$typeof===h||R.$$typeof===s||R.$$typeof===o||R.$$typeof===l||R.$$typeof===M||R.getModuleId!==void 0))}function $(R,oe,ce){var De=R.displayName;if(De)return De;var Oe=oe.displayName||oe.name||"";return Oe!==""?ce+"("+Oe+")":ce}function F(R){return R.displayName||"Context"}function _(R){if(R==null)return null;if(typeof R.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){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 R=="object")switch(R.$$typeof){case o:var oe=R;return F(oe)+".Consumer";case s:var ce=R;return F(ce._context)+".Provider";case l:return $(R,R.render,"ForwardRef");case h:var De=R.displayName||null;return De!==null?De:_(R.type)||"Memo";case m:{var Oe=R,qe=Oe._payload,je=Oe._init;try{return _(je(qe))}catch{return null}}}return null}var P=Object.assign,j=0,W,V,se,re,C,ee,K;function A(){}A.__reactDisabledLog=!0;function B(){{if(j===0){W=console.log,V=console.info,se=console.warn,re=console.error,C=console.group,ee=console.groupCollapsed,K=console.groupEnd;var R={configurable:!0,enumerable:!0,value:A,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}j++}}function O(){{if(j--,j===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},R,{value:W}),info:P({},R,{value:V}),warn:P({},R,{value:se}),error:P({},R,{value:re}),group:P({},R,{value:C}),groupCollapsed:P({},R,{value:ee}),groupEnd:P({},R,{value:K})})}j<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var N=b.ReactCurrentDispatcher,z;function Y(R,oe,ce){{if(z===void 0)try{throw Error()}catch(Oe){var De=Oe.stack.trim().match(/\n( *(at )?)/);z=De&&De[1]||""}return`
22
+ `+z+R}}var U=!1,ne;{var le=typeof WeakMap=="function"?WeakMap:Map;ne=new le}function J(R,oe){if(!R||U)return"";{var ce=ne.get(R);if(ce!==void 0)return ce}var De;U=!0;var Oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var qe;qe=N.current,N.current=null,B();try{if(oe){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(Gt){De=Gt}Reflect.construct(R,[],je)}else{try{je.call()}catch(Gt){De=Gt}R.call(je.prototype)}}else{try{throw Error()}catch(Gt){De=Gt}R()}}catch(Gt){if(Gt&&De&&typeof Gt.stack=="string"){for(var Se=Gt.stack.split(`
23
23
  `),ft=De.stack.split(`
24
24
  `),Je=Se.length-1,tt=ft.length-1;Je>=1&&tt>=0&&Se[Je]!==ft[tt];)tt--;for(;Je>=1&&tt>=0;Je--,tt--)if(Se[Je]!==ft[tt]){if(Je!==1||tt!==1)do if(Je--,tt--,tt<0||Se[Je]!==ft[tt]){var kt=`
25
- `+Se[Je].replace(" at new "," at ");return R.displayName&&kt.includes("<anonymous>")&&(kt=kt.replace("<anonymous>",R.displayName)),typeof R=="function"&&ne.set(R,kt),kt}while(Je>=1&&tt>=0);break}}}finally{U=!1,M.current=qe,O(),Error.prepareStackTrace=Oe}var qn=R?R.displayName||R.name:"",su=qn?Y(qn):"";return typeof R=="function"&&ne.set(R,su),su}function pe(R,oe,ce){return J(R,!1)}function me(R){var oe=R.prototype;return!!(oe&&oe.isReactComponent)}function Fe(R,oe,ce){if(R==null)return"";if(typeof R=="function")return J(R,me(R));if(typeof R=="string")return Y(R);switch(R){case u:return Y("Suspense");case d:return Y("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case l:return pe(R.render);case h:return Fe(R.type,oe,ce);case m:{var De=R,Oe=De._payload,qe=De._init;try{return Fe(qe(Oe),oe,ce)}catch{}}}return""}var Be=Object.prototype.hasOwnProperty,Te={},$e=b.ReactDebugCurrentFrame;function Le(R){if(R){var oe=R._owner,ce=Fe(R.type,R._source,oe?oe.type:null);$e.setExtraStackFrame(ce)}else $e.setExtraStackFrame(null)}function Ue(R,oe,ce,De,Oe){{var qe=Function.call.bind(Be);for(var je in R)if(qe(R,je)){var Se=void 0;try{if(typeof R[je]!="function"){var ft=Error((De||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ft.name="Invariant Violation",ft}Se=R[je](oe,je,De,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Je){Se=Je}Se&&!(Se instanceof Error)&&(Le(Oe),E("%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).",De||"React class",ce,je,typeof Se),Le(null)),Se instanceof Error&&!(Se.message in Te)&&(Te[Se.message]=!0,Le(Oe),E("Failed %s type: %s",ce,Se.message),Le(null))}}}var et=Array.isArray;function Ae(R){return et(R)}function We(R){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&R[Symbol.toStringTag]||R.constructor.name||"Object";return ce}}function be(R){try{return H(R),!1}catch{return!0}}function H(R){return""+R}function ae(R){if(be(R))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(R)),H(R)}var he=b.ReactCurrentOwner,ge={key:!0,ref:!0,__self:!0,__source:!0},we,Ge,Qe;Qe={};function ot(R){if(Be.call(R,"ref")){var oe=Object.getOwnPropertyDescriptor(R,"ref").get;if(oe&&oe.isReactWarning)return!1}return R.ref!==void 0}function ye(R){if(Be.call(R,"key")){var oe=Object.getOwnPropertyDescriptor(R,"key").get;if(oe&&oe.isReactWarning)return!1}return R.key!==void 0}function Ee(R,oe){if(typeof R.ref=="string"&&he.current&&oe&&he.current.stateNode!==oe){var ce=_(he.current.type);Qe[ce]||(E('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',_(he.current.type),R.ref),Qe[ce]=!0)}}function ze(R,oe){{var ce=function(){we||(we=!0,E("%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)",oe))};ce.isReactWarning=!0,Object.defineProperty(R,"key",{get:ce,configurable:!0})}}function nt(R,oe){{var ce=function(){Ge||(Ge=!0,E("%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)",oe))};ce.isReactWarning=!0,Object.defineProperty(R,"ref",{get:ce,configurable:!0})}}var ut=function(R,oe,ce,De,Oe,qe,je){var Se={$$typeof:t,type:R,key:oe,ref:ce,props:je,_owner:qe};return Se._store={},Object.defineProperty(Se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.freeze&&(Object.freeze(Se.props),Object.freeze(Se)),Se};function Ln(R,oe,ce,De,Oe){{var qe,je={},Se=null,ft=null;ce!==void 0&&(ae(ce),Se=""+ce),ye(oe)&&(ae(oe.key),Se=""+oe.key),ot(oe)&&(ft=oe.ref,Ee(oe,Oe));for(qe in oe)Be.call(oe,qe)&&!ge.hasOwnProperty(qe)&&(je[qe]=oe[qe]);if(R&&R.defaultProps){var Je=R.defaultProps;for(qe in Je)je[qe]===void 0&&(je[qe]=Je[qe])}if(Se||ft){var tt=typeof R=="function"?R.displayName||R.name||"Unknown":R;Se&&ze(je,tt),ft&&nt(je,tt)}return ut(R,Se,ft,Oe,De,he.current,je)}}var on=b.ReactCurrentOwner,Jr=b.ReactDebugCurrentFrame;function zn(R){if(R){var oe=R._owner,ce=Fe(R.type,R._source,oe?oe.type:null);Jr.setExtraStackFrame(ce)}else Jr.setExtraStackFrame(null)}var yi;yi=!1;function xi(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function tu(){{if(on.current){var R=_(on.current.type);if(R)return`
25
+ `+Se[Je].replace(" at new "," at ");return R.displayName&&kt.includes("<anonymous>")&&(kt=kt.replace("<anonymous>",R.displayName)),typeof R=="function"&&ne.set(R,kt),kt}while(Je>=1&&tt>=0);break}}}finally{U=!1,N.current=qe,O(),Error.prepareStackTrace=Oe}var qn=R?R.displayName||R.name:"",su=qn?Y(qn):"";return typeof R=="function"&&ne.set(R,su),su}function pe(R,oe,ce){return J(R,!1)}function me(R){var oe=R.prototype;return!!(oe&&oe.isReactComponent)}function Fe(R,oe,ce){if(R==null)return"";if(typeof R=="function")return J(R,me(R));if(typeof R=="string")return Y(R);switch(R){case u:return Y("Suspense");case d:return Y("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case l:return pe(R.render);case h:return Fe(R.type,oe,ce);case m:{var De=R,Oe=De._payload,qe=De._init;try{return Fe(qe(Oe),oe,ce)}catch{}}}return""}var Be=Object.prototype.hasOwnProperty,Te={},$e=b.ReactDebugCurrentFrame;function Le(R){if(R){var oe=R._owner,ce=Fe(R.type,R._source,oe?oe.type:null);$e.setExtraStackFrame(ce)}else $e.setExtraStackFrame(null)}function Ue(R,oe,ce,De,Oe){{var qe=Function.call.bind(Be);for(var je in R)if(qe(R,je)){var Se=void 0;try{if(typeof R[je]!="function"){var ft=Error((De||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ft.name="Invariant Violation",ft}Se=R[je](oe,je,De,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Je){Se=Je}Se&&!(Se instanceof Error)&&(Le(Oe),E("%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).",De||"React class",ce,je,typeof Se),Le(null)),Se instanceof Error&&!(Se.message in Te)&&(Te[Se.message]=!0,Le(Oe),E("Failed %s type: %s",ce,Se.message),Le(null))}}}var et=Array.isArray;function Ae(R){return et(R)}function We(R){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&R[Symbol.toStringTag]||R.constructor.name||"Object";return ce}}function be(R){try{return H(R),!1}catch{return!0}}function H(R){return""+R}function ae(R){if(be(R))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(R)),H(R)}var he=b.ReactCurrentOwner,ge={key:!0,ref:!0,__self:!0,__source:!0},we,Ge,Qe;Qe={};function ot(R){if(Be.call(R,"ref")){var oe=Object.getOwnPropertyDescriptor(R,"ref").get;if(oe&&oe.isReactWarning)return!1}return R.ref!==void 0}function ye(R){if(Be.call(R,"key")){var oe=Object.getOwnPropertyDescriptor(R,"key").get;if(oe&&oe.isReactWarning)return!1}return R.key!==void 0}function Ee(R,oe){if(typeof R.ref=="string"&&he.current&&oe&&he.current.stateNode!==oe){var ce=_(he.current.type);Qe[ce]||(E('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',_(he.current.type),R.ref),Qe[ce]=!0)}}function ze(R,oe){{var ce=function(){we||(we=!0,E("%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)",oe))};ce.isReactWarning=!0,Object.defineProperty(R,"key",{get:ce,configurable:!0})}}function nt(R,oe){{var ce=function(){Ge||(Ge=!0,E("%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)",oe))};ce.isReactWarning=!0,Object.defineProperty(R,"ref",{get:ce,configurable:!0})}}var ut=function(R,oe,ce,De,Oe,qe,je){var Se={$$typeof:t,type:R,key:oe,ref:ce,props:je,_owner:qe};return Se._store={},Object.defineProperty(Se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.freeze&&(Object.freeze(Se.props),Object.freeze(Se)),Se};function Ln(R,oe,ce,De,Oe){{var qe,je={},Se=null,ft=null;ce!==void 0&&(ae(ce),Se=""+ce),ye(oe)&&(ae(oe.key),Se=""+oe.key),ot(oe)&&(ft=oe.ref,Ee(oe,Oe));for(qe in oe)Be.call(oe,qe)&&!ge.hasOwnProperty(qe)&&(je[qe]=oe[qe]);if(R&&R.defaultProps){var Je=R.defaultProps;for(qe in Je)je[qe]===void 0&&(je[qe]=Je[qe])}if(Se||ft){var tt=typeof R=="function"?R.displayName||R.name||"Unknown":R;Se&&ze(je,tt),ft&&nt(je,tt)}return ut(R,Se,ft,Oe,De,he.current,je)}}var on=b.ReactCurrentOwner,Jr=b.ReactDebugCurrentFrame;function zn(R){if(R){var oe=R._owner,ce=Fe(R.type,R._source,oe?oe.type:null);Jr.setExtraStackFrame(ce)}else Jr.setExtraStackFrame(null)}var yi;yi=!1;function xi(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function tu(){{if(on.current){var R=_(on.current.type);if(R)return`
26
26
 
27
27
  Check the render method of \``+R+"`."}return""}}function Yh(R){{if(R!==void 0){var oe=R.fileName.replace(/^.*[\\\/]/,""),ce=R.lineNumber;return`
28
28
 
29
29
  Check your code at `+oe+":"+ce+"."}return""}}var nu={};function Gh(R){{var oe=tu();if(!oe){var ce=typeof R=="string"?R:R.displayName||R.name;ce&&(oe=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return oe}}function ru(R,oe){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var ce=Gh(oe);if(nu[ce])return;nu[ce]=!0;var De="";R&&R._owner&&R._owner!==on.current&&(De=" It was passed a child from "+_(R._owner.type)+"."),zn(R),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,De),zn(null)}}function au(R,oe){{if(typeof R!="object")return;if(Ae(R))for(var ce=0;ce<R.length;ce++){var De=R[ce];xi(De)&&ru(De,oe)}else if(xi(R))R._store&&(R._store.validated=!0);else if(R){var Oe=v(R);if(typeof Oe=="function"&&Oe!==R.entries)for(var qe=Oe.call(R),je;!(je=qe.next()).done;)xi(je.value)&&ru(je.value,oe)}}}function Qh(R){{var oe=R.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 De=_(oe);Ue(ce,R.props,"prop",De,R)}else if(oe.PropTypes!==void 0&&!yi){yi=!0;var Oe=_(oe);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Jh(R){{for(var oe=Object.keys(R.props),ce=0;ce<oe.length;ce++){var De=oe[ce];if(De!=="children"&&De!=="key"){zn(R),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),zn(null);break}}R.ref!==null&&(zn(R),E("Invalid attribute `ref` supplied to `React.Fragment`."),zn(null))}}function iu(R,oe,ce,De,Oe,qe){{var je=q(R);if(!je){var Se="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(Se+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ft=Yh(Oe);ft?Se+=ft:Se+=tu();var Je;R===null?Je="null":Ae(R)?Je="array":R!==void 0&&R.$$typeof===t?(Je="<"+(_(R.type)||"Unknown")+" />",Se=" Did you accidentally export a JSX literal instead of a component?"):Je=typeof R,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Je,Se)}var tt=Ln(R,oe,ce,Oe,qe);if(tt==null)return tt;if(je){var kt=oe.children;if(kt!==void 0)if(De)if(Ae(kt)){for(var qn=0;qn<kt.length;qn++)au(kt[qn],R);Object.freeze&&Object.freeze(kt)}else E("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 au(kt,R)}return R===r?Jh(tt):Qh(tt),tt}}function Xh(R,oe,ce){return iu(R,oe,ce,!0)}function em(R,oe,ce){return iu(R,oe,ce,!1)}var tm=em,nm=Xh;vr.Fragment=r,vr.jsx=tm,vr.jsxs=nm}()),vr}process.env.NODE_ENV==="production"?ys.exports=cm():ys.exports=dm();var c=ys.exports;const Vc=()=>{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},ar=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Kc(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 m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,v="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,E=v?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var k=y.useMemo(function(){var T=function(q){var $=o.current,F=l.current;return o.current=l.current=null,i.current=q,u.current=d.current.apply(F,$)},D=function(q,$){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(q):setTimeout(q,$)},C=function(q){if(!h.current)return!1;var $=q-a.current;return!a.current||$>=t||$<0||v&&q-i.current>=E},S=function(q){return s.current=null,f&&o.current?T(q):(o.current=l.current=null,u.current)},L=function q(){var $=Date.now();if(C($))return S($);if(h.current){var F=t-($-a.current),_=v?Math.min(F,E-($-i.current)):F;D(q,_)}},N=function(){if(m||b){var q=Date.now(),$=C(q);if(o.current=[].slice.call(arguments),l.current=r,a.current=q,$){if(!s.current&&h.current)return i.current=a.current,D(L,t),g?T(a.current):u.current;if(v)return D(L,t),T(a.current)}return s.current||D(L,t),u.current}};return N.cancel=function(){s.current&&(p?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,v,t,E,f,p,m,b]);return k}function Zc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Kc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Di;const Nn=(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(Di),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=Zc(()=>{s()!==r&&(t&&(clearTimeout(Di),document.body.classList.add("is-resizing"),Di=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Yc=({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,m=d-h,p=m>0?"down":"up";if(i({current:d,past:h}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Zc(()=>{l()},250);return a},eo=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);ar(()=>{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)},to=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!t),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const lu={},Rn=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(),[m]=y.useState(e||Date.now().toString()),p=y.useRef(null),g=d||p,[f,v]=y.useState(n?"open":"hidden"),{extraPadding:b=!0,hasPointer:E=!1,hasForm:k=!1}=t,{onOpen:T=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:C=!1,...S}=l,L=lu[m];y.useEffect(()=>{const F=g==null?void 0:g.current;if(F)return F.addEventListener("transitionend",N),()=>{F.removeEventListener("transitionend",N)}},[]),y.useEffect(()=>{if(f!=="open")return;const F=_=>{_.key==="Escape"&&(_.stopPropagation(),_.preventDefault(),v("closed"))};return document.addEventListener("keyup",F),()=>{document.removeEventListener("keyup",F)}},[f]);const N=({propertyName:F})=>{F==="opacity"&&(L!==!1&&clearTimeout(L),v(_=>(_==="open"?T():_==="closed"&&D(),_==="opening"?"open":_==="closing"?"closed":_==="closed"?"hidden":_)))};ar(()=>{L!==!1&&clearTimeout(L);let F="open";n?v("opening"):(v("closing"),F="hidden"),lu[m||""]=setTimeout(()=>{v(F)},300)},[n]);const q={...u,...S};s&&s.onBlur&&(q.onBlur=s.onBlur);const $={className:"content"};return C?$.className=Z("content",{hidden:f==="hidden"}):($.hidden=f==="hidden",$["aria-live"]="polite"),c.jsx("aside",{ref:g,id:m,className:Z("tooltip text-medium",f,i,{loading:r,"extra-padding":b,"has-pointer":E,bottom:E==="bottom","has-form":k}),...q,children:c.jsx("div",{...$,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Kr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=kn(e);return t.forEach(({type:r,value:a})=>{rm(n,r,a)}),n},Gc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Qc=(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},Jc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Xc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),ed=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),fm=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Vt="https://storage.googleapis.com/apolitical-assets/",Zn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},_r={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},xs="SU:",Nr="DELETED",td="Invalid token error: Logging user out...",hm="200,000+",mm="160+",Rr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,nd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function pm(e){return e?{"--icon":`url(${Vt}icons/${e}.svg)`}:{}}const En={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},rd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),no=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ds=e=>{let t;const n=Pa(),r=Pa(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/En.milliseconds.inHour,i=Math.floor(t/En.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<=En.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/En.year.days)}},Pa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},gm=(e,t,n)=>{let r;const a=Pa(),i=Pa(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/En.milliseconds.inSecond<=t;case"minutes":return r/En.milliseconds.inMinute<=t;case"hours":return r/En.milliseconds.inHour<=t}return!1},vm=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},bm=e=>new Promise(t=>setTimeout(t,e)),ym=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},dr={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",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",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 <`+ce+">.")}return oe}}function ru(R,oe){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var ce=Gh(oe);if(nu[ce])return;nu[ce]=!0;var De="";R&&R._owner&&R._owner!==on.current&&(De=" It was passed a child from "+_(R._owner.type)+"."),zn(R),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,De),zn(null)}}function au(R,oe){{if(typeof R!="object")return;if(Ae(R))for(var ce=0;ce<R.length;ce++){var De=R[ce];xi(De)&&ru(De,oe)}else if(xi(R))R._store&&(R._store.validated=!0);else if(R){var Oe=v(R);if(typeof Oe=="function"&&Oe!==R.entries)for(var qe=Oe.call(R),je;!(je=qe.next()).done;)xi(je.value)&&ru(je.value,oe)}}}function Qh(R){{var oe=R.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 De=_(oe);Ue(ce,R.props,"prop",De,R)}else if(oe.PropTypes!==void 0&&!yi){yi=!0;var Oe=_(oe);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Jh(R){{for(var oe=Object.keys(R.props),ce=0;ce<oe.length;ce++){var De=oe[ce];if(De!=="children"&&De!=="key"){zn(R),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),zn(null);break}}R.ref!==null&&(zn(R),E("Invalid attribute `ref` supplied to `React.Fragment`."),zn(null))}}function iu(R,oe,ce,De,Oe,qe){{var je=q(R);if(!je){var Se="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(Se+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ft=Yh(Oe);ft?Se+=ft:Se+=tu();var Je;R===null?Je="null":Ae(R)?Je="array":R!==void 0&&R.$$typeof===t?(Je="<"+(_(R.type)||"Unknown")+" />",Se=" Did you accidentally export a JSX literal instead of a component?"):Je=typeof R,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Je,Se)}var tt=Ln(R,oe,ce,Oe,qe);if(tt==null)return tt;if(je){var kt=oe.children;if(kt!==void 0)if(De)if(Ae(kt)){for(var qn=0;qn<kt.length;qn++)au(kt[qn],R);Object.freeze&&Object.freeze(kt)}else E("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 au(kt,R)}return R===r?Jh(tt):Qh(tt),tt}}function Xh(R,oe,ce){return iu(R,oe,ce,!0)}function em(R,oe,ce){return iu(R,oe,ce,!1)}var tm=em,nm=Xh;vr.Fragment=r,vr.jsx=tm,vr.jsxs=nm}()),vr}process.env.NODE_ENV==="production"?ys.exports=cm():ys.exports=dm();var c=ys.exports;const Vc=()=>{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},ar=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Kc(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 m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,v="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,E=v?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var k=y.useMemo(function(){var T=function(q){var $=o.current,F=l.current;return o.current=l.current=null,i.current=q,u.current=d.current.apply(F,$)},D=function(q,$){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(q):setTimeout(q,$)},w=function(q){if(!h.current)return!1;var $=q-a.current;return!a.current||$>=t||$<0||v&&q-i.current>=E},S=function(q){return s.current=null,f&&o.current?T(q):(o.current=l.current=null,u.current)},L=function q(){var $=Date.now();if(w($))return S($);if(h.current){var F=t-($-a.current),_=v?Math.min(F,E-($-i.current)):F;D(q,_)}},M=function(){if(m||b){var q=Date.now(),$=w(q);if(o.current=[].slice.call(arguments),l.current=r,a.current=q,$){if(!s.current&&h.current)return i.current=a.current,D(L,t),g?T(a.current):u.current;if(v)return D(L,t),T(a.current)}return s.current||D(L,t),u.current}};return M.cancel=function(){s.current&&(p?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,v,t,E,f,p,m,b]);return k}function Zc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Kc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Di;const Nn=(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(Di),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=Zc(()=>{s()!==r&&(t&&(clearTimeout(Di),document.body.classList.add("is-resizing"),Di=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Yc=({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,m=d-h,p=m>0?"down":"up";if(i({current:d,past:h}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Zc(()=>{l()},250);return a},eo=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);ar(()=>{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)},to=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!t),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const lu={},Rn=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(),[m]=y.useState(e||Date.now().toString()),p=y.useRef(null),g=d||p,[f,v]=y.useState(n?"open":"hidden"),{extraPadding:b=!0,hasPointer:E=!1,hasForm:k=!1}=t,{onOpen:T=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:w=!1,...S}=l,L=lu[m];y.useEffect(()=>{const F=g==null?void 0:g.current;if(F)return F.addEventListener("transitionend",M),()=>{F.removeEventListener("transitionend",M)}},[]),y.useEffect(()=>{if(f!=="open")return;const F=_=>{_.key==="Escape"&&(_.stopPropagation(),_.preventDefault(),v("closed"))};return document.addEventListener("keyup",F),()=>{document.removeEventListener("keyup",F)}},[f]);const M=({propertyName:F})=>{F==="opacity"&&(L!==!1&&clearTimeout(L),v(_=>(_==="open"?T():_==="closed"&&D(),_==="opening"?"open":_==="closing"?"closed":_==="closed"?"hidden":_)))};ar(()=>{L!==!1&&clearTimeout(L);let F="open";n?v("opening"):(v("closing"),F="hidden"),lu[m||""]=setTimeout(()=>{v(F)},300)},[n]);const q={...u,...S};s&&s.onBlur&&(q.onBlur=s.onBlur);const $={className:"content"};return w?$.className=Z("content",{hidden:f==="hidden"}):($.hidden=f==="hidden",$["aria-live"]="polite"),c.jsx("aside",{ref:g,id:m,className:Z("tooltip text-medium",f,i,{loading:r,"extra-padding":b,"has-pointer":E,bottom:E==="bottom","has-form":k}),...q,children:c.jsx("div",{...$,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Kr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=kn(e);return t.forEach(({type:r,value:a})=>{rm(n,r,a)}),n},Gc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Qc=(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},Jc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Xc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),ed=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),fm=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Vt="https://storage.googleapis.com/apolitical-assets/",Zn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},_r={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},xs="SU:",Nr="DELETED",td="Invalid token error: Logging user out...",hm="200,000+",mm="160+",Rr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,nd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function pm(e){return e?{"--icon":`url(${Vt}icons/${e}.svg)`}:{}}const En={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},rd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),no=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ds=e=>{let t;const n=Pa(),r=Pa(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/En.milliseconds.inHour,i=Math.floor(t/En.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<=En.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/En.year.days)}},Pa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},gm=(e,t,n)=>{let r;const a=Pa(),i=Pa(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/En.milliseconds.inSecond<=t;case"minutes":return r/En.milliseconds.inMinute<=t;case"hours":return r/En.milliseconds.inHour<=t}return!1},vm=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},bm=e=>new Promise(t=>setTimeout(t,e)),ym=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},dr={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",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",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
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_postType_label:"Post type","discussion_form__postType_no-category":"Post",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_showAll:"Show all...",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_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",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.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_title_error:"Please enter a title and body for your article.",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_disclaimer:"Clicking the 'publish article' button will publish your article right away. Remember to do a final, final check to make sure you're happy with it before publishing.",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article has been published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",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_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",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"},xm={...dr,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>"},Dm={...dr,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={...dr,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>"},wm=Object.freeze(Object.defineProperty({__proto__:null,en:dr,es:xm,fr:Dm,pt:Cm},Symbol.toStringTag,{value:"Module"})),ri=(e,t=dr)=>e in t,Pt=(e,t,n,r,a={})=>{let i="";return ri(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Em=(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},wa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),ad=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},_m=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},km=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Nr).replace(/{{id}}/g,Nr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),id=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Rr);if(!a)return e;for(const s of a){const o=s.replace(Rr,(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(xs))try{const h=d.replace(xs,"");u.id=h,await r({id:h}).then(m=>{const{name:p,error:g}=m;u.name=g||p||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?km(e,u,t):s)}return e},ro=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},sd=e=>new URLSearchParams(window.location.search).get(e),Ma=(e="")=>e.replace(/\s+/g,"").length>0,Cs=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 ke=({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,...m})=>{const g=Nn(typeof t=="object"),{showTooltip:f,tooltipProps:v}=to(!!u);if(typeof t=="object"&&typeof g=="number"){const T=Object.assign({},t),D=Gc(Object.keys(T));t=Qc(g,D,T)}!l&&u&&(u="");const b=[];typeof t=="string"&&b.push(t),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left")));const E={...m,className:Z(e,o,b,{"no-text":!h,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:T=>{(!a||a[0]==="#")&&s&&(T.preventDefault(),T.stopPropagation()),s&&s(T)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",E.href=a);const k=y.createElement(i,E,h||(d?c.jsx(Me,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...v,children:[c.jsx(Rn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),k]}):k},fr=({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(ke,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(ke,{...s})},o)});return y.createElement(a,{className:Z("button-wrapper",n),...r,children:i})};const Kt=({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})},cu={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"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},Fm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?cu[e]:cu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Am=({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},Ci=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Am({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const In=({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:m,sizes:p}=Fm(e),g=Ci({format:"avif",query:s,range:m,url:o}),f=Ci({format:"webp",query:s,range:m,url:o}),v=Ci({format:"",query:s,range:m,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:p,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),c.jsx("img",{srcSet:v,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Bm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(In,{image:{...e},className:"image"})}),gn=({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 od=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})}),hr=({parent:e=document.body,children:t})=>typeof document=="object"?qc.createPortal(t,e):null,Tm=Object.freeze(Object.defineProperty({__proto__:null,default:hr},Symbol.toStringTag,{value:"Module"}));const Sm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Me,{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:Z("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:Z("line",{active:a<e})})]},r)})})})]});const jm=({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(ke,{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 Om=({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))}),du=300,fu="ease-in-out";class Pm{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:du,easing:fu}),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:du,easing:fu}),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 ai=({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 Pm(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})]})},hu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Mm=e=>{let t=e;return Object.keys(hu).includes(e)&&(t=hu[e]),`url(${Vt}icons/${t}.svg)`};const mu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},ud=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ie.useIntl(),i=t?{"--custom-icon":Mm(t)}:{},s=ri(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:Z("content-type-label text-small",e in mu?mu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const St=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Vt}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 vn=({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=Nn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),m=Gc(Object.keys(h));a=Qc(s,m,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(St,{variant:"subtle",className:Z("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Wt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(ke,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ws=({children:e,...t})=>c.jsx("p",{...t,children:e}),ld={q:ws,blockquote:ws};for(let e=1;e<=6;e++)ld[`h${e}`]={component:ws,props:{className:"title"}};const cd=({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(Wt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:ld},children:r}):c.jsx("p",{children:r})]});const dd=({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(""),[m,p]=y.useState("closed");y.useEffect(()=>{const v=u.current;if(v)return v.addEventListener("transitionend",g),()=>{v.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const v=a.split(`
36
36
  `);h(v.length<3?`${a.substring(0,400)}...`:v.slice(0,3).join(`
37
- `))},[a]),y.useEffect(()=>{m==="ready-to-close"&&p("closing")},[m]);const g=({propertyName:v})=>{v==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)},f=["opening","open"].includes(m);return c.jsxs(St,{variant:"subtle",className:Z("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:Z("content",m,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Wt,{options:{forceBlock:!0,...i},children:m==="closed"?d:a}),m!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(ke,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Z({"rotate-180":f}),onClick:()=>{p(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 Nm=({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(${Vt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Wt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Wt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Wt,{options:d,children:l.text}):l.text},u)})})},lt=()=>y.Fragment,Rm=({children:e})=>c.jsx(St,{variant:"secondary",children:e}),Im=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),$m=["span","strong","h1","h2","h3","h4","h5","h6","p"],Lm=({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($m.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(ai,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},zm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(St,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(St,{variant:"primary",children:e});case"pink-textbox":return c.jsx(St,{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})},At=({children:e})=>c.jsx(c.Fragment,{children:e}),qm=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(Me,{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})]})},pu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Um=({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"||pu(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&&pu(a)==="button"&&(i=!0);else break}const s=`@${Nr}`;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(ke,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Es=({children:e,...t})=>c.jsx("span",{className:Z({url:t==null?void 0:t.href}),children:e});const Wm={default:{a:Um,CollapsibleSection:ai,TextBox:St,CaseStudy:Rm,style:lt,details:Lm,div:zm,iframe:qm,center:Im},"text-only":{h1:lt,h2:lt,h3:lt,h4:lt,h5:lt,h6:lt,style:lt,details:lt,div:lt,TextBox:lt,CollapsibleSection:lt,CaseStudy:lt,blockquote:lt,iframe:lt,button:lt}},Tn=({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=Wm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:Z("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Wt,{options:{...o,...n,overrides:l},children:r})})};const fd=({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 Ht=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Vt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=to(!!a),h={},m=a?`tooltip-${window.btoa(a).substring(9,15)}`:void 0;a&&m&&(h["aria-describedby"]=m,h.role="button");const p=y.createElement(a?"span":s,{className:Z("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...h,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[p,c.jsx(Rn,{id:m,isOpen:u,children:a})]})):p};const ir=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:Z("status-banner text-small",n),"aria-live":"assertive"},t),ao=y.createContext({badges:[],isLoading:!0});function hd(){return y.useContext(ao)}const md=({children:e,badges:t})=>c.jsx(ao.Provider,{value:t,children:e}),pd=({showDevTools:e=!0,children:t})=>{const n=new Ve.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ve.QueryClientProvider,{client:n,children:[t,e&&c.jsx(am.ReactQueryDevtools,{initialIsOpen:!1})]})};var Hm=y.createContext({client:Ca});function Vm(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&&(Ca.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ca.init(r,a)),Ca)},[n,r]);return y.createElement(Hm.Provider,{value:{client:i}},t)}const gd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Vm,{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 vd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(vd||{});const bd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...wm[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:a,children:e})},io=y.createContext({}),Ea={en:"English",es:"Español",fr:"Français",pt:"Português"},st=y.createContext({isLoading:!0});function ii(){return y.useContext(st)}const yd=({children:e,user:t,updateDetails:n})=>c.jsx(st.Provider,{value:{...t,updateDetails:n},children:e}),so=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),xd=()=>y.useContext(so),Dd=({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(so.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Km=({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=m=>{localStorage.setItem("language",m),d(m)};return y.useEffect(()=>{e().then(m=>{Array.isArray(m)?(i({...m[0],isLoading:!1}),o({badges:m[1],isLoading:!1})):i({...m,isLoading:!1}),ad(5e3)}).catch(m=>{m.message===td&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(io.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(bd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Xs.CookiesProvider,{children:c.jsx(yd,{user:a,updateDetails:i,children:c.jsx(md,{badges:s,children:c.jsx(Dd,{children:c.jsx(pd,{showDevTools:r,children:c.jsx(gd,{user:a,children:t})})})})})})})})},Zm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Cd=({slug:e})=>{const{badges:t}=hd(),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(Ht,{className:Z("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&Zm[a],element:"li",tooltip:s,children:r})};var ct=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(ct||{});const wd=({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(Cd,{slug:s},o))}))})};const Ym=({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:Z(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},oo=y.memo(Ym);const wi="loadingBlock_",Gm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${wi}loading`})},75:{text:r.formatMessage({id:`${wi}almostDone`})},100:{text:r.formatMessage({id:`${wi}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(${Vt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(St,{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(oo,{progress:e})]})},Qm=y.memo(Gm);const Ot=({element:e="div",className:t="",...n})=>c.jsx(ni,{element:e,className:Z("loading-placeholder",t),...n});const _s={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"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Ed=(e,t)=>e in _s?c.jsx("div",{className:e,children:_s[e].map((n,r)=>Ed(n,r))},t):c.jsx(Ot,{className:e},t),si=({layout:e="overview-page",...t})=>c.jsx("div",{className:Z("loading-state",e),...t,children:_s[e].map((n,r)=>Ed(n,r))}),_d=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):""},ea=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Jm=e=>{const t=Math.ceil(26/ea.length),n=_d(e).toLowerCase();if(n==="")return ea[0];const r=n.charCodeAt(0)-96;for(let a=0;a<ea.length;a++)if(r<=t*(a+1))return ea[a]};const gu=256,bn=({className:e="",src:t="",name:n,alt:r,width:a=gu,height:i=gu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=a,v=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=v*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Jm(n),g.fillRect(0,0,f,v),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(_d(n),f/2,v/1.6)},[n]);let m=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(m=!0),c.jsx("figure",{className:Z("profile-picture",e,{error:l}),...o,children:m?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"})})};var rt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(rt||{});const oi=e=>e==="apolitical"?{image:`${Vt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Vt}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},Xm=({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=rr(l,r)),l};const ep=y.lazy(()=>Promise.resolve().then(()=>Tm)),tp=y.lazy(()=>Promise.resolve().then(()=>g_));let ta=null;const en=({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:m,...p}=i,{size:g="medium",variant:f="inline",isCondensed:v=!0,additionalContentNewLine:b=!1}=a,E=y.useContext(st),k=m&&E&&typeof E.id=="string",[T,D]=y.useState(!1),C=oi(t);C.name||(C.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:S,image:L}=C;let{url:N}=C;typeof t=="object"&&t.link!==void 0&&(t.link===!1?N=void 0:N=t.link);const q=Xm(C),$=r&&r.createdAt?Ds(r.createdAt):!1,F=r&&r.createdAt?no(r.createdAt):"";return y.createElement(e,{...d,className:Z("member text-medium",g,f,l,{"has-profile-link":k}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(gn,{href:N,gtmType:o,gtmContext:s,onClick:_=>{if(_==null||_.preventDefault(),_==null||_.stopPropagation(),!N)return;ta&&clearTimeout(ta),ta=setTimeout(()=>{window.location.href=N},150);const P=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:N,timeout:ta}});document.dispatchEvent(P)},children:[c.jsx(bn,{name:S,src:L,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:Z("name",{"new-line":b}),"data-testid":"member-name",children:[c.jsx("span",{children:S}),(u==null?void 0:u.showBadges)&&(C==null?void 0:C.badges)&&c.jsx(wd,{userBadges:C.badges,badgeOptions:u}),r&&c.jsxs("span",{className:Z("additional-content",{"new-line":b}),children:[r.createdAt&&$&&c.jsx("span",{className:"date",title:F,"aria-label":F,"data-testid":"date",children:h.formatMessage({id:`dates_${$.path}`},{number:$.number})}),r.customMessage&&c.jsx("span",{children:r.customMessage}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),q&&!b&&c.jsx("small",{className:Z({"text-medium":g==="large"}),"data-testid":"member-details",children:v?q:c.jsxs(c.Fragment,{children:[C.role,C.organisation?` — ${C.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:C.country})]})})]})]}),q&&m&&k?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"small",onClick:_=>{_.preventDefault(),_.stopPropagation(),D(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(ep,{children:c.jsx(tp,{form:m,showModal:T,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{D(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},np=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"}));const vu={small:24,medium:48},uo=({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:Z("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:v="",image:b=""}=oi(m);if(s)return c.jsx(Ot,{element:"li",className:"contributor"},p);g=c.jsx(bn,{name:v,src:b,width:vu[a||"medium"],height:vu[a||"medium"]})}else if(p===o){const v=(t||n.length)-o;g=c.jsxs("small",{className:Z({"large-number":v>99}),children:["+",Em(v,0)]}),f="number-left"}return g?c.jsx("li",{className:Z("contributor",f),children:g},p):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]}`}):rr(n[0].name||"",20):l||null})]})})};const lo=({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 ks={exports:{}},na={exports:{}},Ne={};/** @license React v16.13.1
37
+ `))},[a]),y.useEffect(()=>{m==="ready-to-close"&&p("closing")},[m]);const g=({propertyName:v})=>{v==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)},f=["opening","open"].includes(m);return c.jsxs(St,{variant:"subtle",className:Z("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:Z("content",m,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Wt,{options:{forceBlock:!0,...i},children:m==="closed"?d:a}),m!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(ke,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Z({"rotate-180":f}),onClick:()=>{p(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 Nm=({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(${Vt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Wt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Wt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Wt,{options:d,children:l.text}):l.text},u)})})},lt=()=>y.Fragment,Rm=({children:e})=>c.jsx(St,{variant:"secondary",children:e}),Im=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),$m=["span","strong","h1","h2","h3","h4","h5","h6","p"],Lm=({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($m.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(ai,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},zm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(St,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(St,{variant:"primary",children:e});case"pink-textbox":return c.jsx(St,{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})},At=({children:e})=>c.jsx(c.Fragment,{children:e}),qm=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(Me,{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})]})},pu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Um=({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"||pu(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&&pu(a)==="button"&&(i=!0);else break}const s=`@${Nr}`;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(ke,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Es=({children:e,...t})=>c.jsx("span",{className:Z({url:t==null?void 0:t.href}),children:e});const Wm={default:{a:Um,CollapsibleSection:ai,TextBox:St,CaseStudy:Rm,style:lt,details:Lm,div:zm,iframe:qm,center:Im},"text-only":{h1:lt,h2:lt,h3:lt,h4:lt,h5:lt,h6:lt,style:lt,details:lt,div:lt,TextBox:lt,CollapsibleSection:lt,CaseStudy:lt,blockquote:lt,iframe:lt,button:lt}},Tn=({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=Wm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:Z("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Wt,{options:{...o,...n,overrides:l},children:r})})};const fd=({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 Ht=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Vt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=to(!!a),h={},m=a?`tooltip-${window.btoa(a).substring(9,15)}`:void 0;a&&m&&(h["aria-describedby"]=m,h.role="button");const p=y.createElement(a?"span":s,{className:Z("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...h,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[p,c.jsx(Rn,{id:m,isOpen:u,children:a})]})):p};const ir=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:Z("status-banner text-small",n),"aria-live":"assertive"},t),ao=y.createContext({badges:[],isLoading:!0});function hd(){return y.useContext(ao)}const md=({children:e,badges:t})=>c.jsx(ao.Provider,{value:t,children:e}),pd=({showDevTools:e=!0,children:t})=>{const n=new Ve.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ve.QueryClientProvider,{client:n,children:[t,e&&c.jsx(am.ReactQueryDevtools,{initialIsOpen:!1})]})};var Hm=y.createContext({client:Ca});function Vm(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&&(Ca.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ca.init(r,a)),Ca)},[n,r]);return y.createElement(Hm.Provider,{value:{client:i}},t)}const gd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Vm,{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 vd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(vd||{});const bd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...wm[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:a,children:e})},io=y.createContext({}),Ea={en:"English",es:"Español",fr:"Français",pt:"Português"},st=y.createContext({isLoading:!0});function ii(){return y.useContext(st)}const yd=({children:e,user:t,updateDetails:n})=>c.jsx(st.Provider,{value:{...t,updateDetails:n},children:e}),so=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),xd=()=>y.useContext(so),Dd=({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(so.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Km=({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=m=>{localStorage.setItem("language",m),d(m)};return y.useEffect(()=>{e().then(m=>{Array.isArray(m)?(i({...m[0],isLoading:!1}),o({badges:m[1],isLoading:!1})):i({...m,isLoading:!1}),ad(5e3)}).catch(m=>{m.message===td&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(io.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(bd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Xs.CookiesProvider,{children:c.jsx(yd,{user:a,updateDetails:i,children:c.jsx(md,{badges:s,children:c.jsx(Dd,{children:c.jsx(pd,{showDevTools:r,children:c.jsx(gd,{user:a,children:t})})})})})})})})},Zm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Cd=({slug:e})=>{const{badges:t}=hd(),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(Ht,{className:Z("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&Zm[a],element:"li",tooltip:s,children:r})};var ct=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(ct||{});const wd=({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(Cd,{slug:s},o))}))})};const Ym=({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:Z(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},oo=y.memo(Ym);const wi="loadingBlock_",Gm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${wi}loading`})},75:{text:r.formatMessage({id:`${wi}almostDone`})},100:{text:r.formatMessage({id:`${wi}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(${Vt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(St,{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(oo,{progress:e})]})},Qm=y.memo(Gm);const Ot=({element:e="div",className:t="",...n})=>c.jsx(ni,{element:e,className:Z("loading-placeholder",t),...n});const _s={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"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Ed=(e,t)=>e in _s?c.jsx("div",{className:e,children:_s[e].map((n,r)=>Ed(n,r))},t):c.jsx(Ot,{className:e},t),si=({layout:e="overview-page",...t})=>c.jsx("div",{className:Z("loading-state",e),...t,children:_s[e].map((n,r)=>Ed(n,r))}),_d=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):""},ea=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Jm=e=>{const t=Math.ceil(26/ea.length),n=_d(e).toLowerCase();if(n==="")return ea[0];const r=n.charCodeAt(0)-96;for(let a=0;a<ea.length;a++)if(r<=t*(a+1))return ea[a]};const gu=256,bn=({className:e="",src:t="",name:n,alt:r,width:a=gu,height:i=gu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=a,v=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=v*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Jm(n),g.fillRect(0,0,f,v),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(_d(n),f/2,v/1.6)},[n]);let m=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(m=!0),c.jsx("figure",{className:Z("profile-picture",e,{error:l}),...o,children:m?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"})})};var rt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(rt||{});const oi=e=>e==="apolitical"?{image:`${Vt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Vt}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},Xm=({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=rr(l,r)),l};const ep=y.lazy(()=>Promise.resolve().then(()=>Tm)),tp=y.lazy(()=>Promise.resolve().then(()=>g_));let ta=null;const en=({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:m,...p}=i,{size:g="medium",variant:f="inline",isCondensed:v=!0,additionalContentNewLine:b=!1}=a,E=y.useContext(st),k=m&&E&&typeof E.id=="string",[T,D]=y.useState(!1),w=oi(t);w.name||(w.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:S,image:L}=w;let{url:M}=w;typeof t=="object"&&t.link!==void 0&&(t.link===!1?M=void 0:M=t.link);const q=Xm(w),$=r&&r.createdAt?Ds(r.createdAt):!1,F=r&&r.createdAt?no(r.createdAt):"";return y.createElement(e,{...d,className:Z("member text-medium",g,f,l,{"has-profile-link":k}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(gn,{href:M,gtmType:o,gtmContext:s,onClick:_=>{if(_==null||_.preventDefault(),_==null||_.stopPropagation(),!M)return;ta&&clearTimeout(ta),ta=setTimeout(()=>{window.location.href=M},150);const P=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:M,timeout:ta}});document.dispatchEvent(P)},children:[c.jsx(bn,{name:S,src:L,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:Z("name",{"new-line":b}),"data-testid":"member-name",children:[c.jsx("span",{children:S}),(u==null?void 0:u.showBadges)&&(w==null?void 0:w.badges)&&c.jsx(wd,{userBadges:w.badges,badgeOptions:u}),r&&c.jsxs("span",{className:Z("additional-content",{"new-line":b}),children:[r.createdAt&&$&&c.jsx("span",{className:"date",title:F,"aria-label":F,"data-testid":"date",children:h.formatMessage({id:`dates_${$.path}`},{number:$.number})}),r.customMessage&&c.jsx("span",{children:r.customMessage}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),q&&!b&&c.jsx("small",{className:Z({"text-medium":g==="large"}),"data-testid":"member-details",children:v?q:c.jsxs(c.Fragment,{children:[w.role,w.organisation?` — ${w.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:w.country})]})})]})]}),q&&m&&k?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"small",onClick:_=>{_.preventDefault(),_.stopPropagation(),D(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(ep,{children:c.jsx(tp,{form:m,showModal:T,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{D(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},np=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"}));const vu={small:24,medium:48},uo=({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:Z("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:v="",image:b=""}=oi(m);if(s)return c.jsx(Ot,{element:"li",className:"contributor"},p);g=c.jsx(bn,{name:v,src:b,width:vu[a||"medium"],height:vu[a||"medium"]})}else if(p===o){const v=(t||n.length)-o;g=c.jsxs("small",{className:Z({"large-number":v>99}),children:["+",Em(v,0)]}),f="number-left"}return g?c.jsx("li",{className:Z("contributor",f),children:g},p):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]}`}):rr(n[0].name||"",20):l||null})]})})};const lo=({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 ks={exports:{}},na={exports:{}},Ne={};/** @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 bu;function rp(){if(bu)return Ne;bu=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,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function k(D){if(typeof D=="object"&&D!==null){var C=D.$$typeof;switch(C){case t:switch(D=D.type,D){case l:case u:case r:case i:case a:case h:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case g:case p:case s:return D;default:return C}}case n:return C}}}function T(D){return k(D)===u}return Ne.AsyncMode=l,Ne.ConcurrentMode=u,Ne.ContextConsumer=o,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=d,Ne.Fragment=r,Ne.Lazy=g,Ne.Memo=p,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=a,Ne.Suspense=h,Ne.isAsyncMode=function(D){return T(D)||k(D)===l},Ne.isConcurrentMode=T,Ne.isContextConsumer=function(D){return k(D)===o},Ne.isContextProvider=function(D){return k(D)===s},Ne.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},Ne.isForwardRef=function(D){return k(D)===d},Ne.isFragment=function(D){return k(D)===r},Ne.isLazy=function(D){return k(D)===g},Ne.isMemo=function(D){return k(D)===p},Ne.isPortal=function(D){return k(D)===n},Ne.isProfiler=function(D){return k(D)===i},Ne.isStrictMode=function(D){return k(D)===a},Ne.isSuspense=function(D){return k(D)===h},Ne.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===u||D===i||D===a||D===h||D===m||typeof D=="object"&&D!==null&&(D.$$typeof===g||D.$$typeof===p||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===v||D.$$typeof===b||D.$$typeof===E||D.$$typeof===f)},Ne.typeOf=k,Ne}var Re={};/** @license React v16.13.1
44
+ */var bu;function rp(){if(bu)return Ne;bu=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,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function k(D){if(typeof D=="object"&&D!==null){var w=D.$$typeof;switch(w){case t:switch(D=D.type,D){case l:case u:case r:case i:case a:case h:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case g:case p:case s:return D;default:return w}}case n:return w}}}function T(D){return k(D)===u}return Ne.AsyncMode=l,Ne.ConcurrentMode=u,Ne.ContextConsumer=o,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=d,Ne.Fragment=r,Ne.Lazy=g,Ne.Memo=p,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=a,Ne.Suspense=h,Ne.isAsyncMode=function(D){return T(D)||k(D)===l},Ne.isConcurrentMode=T,Ne.isContextConsumer=function(D){return k(D)===o},Ne.isContextProvider=function(D){return k(D)===s},Ne.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},Ne.isForwardRef=function(D){return k(D)===d},Ne.isFragment=function(D){return k(D)===r},Ne.isLazy=function(D){return k(D)===g},Ne.isMemo=function(D){return k(D)===p},Ne.isPortal=function(D){return k(D)===n},Ne.isProfiler=function(D){return k(D)===i},Ne.isStrictMode=function(D){return k(D)===a},Ne.isSuspense=function(D){return k(D)===h},Ne.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===u||D===i||D===a||D===h||D===m||typeof D=="object"&&D!==null&&(D.$$typeof===g||D.$$typeof===p||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===v||D.$$typeof===b||D.$$typeof===E||D.$$typeof===f)},Ne.typeOf=k,Ne}var Re={};/** @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 yu;function ap(){return yu||(yu=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,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function k(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===h||J===m||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===v||J.$$typeof===b||J.$$typeof===E||J.$$typeof===f)}function T(J){if(typeof J=="object"&&J!==null){var pe=J.$$typeof;switch(pe){case t:var me=J.type;switch(me){case l:case u:case r:case i:case a:case h:return me;default:var Fe=me&&me.$$typeof;switch(Fe){case o:case d:case g:case p:case s:return Fe;default:return pe}}case n:return pe}}}var D=l,C=u,S=o,L=s,N=t,q=d,$=r,F=g,_=p,P=n,j=i,W=a,V=h,se=!1;function re(J){return se||(se=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),w(J)||T(J)===l}function w(J){return T(J)===u}function ee(J){return T(J)===o}function K(J){return T(J)===s}function A(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function B(J){return T(J)===d}function O(J){return T(J)===r}function M(J){return T(J)===g}function z(J){return T(J)===p}function Y(J){return T(J)===n}function U(J){return T(J)===i}function ne(J){return T(J)===a}function le(J){return T(J)===h}Re.AsyncMode=D,Re.ConcurrentMode=C,Re.ContextConsumer=S,Re.ContextProvider=L,Re.Element=N,Re.ForwardRef=q,Re.Fragment=$,Re.Lazy=F,Re.Memo=_,Re.Portal=P,Re.Profiler=j,Re.StrictMode=W,Re.Suspense=V,Re.isAsyncMode=re,Re.isConcurrentMode=w,Re.isContextConsumer=ee,Re.isContextProvider=K,Re.isElement=A,Re.isForwardRef=B,Re.isFragment=O,Re.isLazy=M,Re.isMemo=z,Re.isPortal=Y,Re.isProfiler=U,Re.isStrictMode=ne,Re.isSuspense=le,Re.isValidElementType=k,Re.typeOf=T}()),Re}var xu;function kd(){return xu||(xu=1,process.env.NODE_ENV==="production"?na.exports=rp():na.exports=ap()),na.exports}/*
51
+ */var yu;function ap(){return yu||(yu=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,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function k(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===h||J===m||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===v||J.$$typeof===b||J.$$typeof===E||J.$$typeof===f)}function T(J){if(typeof J=="object"&&J!==null){var pe=J.$$typeof;switch(pe){case t:var me=J.type;switch(me){case l:case u:case r:case i:case a:case h:return me;default:var Fe=me&&me.$$typeof;switch(Fe){case o:case d:case g:case p:case s:return Fe;default:return pe}}case n:return pe}}}var D=l,w=u,S=o,L=s,M=t,q=d,$=r,F=g,_=p,P=n,j=i,W=a,V=h,se=!1;function re(J){return se||(se=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(J)||T(J)===l}function C(J){return T(J)===u}function ee(J){return T(J)===o}function K(J){return T(J)===s}function A(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function B(J){return T(J)===d}function O(J){return T(J)===r}function N(J){return T(J)===g}function z(J){return T(J)===p}function Y(J){return T(J)===n}function U(J){return T(J)===i}function ne(J){return T(J)===a}function le(J){return T(J)===h}Re.AsyncMode=D,Re.ConcurrentMode=w,Re.ContextConsumer=S,Re.ContextProvider=L,Re.Element=M,Re.ForwardRef=q,Re.Fragment=$,Re.Lazy=F,Re.Memo=_,Re.Portal=P,Re.Profiler=j,Re.StrictMode=W,Re.Suspense=V,Re.isAsyncMode=re,Re.isConcurrentMode=C,Re.isContextConsumer=ee,Re.isContextProvider=K,Re.isElement=A,Re.isForwardRef=B,Re.isFragment=O,Re.isLazy=N,Re.isMemo=z,Re.isPortal=Y,Re.isProfiler=U,Re.isStrictMode=ne,Re.isSuspense=le,Re.isValidElementType=k,Re.typeOf=T}()),Re}var xu;function kd(){return xu||(xu=1,process.env.NODE_ENV==="production"?na.exports=rp():na.exports=ap()),na.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var Ei,Du;function ip(){if(Du)return Ei;Du=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 Ei=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 m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},Ei}var _i,Cu;function co(){if(Cu)return _i;Cu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _i=e,_i}var ki,wu;function Fd(){return wu||(wu=1,ki=Function.call.bind(Object.prototype.hasOwnProperty)),ki}var Fi,Eu;function sp(){if(Eu)return Fi;Eu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=co(),n={},r=Fd();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 m=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 m.name="Invariant Violation",m}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 p=u?u():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Fi=a,Fi}var Ai,_u;function op(){if(_u)return Ai;_u=1;var e=kd(),t=ip(),n=co(),r=Fd(),a=sp(),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 Ai=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(w){var ee=w&&(u&&w[u]||w[d]);if(typeof ee=="function")return ee}var m="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:E(),arrayOf:k,element:T(),elementType:D(),instanceOf:C,node:q(),objectOf:L,oneOf:S,oneOfType:N,shape:F,exact:_};function g(w,ee){return w===ee?w!==0||1/w===1/ee:w!==w&&ee!==ee}function f(w,ee){this.message=w,this.data=ee&&typeof ee=="object"?ee:{},this.stack=""}f.prototype=Error.prototype;function v(w){if(process.env.NODE_ENV!=="production")var ee={},K=0;function A(O,M,z,Y,U,ne,le){if(Y=Y||m,ne=ne||z,le!==n){if(l){var J=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 J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=Y+":"+z;!ee[pe]&&K<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+Y+"`. 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."),ee[pe]=!0,K++)}}return M[z]==null?O?M[z]===null?new f("The "+U+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new f("The "+U+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:w(M,z,Y,U,ne)}var B=A.bind(null,!1);return B.isRequired=A.bind(null,!0),B}function b(w){function ee(K,A,B,O,M,z){var Y=K[A],U=W(Y);if(U!==w){var ne=V(Y);return new f("Invalid "+O+" `"+M+"` of type "+("`"+ne+"` supplied to `"+B+"`, expected ")+("`"+w+"`."),{expectedType:w})}return null}return v(ee)}function E(){return v(s)}function k(w){function ee(K,A,B,O,M){if(typeof w!="function")return new f("Property `"+M+"` of component `"+B+"` has invalid PropType notation inside arrayOf.");var z=K[A];if(!Array.isArray(z)){var Y=W(z);return new f("Invalid "+O+" `"+M+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected an array."))}for(var U=0;U<z.length;U++){var ne=w(z,U,B,O,M+"["+U+"]",n);if(ne instanceof Error)return ne}return null}return v(ee)}function T(){function w(ee,K,A,B,O){var M=ee[K];if(!o(M)){var z=W(M);return new f("Invalid "+B+" `"+O+"` of type "+("`"+z+"` supplied to `"+A+"`, expected a single ReactElement."))}return null}return v(w)}function D(){function w(ee,K,A,B,O){var M=ee[K];if(!e.isValidElementType(M)){var z=W(M);return new f("Invalid "+B+" `"+O+"` of type "+("`"+z+"` supplied to `"+A+"`, expected a single ReactElement type."))}return null}return v(w)}function C(w){function ee(K,A,B,O,M){if(!(K[A]instanceof w)){var z=w.name||m,Y=re(K[A]);return new f("Invalid "+O+" `"+M+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected ")+("instance of `"+z+"`."))}return null}return v(ee)}function S(w){if(!Array.isArray(w))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 ee(K,A,B,O,M){for(var z=K[A],Y=0;Y<w.length;Y++)if(g(z,w[Y]))return null;var U=JSON.stringify(w,function(le,J){var pe=V(J);return pe==="symbol"?String(J):J});return new f("Invalid "+O+" `"+M+"` of value `"+String(z)+"` "+("supplied to `"+B+"`, expected one of "+U+"."))}return v(ee)}function L(w){function ee(K,A,B,O,M){if(typeof w!="function")return new f("Property `"+M+"` of component `"+B+"` has invalid PropType notation inside objectOf.");var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+M+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected an object."));for(var U in z)if(r(z,U)){var ne=w(z,U,B,O,M+"."+U,n);if(ne instanceof Error)return ne}return null}return v(ee)}function N(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var ee=0;ee<w.length;ee++){var K=w[ee];if(typeof K!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+se(K)+" at index "+ee+"."),s}function A(B,O,M,z,Y){for(var U=[],ne=0;ne<w.length;ne++){var le=w[ne],J=le(B,O,M,z,Y,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&U.push(J.data.expectedType)}var pe=U.length>0?", expected one of type ["+U.join(", ")+"]":"";return new f("Invalid "+z+" `"+Y+"` supplied to "+("`"+M+"`"+pe+"."))}return v(A)}function q(){function w(ee,K,A,B,O){return P(ee[K])?null:new f("Invalid "+B+" `"+O+"` supplied to "+("`"+A+"`, expected a ReactNode."))}return v(w)}function $(w,ee,K,A,B){return new f((w||"React class")+": "+ee+" type `"+K+"."+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+B+"`.")}function F(w){function ee(K,A,B,O,M){var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+M+"` of type `"+Y+"` "+("supplied to `"+B+"`, expected `object`."));for(var U in w){var ne=w[U];if(typeof ne!="function")return $(B,O,M,U,V(ne));var le=ne(z,U,B,O,M+"."+U,n);if(le)return le}return null}return v(ee)}function _(w){function ee(K,A,B,O,M){var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+M+"` of type `"+Y+"` "+("supplied to `"+B+"`, expected `object`."));var U=t({},K[A],w);for(var ne in U){var le=w[ne];if(r(w,ne)&&typeof le!="function")return $(B,O,M,ne,V(le));if(!le)return new f("Invalid "+O+" `"+M+"` key `"+ne+"` supplied to `"+B+"`.\nBad object: "+JSON.stringify(K[A],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(w),null," "));var J=le(z,ne,B,O,M+"."+ne,n);if(J)return J}return null}return v(ee)}function P(w){switch(typeof w){case"number":case"string":case"undefined":return!0;case"boolean":return!w;case"object":if(Array.isArray(w))return w.every(P);if(w===null||o(w))return!0;var ee=h(w);if(ee){var K=ee.call(w),A;if(ee!==w.entries){for(;!(A=K.next()).done;)if(!P(A.value))return!1}else for(;!(A=K.next()).done;){var B=A.value;if(B&&!P(B[1]))return!1}}else return!1;return!0;default:return!1}}function j(w,ee){return w==="symbol"?!0:ee?ee["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&ee instanceof Symbol:!1}function W(w){var ee=typeof w;return Array.isArray(w)?"array":w instanceof RegExp?"object":j(ee,w)?"symbol":ee}function V(w){if(typeof w>"u"||w===null)return""+w;var ee=W(w);if(ee==="object"){if(w instanceof Date)return"date";if(w instanceof RegExp)return"regexp"}return ee}function se(w){var ee=V(w);switch(ee){case"array":case"object":return"an "+ee;case"boolean":case"date":case"regexp":return"a "+ee;default:return ee}}function re(w){return!w.constructor||!w.constructor.name?m:w.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ai}var Bi,ku;function up(){if(ku)return Bi;ku=1;var e=co();function t(){}function n(){}return n.resetWarningCache=t,Bi=function(){function r(s,o,l,u,d,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Bi}if(process.env.NODE_ENV!=="production"){var lp=kd(),cp=!0;ks.exports=op()(lp.isElement,cp)}else ks.exports=up()();var dp=ks.exports;/*!
55
+ */var Ei,Du;function ip(){if(Du)return Ei;Du=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 Ei=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 m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},Ei}var _i,Cu;function co(){if(Cu)return _i;Cu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _i=e,_i}var ki,wu;function Fd(){return wu||(wu=1,ki=Function.call.bind(Object.prototype.hasOwnProperty)),ki}var Fi,Eu;function sp(){if(Eu)return Fi;Eu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=co(),n={},r=Fd();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 m=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 m.name="Invariant Violation",m}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 p=u?u():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Fi=a,Fi}var Ai,_u;function op(){if(_u)return Ai;_u=1;var e=kd(),t=ip(),n=co(),r=Fd(),a=sp(),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 Ai=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(C){var ee=C&&(u&&C[u]||C[d]);if(typeof ee=="function")return ee}var m="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:E(),arrayOf:k,element:T(),elementType:D(),instanceOf:w,node:q(),objectOf:L,oneOf:S,oneOfType:M,shape:F,exact:_};function g(C,ee){return C===ee?C!==0||1/C===1/ee:C!==C&&ee!==ee}function f(C,ee){this.message=C,this.data=ee&&typeof ee=="object"?ee:{},this.stack=""}f.prototype=Error.prototype;function v(C){if(process.env.NODE_ENV!=="production")var ee={},K=0;function A(O,N,z,Y,U,ne,le){if(Y=Y||m,ne=ne||z,le!==n){if(l){var J=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 J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=Y+":"+z;!ee[pe]&&K<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+Y+"`. 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."),ee[pe]=!0,K++)}}return N[z]==null?O?N[z]===null?new f("The "+U+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new f("The "+U+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:C(N,z,Y,U,ne)}var B=A.bind(null,!1);return B.isRequired=A.bind(null,!0),B}function b(C){function ee(K,A,B,O,N,z){var Y=K[A],U=W(Y);if(U!==C){var ne=V(Y);return new f("Invalid "+O+" `"+N+"` of type "+("`"+ne+"` supplied to `"+B+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return v(ee)}function E(){return v(s)}function k(C){function ee(K,A,B,O,N){if(typeof C!="function")return new f("Property `"+N+"` of component `"+B+"` has invalid PropType notation inside arrayOf.");var z=K[A];if(!Array.isArray(z)){var Y=W(z);return new f("Invalid "+O+" `"+N+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected an array."))}for(var U=0;U<z.length;U++){var ne=C(z,U,B,O,N+"["+U+"]",n);if(ne instanceof Error)return ne}return null}return v(ee)}function T(){function C(ee,K,A,B,O){var N=ee[K];if(!o(N)){var z=W(N);return new f("Invalid "+B+" `"+O+"` of type "+("`"+z+"` supplied to `"+A+"`, expected a single ReactElement."))}return null}return v(C)}function D(){function C(ee,K,A,B,O){var N=ee[K];if(!e.isValidElementType(N)){var z=W(N);return new f("Invalid "+B+" `"+O+"` of type "+("`"+z+"` supplied to `"+A+"`, expected a single ReactElement type."))}return null}return v(C)}function w(C){function ee(K,A,B,O,N){if(!(K[A]instanceof C)){var z=C.name||m,Y=re(K[A]);return new f("Invalid "+O+" `"+N+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected ")+("instance of `"+z+"`."))}return null}return v(ee)}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 ee(K,A,B,O,N){for(var z=K[A],Y=0;Y<C.length;Y++)if(g(z,C[Y]))return null;var U=JSON.stringify(C,function(le,J){var pe=V(J);return pe==="symbol"?String(J):J});return new f("Invalid "+O+" `"+N+"` of value `"+String(z)+"` "+("supplied to `"+B+"`, expected one of "+U+"."))}return v(ee)}function L(C){function ee(K,A,B,O,N){if(typeof C!="function")return new f("Property `"+N+"` of component `"+B+"` has invalid PropType notation inside objectOf.");var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+N+"` of type "+("`"+Y+"` supplied to `"+B+"`, expected an object."));for(var U in z)if(r(z,U)){var ne=C(z,U,B,O,N+"."+U,n);if(ne instanceof Error)return ne}return null}return v(ee)}function M(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 ee=0;ee<C.length;ee++){var K=C[ee];if(typeof K!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+se(K)+" at index "+ee+"."),s}function A(B,O,N,z,Y){for(var U=[],ne=0;ne<C.length;ne++){var le=C[ne],J=le(B,O,N,z,Y,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&U.push(J.data.expectedType)}var pe=U.length>0?", expected one of type ["+U.join(", ")+"]":"";return new f("Invalid "+z+" `"+Y+"` supplied to "+("`"+N+"`"+pe+"."))}return v(A)}function q(){function C(ee,K,A,B,O){return P(ee[K])?null:new f("Invalid "+B+" `"+O+"` supplied to "+("`"+A+"`, expected a ReactNode."))}return v(C)}function $(C,ee,K,A,B){return new f((C||"React class")+": "+ee+" type `"+K+"."+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+B+"`.")}function F(C){function ee(K,A,B,O,N){var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+N+"` of type `"+Y+"` "+("supplied to `"+B+"`, expected `object`."));for(var U in C){var ne=C[U];if(typeof ne!="function")return $(B,O,N,U,V(ne));var le=ne(z,U,B,O,N+"."+U,n);if(le)return le}return null}return v(ee)}function _(C){function ee(K,A,B,O,N){var z=K[A],Y=W(z);if(Y!=="object")return new f("Invalid "+O+" `"+N+"` of type `"+Y+"` "+("supplied to `"+B+"`, expected `object`."));var U=t({},K[A],C);for(var ne in U){var le=C[ne];if(r(C,ne)&&typeof le!="function")return $(B,O,N,ne,V(le));if(!le)return new f("Invalid "+O+" `"+N+"` key `"+ne+"` supplied to `"+B+"`.\nBad object: "+JSON.stringify(K[A],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var J=le(z,ne,B,O,N+"."+ne,n);if(J)return J}return null}return v(ee)}function P(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(P);if(C===null||o(C))return!0;var ee=h(C);if(ee){var K=ee.call(C),A;if(ee!==C.entries){for(;!(A=K.next()).done;)if(!P(A.value))return!1}else for(;!(A=K.next()).done;){var B=A.value;if(B&&!P(B[1]))return!1}}else return!1;return!0;default:return!1}}function j(C,ee){return C==="symbol"?!0:ee?ee["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&ee instanceof Symbol:!1}function W(C){var ee=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":j(ee,C)?"symbol":ee}function V(C){if(typeof C>"u"||C===null)return""+C;var ee=W(C);if(ee==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return ee}function se(C){var ee=V(C);switch(ee){case"array":case"object":return"an "+ee;case"boolean":case"date":case"regexp":return"a "+ee;default:return ee}}function re(C){return!C.constructor||!C.constructor.name?m:C.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ai}var Bi,ku;function up(){if(ku)return Bi;ku=1;var e=co();function t(){}function n(){}return n.resetWarningCache=t,Bi=function(){function r(s,o,l,u,d,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Bi}if(process.env.NODE_ENV!=="production"){var lp=kd(),cp=!0;ks.exports=op()(lp.isElement,cp)}else ks.exports=up()();var dp=ks.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
59
  */var Ad=["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])"],Na=Ad.join(","),Bd=typeof Element>"u",Sn=Bd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ra=!Bd&&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},Ia=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},fp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Td=function(t,n,r){if(Ia(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Na));return n&&Sn.call(t,Na)&&a.unshift(t),a=a.filter(r),a},Sd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Ia(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=Sn.call(s,Na);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!Ia(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&m){var p=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},jd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},fn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||fp(t))&&!jd(t)?0:t.tabIndex},hp=function(t,n){var r=fn(t);return r<0&&n&&!jd(t)?0:r},mp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Od=function(t){return t.tagName==="INPUT"},pp=function(t){return Od(t)&&t.type==="hidden"},gp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},vp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},bp=function(t){if(!t.name)return!0;var n=t.form||Ra(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=vp(a,t.form);return!i||i===t},yp=function(t){return Od(t)&&t.type==="radio"},xp=function(t){return yp(t)&&!bp(t)},Dp=function(t){var n,r=t&&Ra(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=Ra(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},Fu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Cp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Sn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Sn.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=Ra(t);if(l&&!l.shadowRoot&&a(l)===!0)return Fu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Dp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Fu(t);return!1},wp=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 Sn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},$a=function(t,n){return!(n.disabled||Ia(n)||pp(n)||Cp(n,t)||gp(n)||wp(n))},Fs=function(t,n){return!(xp(n)||fn(n)<0||!$a(t,n))},Ep=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},_p=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=hp(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(mp).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Pd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sd([t],n.includeContainer,{filter:Fs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ep}):r=Td(t,n.includeContainer,Fs.bind(null,n)),_p(r)},Md=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sd([t],n.includeContainer,{filter:$a.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Td(t,n.includeContainer,$a.bind(null,n)),r},Cn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Sn.call(t,Na)===!1?!1:Fs(n,t)},kp=Ad.concat("iframe").join(","),_a=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Sn.call(t,kp)===!1?!1:$a(n,t)};const Fp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Md,getTabIndex:fn,isFocusable:_a,isTabbable:Cn,tabbable:Pd},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 Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){Ap(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ap(e,t,n){return t=Tp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(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 Tp(e){var t=Bp(e,"string");return typeof t=="symbol"?t:String(t)}var Tu={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()}},Sp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},jp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Ar=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Op=function(t){return Ar(t)&&!t.shiftKey},Pp=function(t){return Ar(t)&&t.shiftKey},Su=function(t){return setTimeout(t,0)},ju=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},br=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},ra=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Mp=[],Np=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Mp,i=Bu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Op,isKeyBackward:Pp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(F,_,P){return F&&F[_]!==void 0?F[_]:i[P||_]},u=function(F,_){var P=typeof(_==null?void 0:_.composedPath)=="function"?_.composedPath():void 0;return s.containerGroups.findIndex(function(j){var W=j.container,V=j.tabbableNodes;return W.contains(F)||(P==null?void 0:P.includes(W))||V.find(function(se){return se===F})})},d=function(F){var _=i[F];if(typeof _=="function"){for(var P=arguments.length,j=new Array(P>1?P-1:0),W=1;W<P;W++)j[W-1]=arguments[W];_=_.apply(void 0,j)}if(_===!0&&(_=void 0),!_){if(_===void 0||_===!1)return _;throw new Error("`".concat(F,"` was specified but was not a node, or did not return a node"))}var V=_;if(typeof _=="string"&&(V=r.querySelector(_),!V))throw new Error("`".concat(F,"` as selector refers to no known node"));return V},h=function(){var F=d("initialFocus");if(F===!1)return!1;if(F===void 0||!_a(F,i.tabbableOptions))if(u(r.activeElement)>=0)F=r.activeElement;else{var _=s.tabbableGroups[0],P=_&&_.firstTabbableNode;F=P||d("fallbackFocus")}if(!F)throw new Error("Your focus-trap needs to have at least one focusable element");return F},m=function(){if(s.containerGroups=s.containers.map(function(F){var _=Pd(F,i.tabbableOptions),P=Md(F,i.tabbableOptions),j=_.length>0?_[0]:void 0,W=_.length>0?_[_.length-1]:void 0,V=P.find(function(w){return Cn(w)}),se=P.slice().reverse().find(function(w){return Cn(w)}),re=!!_.find(function(w){return fn(w)>0});return{container:F,tabbableNodes:_,focusableNodes:P,posTabIndexesFound:re,firstTabbableNode:j,lastTabbableNode:W,firstDomTabbableNode:V,lastDomTabbableNode:se,nextTabbableNode:function(ee){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,A=_.indexOf(ee);return A<0?K?P.slice(P.indexOf(ee)+1).find(function(B){return Cn(B)}):P.slice(0,P.indexOf(ee)).reverse().find(function(B){return Cn(B)}):_[A+(K?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(F){return F.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(F){return F.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function $(F){var _=F.activeElement;if(_)return _.shadowRoot&&_.shadowRoot.activeElement!==null?$(_.shadowRoot):_},g=function $(F){if(F!==!1&&F!==p(document)){if(!F||!F.focus){$(h());return}F.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=F,Sp(F)&&F.select()}},f=function(F){var _=d("setReturnFocus",F);return _||(_===!1?!1:F)},v=function(F){var _=F.target,P=F.event,j=F.isBackward,W=j===void 0?!1:j;_=_||ra(P),m();var V=null;if(s.tabbableGroups.length>0){var se=u(_,P),re=se>=0?s.containerGroups[se]:void 0;if(se<0)W?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(W){var w=ju(s.tabbableGroups,function(M){var z=M.firstTabbableNode;return _===z});if(w<0&&(re.container===_||_a(_,i.tabbableOptions)&&!Cn(_,i.tabbableOptions)&&!re.nextTabbableNode(_,!1))&&(w=se),w>=0){var ee=w===0?s.tabbableGroups.length-1:w-1,K=s.tabbableGroups[ee];V=fn(_)>=0?K.lastTabbableNode:K.lastDomTabbableNode}else Ar(P)||(V=re.nextTabbableNode(_,!1))}else{var A=ju(s.tabbableGroups,function(M){var z=M.lastTabbableNode;return _===z});if(A<0&&(re.container===_||_a(_,i.tabbableOptions)&&!Cn(_,i.tabbableOptions)&&!re.nextTabbableNode(_))&&(A=se),A>=0){var B=A===s.tabbableGroups.length-1?0:A+1,O=s.tabbableGroups[B];V=fn(_)>=0?O.firstTabbableNode:O.firstDomTabbableNode}else Ar(P)||(V=re.nextTabbableNode(_))}}else V=d("fallbackFocus");return V},b=function(F){var _=ra(F);if(!(u(_,F)>=0)){if(br(i.clickOutsideDeactivates,F)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}br(i.allowOutsideClick,F)||F.preventDefault()}},E=function(F){var _=ra(F),P=u(_,F)>=0;if(P||_ instanceof Document)P&&(s.mostRecentlyFocusedNode=_);else{F.stopImmediatePropagation();var j,W=!0;if(s.mostRecentlyFocusedNode)if(fn(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),se=s.containerGroups[V].tabbableNodes;if(se.length>0){var re=se.findIndex(function(w){return w===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<se.length&&(j=se[re+1],W=!1):re-1>=0&&(j=se[re-1],W=!1))}}else s.containerGroups.some(function(w){return w.tabbableNodes.some(function(ee){return fn(ee)>0})})||(W=!1);else W=!1;W&&(j=v({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(j||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},k=function(F){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=F;var P=v({event:F,isBackward:_});P&&(Ar(F)&&F.preventDefault(),g(P))},T=function(F){if(jp(F)&&br(i.escapeDeactivates,F)!==!1){F.preventDefault(),o.deactivate();return}(i.isKeyForward(F)||i.isKeyBackward(F))&&k(F,i.isKeyBackward(F))},D=function(F){var _=ra(F);u(_,F)>=0||br(i.clickOutsideDeactivates,F)||br(i.allowOutsideClick,F)||(F.preventDefault(),F.stopImmediatePropagation())},C=function(){if(s.active)return Tu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Su(function(){g(h())}):g(h()),r.addEventListener("focusin",E,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",T,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",E,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",T,!0),o},L=function(F){var _=F.some(function(P){var j=Array.from(P.removedNodes);return j.some(function(W){return W===s.mostRecentlyFocusedNode})});_&&g(h())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,q=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(F){N.observe(F,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(F){if(s.active)return this;var _=l(F,"onActivate"),P=l(F,"onPostActivate"),j=l(F,"checkCanFocusTrap");j||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,_==null||_();var W=function(){j&&m(),C(),q(),P==null||P()};return j?(j(s.containers.concat()).then(W,W),this):(W(),this)},deactivate:function(F){if(!s.active)return this;var _=Bu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},F);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,q(),Tu.deactivateTrap(a,o);var P=l(_,"onDeactivate"),j=l(_,"onPostDeactivate"),W=l(_,"checkCanReturnFocus"),V=l(_,"returnFocus","returnFocusOnDeactivate");P==null||P();var se=function(){Su(function(){V&&g(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return V&&W?(W(f(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),this)},pause:function(F){if(s.paused||!s.active)return this;var _=l(F,"onPause"),P=l(F,"onPostPause");return s.paused=!0,_==null||_(),S(),q(),P==null||P(),this},unpause:function(F){if(!s.paused||!s.active)return this;var _=l(F,"onUnpause"),P=l(F,"onPostUnpause");return s.paused=!1,_==null||_(),m(),C(),q(),P==null||P(),this},updateContainerElements:function(F){var _=[].concat(F).filter(Boolean);return s.containers=_.map(function(P){return typeof P=="string"?r.querySelector(P):P}),s.active&&m(),q(),this}},o.updateContainerElements(t),o};const Rp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Np},Symbol.toStringTag,{value:"Module"})),Ip=Wc(Rp),$p=Wc(Fp);function sr(e){"@babel/helpers - typeof";return sr=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},sr(e)}function Lp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ou(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,Nd(r.key),r)}}function zp(e,t,n){return t&&Ou(e.prototype,t),n&&Ou(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function qp(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&&As(e,t)}function As(e,t){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},As(e,t)}function Up(e){var t=Hp();return function(){var r=La(e),a;if(t){var i=La(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Wp(this,a)}}function Wp(e,t){if(t&&(sr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kr(e)}function kr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hp(){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 La(e){return La=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},La(e)}function Vp(e,t,n){return t=Nd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nd(e){var t=Kp(e,"string");return sr(t)==="symbol"?t:String(t)}function Kp(e,t){if(sr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(sr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var aa=y,ve=dp,Zp=Ip,Yp=Zp.createFocusTrap,Gp=$p,Qp=Gp.isFocusable,fo=function(e){qp(n,e);var t=Up(n);function n(r){var a;Lp(this,n),a=t.call(this,r),Vp(kr(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),m=1;m<d;m++)h[m-1]=arguments[m];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(kr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(kr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(kr(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 zp(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?aa.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===aa.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=aa.cloneElement(i,{ref:s});return o}return null}}]),n}(aa.Component),yr=typeof Element>"u"?Function:Element;fo.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(yr)),children:ve.oneOfType([ve.element,ve.instanceOf(yr)])};fo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Yp};var Jp=fo;const Xp=Mn(Jp);const rn=({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 m=ie.useIntl(),{registerOverlay:p,unregisterOverlay:g}=xd(),[f,v]=y.useState(t),[b,E]=y.useState(null),k=y.useRef(null),T=N=>{f&&N.key==="Escape"&&S(!1)},D=N=>{E(N.target)},C=N=>{b===k.current&&N.target===k.current&&S(!1),E(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",T),()=>{window.removeEventListener("keyup",T)}},[f]),y.useEffect(()=>{const N=k.current;return N&&(N.addEventListener("mousedown",D),N.addEventListener("mouseup",C)),()=>{N&&(N.removeEventListener("mousedown",D),N.removeEventListener("mouseup",C))}},[b]);const S=N=>{if(v(N),N)a(),p(e);else{if(f===N)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const L=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:k,className:Z("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(lo,{id:e,className:Z("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:L,children:t&&c.jsx(Xp,{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(ke,{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:m.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Kt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Kt,{}),c.jsx(fr,{buttons:u})]}),s&&c.jsx(ir,{className:"error",children:s})]})})})})},Rd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const xr="joinCommunityButton",ho=({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(st),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[m,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${xr}_leave`}),g["aria-label"]=s.formatMessage({id:`${xr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(ke,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${xr}_closed_tooltip`}):"",onClick:async v=>{if(u)return;v.currentTarget.blur(),p(d?"leaving":"joining");const b=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${xr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(b);const E=d?i:a;typeof E=="function"&&setTimeout(async()=>{await E()},500),h(!d)},className:Z("join-community-button",m,{active:m==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${xr}${["joining","leaving"].includes(m)?`_${m}`:d?"_member":n?"_short":""}`})})})};const Ti="communityDetails_",eg=({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(st),d=u,h=5,m=a||i.length,p=i.length?i:Array(h).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,v=!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:`${Ti}members`}),c.jsx("span",{className:"count",children:m})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Ti}viewAll`})})})]}),d&&c.jsx(uo,{contributors:{total:a,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:m===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(ho,{isMember:t,isOpen:n,disabled:v,functions:{...o}}),t&&c.jsx(ke,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Ti}invite`})})]}):c.jsx(c.Fragment,{})]})};const tg=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{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(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(gn,{href:s?void 0:i,...l,children:rr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const mo=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:Z("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),i){i(h);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",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 Id=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ie.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(m=>m.id):[]),h=(m,p)=>{let g=[];u.includes(m)&&!i?g=u.filter(f=>f!==m):m==="all"?g=["all"]:r?g=[...u.filter(f=>f!=="all"),m]:g=[m],d(f=>(a&&typeof a=="function"&&a({current:g,previous:f}),g)),p&&typeof p=="function"&&p()};return c.jsx("ul",{className:Z("filters",s),children:l.map(({id:m,text:p,disabled:g=!1,callback:f=()=>{}})=>{let v={};return g&&(v={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:p})}),c.jsx("li",{children:c.jsx("button",{className:Z(m,{selected:u.includes(m)}),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(m,f)},"aria-selected":u.includes(m),...v,children:p})},m)})})},ng=(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 ia="languageSwitcher_",rg=({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(io),[h,m]=y.useState(e);if(y.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(v=>v&&v.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:`${ia}label`})}),c.jsx("ul",{children:g.map(v=>{var k;if(!Ea[v])return null;const b=(k=r[v])==null?void 0:k.post_name;let E={className:v};if(h===v)E["aria-label"]=u.formatMessage({id:`${ia}selected`},{language:Ea[v]});else{const T=ng(v,b,i);E={...E,href:typeof T=="string"?T:T.url,onClick:D=>{m(v),d(v),typeof a<"u"&&(D.preventDefault(),D.stopPropagation(),a(v,typeof T=="string"?T:T.urlForRouter))}}}return c.jsx("li",{children:c.jsx(gn,{...E,fallbackElement:"span",children:Ea[v]})},v)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ia}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ia}disclaimer`},{email:Zn.support,link:v=>{const b=`mailto:${v}`;return c.jsx("a",{href:b,children:v})}})})]})};const Si=ie.createIntl({locale:"en",messages:dr}),Zr=({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:Si.formatMessage({id:"loadMore_button"}),endOfFeed:Si.formatMessage({id:"loadMore_endOfFeed"}),error:Si.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),m=async p=>{if(!n)try{await t(p)}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(ke,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const po=({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(Me,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let sa=!1;const $d=({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:Z("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(ke,{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:m,...p},g)=>{const f={...p,onClick:v=>{o(!1),typeof d=="function"&&d(v)},onFocus:()=>{sa&&(clearTimeout(sa),sa=!1)},onBlur:()=>{sa=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(ke,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},ag=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const ig=y.lazy(()=>Promise.resolve().then(()=>np)),sg=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Ld=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=y.useContext(st),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[sg.map(({key:i,href:s})=>{const o=ag(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(ig,{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"})]})},Dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,og=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Dr(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(`${Dr(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(`${Dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
62
+ */function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){Ap(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ap(e,t,n){return t=Tp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(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 Tp(e){var t=Bp(e,"string");return typeof t=="symbol"?t:String(t)}var Tu={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()}},Sp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},jp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Ar=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Op=function(t){return Ar(t)&&!t.shiftKey},Pp=function(t){return Ar(t)&&t.shiftKey},Su=function(t){return setTimeout(t,0)},ju=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},br=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},ra=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Mp=[],Np=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Mp,i=Bu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Op,isKeyBackward:Pp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(F,_,P){return F&&F[_]!==void 0?F[_]:i[P||_]},u=function(F,_){var P=typeof(_==null?void 0:_.composedPath)=="function"?_.composedPath():void 0;return s.containerGroups.findIndex(function(j){var W=j.container,V=j.tabbableNodes;return W.contains(F)||(P==null?void 0:P.includes(W))||V.find(function(se){return se===F})})},d=function(F){var _=i[F];if(typeof _=="function"){for(var P=arguments.length,j=new Array(P>1?P-1:0),W=1;W<P;W++)j[W-1]=arguments[W];_=_.apply(void 0,j)}if(_===!0&&(_=void 0),!_){if(_===void 0||_===!1)return _;throw new Error("`".concat(F,"` was specified but was not a node, or did not return a node"))}var V=_;if(typeof _=="string"&&(V=r.querySelector(_),!V))throw new Error("`".concat(F,"` as selector refers to no known node"));return V},h=function(){var F=d("initialFocus");if(F===!1)return!1;if(F===void 0||!_a(F,i.tabbableOptions))if(u(r.activeElement)>=0)F=r.activeElement;else{var _=s.tabbableGroups[0],P=_&&_.firstTabbableNode;F=P||d("fallbackFocus")}if(!F)throw new Error("Your focus-trap needs to have at least one focusable element");return F},m=function(){if(s.containerGroups=s.containers.map(function(F){var _=Pd(F,i.tabbableOptions),P=Md(F,i.tabbableOptions),j=_.length>0?_[0]:void 0,W=_.length>0?_[_.length-1]:void 0,V=P.find(function(C){return Cn(C)}),se=P.slice().reverse().find(function(C){return Cn(C)}),re=!!_.find(function(C){return fn(C)>0});return{container:F,tabbableNodes:_,focusableNodes:P,posTabIndexesFound:re,firstTabbableNode:j,lastTabbableNode:W,firstDomTabbableNode:V,lastDomTabbableNode:se,nextTabbableNode:function(ee){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,A=_.indexOf(ee);return A<0?K?P.slice(P.indexOf(ee)+1).find(function(B){return Cn(B)}):P.slice(0,P.indexOf(ee)).reverse().find(function(B){return Cn(B)}):_[A+(K?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(F){return F.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(F){return F.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function $(F){var _=F.activeElement;if(_)return _.shadowRoot&&_.shadowRoot.activeElement!==null?$(_.shadowRoot):_},g=function $(F){if(F!==!1&&F!==p(document)){if(!F||!F.focus){$(h());return}F.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=F,Sp(F)&&F.select()}},f=function(F){var _=d("setReturnFocus",F);return _||(_===!1?!1:F)},v=function(F){var _=F.target,P=F.event,j=F.isBackward,W=j===void 0?!1:j;_=_||ra(P),m();var V=null;if(s.tabbableGroups.length>0){var se=u(_,P),re=se>=0?s.containerGroups[se]:void 0;if(se<0)W?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(W){var C=ju(s.tabbableGroups,function(N){var z=N.firstTabbableNode;return _===z});if(C<0&&(re.container===_||_a(_,i.tabbableOptions)&&!Cn(_,i.tabbableOptions)&&!re.nextTabbableNode(_,!1))&&(C=se),C>=0){var ee=C===0?s.tabbableGroups.length-1:C-1,K=s.tabbableGroups[ee];V=fn(_)>=0?K.lastTabbableNode:K.lastDomTabbableNode}else Ar(P)||(V=re.nextTabbableNode(_,!1))}else{var A=ju(s.tabbableGroups,function(N){var z=N.lastTabbableNode;return _===z});if(A<0&&(re.container===_||_a(_,i.tabbableOptions)&&!Cn(_,i.tabbableOptions)&&!re.nextTabbableNode(_))&&(A=se),A>=0){var B=A===s.tabbableGroups.length-1?0:A+1,O=s.tabbableGroups[B];V=fn(_)>=0?O.firstTabbableNode:O.firstDomTabbableNode}else Ar(P)||(V=re.nextTabbableNode(_))}}else V=d("fallbackFocus");return V},b=function(F){var _=ra(F);if(!(u(_,F)>=0)){if(br(i.clickOutsideDeactivates,F)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}br(i.allowOutsideClick,F)||F.preventDefault()}},E=function(F){var _=ra(F),P=u(_,F)>=0;if(P||_ instanceof Document)P&&(s.mostRecentlyFocusedNode=_);else{F.stopImmediatePropagation();var j,W=!0;if(s.mostRecentlyFocusedNode)if(fn(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),se=s.containerGroups[V].tabbableNodes;if(se.length>0){var re=se.findIndex(function(C){return C===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<se.length&&(j=se[re+1],W=!1):re-1>=0&&(j=se[re-1],W=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(ee){return fn(ee)>0})})||(W=!1);else W=!1;W&&(j=v({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(j||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},k=function(F){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=F;var P=v({event:F,isBackward:_});P&&(Ar(F)&&F.preventDefault(),g(P))},T=function(F){if(jp(F)&&br(i.escapeDeactivates,F)!==!1){F.preventDefault(),o.deactivate();return}(i.isKeyForward(F)||i.isKeyBackward(F))&&k(F,i.isKeyBackward(F))},D=function(F){var _=ra(F);u(_,F)>=0||br(i.clickOutsideDeactivates,F)||br(i.allowOutsideClick,F)||(F.preventDefault(),F.stopImmediatePropagation())},w=function(){if(s.active)return Tu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Su(function(){g(h())}):g(h()),r.addEventListener("focusin",E,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",T,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",E,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",T,!0),o},L=function(F){var _=F.some(function(P){var j=Array.from(P.removedNodes);return j.some(function(W){return W===s.mostRecentlyFocusedNode})});_&&g(h())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,q=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(F){M.observe(F,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(F){if(s.active)return this;var _=l(F,"onActivate"),P=l(F,"onPostActivate"),j=l(F,"checkCanFocusTrap");j||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,_==null||_();var W=function(){j&&m(),w(),q(),P==null||P()};return j?(j(s.containers.concat()).then(W,W),this):(W(),this)},deactivate:function(F){if(!s.active)return this;var _=Bu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},F);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,q(),Tu.deactivateTrap(a,o);var P=l(_,"onDeactivate"),j=l(_,"onPostDeactivate"),W=l(_,"checkCanReturnFocus"),V=l(_,"returnFocus","returnFocusOnDeactivate");P==null||P();var se=function(){Su(function(){V&&g(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return V&&W?(W(f(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),this)},pause:function(F){if(s.paused||!s.active)return this;var _=l(F,"onPause"),P=l(F,"onPostPause");return s.paused=!0,_==null||_(),S(),q(),P==null||P(),this},unpause:function(F){if(!s.paused||!s.active)return this;var _=l(F,"onUnpause"),P=l(F,"onPostUnpause");return s.paused=!1,_==null||_(),m(),w(),q(),P==null||P(),this},updateContainerElements:function(F){var _=[].concat(F).filter(Boolean);return s.containers=_.map(function(P){return typeof P=="string"?r.querySelector(P):P}),s.active&&m(),q(),this}},o.updateContainerElements(t),o};const Rp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Np},Symbol.toStringTag,{value:"Module"})),Ip=Wc(Rp),$p=Wc(Fp);function sr(e){"@babel/helpers - typeof";return sr=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},sr(e)}function Lp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ou(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,Nd(r.key),r)}}function zp(e,t,n){return t&&Ou(e.prototype,t),n&&Ou(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function qp(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&&As(e,t)}function As(e,t){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},As(e,t)}function Up(e){var t=Hp();return function(){var r=La(e),a;if(t){var i=La(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Wp(this,a)}}function Wp(e,t){if(t&&(sr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kr(e)}function kr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hp(){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 La(e){return La=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},La(e)}function Vp(e,t,n){return t=Nd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nd(e){var t=Kp(e,"string");return sr(t)==="symbol"?t:String(t)}function Kp(e,t){if(sr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(sr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var aa=y,ve=dp,Zp=Ip,Yp=Zp.createFocusTrap,Gp=$p,Qp=Gp.isFocusable,fo=function(e){qp(n,e);var t=Up(n);function n(r){var a;Lp(this,n),a=t.call(this,r),Vp(kr(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),m=1;m<d;m++)h[m-1]=arguments[m];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(kr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(kr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(kr(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 zp(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?aa.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===aa.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=aa.cloneElement(i,{ref:s});return o}return null}}]),n}(aa.Component),yr=typeof Element>"u"?Function:Element;fo.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(yr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(yr)),children:ve.oneOfType([ve.element,ve.instanceOf(yr)])};fo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Yp};var Jp=fo;const Xp=Mn(Jp);const rn=({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 m=ie.useIntl(),{registerOverlay:p,unregisterOverlay:g}=xd(),[f,v]=y.useState(t),[b,E]=y.useState(null),k=y.useRef(null),T=M=>{f&&M.key==="Escape"&&S(!1)},D=M=>{E(M.target)},w=M=>{b===k.current&&M.target===k.current&&S(!1),E(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",T),()=>{window.removeEventListener("keyup",T)}},[f]),y.useEffect(()=>{const M=k.current;return M&&(M.addEventListener("mousedown",D),M.addEventListener("mouseup",w)),()=>{M&&(M.removeEventListener("mousedown",D),M.removeEventListener("mouseup",w))}},[b]);const S=M=>{if(v(M),M)a(),p(e);else{if(f===M)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const L=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:k,className:Z("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(lo,{id:e,className:Z("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:L,children:t&&c.jsx(Xp,{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(ke,{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:m.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Kt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Kt,{}),c.jsx(fr,{buttons:u})]}),s&&c.jsx(ir,{className:"error",children:s})]})})})})},Rd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const xr="joinCommunityButton",ho=({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(st),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[m,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${xr}_leave`}),g["aria-label"]=s.formatMessage({id:`${xr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(ke,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${xr}_closed_tooltip`}):"",onClick:async v=>{if(u)return;v.currentTarget.blur(),p(d?"leaving":"joining");const b=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${xr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(b);const E=d?i:a;typeof E=="function"&&setTimeout(async()=>{await E()},500),h(!d)},className:Z("join-community-button",m,{active:m==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${xr}${["joining","leaving"].includes(m)?`_${m}`:d?"_member":n?"_short":""}`})})})};const Ti="communityDetails_",eg=({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(st),d=u,h=5,m=a||i.length,p=i.length?i:Array(h).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,v=!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:`${Ti}members`}),c.jsx("span",{className:"count",children:m})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Ti}viewAll`})})})]}),d&&c.jsx(uo,{contributors:{total:a,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:m===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(ho,{isMember:t,isOpen:n,disabled:v,functions:{...o}}),t&&c.jsx(ke,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Ti}invite`})})]}):c.jsx(c.Fragment,{})]})};const tg=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{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(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(gn,{href:s?void 0:i,...l,children:rr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const mo=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:Z("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),i){i(h);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",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 Id=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ie.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(m=>m.id):[]),h=(m,p)=>{let g=[];u.includes(m)&&!i?g=u.filter(f=>f!==m):m==="all"?g=["all"]:r?g=[...u.filter(f=>f!=="all"),m]:g=[m],d(f=>(a&&typeof a=="function"&&a({current:g,previous:f}),g)),p&&typeof p=="function"&&p()};return c.jsx("ul",{className:Z("filters",s),children:l.map(({id:m,text:p,disabled:g=!1,callback:f=()=>{}})=>{let v={};return g&&(v={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:p})}),c.jsx("li",{children:c.jsx("button",{className:Z(m,{selected:u.includes(m)}),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(m,f)},"aria-selected":u.includes(m),...v,children:p})},m)})})},ng=(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 ia="languageSwitcher_",rg=({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(io),[h,m]=y.useState(e);if(y.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(v=>v&&v.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:`${ia}label`})}),c.jsx("ul",{children:g.map(v=>{var k;if(!Ea[v])return null;const b=(k=r[v])==null?void 0:k.post_name;let E={className:v};if(h===v)E["aria-label"]=u.formatMessage({id:`${ia}selected`},{language:Ea[v]});else{const T=ng(v,b,i);E={...E,href:typeof T=="string"?T:T.url,onClick:D=>{m(v),d(v),typeof a<"u"&&(D.preventDefault(),D.stopPropagation(),a(v,typeof T=="string"?T:T.urlForRouter))}}}return c.jsx("li",{children:c.jsx(gn,{...E,fallbackElement:"span",children:Ea[v]})},v)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ia}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ia}disclaimer`},{email:Zn.support,link:v=>{const b=`mailto:${v}`;return c.jsx("a",{href:b,children:v})}})})]})};const Si=ie.createIntl({locale:"en",messages:dr}),Zr=({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:Si.formatMessage({id:"loadMore_button"}),endOfFeed:Si.formatMessage({id:"loadMore_endOfFeed"}),error:Si.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),m=async p=>{if(!n)try{await t(p)}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(ke,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const po=({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(Me,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let sa=!1;const $d=({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:Z("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(ke,{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:m,...p},g)=>{const f={...p,onClick:v=>{o(!1),typeof d=="function"&&d(v)},onFocus:()=>{sa&&(clearTimeout(sa),sa=!1)},onBlur:()=>{sa=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(ke,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},ag=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const ig=y.lazy(()=>Promise.resolve().then(()=>np)),sg=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Ld=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=y.useContext(st),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[sg.map(({key:i,href:s})=>{const o=ag(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(ig,{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"})]})},Dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,og=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Dr(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(`${Dr(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(`${Dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
63
63
 
64
- ${Dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const ug="shareLinks_",lg=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ie.useIntl(),l=og({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:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),c.jsx("li",{children:c.jsx(ke,{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:`${ug}link_${u}`}),...g})},u)})})]})};const cg=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,v,b)=>(f||(f=`panel-${window.btoa(v)}-${b}`),f),a=Nn(!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(b=>b.id===f)){for(let b=0;b<e.length;b++)if(r(e[b].id,e[b].text,b)===f){i=b;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,v)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let b=v;f.key==="ArrowLeft"?v>0?b=v-1:b=e.length-1:f.key==="ArrowRight"&&(v<e.length-1?b=v+1:b=0);const E=r(e[b].id,e[b].text,b),k=document.getElementById(`tab-${E}`);k==null||k.focus(),u(E);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let v=!1;return f.target==="min-width"&&a>=f.value&&(v=!0),f.target==="max-width"&&a<=f.value&&(v=!0),v};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const m=[],p=[];return e.forEach(({id:f,text:v,content:b,href:E,hasCarousel:k,breakpoint:T},D)=>{if(T&&!h(T))return;f=r(f,v,D);const C=s===f,S={};E||(S["aria-controls"]=f,S.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!C,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":C?"assertive":"off",children:typeof b=="string"?c.jsx("p",{children:b}):b},`section-${f}`))),m.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:E||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:Z({selected:C}),role:"tab",tabIndex:C?0:-1,"aria-selected":C,onKeyDown:L=>d(L,D),...S,children:v})},`tab-${f}`))}),c.jsxs("div",{className:Z("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:m}),c.jsx("div",{className:"tab-content",children:p})]})};const dg={"2-1":901,"1-3":769,"1-1":769},zd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Nn(!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<dg[e]?null:o)})};const go=({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: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(Me,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ui=e=>(e==null?void 0:e.toString().length)||0,qd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ui(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const oa="emailHelperTextBox_",Ud=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ie.useIntl(),[s,o]=y.useState({path:`${oa}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=v=>{o({path:`${oa}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>d(b),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:v})};if(typeof a!="function"){f(i.formatMessage({id:`${oa}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(v=>{f(v.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=oa,f="default",v={},b={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",v={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",b={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",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>d(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",v={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",v={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:v,mail:b})},[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(cd,{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(Ot,{element:"span"}),c.jsx(Ot,{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})})},Yn=({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(),m=r||h;return y.useEffect(()=>{var p;u&&((p=m.current)==null||p.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:m,...d,type:o,id:n,name:i,className:Z(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:p=>{const g=p.target;a.onChange(g.value)}})};const Un={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},fg=500,hg=({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:m,activePredictionIndex:p,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:v}=ie.useIntl();r||(r=v({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const T=setTimeout(()=>{g||h(D=>({...D,debouncedInput:l}))},fg);return()=>{clearTimeout(T)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const D=await o(d)||[];f(C=>({...C,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(C=>({...C,predictions:[]}))}})():f(T=>({...T,predictions:[]}))},[d,g]),y.useEffect(()=>{p>=0&&m[p]&&h(T=>({...T,displayInput:m[p].description}))},[p,m]);const b=T=>{[Un.DOWN,Un.UP,Un.ENTER].includes(T.key)&&(T.preventDefault(),T.key===Un.DOWN&&p<m.length-1?f(D=>({...D,activePredictionIndex:p+1})):T.key===Un.UP&&p>0?f(D=>({...D,activePredictionIndex:p-1})):T.key===Un.ENTER&&p>-1&&(s(m[p].description),h(D=>({...D,input:m[p].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},E=T=>{s(T.target.value),h(D=>({...D,input:T.target.value,displayInput:T.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},k=T=>{s(T.description),h(D=>({...D,input:T.description,displayInput:T.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:b,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:m.map((T,D)=>c.jsx("li",{onClick:()=>k(T),onMouseEnter:()=>f(C=>({...C,activePredictionIndex:D})),className:Z("predictions-list-item",{active:D===p}),children:T.description},D))})]})};const Wd=({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,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...m})=>{const p=ie.useIntl(),{onChange:g,...f}=r,v=()=>{t||g(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:E=>{(E.key==="Enter"||E.code==="Space")&&(E.preventDefault(),E.stopPropagation(),v())},tabIndex:d||!h?0:-1,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:E=>{const k=E.target;k.nodeName.toLowerCase()==="a"||k.parentNode&&k.parentNode.nodeName.toLowerCase()==="a"||(E.preventDefault(),E.stopPropagation(),v())},onKeyDown:h?E=>{var k,T,D;if(E.key!=="Tab")switch(E.key){case"Enter":case"Space":E.stopPropagation(),E.preventDefault(),v();break;case"ArrowLeft":case"ArrowRight":E.stopPropagation(),E.preventDefault();const C=E.currentTarget;let S=C==null?void 0:C.nextElementSibling;if(E.key==="ArrowLeft"){const L=C==null?void 0:C.previousElementSibling;L?S=L:S=(k=C==null?void 0:C.parentElement)==null?void 0:k.lastElementChild}else S||(S=(T=C==null?void 0:C.parentElement)==null?void 0:T.firstElementChild);S&&((D=S==null?void 0:S.querySelector("label"))==null||D.focus());break}}:void 0,className:Z(a,"checkbox-wrapper",e,{"is-checked":d}),...m,...f},b)};const mg=y.memo(function({direction:t="down"}){return c.jsx(ni,{className:Z("rotating-chevron",`direction-${t}`)})});const pg=({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,m]=y.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,v]=y.useState(g);let b;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?b=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?b=f[0]:b={id:"",label:""},y.useEffect(()=>{v(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:k,...T}=a,D=S=>{if(o){let L=[];f!=null&&f.includes(S.id)?L=f.filter(N=>N!==S.id):L=[...f,S.id],v([...L]),E&&E([...L])}else v([S]),E&&E(S.id),m(!1)},C=S=>{if(S==="all"){const L=(t==null?void 0:t.map(N=>N.id))||[];v(L),E&&E(L)}else v([]),E&&E([])};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(),m(!h)},"data-testid":"dropdown-selector",...T,children:[o?`${s} · ${f.length}`:b.label,c.jsx(mg,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:b.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const L=t&&t.find(N=>N.id===S.target.value);D(L)},hidden:!h,...T,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(ke,{variant:"tertiary",size:"small",onClick:()=>C("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(ke,{variant:"tertiary",size:"small",onClick:()=>C("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 L=S.id===b.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:L,"selected-single":L&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),D(S)},role:"menuitem","aria-current":L,"data-testid":L?"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(ke,{variant:"secondary",onClick:()=>{k&&k(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),m(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Pu=({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,accessibilityOptions:h,...m})=>{const p=ie.useIntl(),g=i?d:[],f=d;return c.jsx("ul",{...m,className:Z("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:v,label:b=!1,value:E=v,disabled:k=!1})=>{const T=`${r}_${v}`,D=()=>{if(k)return;let C;if(i){const S=g==null?void 0:g.indexOf(E);Array.isArray(g)&&S>=0?(C=g,C.splice(S,1)):(!g||g.length===0?C=[]:C=g,C.push(E))}else C=f===E?void 0:E;t.onChange(C)};return c.jsx(Wd,{element:"li",id:T,type:u==="checkboxes"?"checkbox":"radio",shownValue:E,value:i?g==null?void 0:g.includes(E):f===E,functions:{...t,onChange:D},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${v}`:v}),disabled:k,accessibilityOptions:h},T)})})};const gg=({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),m=()=>{var p;u(!l),h(l?"password":"text"),(p=o.current)==null||p.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:m,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Yn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Wn={text:{component:Yn},email:{component:Yn},url:{component:Yn},textarea:{component:Yn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Wd},checkboxes:{component:Pu,props:{multiSelect:!0}},radio:{component:Pu,props:{multiSelect:!1}},select:{component:pg},password:{component:gg},autocomplete:{component:hg}},vg=({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 m=ie.useIntl(),p=l&&l.some(({condition:$})=>$==="required"),g=ui(u),f=o&&Wn[o]&&Wn[o].component?Wn[o].component:Yn,v=o&&["checkboxes","radio"].includes(o),b=o&&["autocomplete"].includes(o),E=r&&`error-${e}`,k=`character-limit-${e}`,T={};v?T.element="legend":T.htmlFor=e;let D={...h,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:kn(a),value:u};const C=$=>{D["aria-describedby"]?D["aria-describedby"]+=` ${$}`:D["aria-describedby"]=$};if(i>0){const $=qd(i,a.onChange);C(`${k}-info`),D={...D,...$},$.functions&&typeof $.functions=="object"&&(D.functions={...D.functions,...$.functions})}o&&Wn[o]&&Wn[o].props&&(D={...D,...Wn[o].props}),v&&(D.intlPath=`${t}_${e}`),r&&(D["aria-invalid"]=!0,D["aria-errormessage"]=E,C(E));const S=h.label||m.formatMessage({id:t?`${t}_${e}`:e}),L=({...$})=>r?y.createElement($.as||"p",{id:E,className:"error text-small",...$},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...D,label:S,className:Z("field-wrapper",n)}),c.jsx(L,{as:"p"})]});const N={};v||(N.className="field-label");const q=$=>y.createElement($.element||"label",{...$,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(v?"fieldset":"div",{className:Z("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(v?y.Fragment:"p",N,c.jsxs(q,{...T,children:[S,p&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(v||b?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...D}),c.jsx(go,{id:k,limit:i,valueLength:g})]})),c.jsx(L,{})]}))})},bg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?kn(e.errors):{},i=e.values?kn(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=kn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let v=!1;if(typeof g=="function"){const b=g(i);b&&(v=f||b)}else{const b=i[m.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\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(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(v){o({type:"addError",payload:{key:m.id,value:v}}),h.push(m.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 ji=null;const Yt=({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,...m})=>{const{customOnSubmit:p,hideButton:g,...f}=s,v=40,{shouldShowCancelButton:b=!1,shouldReset:E=!0,shouldHide:k=!0,showRequiredLabels:T=!0,showSuccessMessage:D=!1}=l||{},{onSuccess:C=async()=>{},onCancel:S=()=>{},onCatch:L=()=>{},onFailure:N=()=>{}}=h||{},q=ie.useIntl(),$={};t.length&&t.forEach(B=>{const O=B.id||B.name;O&&($[O]=B.value||"")});const[F,_]=y.useReducer(bg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:$}),{errors:P,isSubmitting:j,formSubmitted:W,values:V}=F;y.useEffect(()=>{E&&W&&(ji=setTimeout(()=>{_({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[W]),y.useEffect(()=>()=>{ji&&clearTimeout(ji)},[]),y.useEffect(()=>{const B=O=>{_({type:"updateValue",payload:{key:O.detail.id,value:O.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const se=y.useRef(null),re=a||se;if(!t.length)return null;const w={};s.children&&(w.default=s.children),f.text&&typeof f.text=="string"&&(w.default=f.text),["default","submitting","submitted"].forEach(B=>{f.text&&typeof f.text!="string"&&B in f.text?w[B]=f.text[B]:w[B]||(w[B]=q.formatMessage({id:`form_${B==="default"?"submit":B}`}))}),delete f.text;const ee=()=>{if(!j){if(_({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&_({type:"submitForm",payload:{fields:t,dispatch:_,intl:q}});return}_({type:"submitForm",payload:{fields:t,dispatch:_,onSuccess:async B=>{try{await C(B),_({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(O){L(O),_({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(B,O)=>{N(B,O),_({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:q}})}},K=B=>{var z;if(B.preventDefault(),B.stopPropagation(),j)return;let O=0;if((z=re==null?void 0:re.current)!=null&&z.id){const Y=document.getElementById(re.current.id);Y&&(O=Y.getBoundingClientRect().top+window.scrollY)}const M=document.getElementById("header");M&&(O=O-M.offsetHeight-v),O<0&&(O=0),window.scrollTo({top:O,behavior:"smooth"}),ee()},A=[{...f,icon:W?{icon:"tick",position:"left"}:!1,className:Z("gtm-trackable",f.className),onClick:K,disabled:j||W||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:w[j?"submitting":W?"submitted":"default"]}];return b&&A.unshift({...o,className:Z("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:j||W,onClick:S,children:o.text||q.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...m,id:r,className:Z("form",n),ref:re},c.jsxs(c.Fragment,{children:[P!=null&&P.general?c.jsx(vn,{variant:"error",text:q.formatMessage({id:"form_error_generalError"})}):null,u,(!k||!j&&!W||p)&&t.map((B,O)=>{const{id:M=B.name||O,component:z,functions:Y={onChange:()=>{}},submitOnEnter:U=!1}=B;if(z)return c.jsx(z,{...B.props||{}},`component-${M}-${O}`);const ne=(V==null?void 0:V[M])||"",le={...Y,onChange:J=>{_({type:"updateValue",payload:{key:M,value:J}}),Y.onChange(J&&J.toString(),_)}};return U&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),ee()),Y.onKeyDown&&Y.onKeyDown(J)}),c.jsx(vg,{intlPath:i,...B,showRequiredLabels:T,value:ne,error:P==null?void 0:P[M],functions:le},M)}),g?null:(j||W)&&p?p:c.jsx(fr,{className:Z("cta",{center:j||W,submitted:W}),buttons:A})]})),D&&W&&c.jsx(ir,{className:"success",children:typeof D=="string"?D:q.formatMessage({id:"form_success"})})]})};const ua="passwordRules_",Hd="isMoreThanEightCharacters",Vd="includesNumberAndSymbol",Kd="includesLowerAndUppercase",yg={[Hd]:"8Characters",[Vd]:"numberSymbol",[Kd]:"lowercaseUppercase"},xg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:Z("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ua}intro`})}),c.jsx("ul",{children:[Hd,Vd,Kd].map(r=>c.jsxs("li",{className:Z({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${ua}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ua}rule_${yg[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${ua}notMet`})]})]},`rule-${r}`))})]})},Zd=y.memo(xg);const Dg=({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 b=await n();u(E=>({...E,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(E=>({...E,setUp:!0,disabled:!0})),a(b)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ot,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},v=async b=>{if(!(!h||p))try{u(E=>({...E,rating:b,disabled:!0})),await r({id:h,value:b})}catch(E){u(k=>({...k,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return c.jsxs("div",{className:Z("rating",i),children:[c.jsx("span",{className:"label",children:f[m?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const E=b+1;return c.jsx("li",{className:Z({selected:m&&E<=m}),children:c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:`star${!m||E>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:E,total:t})}${E===1||E===t?` - ${f[E===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),v(E)},disabled:p})},`rating-${E}`)})})]})},Cg={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},an=y.createContext(Cg);var G=(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))(G||{}),Ut=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ut||{});const wg=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case G.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case G.link:return c.jsx("a",{...e,children:t});case G.li:return c.jsx("li",{...e,children:t});case G.mention:const a=r;return a!=null&&a.name&&a.name===Nr?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 G.ol:return c.jsx("ol",{...e,children:t});case G.ul:return c.jsx("ul",{...e,children:t});case G.span:return c.jsx("span",{...e,children:t});case G.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Eg=({attributes:e,children:t,leaf:n})=>{const r=n;return r[G.bold]&&(t=c.jsx("strong",{children:t})),r[G.italic]&&(t=c.jsx("em",{children:t})),r[G.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})};var _g=Ag,Yd="֑-߿יִ-﷽ﹰ-ﻼ",Gd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",kg=new RegExp("^[^"+Gd+"]*["+Yd+"]"),Fg=new RegExp("^[^"+Yd+"]*["+Gd+"]");function Ag(e){return e=String(e||""),kg.test(e)?"rtl":Fg.test(e)?"ltr":"neutral"}const Qd=Mn(_g);function Bg(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vo=Bg,Tg=typeof Xr=="object"&&Xr&&Xr.Object===Object&&Xr,Sg=Tg,jg=Sg,Og=typeof self=="object"&&self&&self.Object===Object&&self,Pg=jg||Og||Function("return this")(),Jd=Pg,Mg=Jd,Ng=function(){return Mg.Date.now()},Rg=Ng,Ig=/\s/;function $g(e){for(var t=e.length;t--&&Ig.test(e.charAt(t)););return t}var Lg=$g,zg=Lg,qg=/^\s+/;function Ug(e){return e&&e.slice(0,zg(e)+1).replace(qg,"")}var Wg=Ug,Hg=Jd,Vg=Hg.Symbol,Xd=Vg,Mu=Xd,ef=Object.prototype,Kg=ef.hasOwnProperty,Zg=ef.toString,Cr=Mu?Mu.toStringTag:void 0;function Yg(e){var t=Kg.call(e,Cr),n=e[Cr];try{e[Cr]=void 0;var r=!0}catch{}var a=Zg.call(e);return r&&(t?e[Cr]=n:delete e[Cr]),a}var Gg=Yg,Qg=Object.prototype,Jg=Qg.toString;function Xg(e){return Jg.call(e)}var ev=Xg,Nu=Xd,tv=Gg,nv=ev,rv="[object Null]",av="[object Undefined]",Ru=Nu?Nu.toStringTag:void 0;function iv(e){return e==null?e===void 0?av:rv:Ru&&Ru in Object(e)?tv(e):nv(e)}var sv=iv;function ov(e){return e!=null&&typeof e=="object"}var uv=ov,lv=sv,cv=uv,dv="[object Symbol]";function fv(e){return typeof e=="symbol"||cv(e)&&lv(e)==dv}var hv=fv,mv=Wg,Iu=vo,pv=hv,$u=0/0,gv=/^[-+]0x[0-9a-f]+$/i,vv=/^0b[01]+$/i,bv=/^0o[0-7]+$/i,yv=parseInt;function xv(e){if(typeof e=="number")return e;if(pv(e))return $u;if(Iu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Iu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=mv(e);var n=vv.test(e);return n||bv.test(e)?yv(e.slice(2),n?2:8):gv.test(e)?$u:+e}var Dv=xv,Cv=vo,Oi=Rg,Lu=Dv,wv="Expected a function",Ev=Math.max,_v=Math.min;function kv(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(wv);t=Lu(t)||0,Cv(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Ev(Lu(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(C){var S=r,L=a;return r=a=void 0,u=C,s=e.apply(L,S),s}function g(C){return u=C,o=setTimeout(b,t),d?p(C):s}function f(C){var S=C-l,L=C-u,N=t-S;return h?_v(N,i-L):N}function v(C){var S=C-l,L=C-u;return l===void 0||S>=t||S<0||h&&L>=i}function b(){var C=Oi();if(v(C))return E(C);o=setTimeout(b,f(C))}function E(C){return o=void 0,m&&r?p(C):(r=a=void 0,s)}function k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function T(){return o===void 0?s:E(Oi())}function D(){var C=Oi(),S=v(C);if(r=arguments,a=this,l=C,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return D.cancel=k,D.flush=T,D}var tf=kv;const Fv=Mn(tf);var Av=tf,Bv=vo,Tv="Expected a function";function Sv(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Tv);return Bv(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Av(e,t,{leading:r,maxWait:t,trailing:a})}var jv=Sv;const Ov=Mn(jv),zu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,qu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Pi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return qu(n.overflowY,t)||qu(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},la=(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,Pv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Uu=(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(!zu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;zu(g)&&h(g);){if(g=Pv(g),g===m){p.push(g);break}g!=null&&g===document.body&&Pi(g)&&!Pi(document.documentElement)||g!=null&&Pi(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,v=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:E}=window,{height:k,width:T,top:D,right:C,bottom:S,left:L}=e.getBoundingClientRect(),{top:N,right:q,bottom:$,left:F}=(W=>{const V=window.getComputedStyle(W);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let _=o==="start"||o==="nearest"?D-N:o==="end"?S+$:D+k/2-N+$,P=l==="center"?L+T/2-F+q:l==="end"?C+q:L-F;const j=[];for(let W=0;W<p.length;W++){const V=p[W],{height:se,width:re,top:w,right:ee,bottom:K,left:A}=V.getBoundingClientRect();if(s==="if-needed"&&D>=0&&L>=0&&S<=v&&C<=f&&D>=w&&S<=K&&L>=A&&C<=ee)return j;const B=getComputedStyle(V),O=parseInt(B.borderLeftWidth,10),M=parseInt(B.borderTopWidth,10),z=parseInt(B.borderRightWidth,10),Y=parseInt(B.borderBottomWidth,10);let U=0,ne=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-O-z:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-M-Y:0,pe="offsetWidth"in V?V.offsetWidth===0?0:re/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:se/V.offsetHeight:0;if(m===V)U=o==="start"?_:o==="end"?_-v:o==="nearest"?la(E,E+v,v,M,Y,E+_,E+_+k,k):_-v/2,ne=l==="start"?P:l==="center"?P-f/2:l==="end"?P-f:la(b,b+f,f,O,z,b+P,b+P+T,T),U=Math.max(0,U+E),ne=Math.max(0,ne+b);else{U=o==="start"?_-w-M:o==="end"?_-K+Y+J:o==="nearest"?la(w,K,se,M,Y+J,_,_+k,k):_-(w+se/2)+J/2,ne=l==="start"?P-A-O:l==="center"?P-(A+re/2)+le/2:l==="end"?P-ee+z+le:la(A,ee,re,O,z+le,P,P+T,T);const{scrollLeft:Fe,scrollTop:Be}=V;U=me===0?0:Math.max(0,Math.min(Be+U/me,V.scrollHeight-se/me+J)),ne=pe===0?0:Math.max(0,Math.min(Fe+ne/pe,V.scrollWidth-re/pe+le)),_+=Be-U,P+=Fe-ne}j.push({el:V,top:U,left:ne})}return j},Mv=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Nv(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(Uu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Uu(e,Mv(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
64
+ ${Dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const ug="shareLinks_",lg=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ie.useIntl(),l=og({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:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),c.jsx("li",{children:c.jsx(ke,{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:`${ug}link_${u}`}),...g})},u)})})]})};const cg=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,v,b)=>(f||(f=`panel-${window.btoa(v)}-${b}`),f),a=Nn(!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(b=>b.id===f)){for(let b=0;b<e.length;b++)if(r(e[b].id,e[b].text,b)===f){i=b;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,v)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let b=v;f.key==="ArrowLeft"?v>0?b=v-1:b=e.length-1:f.key==="ArrowRight"&&(v<e.length-1?b=v+1:b=0);const E=r(e[b].id,e[b].text,b),k=document.getElementById(`tab-${E}`);k==null||k.focus(),u(E);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let v=!1;return f.target==="min-width"&&a>=f.value&&(v=!0),f.target==="max-width"&&a<=f.value&&(v=!0),v};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const m=[],p=[];return e.forEach(({id:f,text:v,content:b,href:E,hasCarousel:k,breakpoint:T},D)=>{if(T&&!h(T))return;f=r(f,v,D);const w=s===f,S={};E||(S["aria-controls"]=f,S.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!w,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":w?"assertive":"off",children:typeof b=="string"?c.jsx("p",{children:b}):b},`section-${f}`))),m.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:E||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:Z({selected:w}),role:"tab",tabIndex:w?0:-1,"aria-selected":w,onKeyDown:L=>d(L,D),...S,children:v})},`tab-${f}`))}),c.jsxs("div",{className:Z("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:m}),c.jsx("div",{className:"tab-content",children:p})]})};const dg={"2-1":901,"1-3":769,"1-1":769},zd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Nn(!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<dg[e]?null:o)})};const go=({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: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(Me,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ui=e=>(e==null?void 0:e.toString().length)||0,qd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ui(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const oa="emailHelperTextBox_",Ud=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ie.useIntl(),[s,o]=y.useState({path:`${oa}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=v=>{o({path:`${oa}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>d(b),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:v})};if(typeof a!="function"){f(i.formatMessage({id:`${oa}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(v=>{f(v.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=oa,f="default",v={},b={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",v={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",b={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",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>d(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",v={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",v={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:v,mail:b})},[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(cd,{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(Ot,{element:"span"}),c.jsx(Ot,{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})})},Yn=({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(),m=r||h;return y.useEffect(()=>{var p;u&&((p=m.current)==null||p.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:m,...d,type:o,id:n,name:i,className:Z(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:p=>{const g=p.target;a.onChange(g.value)}})};const Un={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},fg=500,hg=({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:m,activePredictionIndex:p,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:v}=ie.useIntl();r||(r=v({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const T=setTimeout(()=>{g||h(D=>({...D,debouncedInput:l}))},fg);return()=>{clearTimeout(T)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const D=await o(d)||[];f(w=>({...w,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(w=>({...w,predictions:[]}))}})():f(T=>({...T,predictions:[]}))},[d,g]),y.useEffect(()=>{p>=0&&m[p]&&h(T=>({...T,displayInput:m[p].description}))},[p,m]);const b=T=>{[Un.DOWN,Un.UP,Un.ENTER].includes(T.key)&&(T.preventDefault(),T.key===Un.DOWN&&p<m.length-1?f(D=>({...D,activePredictionIndex:p+1})):T.key===Un.UP&&p>0?f(D=>({...D,activePredictionIndex:p-1})):T.key===Un.ENTER&&p>-1&&(s(m[p].description),h(D=>({...D,input:m[p].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},E=T=>{s(T.target.value),h(D=>({...D,input:T.target.value,displayInput:T.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},k=T=>{s(T.description),h(D=>({...D,input:T.description,displayInput:T.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:b,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:m.map((T,D)=>c.jsx("li",{onClick:()=>k(T),onMouseEnter:()=>f(w=>({...w,activePredictionIndex:D})),className:Z("predictions-list-item",{active:D===p}),children:T.description},D))})]})};const Wd=({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,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...m})=>{const p=ie.useIntl(),{onChange:g,...f}=r,v=()=>{t||g(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:E=>{(E.key==="Enter"||E.code==="Space")&&(E.preventDefault(),E.stopPropagation(),v())},tabIndex:d||!h?0:-1,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:E=>{const k=E.target;k.nodeName.toLowerCase()==="a"||k.parentNode&&k.parentNode.nodeName.toLowerCase()==="a"||(E.preventDefault(),E.stopPropagation(),v())},onKeyDown:h?E=>{var k,T,D;if(E.key!=="Tab")switch(E.key){case"Enter":case"Space":E.stopPropagation(),E.preventDefault(),v();break;case"ArrowLeft":case"ArrowRight":E.stopPropagation(),E.preventDefault();const w=E.currentTarget;let S=w==null?void 0:w.nextElementSibling;if(E.key==="ArrowLeft"){const L=w==null?void 0:w.previousElementSibling;L?S=L:S=(k=w==null?void 0:w.parentElement)==null?void 0:k.lastElementChild}else S||(S=(T=w==null?void 0:w.parentElement)==null?void 0:T.firstElementChild);S&&((D=S==null?void 0:S.querySelector("label"))==null||D.focus());break}}:void 0,className:Z(a,"checkbox-wrapper",e,{"is-checked":d}),...m,...f},b)};const mg=y.memo(function({direction:t="down"}){return c.jsx(ni,{className:Z("rotating-chevron",`direction-${t}`)})});const pg=({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,m]=y.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,v]=y.useState(g);let b;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?b=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?b=f[0]:b={id:"",label:""},y.useEffect(()=>{v(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:k,...T}=a,D=S=>{if(o){let L=[];f!=null&&f.includes(S.id)?L=f.filter(M=>M!==S.id):L=[...f,S.id],v([...L]),E&&E([...L])}else v([S]),E&&E(S.id),m(!1)},w=S=>{if(S==="all"){const L=(t==null?void 0:t.map(M=>M.id))||[];v(L),E&&E(L)}else v([]),E&&E([])};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(),m(!h)},"data-testid":"dropdown-selector",...T,children:[o?`${s} · ${f.length}`:b.label,c.jsx(mg,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:b.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const L=t&&t.find(M=>M.id===S.target.value);D(L)},hidden:!h,...T,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(ke,{variant:"tertiary",size:"small",onClick:()=>w("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(ke,{variant:"tertiary",size:"small",onClick:()=>w("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 L=S.id===b.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:L,"selected-single":L&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),D(S)},role:"menuitem","aria-current":L,"data-testid":L?"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(ke,{variant:"secondary",onClick:()=>{k&&k(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),m(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Pu=({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,accessibilityOptions:h,...m})=>{const p=ie.useIntl(),g=i?d:[],f=d;return c.jsx("ul",{...m,className:Z("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:v,label:b=!1,value:E=v,disabled:k=!1})=>{const T=`${r}_${v}`,D=()=>{if(k)return;let w;if(i){const S=g==null?void 0:g.indexOf(E);Array.isArray(g)&&S>=0?(w=g,w.splice(S,1)):(!g||g.length===0?w=[]:w=g,w.push(E))}else w=f===E?void 0:E;t.onChange(w)};return c.jsx(Wd,{element:"li",id:T,type:u==="checkboxes"?"checkbox":"radio",shownValue:E,value:i?g==null?void 0:g.includes(E):f===E,functions:{...t,onChange:D},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${v}`:v}),disabled:k,accessibilityOptions:h},T)})})};const gg=({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),m=()=>{var p;u(!l),h(l?"password":"text"),(p=o.current)==null||p.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:m,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Yn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Wn={text:{component:Yn},email:{component:Yn},url:{component:Yn},textarea:{component:Yn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Wd},checkboxes:{component:Pu,props:{multiSelect:!0}},radio:{component:Pu,props:{multiSelect:!1}},select:{component:pg},password:{component:gg},autocomplete:{component:hg}},vg=({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 m=ie.useIntl(),p=l&&l.some(({condition:$})=>$==="required"),g=ui(u),f=o&&Wn[o]&&Wn[o].component?Wn[o].component:Yn,v=o&&["checkboxes","radio"].includes(o),b=o&&["autocomplete"].includes(o),E=r&&`error-${e}`,k=`character-limit-${e}`,T={};v?T.element="legend":T.htmlFor=e;let D={...h,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:kn(a),value:u};const w=$=>{D["aria-describedby"]?D["aria-describedby"]+=` ${$}`:D["aria-describedby"]=$};if(i>0){const $=qd(i,a.onChange);w(`${k}-info`),D={...D,...$},$.functions&&typeof $.functions=="object"&&(D.functions={...D.functions,...$.functions})}o&&Wn[o]&&Wn[o].props&&(D={...D,...Wn[o].props}),v&&(D.intlPath=`${t}_${e}`),r&&(D["aria-invalid"]=!0,D["aria-errormessage"]=E,w(E));const S=h.label||m.formatMessage({id:t?`${t}_${e}`:e}),L=({...$})=>r?y.createElement($.as||"p",{id:E,className:"error text-small",...$},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...D,label:S,className:Z("field-wrapper",n)}),c.jsx(L,{as:"p"})]});const M={};v||(M.className="field-label");const q=$=>y.createElement($.element||"label",{...$,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(v?"fieldset":"div",{className:Z("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(v?y.Fragment:"p",M,c.jsxs(q,{...T,children:[S,p&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(v||b?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...D}),c.jsx(go,{id:k,limit:i,valueLength:g})]})),c.jsx(L,{})]}))})},bg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?kn(e.errors):{},i=e.values?kn(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=kn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let v=!1;if(typeof g=="function"){const b=g(i);b&&(v=f||b)}else{const b=i[m.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\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(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(b)&&(v=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(v){o({type:"addError",payload:{key:m.id,value:v}}),h.push(m.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 ji=null;const Yt=({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,...m})=>{const{customOnSubmit:p,hideButton:g,...f}=s,v=40,{shouldShowCancelButton:b=!1,shouldReset:E=!0,shouldHide:k=!0,showRequiredLabels:T=!0,showSuccessMessage:D=!1}=l||{},{onSuccess:w=async()=>{},onCancel:S=()=>{},onCatch:L=()=>{},onFailure:M=()=>{}}=h||{},q=ie.useIntl(),$={};t.length&&t.forEach(B=>{const O=B.id||B.name;O&&($[O]=B.value||"")});const[F,_]=y.useReducer(bg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:$}),{errors:P,isSubmitting:j,formSubmitted:W,values:V}=F;y.useEffect(()=>{E&&W&&(ji=setTimeout(()=>{_({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[W]),y.useEffect(()=>()=>{ji&&clearTimeout(ji)},[]),y.useEffect(()=>{const B=O=>{_({type:"updateValue",payload:{key:O.detail.id,value:O.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const se=y.useRef(null),re=a||se;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(B=>{f.text&&typeof f.text!="string"&&B in f.text?C[B]=f.text[B]:C[B]||(C[B]=q.formatMessage({id:`form_${B==="default"?"submit":B}`}))}),delete f.text;const ee=()=>{if(!j){if(_({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&_({type:"submitForm",payload:{fields:t,dispatch:_,intl:q}});return}_({type:"submitForm",payload:{fields:t,dispatch:_,onSuccess:async B=>{try{await w(B),_({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(O){L(O),_({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(B,O)=>{M(B,O),_({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:q}})}},K=B=>{var z;if(B.preventDefault(),B.stopPropagation(),j)return;let O=0;if((z=re==null?void 0:re.current)!=null&&z.id){const Y=document.getElementById(re.current.id);Y&&(O=Y.getBoundingClientRect().top+window.scrollY)}const N=document.getElementById("header");N&&(O=O-N.offsetHeight-v),O<0&&(O=0),window.scrollTo({top:O,behavior:"smooth"}),ee()},A=[{...f,icon:W?{icon:"tick",position:"left"}:!1,className:Z("gtm-trackable",f.className),onClick:K,disabled:j||W||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[j?"submitting":W?"submitted":"default"]}];return b&&A.unshift({...o,className:Z("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:j||W,onClick:S,children:o.text||q.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...m,id:r,className:Z("form",n),ref:re},c.jsxs(c.Fragment,{children:[P!=null&&P.general?c.jsx(vn,{variant:"error",text:q.formatMessage({id:"form_error_generalError"})}):null,u,(!k||!j&&!W||p)&&t.map((B,O)=>{const{id:N=B.name||O,component:z,functions:Y={onChange:()=>{}},submitOnEnter:U=!1}=B;if(z)return c.jsx(z,{...B.props||{}},`component-${N}-${O}`);const ne=(V==null?void 0:V[N])||"",le={...Y,onChange:J=>{_({type:"updateValue",payload:{key:N,value:J}}),Y.onChange(J&&J.toString(),_)}};return U&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),ee()),Y.onKeyDown&&Y.onKeyDown(J)}),c.jsx(vg,{intlPath:i,...B,showRequiredLabels:T,value:ne,error:P==null?void 0:P[N],functions:le},N)}),g?null:(j||W)&&p?p:c.jsx(fr,{className:Z("cta",{center:j||W,submitted:W}),buttons:A})]})),D&&W&&c.jsx(ir,{className:"success",children:typeof D=="string"?D:q.formatMessage({id:"form_success"})})]})};const ua="passwordRules_",Hd="isMoreThanEightCharacters",Vd="includesNumberAndSymbol",Kd="includesLowerAndUppercase",yg={[Hd]:"8Characters",[Vd]:"numberSymbol",[Kd]:"lowercaseUppercase"},xg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:Z("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ua}intro`})}),c.jsx("ul",{children:[Hd,Vd,Kd].map(r=>c.jsxs("li",{className:Z({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${ua}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ua}rule_${yg[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${ua}notMet`})]})]},`rule-${r}`))})]})},Zd=y.memo(xg);const Dg=({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 b=await n();u(E=>({...E,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(E=>({...E,setUp:!0,disabled:!0})),a(b)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ot,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},v=async b=>{if(!(!h||p))try{u(E=>({...E,rating:b,disabled:!0})),await r({id:h,value:b})}catch(E){u(k=>({...k,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return c.jsxs("div",{className:Z("rating",i),children:[c.jsx("span",{className:"label",children:f[m?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const E=b+1;return c.jsx("li",{className:Z({selected:m&&E<=m}),children:c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:`star${!m||E>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:E,total:t})}${E===1||E===t?` - ${f[E===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),v(E)},disabled:p})},`rating-${E}`)})})]})},Cg={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},an=y.createContext(Cg);var G=(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))(G||{}),Ut=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ut||{});const wg=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case G.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case G.link:return c.jsx("a",{...e,children:t});case G.li:return c.jsx("li",{...e,children:t});case G.mention:const a=r;return a!=null&&a.name&&a.name===Nr?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 G.ol:return c.jsx("ol",{...e,children:t});case G.ul:return c.jsx("ul",{...e,children:t});case G.span:return c.jsx("span",{...e,children:t});case G.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Eg=({attributes:e,children:t,leaf:n})=>{const r=n;return r[G.bold]&&(t=c.jsx("strong",{children:t})),r[G.italic]&&(t=c.jsx("em",{children:t})),r[G.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})};var _g=Ag,Yd="֑-߿יִ-﷽ﹰ-ﻼ",Gd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",kg=new RegExp("^[^"+Gd+"]*["+Yd+"]"),Fg=new RegExp("^[^"+Yd+"]*["+Gd+"]");function Ag(e){return e=String(e||""),kg.test(e)?"rtl":Fg.test(e)?"ltr":"neutral"}const Qd=Mn(_g);function Bg(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vo=Bg,Tg=typeof Xr=="object"&&Xr&&Xr.Object===Object&&Xr,Sg=Tg,jg=Sg,Og=typeof self=="object"&&self&&self.Object===Object&&self,Pg=jg||Og||Function("return this")(),Jd=Pg,Mg=Jd,Ng=function(){return Mg.Date.now()},Rg=Ng,Ig=/\s/;function $g(e){for(var t=e.length;t--&&Ig.test(e.charAt(t)););return t}var Lg=$g,zg=Lg,qg=/^\s+/;function Ug(e){return e&&e.slice(0,zg(e)+1).replace(qg,"")}var Wg=Ug,Hg=Jd,Vg=Hg.Symbol,Xd=Vg,Mu=Xd,ef=Object.prototype,Kg=ef.hasOwnProperty,Zg=ef.toString,Cr=Mu?Mu.toStringTag:void 0;function Yg(e){var t=Kg.call(e,Cr),n=e[Cr];try{e[Cr]=void 0;var r=!0}catch{}var a=Zg.call(e);return r&&(t?e[Cr]=n:delete e[Cr]),a}var Gg=Yg,Qg=Object.prototype,Jg=Qg.toString;function Xg(e){return Jg.call(e)}var ev=Xg,Nu=Xd,tv=Gg,nv=ev,rv="[object Null]",av="[object Undefined]",Ru=Nu?Nu.toStringTag:void 0;function iv(e){return e==null?e===void 0?av:rv:Ru&&Ru in Object(e)?tv(e):nv(e)}var sv=iv;function ov(e){return e!=null&&typeof e=="object"}var uv=ov,lv=sv,cv=uv,dv="[object Symbol]";function fv(e){return typeof e=="symbol"||cv(e)&&lv(e)==dv}var hv=fv,mv=Wg,Iu=vo,pv=hv,$u=0/0,gv=/^[-+]0x[0-9a-f]+$/i,vv=/^0b[01]+$/i,bv=/^0o[0-7]+$/i,yv=parseInt;function xv(e){if(typeof e=="number")return e;if(pv(e))return $u;if(Iu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Iu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=mv(e);var n=vv.test(e);return n||bv.test(e)?yv(e.slice(2),n?2:8):gv.test(e)?$u:+e}var Dv=xv,Cv=vo,Oi=Rg,Lu=Dv,wv="Expected a function",Ev=Math.max,_v=Math.min;function kv(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(wv);t=Lu(t)||0,Cv(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Ev(Lu(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(w){var S=r,L=a;return r=a=void 0,u=w,s=e.apply(L,S),s}function g(w){return u=w,o=setTimeout(b,t),d?p(w):s}function f(w){var S=w-l,L=w-u,M=t-S;return h?_v(M,i-L):M}function v(w){var S=w-l,L=w-u;return l===void 0||S>=t||S<0||h&&L>=i}function b(){var w=Oi();if(v(w))return E(w);o=setTimeout(b,f(w))}function E(w){return o=void 0,m&&r?p(w):(r=a=void 0,s)}function k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function T(){return o===void 0?s:E(Oi())}function D(){var w=Oi(),S=v(w);if(r=arguments,a=this,l=w,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return D.cancel=k,D.flush=T,D}var tf=kv;const Fv=Mn(tf);var Av=tf,Bv=vo,Tv="Expected a function";function Sv(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Tv);return Bv(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Av(e,t,{leading:r,maxWait:t,trailing:a})}var jv=Sv;const Ov=Mn(jv),zu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,qu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Pi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return qu(n.overflowY,t)||qu(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},la=(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,Pv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Uu=(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(!zu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;zu(g)&&h(g);){if(g=Pv(g),g===m){p.push(g);break}g!=null&&g===document.body&&Pi(g)&&!Pi(document.documentElement)||g!=null&&Pi(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,v=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:E}=window,{height:k,width:T,top:D,right:w,bottom:S,left:L}=e.getBoundingClientRect(),{top:M,right:q,bottom:$,left:F}=(W=>{const V=window.getComputedStyle(W);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let _=o==="start"||o==="nearest"?D-M:o==="end"?S+$:D+k/2-M+$,P=l==="center"?L+T/2-F+q:l==="end"?w+q:L-F;const j=[];for(let W=0;W<p.length;W++){const V=p[W],{height:se,width:re,top:C,right:ee,bottom:K,left:A}=V.getBoundingClientRect();if(s==="if-needed"&&D>=0&&L>=0&&S<=v&&w<=f&&D>=C&&S<=K&&L>=A&&w<=ee)return j;const B=getComputedStyle(V),O=parseInt(B.borderLeftWidth,10),N=parseInt(B.borderTopWidth,10),z=parseInt(B.borderRightWidth,10),Y=parseInt(B.borderBottomWidth,10);let U=0,ne=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-O-z:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-N-Y:0,pe="offsetWidth"in V?V.offsetWidth===0?0:re/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:se/V.offsetHeight:0;if(m===V)U=o==="start"?_:o==="end"?_-v:o==="nearest"?la(E,E+v,v,N,Y,E+_,E+_+k,k):_-v/2,ne=l==="start"?P:l==="center"?P-f/2:l==="end"?P-f:la(b,b+f,f,O,z,b+P,b+P+T,T),U=Math.max(0,U+E),ne=Math.max(0,ne+b);else{U=o==="start"?_-C-N:o==="end"?_-K+Y+J:o==="nearest"?la(C,K,se,N,Y+J,_,_+k,k):_-(C+se/2)+J/2,ne=l==="start"?P-A-O:l==="center"?P-(A+re/2)+le/2:l==="end"?P-ee+z+le:la(A,ee,re,O,z+le,P,P+T,T);const{scrollLeft:Fe,scrollTop:Be}=V;U=me===0?0:Math.max(0,Math.min(Be+U/me,V.scrollHeight-se/me+J)),ne=pe===0?0:Math.max(0,Math.min(Fe+ne/pe,V.scrollWidth-re/pe+le)),_+=Be-U,P+=Fe-ne}j.push({el:V,top:U,left:ne})}return j},Mv=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Nv(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(Uu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Uu(e,Mv(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
65
65
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
66
66
  *
67
67
  * Copyright (c) 2014-2017, Jon Schlinkert.
68
68
  * Released under the MIT License.
69
- */function Wu(e){return Object.prototype.toString.call(e)==="[object Object]"}function it(e){var t,n;return Wu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Wu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var nf=Symbol.for("immer-nothing"),Hu=Symbol.for("immer-draftable"),Et=Symbol.for("immer-state"),Rv=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Rv[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 or=Object.getPrototypeOf;function jn(e){return!!e&&!!e[Et]}function On(e){var t;return e?rf(e)||Array.isArray(e)||!!e[Hu]||!!((t=e.constructor)!=null&&t[Hu])||ci(e)||di(e):!1}var Iv=Object.prototype.constructor.toString();function rf(e){if(!e||typeof e!="object")return!1;const t=or(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)===Iv}function za(e,t){li(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function li(e){const t=e[Et];return t?t.type_:Array.isArray(e)?1:ci(e)?2:di(e)?3:0}function Bs(e,t){return li(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function af(e,t,n){const r=li(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function $v(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ci(e){return e instanceof Map}function di(e){return e instanceof Set}function wn(e){return e.copy_||e.base_}function Ts(e,t){if(ci(e))return new Map(e);if(di(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=rf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Et];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(or(e),r)}else{const r=or(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function bo(e,t=!1){return fi(e)||jn(e)||!On(e)||(li(e)>1&&(e.set=e.add=e.clear=e.delete=Lv),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>bo(r,!0))),e}function Lv(){xt(2)}function fi(e){return Object.isFrozen(e)}var zv={};function Pn(e){const t=zv[e];return t||xt(0,e),t}var Ir;function sf(){return Ir}function qv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vu(e,t){t&&(Pn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ss(e){js(e),e.drafts_.forEach(Uv),e.drafts_=null}function js(e){e===Ir&&(Ir=e.parent_)}function Ku(e){return Ir=qv(Ir,e)}function Uv(e){const t=e[Et];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zu(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Et].modified_&&(Ss(t),xt(4)),On(e)&&(e=qa(t,e),t.parent_||Ua(t,e)),t.patches_&&Pn("Patches").generateReplacementPatches_(n[Et].base_,e,t.patches_,t.inversePatches_)):e=qa(t,n,[]),Ss(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==nf?e:void 0}function qa(e,t,n){if(fi(t))return t;const r=t[Et];if(!r)return za(t,(a,i)=>Yu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ua(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),za(i,(o,l)=>Yu(e,r,a,o,l,n,s)),Ua(e,a,!1),n&&e.patches_&&Pn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Yu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&xt(5),jn(a)){const o=i&&t&&t.type_!==3&&!Bs(t.assigned_,r)?i.concat(r):void 0,l=qa(e,a,o);if(af(n,r,l),jn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(On(a)&&!fi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;qa(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ua(e,a)}}function Ua(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&bo(t,n)}function Wv(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:sf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=yo;n&&(a=[r],i=$r);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var yo={get(e,t){if(t===Et)return e;const n=wn(e);if(!Bs(n,t))return Hv(e,n,t);const r=n[t];return e.finalized_||!On(r)?r:r===Mi(e.base_,t)?(Ni(e),e.copy_[t]=Ps(r,e)):r},has(e,t){return t in wn(e)},ownKeys(e){return Reflect.ownKeys(wn(e))},set(e,t,n){const r=of(wn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Mi(wn(e),t),i=a==null?void 0:a[Et];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if($v(n,a)&&(n!==void 0||Bs(e.base_,t)))return!0;Ni(e),Os(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 Mi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ni(e),Os(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=wn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return or(e.base_)},setPrototypeOf(){xt(12)}},$r={};za(yo,(e,t)=>{$r[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$r.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),$r.set.call(this,e,t,void 0)};$r.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),yo.set.call(this,e[0],t,n,e[0])};function Mi(e,t){const n=e[Et];return(n?wn(n):e)[t]}function Hv(e,t,n){var a;const r=of(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function of(e,t){if(!(t in e))return;let n=or(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=or(n)}}function Os(e){e.modified_||(e.modified_=!0,e.parent_&&Os(e.parent_))}function Ni(e){e.copy_||(e.copy_=Ts(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Vv=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"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let a;if(On(t)){const i=Ku(this),s=Ps(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Ss(i):js(i)}return Vu(i,r),Zu(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===nf&&(a=void 0),this.autoFreeze_&&bo(a,!0),r){const i=[],s=[];Pn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else xt(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){On(e)||xt(8),jn(e)&&(e=Kv(e));const t=Ku(this),n=Ps(e,void 0);return n[Et].isManual_=!0,js(t),n}finishDraft(e,t){const n=e&&e[Et];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Vu(r,t),Zu(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=Pn("Patches").applyPatches_;return jn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ps(e,t){const n=ci(e)?Pn("MapSet").proxyMap_(e,t):di(e)?Pn("MapSet").proxySet_(e,t):Wv(e,t);return(t?t.scope_:sf()).drafts_.push(n),n}function Kv(e){return jn(e)||xt(10,e),uf(e)}function uf(e){if(!On(e)||fi(e))return e;const t=e[Et];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ts(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ts(e,!0);return za(n,(r,a)=>{af(n,r,uf(a))}),t&&(t.finalized_=!1),n}var _t=new Vv,xo=_t.produce;_t.produceWithPatches.bind(_t);_t.setAutoFreeze.bind(_t);_t.setUseStrictShallowCopy.bind(_t);_t.applyPatches.bind(_t);var Gu=_t.createDraft.bind(_t),Qu=_t.finishDraft.bind(_t),Zv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Yv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=_e.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Gv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Q.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Wa=new WeakMap,Ha=new WeakMap,Br=new WeakMap,lf=new WeakMap,Ju=new WeakMap,Xu=new WeakMap,el=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.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 I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.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 I.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 I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.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&&I.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(!I.isAncestor(t,e)&&!I.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;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:m}=t;if(I.equals(h,m))return r;if(I.isAncestor(h,r)||I.equals(h,r)){var p=m.slice();return I.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else I.isSibling(h,m)&&(I.isAncestor(m,r)||I.equals(m,r))?I.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:I.endsBefore(m,r)||I.equals(m,r)||I.isAncestor(m,r)?(I.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):I.endsBefore(h,r)&&(I.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Lr(e){"@babel/helpers - typeof";return Lr=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},Lr(e)}function Qv(e,t){if(Lr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Lr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jv(e){var t=Qv(e,"string");return Lr(t)==="symbol"?t:String(t)}function vt(e,t,n){return t=Jv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 wr(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){vt(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 Xv=(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 Q.points(t))t[l]=_e.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var m=ue.leaf(e,u),p=m.text.slice(0,d),g=m.text.slice(d);if(m.text=p+h+g,t)for(var[f,v]of Q.points(t))t[v]=_e.transform(f,n);break}case"merge_node":{var{path:b}=n,E=ue.get(e,b),k=I.previous(b),T=ue.get(e,k),D=ue.parent(e,b),C=b[b.length-1];if(fe.isText(E)&&fe.isText(T))T.text+=E.text;else if(!fe.isText(E)&&!fe.isText(T))T.children.push(...E.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(at.stringify(E)," ").concat(at.stringify(T)));if(D.children.splice(C,1),t)for(var[S,L]of Q.points(t))t[L]=_e.transform(S,n);break}case"move_node":{var{path:N,newPath:q}=n;if(I.isAncestor(N,q))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat(q,"] because the destination is inside itself."));var $=ue.get(e,N),F=ue.parent(e,N),_=N[N.length-1];F.children.splice(_,1);var P=I.transform(N,n),j=ue.get(e,I.parent(P)),W=P[P.length-1];if(j.children.splice(W,0,$),t)for(var[V,se]of Q.points(t))t[se]=_e.transform(V,n);break}case"remove_node":{var{path:re}=n,w=re[re.length-1],ee=ue.parent(e,re);if(ee.children.splice(w,1),t)for(var[K,A]of Q.points(t)){var B=_e.transform(K,n);if(t!=null&&B!=null)t[A]=B;else{var O=void 0,M=void 0;for(var[z,Y]of ue.texts(e))if(I.compare(Y,re)===-1)O=[z,Y];else{M=[z,Y];break}var U=!1;O&&M&&(I.equals(M[1],re)?U=!I.hasPrevious(M[1]):U=I.common(O[1],re).length<I.common(M[1],re).length),O&&!U?(K.path=O[1],K.offset=O[0].text.length):M?(K.path=M[1],K.offset=0):t=null}}break}case"remove_text":{var{path:ne,offset:le,text:J}=n;if(J.length===0)break;var pe=ue.leaf(e,ne),me=pe.text.slice(0,le),Fe=pe.text.slice(le+J.length);if(pe.text=me+Fe,t)for(var[Be,Te]of Q.points(t))t[Te]=_e.transform(Be,n);break}case"set_node":{var{path:$e,properties:Le,newProperties:Ue}=n;if($e.length===0)throw new Error("Cannot set properties on the root node!");var et=ue.get(e,$e);for(var Ae in Ue){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ue[Ae];We==null?delete et[Ae]:et[Ae]=We}for(var be in Le)Ue.hasOwnProperty(be)||delete et[be];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!Q.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(H)," when there is no current selection."));t=wr({},H)}for(var ae in H){var he=H[ae];if(he==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=he}}break}case"split_node":{var{path:ge,position:we,properties:Ge}=n;if(ge.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ge,"] because the root node cannot be split."));var Qe=ue.get(e,ge),ot=ue.parent(e,ge),ye=ge[ge.length-1],Ee;if(fe.isText(Qe)){var ze=Qe.text.slice(0,we),nt=Qe.text.slice(we);Qe.text=ze,Ee=wr(wr({},Ge),{},{text:nt})}else{var ut=Qe.children.slice(0,we),Ln=Qe.children.slice(we);Qe.children=ut,Ee=wr(wr({},Ge),{},{children:Ln})}if(ot.children.splice(ye+1,0,Ee),t)for(var[on,Jr]of Q.points(t))t[Jr]=_e.transform(on,n);break}}return t},eb={transform(e,t){e.children=Gu(e.children);var n=e.selection&&Gu(e.selection);try{n=Xv(e,n,t)}finally{e.children=Qu(e.children),n?e.selection=jn(n)?Qu(n):n:e.selection=null}}},tb={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)}},nb={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)}},cf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(it(r)&&it(a)){if(!cf(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 rb(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 tn(e,t){if(e==null)return{};var n=rb(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 ab=["anchor","focus"];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 ib(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){vt(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 Q={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Q.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Q.edges(e);return t},equals(e,t){return _e.equals(e.anchor,t.anchor)&&_e.equals(e.focus,t.focus)},includes(e,t){if(Q.isRange(t)){if(Q.includes(e,t.anchor)||Q.includes(e,t.focus))return!0;var[n,r]=Q.edges(e),[a,i]=Q.edges(t);return _e.isBefore(n,a)&&_e.isAfter(r,i)}var[s,o]=Q.edges(e),l=!1,u=!1;return _e.isPoint(t)?(l=_e.compare(t,s)>=0,u=_e.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=tn(e,ab),[r,a]=Q.edges(e),[i,s]=Q.edges(t),o=_e.isBefore(r,i)?i:r,l=_e.isBefore(a,s)?a:s;return _e.isBefore(l,o)?null:ib({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return _e.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return _e.equals(t,n)},isExpanded(e){return!Q.isCollapsed(e)},isForward(e){return!Q.isBackward(e)},isRange(e){return it(e)&&_e.isPoint(e.anchor)&&_e.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Q.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return xo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Q.isCollapsed(r);Q.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Q.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=_e.transform(r.anchor,t,{affinity:i}),u=_e.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},rl=e=>it(e)&&ue.isNodeList(e.children)&&!x.isEditor(e),de={isAncestor(e){return it(e)&&ue.isNodeList(e.children)},isElement:rl,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 rl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},sb=["children"],ob=["text"],al=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(at.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(at.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(at.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=I.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(at.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=tn(e,sb);return t}else{var t=tn(e,ob);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=xo({children:e.children},r=>{var[a,i]=Q.edges(t),s=ue.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!Q.includes(t,p)}});for(var[,o]of s){if(!Q.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}x.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(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.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(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=al.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return al.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(fe.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(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(at.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.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)||fe.isText(e)&&fe.isTextProps(t)&&fe.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?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.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=I.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=I.previous(o);o=h,l=ue.get(e,o);continue}o=I.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=ue.get(e,n);if(fe.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 fe.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))fe.isText(n)&&(yield[n,r])}()}};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 Ke(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){vt(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 hn={isNodeOperation(e){return hn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!it(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&it(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&it(e.properties)&&it(e.newProperties);case"set_selection":return e.properties===null&&Q.isRange(e.newProperties)||e.newProperties===null&&Q.isRange(e.properties)||it(e.properties)&&it(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&it(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>hn.isOperation(t))},isSelectionOperation(e){return hn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return hn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ke(Ke({},e),{},{type:"remove_node"});case"insert_text":return Ke(Ke({},e),{},{type:"remove_text"});case"merge_node":return Ke(Ke({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return Ke(Ke({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return Ke(Ke({},e),{},{path:r,newPath:a})}case"remove_node":return Ke(Ke({},e),{},{type:"insert_node"});case"remove_text":return Ke(Ke({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ke(Ke({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ke(Ke({},e),{},{properties:l,newProperties:null}):l==null?Ke(Ke({},e),{},{properties:null,newProperties:o}):Ke(Ke({},e),{},{properties:l,newProperties:o})}case"split_node":return Ke(Ke({},e),{},{type:"merge_node",path:I.next(e.path)})}}},sl=new WeakMap,ub=e=>{var t=sl.get(e);if(t!==void 0)return t;if(!it(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||it(e.marks))&&(e.selection===null||Q.isRange(e.selection))&&ue.isNodeList(e.children)&&hn.isOperationList(e.operations);return sl.set(e,n),n},x={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 ub(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)}},lb={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};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){vt(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 _e={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return _e.compare(e,t)===1},isBefore(e,t){return _e.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return it(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return xo(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=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.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=I.transform(i,t,ul(ul({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},ll=void 0,at={setScrubber(e){ll=e},stringify(e){return JSON.stringify(e,ll)}},cb=["text"],db=["anchor","focus"];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 Qt(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){vt(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=tn(i,cb);return s}return cf(r?a(e):e,r?a(t):t)},isText(e){return it(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.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=[Qt({},e)];for(var r of t){var a=tn(r,db),[i,s]=Q.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:m}=h.text,p=l;if(l+=m,u<=p&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(h);continue}var g=h,f=void 0,v=void 0;if(d<l){var b=d-p;v=Qt(Qt({},g),{},{text:g.text.slice(b)}),g=Qt(Qt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var E=u-p;f=Qt(Qt({},g),{},{text:g.text.slice(0,E)}),g=Qt(Qt({},g),{},{text:g.text.slice(E)})}Object.assign(g,a),f&&o.push(f),o.push(g),v&&o.push(v)}n=o}return n}},Do=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],mr=(e,t)=>{var[n]=x.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?vb(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 m=Bb(d,h);if([i,s]=r?[s,m]:[m,i],Gn(i,Ce.ZWJ)&&Gn(s,Ce.ExtPict)&&(r?l=dl(t.substring(0,o)):l=dl(t.substring(0,t.length-o)),!l)||Gn(i,Ce.RI)&&Gn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Pb(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Sb(i,s))break;o+=d.length}return o||1},fb=/\s/,hb=/[\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]/,mb=/['\u2018\u2019]/,pb=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]=wo(t,i,n);if(gb(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},wo=(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)]},gb=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(fb.test(t))return!1;if(mb.test(t)){var a=Co(n,r),[i,s]=wo(n,a,r);if(e(i,s,r))return!0}return!hb.test(t)},vb=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(yb(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(bb(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},bb=e=>e>=55296&&e<=56319,yb=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 xb=/^(?:[\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])$/,Db=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Cb=/^(?:[\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])$/,wb=/^[\u1100-\u115F\uA960-\uA97C]$/,Eb=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,_b=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,kb=/^[\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]$/,Fb=/^[\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]$/,Ab=/^(?:[\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])$/,Bb=(e,t)=>{var n=Ce.Any;return e.search(xb)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Db)!==-1&&(n|=Ce.Prepend),e.search(Cb)!==-1&&(n|=Ce.SpacingMark),e.search(wb)!==-1&&(n|=Ce.L),e.search(Eb)!==-1&&(n|=Ce.V),e.search(_b)!==-1&&(n|=Ce.T),e.search(kb)!==-1&&(n|=Ce.LV),e.search(Fb)!==-1&&(n|=Ce.LVT),e.search(Ab)!==-1&&(n|=Ce.ExtPict),n};function Gn(e,t){return(e&t)!==0}var Tb=[[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 Sb(e,t){return Tb.findIndex(n=>Gn(e,n[0])&&Gn(t,n[1]))===-1}var jb=/(?:[\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$/,dl=e=>e.search(jb)!==-1,Ob=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Pb=e=>{var t=e.match(Ob);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Mb={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]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Do(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),Q.isRange(a))if(Q.isCollapsed(a))a=a.anchor;else{var i=Q.end(a);if(!r&&x.void(e,{at:i}))return;var s=Q.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:h,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function 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 ca(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){vt(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 X=ca(ca(ca(ca({},eb),tb),nb),Mb),ka=new WeakMap,Nb=e=>ka.get(e)||!1,Rb=(e,t,n)=>{var r=ka.get(e)||!1;ka.set(e,!0);try{t(),n()}finally{ka.set(e,r)}};function df(e,t,n){var r=Wa.get(e)||[],a=Ha.get(e)||new Set,i,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Wa.set(e,i),Ha.set(e,s)}var Ib=(e,t)=>{for(var n of x.pathRefs(e))Zv.transform(n,t);for(var r of x.pointRefs(e))Yv.transform(r,t);for(var a of x.rangeRefs(e))Gv.transform(a,t);if(!Nb(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;df(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Br.get(e)||(Br.set(e,!0),Promise.resolve().then(()=>{Br.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},$b=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=fe.isText(r)?[]:Array.from(ue.nodes(r),q=>{var[,$]=q;return a.concat($)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(I.equals(d,h))return[];var m=[],p=[];for(var g of I.ancestors(d)){var f=I.transform(g,t);m.push(f)}for(var v of I.ancestors(h)){var b=I.transform(v,t);p.push(b)}var E=p[p.length-1],k=h[h.length-1],T=E.concat(k);return[...m,...p,T]}case"remove_node":{var{path:D}=t,C=I.ancestors(D);return[...C]}case"split_node":{var{path:S}=t,L=I.levels(S),N=I.next(S);return[...L,N]}default:return[]}},Lb=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},zb=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.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(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,m=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(m!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var p={text:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},qb=(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},Ub=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=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(Q.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};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){vt(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 Wb=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,m)=>{if(!fe.isText(h))return!1;var[p,g]=x.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=Q.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=ml(ml({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Br.get(e)||e.onChange()}}};function pl(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 gl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,gl(gl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function vl(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 bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,bl(bl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Kb=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Zb=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&X.delete(e,{unit:t})},Yb=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Q.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Gb=(e,t)=>[x.start(e,t),x.end(e,t)];function yl(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 xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,xl(xl({},n),{},{match:r=>de.isElement(r)&&x.isElementReadOnly(t,r)}))},Jb=(e,t)=>x.point(e,t,{edge:"end"}),Xb=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},e0=(e,t)=>{var n=x.range(e,t);return ue.fragment(e,n)};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 Cl(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){vt(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 t0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Cl(Cl({},n),{},{match:r=>de.isElement(r)&&x.isVoid(t,r)}))},n0=(e,t)=>t.children.some(n=>de.isElement(n)&&x.isBlock(e,n)),r0=(e,t)=>t.children.some(n=>fe.isText(n)||x.isInline(e,n)),a0=(e,t)=>ue.has(e,t),i0=(e,t)=>t.children.every(n=>fe.isText(n)),s0=e=>{X.splitNodes(e,{always:!0})},o0=(e,t,n)=>{X.insertNodes(e,t,n)},u0=e=>{X.splitNodes(e,{always:!0})};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 l0(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){vt(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 c0=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=l0({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},d0=(e,t)=>!e.isInline(t),f0=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),h0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},m0=(e,t,n)=>{var r=x.end(e,n);return _e.equals(t,r)},p0=e=>{var t=lf.get(e);return t===void 0?!0:t},g0=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return _e.equals(t,r)},v0=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},b0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function y0(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=x.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var x0=["text"],D0=["text"],C0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Q.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=tn(u,x0);return d}else return{}}var{path:h}=a,[m]=x.leaf(t,h);if(a.offset===0){var p=x.previous(t,{at:h,match:fe.isText}),g=x.above(t,{match:T=>de.isElement(T)&&x.isVoid(t,T)&&t.markableVoid(T)});if(!g){var f=x.above(t,{match:T=>de.isElement(T)&&x.isBlock(t,T)});if(p&&f){var[v,b]=p,[,E]=f;I.isAncestor(E,b)&&(m=v)}}}var k=tn(m,D0);return k},w0=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=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=m=>d.children.includes(m)}else i=()=>!0;var[h]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},E0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.get(t,a);return[i,a]};function _0(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(lb.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),m=x.path(e,n,{edge:"end"});u=i?m:h,d=i?h:m}var p=ue.nodes(e,{reverse:i,from:u,to:d,pass:T=>{var[D]=T;return de.isElement(D)?!!(!s&&(x.isVoid(e,D)||x.isElementReadOnly(e,D))||o&&!x.isSelectable(e,D)):!1}}),g=[],f;for(var[v,b]of p)if(!(o&&de.isElement(v)&&!x.isSelectable(e,v))){var E=f&&I.compare(b,f[1])===0;if(!(r==="highest"&&E)){if(!l(v,b)){if(a&&!E&&fe.isText(v))return;continue}if(r==="lowest"&&E){f=[v,b];continue}var k=r==="lowest"?f:[v,b];k&&(a?g.push(k):yield k),f=[v,b]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var k0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Wa.get(d)||[],s=d=>Ha.get(d)||new Set,o=d=>{var h=i(d).pop(),m=h.join(",");return s(d).delete(m),h};if(x.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(",")));Wa.set(t,l),Ha.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=x.node(t,d),[m,p]=h;de.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,v=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:v,initialDirtyPathsLength:f,operation:a}))return;var b=o(t);if(ue.has(t,b)){var E=x.node(t,b);t.normalizeNode(E,{operation:a})}v++,g=i(t)}})}},F0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},A0=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=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},B0=e=>{var t=Ju.get(e);return t||(t=new Set,Ju.set(e,t)),t},T0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.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 Q.isRange(n)&&(i==="start"?n=Q.start(n):i==="end"?n=Q.end(n):n=I.common(n.anchor.path,n.focus.path)),_e.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},S0=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=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},j0=e=>{var t=Xu.get(e);return t||(t=new Set,Xu.set(e,t)),t},O0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.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(!fe.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(Q.isRange(n)){var[u,d]=Q.edges(n);return a==="start"?u:d}return n};function P0(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=x.range(e,n),[l,u]=Q.edges(o),d=a?u:l,h=!1,m="",p=0,g=0,f=0;for(var[v,b]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(v)){if(!i&&(e.isVoid(v)||e.isElementReadOnly(v))){yield x.start(e,b);continue}if(e.isInline(v))continue;if(x.hasInlines(e,v)){var E=I.isAncestor(b,u.path)?u:x.end(e,b),k=I.isAncestor(b,l.path)?l:x.start(e,b);m=x.string(e,{anchor:k,focus:E},{voids:i}),h=!0}}if(fe.isText(v)){var T=I.equals(b,d.path);for(T?(g=a?d.offset:v.text.length-d.offset,f=d.offset):(g=v.text.length,f=a?g:0),(T||h||r==="offset")&&(yield{path:b,offset:f},h=!1);;){if(p===0){if(m==="")break;p=D(m,r,a),m=wo(m,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:f}}}}function D(C,S,L){return S==="character"?Co(C,L):S==="word"?pb(C,L):S==="line"||S==="block"?C.length:1}}()}var M0=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=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=m=>d.children.includes(m)}else i=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},N0=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=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},R0=e=>{var t=el.get(e);return t||(t=new Set,el.set(e,t)),t},I0=(e,t,n)=>{if(Q.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};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 $0(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){vt(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 L0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!fe.isText(d))return!1;var[m,p]=x.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},a=Q.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=$0({},x.marks(e)||{});delete u[t],e.marks=u,Br.get(e)||e.onChange()}}},z0=(e,t)=>{lf.set(e,t)},q0=(e,t)=>x.point(e,t,{edge:"start"}),U0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Q.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;I.equals(d,o.path)&&(h=h.slice(0,o.offset)),I.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},W0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Q.edges(n);if(i.offset!==0||s.offset!==0||Q.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:g=>de.isElement(g)&&x.isBlock(t,g),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},h=!0;for(var[m,p]of x.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(m.text!==""||I.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},H0=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},V0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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(Q.isRange(u)&&Q.isCollapsed(u)&&(h=!0,u=u.anchor),_e.isPoint(u)){var m=x.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},f=i?x.before(t,u,g)||x.start(t,[]):x.after(t,u,g)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!Q.isCollapsed(u)){if(!d){var[,v]=Q.edges(u),b=x.end(t,[]);_e.equals(v,b)||(u=x.unhangRange(t,u,{voids:l}))}var[E,k]=Q.edges(u),T=x.above(t,{match:me=>de.isElement(me)&&x.isBlock(t,me),at:E,voids:l}),D=x.above(t,{match:me=>de.isElement(me)&&x.isBlock(t,me),at:k,voids:l}),C=T&&D&&!I.equals(T[1],D[1]),S=I.equals(E.path,k.path),L=l?null:(r=x.void(t,{at:E,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:E,mode:"highest"}),N=l?null:(a=x.void(t,{at:k,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:k,mode:"highest"});if(L){var q=x.before(t,E);q&&T&&I.isAncestor(T[1],q.path)&&(E=q)}if(N){var $=x.after(t,k);$&&D&&I.isAncestor(D[1],$.path)&&(k=$)}var F=[],_;for(var P of x.nodes(t,{at:u,voids:l})){var[j,W]=P;_&&I.compare(W,_)===0||(!l&&de.isElement(j)&&(x.isVoid(t,j)||x.isElementReadOnly(t,j))||!I.isCommon(W,E.path)&&!I.isCommon(W,k.path))&&(F.push(P),_=W)}var V=Array.from(F,me=>{var[,Fe]=me;return x.pathRef(t,Fe)}),se=x.pointRef(t,E),re=x.pointRef(t,k),w="";if(!S&&!L){var ee=se.current,[K]=x.leaf(t,ee),{path:A}=ee,{offset:B}=E,O=K.text.slice(B);O.length>0&&(t.apply({type:"remove_text",path:A,offset:B,text:O}),w=O)}if(V.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>X.removeNodes(t,{at:me,voids:l})),!N){var M=re.current,[z]=x.leaf(t,M),{path:Y}=M,U=S?E.offset:0,ne=z.text.slice(U,k.offset);ne.length>0&&(t.apply({type:"remove_text",path:Y,offset:U,text:ne}),w=ne)}!S&&C&&re.current&&se.current&&X.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),h&&i&&s==="character"&&w.length>1&&w.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,w.slice(0,w.length-o));var le=se.unref(),J=re.unref(),pe=i?le||J:J||le;n.at==null&&pe&&X.select(t,pe)}}})},K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Do(t),batchDirty:o=!0}=r;if(n.length){if(Q.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Q.isCollapsed(s))s=s.anchor;else{var[,l]=Q.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:O=>de.isElement(O)&&x.isInline(t,O),mode:"highest",voids:i});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var m=x.after(t,h);s=m}else if(x.isStart(t,s,h)){var p=x.before(t,h);s=p}}var g=x.above(t,{match:O=>de.isElement(O)&&x.isBlock(t,O),at:s,voids:i}),[,f]=g,v=x.isStart(t,s,f),b=x.isEnd(t,s,f),E=v&&b,k=!v||v&&b,T=!b,[,D]=ue.first({children:n},[]),[,C]=ue.last({children:n},[]),S=[],L=O=>{var[M,z]=O,Y=z.length===0;return Y?!1:E?!0:!(k&&I.isAncestor(z,D)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M)||T&&I.isAncestor(z,C)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M))};for(var N of ue.nodes({children:n},{pass:L}))L(N)&&S.push(N);var q=[],$=[],F=[],_=!0,P=!1;for(var[j]of S)de.isElement(j)&&!t.isInline(j)?(_=!1,P=!0,$.push(j)):_?q.push(j):F.push(j);var[W]=x.nodes(t,{at:s,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i}),[,V]=W,se=x.isStart(t,s,V),re=x.isEnd(t,s,V),w=x.pathRef(t,b&&!F.length?I.next(f):f),ee=x.pathRef(t,re?I.next(V):V);X.splitNodes(t,{at:s,match:O=>P?de.isElement(O)&&x.isBlock(t,O):fe.isText(O)||x.isInline(t,O),mode:P?"lowest":"highest",always:P&&(!v||q.length>0)&&(!b||F.length>0),voids:i});var K=x.pathRef(t,!se||se&&re?I.next(V):V);if(X.insertNodes(t,q,{at:K.current,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),E&&!q.length&&$.length&&!F.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,$,{at:w.current,match:O=>de.isElement(O)&&x.isBlock(t,O),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,F,{at:ee.current,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),!r.at){var A;if(F.length>0&&ee.current?A=I.previous(ee.current):$.length>0&&w.current?A=I.previous(w.current):K.current&&(A=I.previous(K.current)),A){var B=x.end(t,A);X.select(t,B)}}K.unref(),w.unref(),ee.unref()}}})},Z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=Q.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=Q.edges(a);X.select(t,s)}}else return},Y0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=Q.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Q.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?x.before(t,l,d):x.after(t,l,d);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?x.before(t,u,d):x.after(t,u,d);p&&(h.focus=p)}X.setSelection(t,h)}},Q0=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){X.setSelection(e,t);return}if(!Q.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(at.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};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 kl(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){vt(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 J0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=Q.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Q.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:kl(kl({},l),n)})}},X0=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!_e.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!_e.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})}},ey=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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),Q.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Q.isCollapsed(l))l=l.anchor;else{var[,m]=Q.edges(l),p=x.pointRef(t,m);X.delete(t,{at:l}),l=p.unref()}if(_e.isPoint(l)){u==null&&(fe.isText(h)?u=q=>fe.isText(q):t.isInline(h)?u=q=>fe.isText(q)||x.isInline(t,q):u=q=>de.isElement(q)&&x.isBlock(t,q));var[g]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,v=x.pathRef(t,f),b=x.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var E=v.unref();l=b?I.next(E):E}else return}var k=I.parent(l),T=l[l.length-1];if(!(!i&&x.void(t,{at:k}))){if(o){var D=[],C=I.levels(k);Rb(t,()=>{var q=function(){var _=k.concat(T);T++;var P={type:"insert_node",path:_,node:$};t.apply(P),l=I.next(l),D.push(P),fe.isText?C.push(...Array.from(ue.nodes($),j=>{var[,W]=j;return _.concat(W)})):C.push(_)};for(var $ of n)q()},()=>{df(t,C,q=>{var $=q;for(var F of D)if(I.operationCanTransformPath(F)&&($=I.transform($,F),!$))return null;return $})})}else for(var S of n){var L=k.concat(T);T++,t.apply({type:"insert_node",path:L,node:S}),l=I.next(l)}if(l=I.previous(l),d){var N=x.end(t,l);N&&X.select(t,N)}}}})},ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?mr(t,r):T=>de.isElement(T)&&x.isBlock(t,T)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,T=>{var[,D]=T;return x.pathRef(t,D)});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=x.node(t,I.parent(d)),[m,p]=h,g=d[d.length-1],{length:f}=m.children;if(f===1){var v=I.next(p);X.moveNodes(t,{at:d,to:v,voids:i}),X.removeNodes(t,{at:p,voids:i})}else if(g===0)X.moveNodes(t,{at:d,to:p,voids:i});else if(g===f-1){var b=I.next(p);X.moveNodes(t,{at:d,to:b,voids:i})}else{var E=I.next(d),k=I.next(p);X.splitNodes(t,{at:E,voids:i}),X.moveNodes(t,{at:d,to:k,voids:i})}}}})},ny=["text"],ry=["children"],ff=(e,t)=>{if(de.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?ff(e,n.children[0]):!1}else return!x.isEditor(t)},ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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(I.isPath(a)){var[l]=x.parent(t,a);r=q=>l.children.includes(q)}else r=q=>de.isElement(q)&&x.isBlock(t,q);if(!i&&Q.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Q.isRange(a))if(Q.isCollapsed(a))a=a.anchor;else{var[,u]=Q.edges(a),d=x.pointRef(t,u);X.delete(t,{at:a}),a=d.unref(),n.at==null&&X.select(t,a)}var[h]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),m=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,v]=m;if(!(g.length===0||v.length===0)){var b=I.next(v),E=I.common(g,v),k=I.isSibling(g,v),T=Array.from(x.levels(t,{at:g}),q=>{var[$]=q;return $}).slice(E.length).slice(0,-1),D=x.above(t,{at:g,mode:"highest",match:q=>T.includes(q)&&ff(t,q)}),C=D&&x.pathRef(t,D[1]),S,L;if(fe.isText(p)&&fe.isText(f)){var N=tn(p,ny);L=f.text.length,S=N}else if(de.isElement(p)&&de.isElement(f)){var N=tn(p,ry);L=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(at.stringify(p)," ").concat(at.stringify(f)));k||X.moveNodes(t,{at:g,to:b,voids:s}),C&&X.removeNodes(t,{at:C.current,voids:s}),de.isElement(f)&&x.isEmpty(t,f)||fe.isText(f)&&f.text===""&&v[v.length-1]!==0?X.removeNodes(t,{at:v,voids:s}):t.apply({type:"merge_node",path:b,position:L,properties:S}),C&&C.unref()}}}})},iy=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?mr(e,r):p=>de.isElement(p)&&x.isBlock(e,p));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(e,g)});for(var d of u){var h=d.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&I.isSibling(m,h)&&I.isAfter(m,h)&&(o.current=I.next(o.current))}o.unref()}})},sy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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=I.isPath(s)?mr(t,s):p=>de.isElement(p)&&x.isBlock(t,p)),!r&&Q.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(t,g)});for(var d of u){var h=d.unref();if(h){var[m]=x.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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=I.isPath(i)?mr(t,i):L=>de.isElement(L)&&x.isBlock(t,L)),!l&&Q.isRange(i)&&(i=x.unhangRange(t,i,{voids:h})),d&&Q.isRange(i)){if(Q.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var m=x.rangeRef(t,i,{affinity:"inward"}),[p,g]=Q.edges(i),f=u==="lowest"?"lowest":"highest",v=x.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!v});var b=x.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:f,voids:h,always:!b}),i=m.unref(),r.at==null&&X.select(t,i)}s||(s=(L,N)=>L!==N);for(var[E,k]of x.nodes(t,{at:i,match:a,mode:u,voids:h})){var T={},D={};if(k.length!==0){var C=!1;for(var S in n)S==="children"||S==="text"||s(n[S],E[S])&&(C=!0,E.hasOwnProperty(S)&&(T[S]=E[S]),o?n[S]!=null&&(D[S]=o(E[S],n[S])):n[S]!=null&&(D[S]=n[S]));C&&t.apply({type:"set_node",path:k,properties:T,newProperties:D})}}}})},uy=(e,t)=>{if(Q.isCollapsed(t))return t.anchor;var[,n]=Q.edges(t),r=x.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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)&&x.isBlock(t,re)),Q.isRange(s)&&(s=uy(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);i=re=>re===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var m=x.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=x.void(t,{at:s,mode:"highest"}),v=0;if(!a&&f){var[b,E]=f;if(de.isElement(b)&&t.isInline(b)){var k=x.after(t,E);if(!k){var T={text:""},D=I.next(E);X.insertNodes(t,T,{at:D,voids:a}),k=x.point(t,D)}s=k,l=!0}var C=s.path.length-E.length;o=C+1,l=!0}p=x.pointRef(t,s);var S=s.path.length-o,[,L]=g,N=s.path.slice(0,S),q=o===0?s.offset:s.path[S]+v;for(var[$,F]of x.levels(t,{at:N,reverse:!0,voids:a})){var _=!1;if(F.length<L.length||F.length===0||!a&&de.isElement($)&&x.isVoid(t,$))break;var P=m.current,j=x.isEnd(t,P,F);if(l||!m||!x.isEdge(t,P,F)){_=!0;var W=ue.extractProps($);t.apply({type:"split_node",path:F,position:q,properties:W})}q=F[F.length-1]+(_||j?1:0)}if(n.at==null){var V=p.current||x.end(t,[]);X.select(t,V)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},cy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;X.setNodes(t,a,r)},dy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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=I.isPath(s)?mr(t,s):p=>de.isElement(p)&&x.isBlock(t,p)),I.isPath(s)&&(s=x.range(t,s));var l=Q.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,p=>{var[,g]=p;return x.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=x.node(t,g),v=x.range(t,g);a&&l&&(v=Q.intersection(l.current,v)),X.liftNodes(t,{at:v,match:b=>de.isAncestor(f)&&f.children.includes(b),voids:i})};for(var m of d)h();l&&l.unref()}})};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 Al(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){vt(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 fy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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&&(I.isPath(l)?o=mr(t,l):t.isInline(n)?o=v=>de.isElement(v)&&x.isInline(t,v)||fe.isText(v):o=v=>de.isElement(v)&&x.isBlock(t,v)),i&&Q.isRange(l)){var[u,d]=Q.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var m=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?v=>de.isElement(v)&&x.isBlock(t,v):v=>x.isEditor(v),mode:"lowest",voids:s})),p=function(){var b=Q.isRange(l)?Q.intersection(l,x.range(t,f)):l;if(!b)return 0;var E=Array.from(x.nodes(t,{at:b,match:o,mode:a,voids:s}));if(E.length>0){var[k]=E,T=E[E.length-1],[,D]=k,[,C]=T;if(D.length===0&&C.length===0)return 0;var S=I.equals(D,C)?I.parent(D):I.common(D,C),L=x.range(t,D,C),N=x.node(t,S),[q]=N,$=S.length+1,F=I.next(C.slice(0,$)),_=Al(Al({},n),{},{children:[]});X.insertNodes(t,_,{at:F,voids:s}),X.moveNodes(t,{at:L,match:P=>de.isAncestor(q)&&q.children.includes(P),to:F.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},hy=()=>{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 Ib(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wb(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kb(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zb(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yb(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lb(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zb(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $b(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qb(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ub(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hb(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vb(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gb(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qb(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jb(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xb(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return h0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)}};return e},Fn=[],my=function(){return Fn.some(function(e){return e.activeTargets.length>0})},py=function(){return Fn.some(function(e){return e.skippedTargets.length>0})},Bl="ResizeObserver loop completed with undelivered notifications.",gy=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Bl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Bl),window.dispatchEvent(e)},zr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(zr||(zr={}));var An=function(e){return Object.freeze(e)},vy=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,An(this)}return e}(),hf=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,An(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},mf=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)},Tl=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)},by=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},Tr=typeof window<"u"?window:{},da=new WeakMap,Sl=/auto|scroll/,yy=/^tb|vertical/,xy=/msie|trident/i.test(Tr.navigator&&Tr.navigator.userAgent),It=function(e){return parseFloat(e||"0")},tr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new vy((n?t:e)||0,(n?e:t)||0)},jl=An({devicePixelContentBoxSize:tr(),borderBoxSize:tr(),contentBoxSize:tr(),contentRect:new hf(0,0,0,0)}),pf=function(e,t){if(t===void 0&&(t=!1),da.has(e)&&!t)return da.get(e);if(mf(e))return da.set(e,jl),jl;var n=getComputedStyle(e),r=Eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!xy&&n.boxSizing==="border-box",i=yy.test(n.writingMode||""),s=!r&&Sl.test(n.overflowY||""),o=!r&&Sl.test(n.overflowX||""),l=r?0:It(n.paddingTop),u=r?0:It(n.paddingRight),d=r?0:It(n.paddingBottom),h=r?0:It(n.paddingLeft),m=r?0:It(n.borderTopWidth),p=r?0:It(n.borderRightWidth),g=r?0:It(n.borderBottomWidth),f=r?0:It(n.borderLeftWidth),v=h+u,b=l+d,E=f+p,k=m+g,T=o?e.offsetHeight-k-e.clientHeight:0,D=s?e.offsetWidth-E-e.clientWidth:0,C=a?v+E:0,S=a?b+k:0,L=r?r.width:It(n.width)-C-D,N=r?r.height:It(n.height)-S-T,q=L+v+D+E,$=N+b+T+k,F=An({devicePixelContentBoxSize:tr(Math.round(L*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:tr(q,$,i),contentBoxSize:tr(L,N,i),contentRect:new hf(h,l,L,N)});return da.set(e,F),F},gf=function(e,t,n){var r=pf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case zr.DEVICE_PIXEL_CONTENT_BOX:return s;case zr.BORDER_BOX:return a;default:return i}},Dy=function(){function e(t){var n=pf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=An([n.borderBoxSize]),this.contentBoxSize=An([n.contentBoxSize]),this.devicePixelContentBoxSize=An([n.devicePixelContentBoxSize])}return e}(),vf=function(e){if(mf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Cy=function(){var e=1/0,t=[];Fn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Dy(u.target),h=vf(u.target);o.push(d),u.lastReportedSize=gf(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},Ol=function(e){Fn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(vf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},wy=function(){var e=0;for(Ol(e);my();)e=Cy(),Ol(e);return py()&&gy(),e>0},Ri,bf=[],Ey=function(){return bf.splice(0).forEach(function(e){return e()})},_y=function(e){if(!Ri){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Ey()}).observe(n,r),Ri=function(){n.textContent="".concat(t?t--:t++)}}bf.push(e),Ri()},ky=function(e){_y(function(){requestAnimationFrame(e)})},Fa=0,Fy=function(){return!!Fa},Ay=250,By={attributes:!0,characterData:!0,childList:!0,subtree:!0},Pl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ml=function(e){return e===void 0&&(e=0),Date.now()+e},Ii=!1,Ty=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=Ay),!Ii){Ii=!0;var r=Ml(t);ky(function(){var a=!1;try{a=wy()}finally{if(Ii=!1,t=r-Ml(),!Fy())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,By)};document.body?n():Tr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Pl.forEach(function(n){return Tr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Pl.forEach(function(n){return Tr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ms=new Ty,Nl=function(e){!Fa&&e>0&&Ms.start(),Fa+=e,!Fa&&Ms.stop()},Sy=function(e){return!Eo(e)&&!by(e)&&getComputedStyle(e).display==="inline"},jy=function(){function e(t,n){this.target=t,this.observedBox=n||zr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=gf(this.target,this.observedBox,!0);return Sy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Oy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),fa=new WeakMap,Rl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ha=function(){function e(){}return e.connect=function(t,n){var r=new Oy(t,n);fa.set(t,r)},e.observe=function(t,n,r){var a=fa.get(t),i=a.observationTargets.length===0;Rl(a.observationTargets,n)<0&&(i&&Fn.push(a),a.observationTargets.push(new jy(n,r&&r.box)),Nl(1),Ms.schedule())},e.unobserve=function(t,n){var r=fa.get(t),a=Rl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Fn.splice(Fn.indexOf(r),1),r.observationTargets.splice(a,1),Nl(-1))},e.disconnect=function(t){var n=this,r=fa.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Py=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.");ha.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(!Tl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ha.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(!Tl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ha.unobserve(this,t)},e.prototype.disconnect=function(){ha.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),sn={};Object.defineProperty(sn,"__esModule",{value:!0});var My=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),$i={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},yf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:My?"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 ma=1;ma<20;ma++)_o["f"+ma]=111+ma;function hi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return xf(s,t)}),a=function(o){return r.some(function(l){return Df(l,o)})},i=n==null?a:a(n);return i}function Ny(e,t){return hi(e,t)}function Ry(e,t){return hi(e,{byKey:!0},t)}function xf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in $i)r[$i[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 m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=ko(m),f=$i[g];if(m.length>1&&!f&&!yf[m]&&!_o[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!f)&&(n?r.key=g:r.which=Cf(m)),f&&(r[f]=p?null:!0)}}catch(v){l=!0,u=v}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=yf[e]||e,e}var Iy=sn.default=hi,Li=sn.isHotkey=hi;sn.isCodeHotkey=Ny;sn.isKeyHotkey=Ry;sn.parseHotkey=xf;sn.compareHotkey=Df;sn.toKeyCode=Cf;sn.toKeyName=ko;function $y(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 ur(e,t){if(e==null)return{};var n=$y(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 qr(e){"@babel/helpers - typeof";return qr=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},qr(e)}function Ly(e,t){if(qr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(qr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zy(e){var t=Ly(e,"string");return qr(t)==="symbol"?t:String(t)}function jt(e,t,n){return t=zy(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),yn=()=>{var e=y.useContext(Fo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},wf=parseInt(y.version.split(".")[0],10),qy=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Il=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),gt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Qn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Uy=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Ef=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Wy=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Hy=gt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Vy=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Ky=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Zy=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Aa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",un=(!Wy||!Hy)&&!Uy&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Ao=new WeakMap,Bo=new WeakMap,_f=new WeakMap,Ba=new WeakMap,Ns=new WeakMap,Ur=new WeakMap,Bn=new WeakMap,Va=new WeakMap,mi=new WeakMap,Rs=new WeakMap,mn=new WeakMap,_n=new WeakMap,Sr=new WeakMap,Is=new WeakMap,To=new WeakMap,Mt=new WeakMap,Xt=new WeakMap,yt=new WeakMap,cn=new WeakMap,dn=new WeakMap,kf=new WeakMap,lr=Symbol("placeholder"),Ff=Symbol("mark-placeholder"),Yy=globalThis.Text,So=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Gy=e=>pn(e)&&e.nodeType===8,Tt=e=>pn(e)&&e.nodeType===1,pn=e=>{var t=So(e);return!!t&&e instanceof t.Node},$s=e=>{var t=e&&e.anchorNode&&So(e.anchorNode);return!!t&&e instanceof t.Selection},Af=e=>pn(e)&&e.nodeType===3,Qy=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Jy=e=>{var[t,n]=e;if(Tt(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;Tt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=e1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Xy=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;(Gy(a)||Tt(a)&&a.childNodes.length===0||Tt(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]},e1=(e,t,n)=>{var[r]=Bf(e,t,n);return r},Tf=e=>{var t="";if(Af(e)&&e.nodeValue)return e.nodeValue;if(Tt(e)){for(var n of Array.from(e.childNodes))t+=Tf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
70
- `)}return t},t1=/data-slate-fragment="(.+?)"/m,n1=e=>{var t=e.getData("text/html"),[,n]=t.match(t1)||[];return n},jo=(e,t,n)=>{var{target:r}=t;if(Tt(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)},r1=0;class a1{constructor(){jt(this,"id",void 0),this.id="".concat(r1++)}}var te={androidPendingDiffs:e=>yt.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);mn.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&&X.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(de.isElement(i)&&x.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=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var h=x.range(e,d);return h}}var m,{document:p}=te.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=te.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Va.get(t);return n||(n=new a1,Va.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Bo.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=Ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(at.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!mn.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||(X.select(t,x.start(t,[])),t.onChange()),mn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=_f.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=Tt(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)=>pn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>pn(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=>!!_n.get(e),isFocused:e=>!!mn.get(e),isReadOnly:e=>!!Rs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Rs.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return de.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=mi.get(e),r=x.isEditor(t)?Ba.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(at.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=te.toDOMNode(e,n),a;x.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,m=u.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var v,b=f.childNodes[0];a=[b instanceof Yy?b:f,(v=f.textContent)!==null&&v!==void 0&&v.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var E=Math.min(h,Math.max(0,t.offset-o));a=[d,E];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Q.isBackward(t),i=te.toDOMPoint(e,n),s=Q.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,m]=a?i:s,p=Tt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Tt(h)?h:h.parentElement,v=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,v?1:m),l},toSlateNode:(e,t)=>{var n=Tt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Ur.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:Jy(t),o=i.parentNode,l=null,u=0;if(o){var d,h,m=te.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),v=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var b=te.getWindow(e),E=b.document.createRange();E.setStart(l,0),E.setEnd(i,s);var k=E.cloneContents(),T=[...Array.prototype.slice.call(k.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(k.querySelectorAll("[contenteditable=false]"))];T.forEach(P=>{if(gt&&!r&&P.hasAttribute("data-slate-zero-width")&&P.textContent.length>0&&P.textContext!=="\uFEFF"){P.textContent.startsWith("\uFEFF")&&(P.textContent=P.textContent.slice(1));return}P.parentNode.removeChild(P)}),u=k.textContent.length,v=l}}else if(g){for(var D=g.querySelectorAll("[data-slate-leaf]"),C=0;C<D.length;C++){var S=D[C];if(te.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),v=f,u=v.textContent.length,v.querySelectorAll("[data-slate-zero-width]").forEach(P=>{u-=P.textContent.length})):u=1}v&&u===v.textContent.length&&gt&&v.getAttribute("data-slate-zero-width")==="z"&&(d=v.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Qn&&(h=v.textContent)!==null&&h!==void 0&&h.endsWith(`
69
+ */function Wu(e){return Object.prototype.toString.call(e)==="[object Object]"}function it(e){var t,n;return Wu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Wu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var nf=Symbol.for("immer-nothing"),Hu=Symbol.for("immer-draftable"),Et=Symbol.for("immer-state"),Rv=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Rv[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 or=Object.getPrototypeOf;function jn(e){return!!e&&!!e[Et]}function On(e){var t;return e?rf(e)||Array.isArray(e)||!!e[Hu]||!!((t=e.constructor)!=null&&t[Hu])||ci(e)||di(e):!1}var Iv=Object.prototype.constructor.toString();function rf(e){if(!e||typeof e!="object")return!1;const t=or(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)===Iv}function za(e,t){li(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function li(e){const t=e[Et];return t?t.type_:Array.isArray(e)?1:ci(e)?2:di(e)?3:0}function Bs(e,t){return li(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function af(e,t,n){const r=li(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function $v(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ci(e){return e instanceof Map}function di(e){return e instanceof Set}function wn(e){return e.copy_||e.base_}function Ts(e,t){if(ci(e))return new Map(e);if(di(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=rf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Et];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(or(e),r)}else{const r=or(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function bo(e,t=!1){return fi(e)||jn(e)||!On(e)||(li(e)>1&&(e.set=e.add=e.clear=e.delete=Lv),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>bo(r,!0))),e}function Lv(){xt(2)}function fi(e){return Object.isFrozen(e)}var zv={};function Pn(e){const t=zv[e];return t||xt(0,e),t}var Ir;function sf(){return Ir}function qv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vu(e,t){t&&(Pn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ss(e){js(e),e.drafts_.forEach(Uv),e.drafts_=null}function js(e){e===Ir&&(Ir=e.parent_)}function Ku(e){return Ir=qv(Ir,e)}function Uv(e){const t=e[Et];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zu(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Et].modified_&&(Ss(t),xt(4)),On(e)&&(e=qa(t,e),t.parent_||Ua(t,e)),t.patches_&&Pn("Patches").generateReplacementPatches_(n[Et].base_,e,t.patches_,t.inversePatches_)):e=qa(t,n,[]),Ss(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==nf?e:void 0}function qa(e,t,n){if(fi(t))return t;const r=t[Et];if(!r)return za(t,(a,i)=>Yu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ua(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),za(i,(o,l)=>Yu(e,r,a,o,l,n,s)),Ua(e,a,!1),n&&e.patches_&&Pn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Yu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&xt(5),jn(a)){const o=i&&t&&t.type_!==3&&!Bs(t.assigned_,r)?i.concat(r):void 0,l=qa(e,a,o);if(af(n,r,l),jn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(On(a)&&!fi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;qa(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ua(e,a)}}function Ua(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&bo(t,n)}function Wv(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:sf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=yo;n&&(a=[r],i=$r);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var yo={get(e,t){if(t===Et)return e;const n=wn(e);if(!Bs(n,t))return Hv(e,n,t);const r=n[t];return e.finalized_||!On(r)?r:r===Mi(e.base_,t)?(Ni(e),e.copy_[t]=Ps(r,e)):r},has(e,t){return t in wn(e)},ownKeys(e){return Reflect.ownKeys(wn(e))},set(e,t,n){const r=of(wn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Mi(wn(e),t),i=a==null?void 0:a[Et];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if($v(n,a)&&(n!==void 0||Bs(e.base_,t)))return!0;Ni(e),Os(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 Mi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ni(e),Os(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=wn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return or(e.base_)},setPrototypeOf(){xt(12)}},$r={};za(yo,(e,t)=>{$r[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$r.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),$r.set.call(this,e,t,void 0)};$r.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),yo.set.call(this,e[0],t,n,e[0])};function Mi(e,t){const n=e[Et];return(n?wn(n):e)[t]}function Hv(e,t,n){var a;const r=of(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function of(e,t){if(!(t in e))return;let n=or(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=or(n)}}function Os(e){e.modified_||(e.modified_=!0,e.parent_&&Os(e.parent_))}function Ni(e){e.copy_||(e.copy_=Ts(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Vv=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"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let a;if(On(t)){const i=Ku(this),s=Ps(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Ss(i):js(i)}return Vu(i,r),Zu(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===nf&&(a=void 0),this.autoFreeze_&&bo(a,!0),r){const i=[],s=[];Pn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else xt(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){On(e)||xt(8),jn(e)&&(e=Kv(e));const t=Ku(this),n=Ps(e,void 0);return n[Et].isManual_=!0,js(t),n}finishDraft(e,t){const n=e&&e[Et];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Vu(r,t),Zu(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=Pn("Patches").applyPatches_;return jn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ps(e,t){const n=ci(e)?Pn("MapSet").proxyMap_(e,t):di(e)?Pn("MapSet").proxySet_(e,t):Wv(e,t);return(t?t.scope_:sf()).drafts_.push(n),n}function Kv(e){return jn(e)||xt(10,e),uf(e)}function uf(e){if(!On(e)||fi(e))return e;const t=e[Et];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ts(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ts(e,!0);return za(n,(r,a)=>{af(n,r,uf(a))}),t&&(t.finalized_=!1),n}var _t=new Vv,xo=_t.produce;_t.produceWithPatches.bind(_t);_t.setAutoFreeze.bind(_t);_t.setUseStrictShallowCopy.bind(_t);_t.applyPatches.bind(_t);var Gu=_t.createDraft.bind(_t),Qu=_t.finishDraft.bind(_t),Zv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Yv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=_e.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Gv={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Q.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Wa=new WeakMap,Ha=new WeakMap,Br=new WeakMap,lf=new WeakMap,Ju=new WeakMap,Xu=new WeakMap,el=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.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 I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.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 I.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 I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.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&&I.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(!I.isAncestor(t,e)&&!I.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;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:m}=t;if(I.equals(h,m))return r;if(I.isAncestor(h,r)||I.equals(h,r)){var p=m.slice();return I.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else I.isSibling(h,m)&&(I.isAncestor(m,r)||I.equals(m,r))?I.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:I.endsBefore(m,r)||I.equals(m,r)||I.isAncestor(m,r)?(I.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):I.endsBefore(h,r)&&(I.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Lr(e){"@babel/helpers - typeof";return Lr=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},Lr(e)}function Qv(e,t){if(Lr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Lr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jv(e){var t=Qv(e,"string");return Lr(t)==="symbol"?t:String(t)}function vt(e,t,n){return t=Jv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 wr(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){vt(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 Xv=(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 Q.points(t))t[l]=_e.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var m=ue.leaf(e,u),p=m.text.slice(0,d),g=m.text.slice(d);if(m.text=p+h+g,t)for(var[f,v]of Q.points(t))t[v]=_e.transform(f,n);break}case"merge_node":{var{path:b}=n,E=ue.get(e,b),k=I.previous(b),T=ue.get(e,k),D=ue.parent(e,b),w=b[b.length-1];if(fe.isText(E)&&fe.isText(T))T.text+=E.text;else if(!fe.isText(E)&&!fe.isText(T))T.children.push(...E.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(at.stringify(E)," ").concat(at.stringify(T)));if(D.children.splice(w,1),t)for(var[S,L]of Q.points(t))t[L]=_e.transform(S,n);break}case"move_node":{var{path:M,newPath:q}=n;if(I.isAncestor(M,q))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(q,"] because the destination is inside itself."));var $=ue.get(e,M),F=ue.parent(e,M),_=M[M.length-1];F.children.splice(_,1);var P=I.transform(M,n),j=ue.get(e,I.parent(P)),W=P[P.length-1];if(j.children.splice(W,0,$),t)for(var[V,se]of Q.points(t))t[se]=_e.transform(V,n);break}case"remove_node":{var{path:re}=n,C=re[re.length-1],ee=ue.parent(e,re);if(ee.children.splice(C,1),t)for(var[K,A]of Q.points(t)){var B=_e.transform(K,n);if(t!=null&&B!=null)t[A]=B;else{var O=void 0,N=void 0;for(var[z,Y]of ue.texts(e))if(I.compare(Y,re)===-1)O=[z,Y];else{N=[z,Y];break}var U=!1;O&&N&&(I.equals(N[1],re)?U=!I.hasPrevious(N[1]):U=I.common(O[1],re).length<I.common(N[1],re).length),O&&!U?(K.path=O[1],K.offset=O[0].text.length):N?(K.path=N[1],K.offset=0):t=null}}break}case"remove_text":{var{path:ne,offset:le,text:J}=n;if(J.length===0)break;var pe=ue.leaf(e,ne),me=pe.text.slice(0,le),Fe=pe.text.slice(le+J.length);if(pe.text=me+Fe,t)for(var[Be,Te]of Q.points(t))t[Te]=_e.transform(Be,n);break}case"set_node":{var{path:$e,properties:Le,newProperties:Ue}=n;if($e.length===0)throw new Error("Cannot set properties on the root node!");var et=ue.get(e,$e);for(var Ae in Ue){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ue[Ae];We==null?delete et[Ae]:et[Ae]=We}for(var be in Le)Ue.hasOwnProperty(be)||delete et[be];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!Q.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(H)," when there is no current selection."));t=wr({},H)}for(var ae in H){var he=H[ae];if(he==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=he}}break}case"split_node":{var{path:ge,position:we,properties:Ge}=n;if(ge.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ge,"] because the root node cannot be split."));var Qe=ue.get(e,ge),ot=ue.parent(e,ge),ye=ge[ge.length-1],Ee;if(fe.isText(Qe)){var ze=Qe.text.slice(0,we),nt=Qe.text.slice(we);Qe.text=ze,Ee=wr(wr({},Ge),{},{text:nt})}else{var ut=Qe.children.slice(0,we),Ln=Qe.children.slice(we);Qe.children=ut,Ee=wr(wr({},Ge),{},{children:Ln})}if(ot.children.splice(ye+1,0,Ee),t)for(var[on,Jr]of Q.points(t))t[Jr]=_e.transform(on,n);break}}return t},eb={transform(e,t){e.children=Gu(e.children);var n=e.selection&&Gu(e.selection);try{n=Xv(e,n,t)}finally{e.children=Qu(e.children),n?e.selection=jn(n)?Qu(n):n:e.selection=null}}},tb={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)}},nb={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)}},cf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(it(r)&&it(a)){if(!cf(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 rb(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 tn(e,t){if(e==null)return{};var n=rb(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 ab=["anchor","focus"];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 ib(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){vt(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 Q={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Q.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Q.edges(e);return t},equals(e,t){return _e.equals(e.anchor,t.anchor)&&_e.equals(e.focus,t.focus)},includes(e,t){if(Q.isRange(t)){if(Q.includes(e,t.anchor)||Q.includes(e,t.focus))return!0;var[n,r]=Q.edges(e),[a,i]=Q.edges(t);return _e.isBefore(n,a)&&_e.isAfter(r,i)}var[s,o]=Q.edges(e),l=!1,u=!1;return _e.isPoint(t)?(l=_e.compare(t,s)>=0,u=_e.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=tn(e,ab),[r,a]=Q.edges(e),[i,s]=Q.edges(t),o=_e.isBefore(r,i)?i:r,l=_e.isBefore(a,s)?a:s;return _e.isBefore(l,o)?null:ib({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return _e.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return _e.equals(t,n)},isExpanded(e){return!Q.isCollapsed(e)},isForward(e){return!Q.isBackward(e)},isRange(e){return it(e)&&_e.isPoint(e.anchor)&&_e.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Q.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return xo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Q.isCollapsed(r);Q.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Q.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=_e.transform(r.anchor,t,{affinity:i}),u=_e.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},rl=e=>it(e)&&ue.isNodeList(e.children)&&!x.isEditor(e),de={isAncestor(e){return it(e)&&ue.isNodeList(e.children)},isElement:rl,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 rl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},sb=["children"],ob=["text"],al=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(at.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(at.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(at.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=I.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(at.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=tn(e,sb);return t}else{var t=tn(e,ob);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=xo({children:e.children},r=>{var[a,i]=Q.edges(t),s=ue.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!Q.includes(t,p)}});for(var[,o]of s){if(!Q.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}x.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(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.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(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=al.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return al.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(fe.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(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(at.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.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)||fe.isText(e)&&fe.isTextProps(t)&&fe.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?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.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=I.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=I.previous(o);o=h,l=ue.get(e,o);continue}o=I.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=ue.get(e,n);if(fe.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 fe.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))fe.isText(n)&&(yield[n,r])}()}};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 Ke(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){vt(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 hn={isNodeOperation(e){return hn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!it(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&it(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&it(e.properties)&&it(e.newProperties);case"set_selection":return e.properties===null&&Q.isRange(e.newProperties)||e.newProperties===null&&Q.isRange(e.properties)||it(e.properties)&&it(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&it(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>hn.isOperation(t))},isSelectionOperation(e){return hn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return hn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ke(Ke({},e),{},{type:"remove_node"});case"insert_text":return Ke(Ke({},e),{},{type:"remove_text"});case"merge_node":return Ke(Ke({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return Ke(Ke({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return Ke(Ke({},e),{},{path:r,newPath:a})}case"remove_node":return Ke(Ke({},e),{},{type:"insert_node"});case"remove_text":return Ke(Ke({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ke(Ke({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ke(Ke({},e),{},{properties:l,newProperties:null}):l==null?Ke(Ke({},e),{},{properties:null,newProperties:o}):Ke(Ke({},e),{},{properties:l,newProperties:o})}case"split_node":return Ke(Ke({},e),{},{type:"merge_node",path:I.next(e.path)})}}},sl=new WeakMap,ub=e=>{var t=sl.get(e);if(t!==void 0)return t;if(!it(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||it(e.marks))&&(e.selection===null||Q.isRange(e.selection))&&ue.isNodeList(e.children)&&hn.isOperationList(e.operations);return sl.set(e,n),n},x={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 ub(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)}},lb={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};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){vt(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 _e={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return _e.compare(e,t)===1},isBefore(e,t){return _e.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return it(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return xo(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=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.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=I.transform(i,t,ul(ul({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},ll=void 0,at={setScrubber(e){ll=e},stringify(e){return JSON.stringify(e,ll)}},cb=["text"],db=["anchor","focus"];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 Qt(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){vt(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=tn(i,cb);return s}return cf(r?a(e):e,r?a(t):t)},isText(e){return it(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.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=[Qt({},e)];for(var r of t){var a=tn(r,db),[i,s]=Q.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:m}=h.text,p=l;if(l+=m,u<=p&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(h);continue}var g=h,f=void 0,v=void 0;if(d<l){var b=d-p;v=Qt(Qt({},g),{},{text:g.text.slice(b)}),g=Qt(Qt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var E=u-p;f=Qt(Qt({},g),{},{text:g.text.slice(0,E)}),g=Qt(Qt({},g),{},{text:g.text.slice(E)})}Object.assign(g,a),f&&o.push(f),o.push(g),v&&o.push(v)}n=o}return n}},Do=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],mr=(e,t)=>{var[n]=x.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?vb(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 m=Bb(d,h);if([i,s]=r?[s,m]:[m,i],Gn(i,Ce.ZWJ)&&Gn(s,Ce.ExtPict)&&(r?l=dl(t.substring(0,o)):l=dl(t.substring(0,t.length-o)),!l)||Gn(i,Ce.RI)&&Gn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Pb(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Sb(i,s))break;o+=d.length}return o||1},fb=/\s/,hb=/[\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]/,mb=/['\u2018\u2019]/,pb=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]=wo(t,i,n);if(gb(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},wo=(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)]},gb=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(fb.test(t))return!1;if(mb.test(t)){var a=Co(n,r),[i,s]=wo(n,a,r);if(e(i,s,r))return!0}return!hb.test(t)},vb=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(yb(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(bb(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},bb=e=>e>=55296&&e<=56319,yb=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 xb=/^(?:[\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])$/,Db=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Cb=/^(?:[\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])$/,wb=/^[\u1100-\u115F\uA960-\uA97C]$/,Eb=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,_b=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,kb=/^[\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]$/,Fb=/^[\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]$/,Ab=/^(?:[\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])$/,Bb=(e,t)=>{var n=Ce.Any;return e.search(xb)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Db)!==-1&&(n|=Ce.Prepend),e.search(Cb)!==-1&&(n|=Ce.SpacingMark),e.search(wb)!==-1&&(n|=Ce.L),e.search(Eb)!==-1&&(n|=Ce.V),e.search(_b)!==-1&&(n|=Ce.T),e.search(kb)!==-1&&(n|=Ce.LV),e.search(Fb)!==-1&&(n|=Ce.LVT),e.search(Ab)!==-1&&(n|=Ce.ExtPict),n};function Gn(e,t){return(e&t)!==0}var Tb=[[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 Sb(e,t){return Tb.findIndex(n=>Gn(e,n[0])&&Gn(t,n[1]))===-1}var jb=/(?:[\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$/,dl=e=>e.search(jb)!==-1,Ob=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Pb=e=>{var t=e.match(Ob);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Mb={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]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Do(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),Q.isRange(a))if(Q.isCollapsed(a))a=a.anchor;else{var i=Q.end(a);if(!r&&x.void(e,{at:i}))return;var s=Q.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:h,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function 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 ca(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){vt(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 X=ca(ca(ca(ca({},eb),tb),nb),Mb),ka=new WeakMap,Nb=e=>ka.get(e)||!1,Rb=(e,t,n)=>{var r=ka.get(e)||!1;ka.set(e,!0);try{t(),n()}finally{ka.set(e,r)}};function df(e,t,n){var r=Wa.get(e)||[],a=Ha.get(e)||new Set,i,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Wa.set(e,i),Ha.set(e,s)}var Ib=(e,t)=>{for(var n of x.pathRefs(e))Zv.transform(n,t);for(var r of x.pointRefs(e))Yv.transform(r,t);for(var a of x.rangeRefs(e))Gv.transform(a,t);if(!Nb(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;df(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Br.get(e)||(Br.set(e,!0),Promise.resolve().then(()=>{Br.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},$b=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=fe.isText(r)?[]:Array.from(ue.nodes(r),q=>{var[,$]=q;return a.concat($)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(I.equals(d,h))return[];var m=[],p=[];for(var g of I.ancestors(d)){var f=I.transform(g,t);m.push(f)}for(var v of I.ancestors(h)){var b=I.transform(v,t);p.push(b)}var E=p[p.length-1],k=h[h.length-1],T=E.concat(k);return[...m,...p,T]}case"remove_node":{var{path:D}=t,w=I.ancestors(D);return[...w]}case"split_node":{var{path:S}=t,L=I.levels(S),M=I.next(S);return[...L,M]}default:return[]}},Lb=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},zb=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.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(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,m=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(m!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var p={text:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},qb=(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},Ub=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=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(Q.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};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){vt(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 Wb=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,m)=>{if(!fe.isText(h))return!1;var[p,g]=x.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=Q.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=ml(ml({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Br.get(e)||e.onChange()}}};function pl(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 gl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,gl(gl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function vl(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 bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,bl(bl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Kb=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Zb=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&X.delete(e,{unit:t})},Yb=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Q.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Gb=(e,t)=>[x.start(e,t),x.end(e,t)];function yl(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 xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,xl(xl({},n),{},{match:r=>de.isElement(r)&&x.isElementReadOnly(t,r)}))},Jb=(e,t)=>x.point(e,t,{edge:"end"}),Xb=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},e0=(e,t)=>{var n=x.range(e,t);return ue.fragment(e,n)};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 Cl(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){vt(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 t0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Cl(Cl({},n),{},{match:r=>de.isElement(r)&&x.isVoid(t,r)}))},n0=(e,t)=>t.children.some(n=>de.isElement(n)&&x.isBlock(e,n)),r0=(e,t)=>t.children.some(n=>fe.isText(n)||x.isInline(e,n)),a0=(e,t)=>ue.has(e,t),i0=(e,t)=>t.children.every(n=>fe.isText(n)),s0=e=>{X.splitNodes(e,{always:!0})},o0=(e,t,n)=>{X.insertNodes(e,t,n)},u0=e=>{X.splitNodes(e,{always:!0})};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 l0(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){vt(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 c0=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=l0({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},d0=(e,t)=>!e.isInline(t),f0=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),h0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},m0=(e,t,n)=>{var r=x.end(e,n);return _e.equals(t,r)},p0=e=>{var t=lf.get(e);return t===void 0?!0:t},g0=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return _e.equals(t,r)},v0=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},b0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function y0(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=x.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var x0=["text"],D0=["text"],C0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Q.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=tn(u,x0);return d}else return{}}var{path:h}=a,[m]=x.leaf(t,h);if(a.offset===0){var p=x.previous(t,{at:h,match:fe.isText}),g=x.above(t,{match:T=>de.isElement(T)&&x.isVoid(t,T)&&t.markableVoid(T)});if(!g){var f=x.above(t,{match:T=>de.isElement(T)&&x.isBlock(t,T)});if(p&&f){var[v,b]=p,[,E]=f;I.isAncestor(E,b)&&(m=v)}}}var k=tn(m,D0);return k},w0=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=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=m=>d.children.includes(m)}else i=()=>!0;var[h]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},E0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.get(t,a);return[i,a]};function _0(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(lb.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),m=x.path(e,n,{edge:"end"});u=i?m:h,d=i?h:m}var p=ue.nodes(e,{reverse:i,from:u,to:d,pass:T=>{var[D]=T;return de.isElement(D)?!!(!s&&(x.isVoid(e,D)||x.isElementReadOnly(e,D))||o&&!x.isSelectable(e,D)):!1}}),g=[],f;for(var[v,b]of p)if(!(o&&de.isElement(v)&&!x.isSelectable(e,v))){var E=f&&I.compare(b,f[1])===0;if(!(r==="highest"&&E)){if(!l(v,b)){if(a&&!E&&fe.isText(v))return;continue}if(r==="lowest"&&E){f=[v,b];continue}var k=r==="lowest"?f:[v,b];k&&(a?g.push(k):yield k),f=[v,b]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var k0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Wa.get(d)||[],s=d=>Ha.get(d)||new Set,o=d=>{var h=i(d).pop(),m=h.join(",");return s(d).delete(m),h};if(x.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(",")));Wa.set(t,l),Ha.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=x.node(t,d),[m,p]=h;de.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,v=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:v,initialDirtyPathsLength:f,operation:a}))return;var b=o(t);if(ue.has(t,b)){var E=x.node(t,b);t.normalizeNode(E,{operation:a})}v++,g=i(t)}})}},F0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},A0=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=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},B0=e=>{var t=Ju.get(e);return t||(t=new Set,Ju.set(e,t)),t},T0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.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 Q.isRange(n)&&(i==="start"?n=Q.start(n):i==="end"?n=Q.end(n):n=I.common(n.anchor.path,n.focus.path)),_e.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},S0=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=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},j0=e=>{var t=Xu.get(e);return t||(t=new Set,Xu.set(e,t)),t},O0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.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(!fe.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(Q.isRange(n)){var[u,d]=Q.edges(n);return a==="start"?u:d}return n};function P0(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=x.range(e,n),[l,u]=Q.edges(o),d=a?u:l,h=!1,m="",p=0,g=0,f=0;for(var[v,b]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(v)){if(!i&&(e.isVoid(v)||e.isElementReadOnly(v))){yield x.start(e,b);continue}if(e.isInline(v))continue;if(x.hasInlines(e,v)){var E=I.isAncestor(b,u.path)?u:x.end(e,b),k=I.isAncestor(b,l.path)?l:x.start(e,b);m=x.string(e,{anchor:k,focus:E},{voids:i}),h=!0}}if(fe.isText(v)){var T=I.equals(b,d.path);for(T?(g=a?d.offset:v.text.length-d.offset,f=d.offset):(g=v.text.length,f=a?g:0),(T||h||r==="offset")&&(yield{path:b,offset:f},h=!1);;){if(p===0){if(m==="")break;p=D(m,r,a),m=wo(m,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:f}}}}function D(w,S,L){return S==="character"?Co(w,L):S==="word"?pb(w,L):S==="line"||S==="block"?w.length:1}}()}var M0=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=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=m=>d.children.includes(m)}else i=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},N0=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=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},R0=e=>{var t=el.get(e);return t||(t=new Set,el.set(e,t)),t},I0=(e,t,n)=>{if(Q.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};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 $0(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){vt(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 L0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!fe.isText(d))return!1;var[m,p]=x.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},a=Q.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=$0({},x.marks(e)||{});delete u[t],e.marks=u,Br.get(e)||e.onChange()}}},z0=(e,t)=>{lf.set(e,t)},q0=(e,t)=>x.point(e,t,{edge:"start"}),U0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Q.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;I.equals(d,o.path)&&(h=h.slice(0,o.offset)),I.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},W0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Q.edges(n);if(i.offset!==0||s.offset!==0||Q.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:g=>de.isElement(g)&&x.isBlock(t,g),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},h=!0;for(var[m,p]of x.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(m.text!==""||I.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},H0=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},V0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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(Q.isRange(u)&&Q.isCollapsed(u)&&(h=!0,u=u.anchor),_e.isPoint(u)){var m=x.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},f=i?x.before(t,u,g)||x.start(t,[]):x.after(t,u,g)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!Q.isCollapsed(u)){if(!d){var[,v]=Q.edges(u),b=x.end(t,[]);_e.equals(v,b)||(u=x.unhangRange(t,u,{voids:l}))}var[E,k]=Q.edges(u),T=x.above(t,{match:me=>de.isElement(me)&&x.isBlock(t,me),at:E,voids:l}),D=x.above(t,{match:me=>de.isElement(me)&&x.isBlock(t,me),at:k,voids:l}),w=T&&D&&!I.equals(T[1],D[1]),S=I.equals(E.path,k.path),L=l?null:(r=x.void(t,{at:E,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:E,mode:"highest"}),M=l?null:(a=x.void(t,{at:k,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:k,mode:"highest"});if(L){var q=x.before(t,E);q&&T&&I.isAncestor(T[1],q.path)&&(E=q)}if(M){var $=x.after(t,k);$&&D&&I.isAncestor(D[1],$.path)&&(k=$)}var F=[],_;for(var P of x.nodes(t,{at:u,voids:l})){var[j,W]=P;_&&I.compare(W,_)===0||(!l&&de.isElement(j)&&(x.isVoid(t,j)||x.isElementReadOnly(t,j))||!I.isCommon(W,E.path)&&!I.isCommon(W,k.path))&&(F.push(P),_=W)}var V=Array.from(F,me=>{var[,Fe]=me;return x.pathRef(t,Fe)}),se=x.pointRef(t,E),re=x.pointRef(t,k),C="";if(!S&&!L){var ee=se.current,[K]=x.leaf(t,ee),{path:A}=ee,{offset:B}=E,O=K.text.slice(B);O.length>0&&(t.apply({type:"remove_text",path:A,offset:B,text:O}),C=O)}if(V.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>X.removeNodes(t,{at:me,voids:l})),!M){var N=re.current,[z]=x.leaf(t,N),{path:Y}=N,U=S?E.offset:0,ne=z.text.slice(U,k.offset);ne.length>0&&(t.apply({type:"remove_text",path:Y,offset:U,text:ne}),C=ne)}!S&&w&&re.current&&se.current&&X.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var le=se.unref(),J=re.unref(),pe=i?le||J:J||le;n.at==null&&pe&&X.select(t,pe)}}})},K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Do(t),batchDirty:o=!0}=r;if(n.length){if(Q.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Q.isCollapsed(s))s=s.anchor;else{var[,l]=Q.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:O=>de.isElement(O)&&x.isInline(t,O),mode:"highest",voids:i});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var m=x.after(t,h);s=m}else if(x.isStart(t,s,h)){var p=x.before(t,h);s=p}}var g=x.above(t,{match:O=>de.isElement(O)&&x.isBlock(t,O),at:s,voids:i}),[,f]=g,v=x.isStart(t,s,f),b=x.isEnd(t,s,f),E=v&&b,k=!v||v&&b,T=!b,[,D]=ue.first({children:n},[]),[,w]=ue.last({children:n},[]),S=[],L=O=>{var[N,z]=O,Y=z.length===0;return Y?!1:E?!0:!(k&&I.isAncestor(z,D)&&de.isElement(N)&&!t.isVoid(N)&&!t.isInline(N)||T&&I.isAncestor(z,w)&&de.isElement(N)&&!t.isVoid(N)&&!t.isInline(N))};for(var M of ue.nodes({children:n},{pass:L}))L(M)&&S.push(M);var q=[],$=[],F=[],_=!0,P=!1;for(var[j]of S)de.isElement(j)&&!t.isInline(j)?(_=!1,P=!0,$.push(j)):_?q.push(j):F.push(j);var[W]=x.nodes(t,{at:s,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i}),[,V]=W,se=x.isStart(t,s,V),re=x.isEnd(t,s,V),C=x.pathRef(t,b&&!F.length?I.next(f):f),ee=x.pathRef(t,re?I.next(V):V);X.splitNodes(t,{at:s,match:O=>P?de.isElement(O)&&x.isBlock(t,O):fe.isText(O)||x.isInline(t,O),mode:P?"lowest":"highest",always:P&&(!v||q.length>0)&&(!b||F.length>0),voids:i});var K=x.pathRef(t,!se||se&&re?I.next(V):V);if(X.insertNodes(t,q,{at:K.current,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),E&&!q.length&&$.length&&!F.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,$,{at:C.current,match:O=>de.isElement(O)&&x.isBlock(t,O),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,F,{at:ee.current,match:O=>fe.isText(O)||x.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),!r.at){var A;if(F.length>0&&ee.current?A=I.previous(ee.current):$.length>0&&C.current?A=I.previous(C.current):K.current&&(A=I.previous(K.current)),A){var B=x.end(t,A);X.select(t,B)}}K.unref(),C.unref(),ee.unref()}}})},Z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=Q.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=Q.edges(a);X.select(t,s)}}else return},Y0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=Q.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Q.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?x.before(t,l,d):x.after(t,l,d);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?x.before(t,u,d):x.after(t,u,d);p&&(h.focus=p)}X.setSelection(t,h)}},Q0=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){X.setSelection(e,t);return}if(!Q.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(at.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};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 kl(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){vt(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 J0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=Q.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Q.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:kl(kl({},l),n)})}},X0=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!_e.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!_e.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})}},ey=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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),Q.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Q.isCollapsed(l))l=l.anchor;else{var[,m]=Q.edges(l),p=x.pointRef(t,m);X.delete(t,{at:l}),l=p.unref()}if(_e.isPoint(l)){u==null&&(fe.isText(h)?u=q=>fe.isText(q):t.isInline(h)?u=q=>fe.isText(q)||x.isInline(t,q):u=q=>de.isElement(q)&&x.isBlock(t,q));var[g]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,v=x.pathRef(t,f),b=x.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var E=v.unref();l=b?I.next(E):E}else return}var k=I.parent(l),T=l[l.length-1];if(!(!i&&x.void(t,{at:k}))){if(o){var D=[],w=I.levels(k);Rb(t,()=>{var q=function(){var _=k.concat(T);T++;var P={type:"insert_node",path:_,node:$};t.apply(P),l=I.next(l),D.push(P),fe.isText?w.push(...Array.from(ue.nodes($),j=>{var[,W]=j;return _.concat(W)})):w.push(_)};for(var $ of n)q()},()=>{df(t,w,q=>{var $=q;for(var F of D)if(I.operationCanTransformPath(F)&&($=I.transform($,F),!$))return null;return $})})}else for(var S of n){var L=k.concat(T);T++,t.apply({type:"insert_node",path:L,node:S}),l=I.next(l)}if(l=I.previous(l),d){var M=x.end(t,l);M&&X.select(t,M)}}}})},ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?mr(t,r):T=>de.isElement(T)&&x.isBlock(t,T)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,T=>{var[,D]=T;return x.pathRef(t,D)});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=x.node(t,I.parent(d)),[m,p]=h,g=d[d.length-1],{length:f}=m.children;if(f===1){var v=I.next(p);X.moveNodes(t,{at:d,to:v,voids:i}),X.removeNodes(t,{at:p,voids:i})}else if(g===0)X.moveNodes(t,{at:d,to:p,voids:i});else if(g===f-1){var b=I.next(p);X.moveNodes(t,{at:d,to:b,voids:i})}else{var E=I.next(d),k=I.next(p);X.splitNodes(t,{at:E,voids:i}),X.moveNodes(t,{at:d,to:k,voids:i})}}}})},ny=["text"],ry=["children"],ff=(e,t)=>{if(de.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?ff(e,n.children[0]):!1}else return!x.isEditor(t)},ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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(I.isPath(a)){var[l]=x.parent(t,a);r=q=>l.children.includes(q)}else r=q=>de.isElement(q)&&x.isBlock(t,q);if(!i&&Q.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Q.isRange(a))if(Q.isCollapsed(a))a=a.anchor;else{var[,u]=Q.edges(a),d=x.pointRef(t,u);X.delete(t,{at:a}),a=d.unref(),n.at==null&&X.select(t,a)}var[h]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),m=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,v]=m;if(!(g.length===0||v.length===0)){var b=I.next(v),E=I.common(g,v),k=I.isSibling(g,v),T=Array.from(x.levels(t,{at:g}),q=>{var[$]=q;return $}).slice(E.length).slice(0,-1),D=x.above(t,{at:g,mode:"highest",match:q=>T.includes(q)&&ff(t,q)}),w=D&&x.pathRef(t,D[1]),S,L;if(fe.isText(p)&&fe.isText(f)){var M=tn(p,ny);L=f.text.length,S=M}else if(de.isElement(p)&&de.isElement(f)){var M=tn(p,ry);L=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(at.stringify(p)," ").concat(at.stringify(f)));k||X.moveNodes(t,{at:g,to:b,voids:s}),w&&X.removeNodes(t,{at:w.current,voids:s}),de.isElement(f)&&x.isEmpty(t,f)||fe.isText(f)&&f.text===""&&v[v.length-1]!==0?X.removeNodes(t,{at:v,voids:s}):t.apply({type:"merge_node",path:b,position:L,properties:S}),w&&w.unref()}}}})},iy=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?mr(e,r):p=>de.isElement(p)&&x.isBlock(e,p));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(e,g)});for(var d of u){var h=d.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&I.isSibling(m,h)&&I.isAfter(m,h)&&(o.current=I.next(o.current))}o.unref()}})},sy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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=I.isPath(s)?mr(t,s):p=>de.isElement(p)&&x.isBlock(t,p)),!r&&Q.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(t,g)});for(var d of u){var h=d.unref();if(h){var[m]=x.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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=I.isPath(i)?mr(t,i):L=>de.isElement(L)&&x.isBlock(t,L)),!l&&Q.isRange(i)&&(i=x.unhangRange(t,i,{voids:h})),d&&Q.isRange(i)){if(Q.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var m=x.rangeRef(t,i,{affinity:"inward"}),[p,g]=Q.edges(i),f=u==="lowest"?"lowest":"highest",v=x.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!v});var b=x.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:f,voids:h,always:!b}),i=m.unref(),r.at==null&&X.select(t,i)}s||(s=(L,M)=>L!==M);for(var[E,k]of x.nodes(t,{at:i,match:a,mode:u,voids:h})){var T={},D={};if(k.length!==0){var w=!1;for(var S in n)S==="children"||S==="text"||s(n[S],E[S])&&(w=!0,E.hasOwnProperty(S)&&(T[S]=E[S]),o?n[S]!=null&&(D[S]=o(E[S],n[S])):n[S]!=null&&(D[S]=n[S]));w&&t.apply({type:"set_node",path:k,properties:T,newProperties:D})}}}})},uy=(e,t)=>{if(Q.isCollapsed(t))return t.anchor;var[,n]=Q.edges(t),r=x.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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)&&x.isBlock(t,re)),Q.isRange(s)&&(s=uy(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);i=re=>re===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var m=x.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=x.void(t,{at:s,mode:"highest"}),v=0;if(!a&&f){var[b,E]=f;if(de.isElement(b)&&t.isInline(b)){var k=x.after(t,E);if(!k){var T={text:""},D=I.next(E);X.insertNodes(t,T,{at:D,voids:a}),k=x.point(t,D)}s=k,l=!0}var w=s.path.length-E.length;o=w+1,l=!0}p=x.pointRef(t,s);var S=s.path.length-o,[,L]=g,M=s.path.slice(0,S),q=o===0?s.offset:s.path[S]+v;for(var[$,F]of x.levels(t,{at:M,reverse:!0,voids:a})){var _=!1;if(F.length<L.length||F.length===0||!a&&de.isElement($)&&x.isVoid(t,$))break;var P=m.current,j=x.isEnd(t,P,F);if(l||!m||!x.isEdge(t,P,F)){_=!0;var W=ue.extractProps($);t.apply({type:"split_node",path:F,position:q,properties:W})}q=F[F.length-1]+(_||j?1:0)}if(n.at==null){var V=p.current||x.end(t,[]);X.select(t,V)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},cy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;X.setNodes(t,a,r)},dy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.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=I.isPath(s)?mr(t,s):p=>de.isElement(p)&&x.isBlock(t,p)),I.isPath(s)&&(s=x.range(t,s));var l=Q.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,p=>{var[,g]=p;return x.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=x.node(t,g),v=x.range(t,g);a&&l&&(v=Q.intersection(l.current,v)),X.liftNodes(t,{at:v,match:b=>de.isAncestor(f)&&f.children.includes(b),voids:i})};for(var m of d)h();l&&l.unref()}})};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 Al(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){vt(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 fy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.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&&(I.isPath(l)?o=mr(t,l):t.isInline(n)?o=v=>de.isElement(v)&&x.isInline(t,v)||fe.isText(v):o=v=>de.isElement(v)&&x.isBlock(t,v)),i&&Q.isRange(l)){var[u,d]=Q.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var m=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?v=>de.isElement(v)&&x.isBlock(t,v):v=>x.isEditor(v),mode:"lowest",voids:s})),p=function(){var b=Q.isRange(l)?Q.intersection(l,x.range(t,f)):l;if(!b)return 0;var E=Array.from(x.nodes(t,{at:b,match:o,mode:a,voids:s}));if(E.length>0){var[k]=E,T=E[E.length-1],[,D]=k,[,w]=T;if(D.length===0&&w.length===0)return 0;var S=I.equals(D,w)?I.parent(D):I.common(D,w),L=x.range(t,D,w),M=x.node(t,S),[q]=M,$=S.length+1,F=I.next(w.slice(0,$)),_=Al(Al({},n),{},{children:[]});X.insertNodes(t,_,{at:F,voids:s}),X.moveNodes(t,{at:L,match:P=>de.isAncestor(q)&&q.children.includes(P),to:F.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},hy=()=>{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 Ib(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wb(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kb(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zb(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yb(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lb(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zb(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $b(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qb(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ub(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hb(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vb(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gb(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qb(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jb(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xb(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return h0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)}};return e},Fn=[],my=function(){return Fn.some(function(e){return e.activeTargets.length>0})},py=function(){return Fn.some(function(e){return e.skippedTargets.length>0})},Bl="ResizeObserver loop completed with undelivered notifications.",gy=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Bl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Bl),window.dispatchEvent(e)},zr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(zr||(zr={}));var An=function(e){return Object.freeze(e)},vy=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,An(this)}return e}(),hf=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,An(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},mf=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)},Tl=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)},by=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},Tr=typeof window<"u"?window:{},da=new WeakMap,Sl=/auto|scroll/,yy=/^tb|vertical/,xy=/msie|trident/i.test(Tr.navigator&&Tr.navigator.userAgent),It=function(e){return parseFloat(e||"0")},tr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new vy((n?t:e)||0,(n?e:t)||0)},jl=An({devicePixelContentBoxSize:tr(),borderBoxSize:tr(),contentBoxSize:tr(),contentRect:new hf(0,0,0,0)}),pf=function(e,t){if(t===void 0&&(t=!1),da.has(e)&&!t)return da.get(e);if(mf(e))return da.set(e,jl),jl;var n=getComputedStyle(e),r=Eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!xy&&n.boxSizing==="border-box",i=yy.test(n.writingMode||""),s=!r&&Sl.test(n.overflowY||""),o=!r&&Sl.test(n.overflowX||""),l=r?0:It(n.paddingTop),u=r?0:It(n.paddingRight),d=r?0:It(n.paddingBottom),h=r?0:It(n.paddingLeft),m=r?0:It(n.borderTopWidth),p=r?0:It(n.borderRightWidth),g=r?0:It(n.borderBottomWidth),f=r?0:It(n.borderLeftWidth),v=h+u,b=l+d,E=f+p,k=m+g,T=o?e.offsetHeight-k-e.clientHeight:0,D=s?e.offsetWidth-E-e.clientWidth:0,w=a?v+E:0,S=a?b+k:0,L=r?r.width:It(n.width)-w-D,M=r?r.height:It(n.height)-S-T,q=L+v+D+E,$=M+b+T+k,F=An({devicePixelContentBoxSize:tr(Math.round(L*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:tr(q,$,i),contentBoxSize:tr(L,M,i),contentRect:new hf(h,l,L,M)});return da.set(e,F),F},gf=function(e,t,n){var r=pf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case zr.DEVICE_PIXEL_CONTENT_BOX:return s;case zr.BORDER_BOX:return a;default:return i}},Dy=function(){function e(t){var n=pf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=An([n.borderBoxSize]),this.contentBoxSize=An([n.contentBoxSize]),this.devicePixelContentBoxSize=An([n.devicePixelContentBoxSize])}return e}(),vf=function(e){if(mf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Cy=function(){var e=1/0,t=[];Fn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Dy(u.target),h=vf(u.target);o.push(d),u.lastReportedSize=gf(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},Ol=function(e){Fn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(vf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},wy=function(){var e=0;for(Ol(e);my();)e=Cy(),Ol(e);return py()&&gy(),e>0},Ri,bf=[],Ey=function(){return bf.splice(0).forEach(function(e){return e()})},_y=function(e){if(!Ri){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Ey()}).observe(n,r),Ri=function(){n.textContent="".concat(t?t--:t++)}}bf.push(e),Ri()},ky=function(e){_y(function(){requestAnimationFrame(e)})},Fa=0,Fy=function(){return!!Fa},Ay=250,By={attributes:!0,characterData:!0,childList:!0,subtree:!0},Pl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ml=function(e){return e===void 0&&(e=0),Date.now()+e},Ii=!1,Ty=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=Ay),!Ii){Ii=!0;var r=Ml(t);ky(function(){var a=!1;try{a=wy()}finally{if(Ii=!1,t=r-Ml(),!Fy())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,By)};document.body?n():Tr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Pl.forEach(function(n){return Tr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Pl.forEach(function(n){return Tr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ms=new Ty,Nl=function(e){!Fa&&e>0&&Ms.start(),Fa+=e,!Fa&&Ms.stop()},Sy=function(e){return!Eo(e)&&!by(e)&&getComputedStyle(e).display==="inline"},jy=function(){function e(t,n){this.target=t,this.observedBox=n||zr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=gf(this.target,this.observedBox,!0);return Sy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Oy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),fa=new WeakMap,Rl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ha=function(){function e(){}return e.connect=function(t,n){var r=new Oy(t,n);fa.set(t,r)},e.observe=function(t,n,r){var a=fa.get(t),i=a.observationTargets.length===0;Rl(a.observationTargets,n)<0&&(i&&Fn.push(a),a.observationTargets.push(new jy(n,r&&r.box)),Nl(1),Ms.schedule())},e.unobserve=function(t,n){var r=fa.get(t),a=Rl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Fn.splice(Fn.indexOf(r),1),r.observationTargets.splice(a,1),Nl(-1))},e.disconnect=function(t){var n=this,r=fa.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Py=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.");ha.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(!Tl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ha.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(!Tl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ha.unobserve(this,t)},e.prototype.disconnect=function(){ha.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),sn={};Object.defineProperty(sn,"__esModule",{value:!0});var My=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),$i={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},yf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:My?"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 ma=1;ma<20;ma++)_o["f"+ma]=111+ma;function hi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return xf(s,t)}),a=function(o){return r.some(function(l){return Df(l,o)})},i=n==null?a:a(n);return i}function Ny(e,t){return hi(e,t)}function Ry(e,t){return hi(e,{byKey:!0},t)}function xf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in $i)r[$i[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 m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=ko(m),f=$i[g];if(m.length>1&&!f&&!yf[m]&&!_o[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!f)&&(n?r.key=g:r.which=Cf(m)),f&&(r[f]=p?null:!0)}}catch(v){l=!0,u=v}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=yf[e]||e,e}var Iy=sn.default=hi,Li=sn.isHotkey=hi;sn.isCodeHotkey=Ny;sn.isKeyHotkey=Ry;sn.parseHotkey=xf;sn.compareHotkey=Df;sn.toKeyCode=Cf;sn.toKeyName=ko;function $y(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 ur(e,t){if(e==null)return{};var n=$y(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 qr(e){"@babel/helpers - typeof";return qr=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},qr(e)}function Ly(e,t){if(qr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(qr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zy(e){var t=Ly(e,"string");return qr(t)==="symbol"?t:String(t)}function jt(e,t,n){return t=zy(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),yn=()=>{var e=y.useContext(Fo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},wf=parseInt(y.version.split(".")[0],10),qy=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Il=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),gt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Qn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Uy=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Ef=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Wy=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Hy=gt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Vy=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Ky=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Zy=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Aa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",un=(!Wy||!Hy)&&!Uy&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Ao=new WeakMap,Bo=new WeakMap,_f=new WeakMap,Ba=new WeakMap,Ns=new WeakMap,Ur=new WeakMap,Bn=new WeakMap,Va=new WeakMap,mi=new WeakMap,Rs=new WeakMap,mn=new WeakMap,_n=new WeakMap,Sr=new WeakMap,Is=new WeakMap,To=new WeakMap,Mt=new WeakMap,Xt=new WeakMap,yt=new WeakMap,cn=new WeakMap,dn=new WeakMap,kf=new WeakMap,lr=Symbol("placeholder"),Ff=Symbol("mark-placeholder"),Yy=globalThis.Text,So=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Gy=e=>pn(e)&&e.nodeType===8,Tt=e=>pn(e)&&e.nodeType===1,pn=e=>{var t=So(e);return!!t&&e instanceof t.Node},$s=e=>{var t=e&&e.anchorNode&&So(e.anchorNode);return!!t&&e instanceof t.Selection},Af=e=>pn(e)&&e.nodeType===3,Qy=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Jy=e=>{var[t,n]=e;if(Tt(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;Tt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=e1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Xy=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;(Gy(a)||Tt(a)&&a.childNodes.length===0||Tt(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]},e1=(e,t,n)=>{var[r]=Bf(e,t,n);return r},Tf=e=>{var t="";if(Af(e)&&e.nodeValue)return e.nodeValue;if(Tt(e)){for(var n of Array.from(e.childNodes))t+=Tf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
70
+ `)}return t},t1=/data-slate-fragment="(.+?)"/m,n1=e=>{var t=e.getData("text/html"),[,n]=t.match(t1)||[];return n},jo=(e,t,n)=>{var{target:r}=t;if(Tt(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)},r1=0;class a1{constructor(){jt(this,"id",void 0),this.id="".concat(r1++)}}var te={androidPendingDiffs:e=>yt.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);mn.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&&X.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(de.isElement(i)&&x.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=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var h=x.range(e,d);return h}}var m,{document:p}=te.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=te.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Va.get(t);return n||(n=new a1,Va.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Bo.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=Ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(at.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!mn.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||(X.select(t,x.start(t,[])),t.onChange()),mn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=_f.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=Tt(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)=>pn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>pn(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=>!!_n.get(e),isFocused:e=>!!mn.get(e),isReadOnly:e=>!!Rs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Rs.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return de.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=mi.get(e),r=x.isEditor(t)?Ba.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(at.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=te.toDOMNode(e,n),a;x.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,m=u.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var v,b=f.childNodes[0];a=[b instanceof Yy?b:f,(v=f.textContent)!==null&&v!==void 0&&v.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var E=Math.min(h,Math.max(0,t.offset-o));a=[d,E];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Q.isBackward(t),i=te.toDOMPoint(e,n),s=Q.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,m]=a?i:s,p=Tt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Tt(h)?h:h.parentElement,v=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,v?1:m),l},toSlateNode:(e,t)=>{var n=Tt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Ur.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:Jy(t),o=i.parentNode,l=null,u=0;if(o){var d,h,m=te.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),v=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var b=te.getWindow(e),E=b.document.createRange();E.setStart(l,0),E.setEnd(i,s);var k=E.cloneContents(),T=[...Array.prototype.slice.call(k.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(k.querySelectorAll("[contenteditable=false]"))];T.forEach(P=>{if(gt&&!r&&P.hasAttribute("data-slate-zero-width")&&P.textContent.length>0&&P.textContext!=="\uFEFF"){P.textContent.startsWith("\uFEFF")&&(P.textContent=P.textContent.slice(1));return}P.parentNode.removeChild(P)}),u=k.textContent.length,v=l}}else if(g){for(var D=g.querySelectorAll("[data-slate-leaf]"),w=0;w<D.length;w++){var S=D[w];if(te.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),v=f,u=v.textContent.length,v.querySelectorAll("[data-slate-zero-width]").forEach(P=>{u-=P.textContent.length})):u=1}v&&u===v.textContent.length&&gt&&v.getAttribute("data-slate-zero-width")==="z"&&(d=v.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Qn&&(h=v.textContent)!==null&&h!==void 0&&h.endsWith(`
71
71
 
72
- `))&&u--}if(gt&&!l&&!r){var L=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(L&&te.hasDOMNode(e,L,{editable:!0})){var N=te.toSlateNode(e,L),{path:q,offset:$}=x.start(e,te.findPath(e,N));return L.querySelector("[data-slate-leaf]")||($=s),{path:q,offset:$}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var F=te.toSlateNode(e,l),_=te.findPath(e,F);return{path:_,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=$s(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if($s(t)){if(Qn&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let C=function(S){return S.childElementCount>0?C(S.children[0]):S};var g=m.startContainer,f=p.startContainer,v=C(g.children[m.startOffset]),b=C(f.children[p.startOffset]);d=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,v.childNodes.length>0?u=v.childNodes[0]:u=v,b instanceof HTMLElement?l=b.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,d=m.startOffset):(o=m.startContainer,l=m.endOffset,d=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Ef&&Xy(o)||Qn?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(Qn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
72
+ `))&&u--}if(gt&&!l&&!r){var L=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(L&&te.hasDOMNode(e,L,{editable:!0})){var M=te.toSlateNode(e,L),{path:q,offset:$}=x.start(e,te.findPath(e,M));return L.querySelector("[data-slate-leaf]")||($=s),{path:q,offset:$}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var F=te.toSlateNode(e,l),_=te.findPath(e,F);return{path:_,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=$s(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if($s(t)){if(Qn&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let w=function(S){return S.childElementCount>0?w(S.children[0]):S};var g=m.startContainer,f=p.startContainer,v=w(g.children[m.startOffset]),b=w(f.children[p.startOffset]);d=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,v.childNodes.length>0?u=v.childNodes[0]:u=v,b instanceof HTMLElement?l=b.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,d=m.startOffset):(o=m.startContainer,l=m.endOffset,d=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Ef&&Xy(o)||Qn?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(Qn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
73
73
 
74
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var E;u=o,d=((E=o.textContent)===null||E===void 0?void 0:E.length)||0}var k=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var T=h?k:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!T)return null;var D={anchor:k,focus:T};return Q.isExpanded(D)&&Q.isForward(D)&&Tt(u)&&x.void(e,{at:D.focus,mode:"highest"})&&(D=x.unhangRange(e,D,{voids:!0})),D}};function i1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=ue.get(e,n);if(!fe.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=I.next(n);if(!x.hasPath(e,i))return!1;var s=ue.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Sf(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 s1(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 o1(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 jf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=s1(i,a),o=Math.min(i.length-s,a.length-s),l=o1(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 u1(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=Sf(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 jf(e,{start:r,end:l,text:o})}function l1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ls(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=ue.get(e,n);if(!fe.isText(a))return null;var i=x.above(e,{match:o=>de.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:fe.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function $l(e,t){var n=Ls(e,t.anchor);if(!n)return null;if(Q.isCollapsed(t))return{anchor:n,focus:n};var r=Ls(e,t.focus);return r?{anchor:n,focus:r}:null}function zs(e,t,n){var r=yt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return I.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return _e.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=_e.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=_e.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.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 Ll(e,t,n){var r=zs(e,t.anchor,n);if(!r)return null;if(Q.isCollapsed(t))return{anchor:r,focus:r};var a=zs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function c1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.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!I.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!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.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:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}: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 pa(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){jt(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 d1=25,f1=200,h1=function(){},m1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function p1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var F=dn.get(t);if(dn.delete(t),F){var{selection:_}=t,P=$l(t,F);P&&(!_||!Q.equals(P,_))&&X.select(t,P)}},h=()=>{var F=cn.get(t);if(cn.delete(t),!!F){if(F.at){var _=_e.isPoint(F.at)?Ls(t,F.at):$l(t,F.at);if(!_)return;var P=x.range(t,_);(!t.selection||!Q.equals(t.selection,P))&&X.select(t,_)}F.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!T()&&!k()){d();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var F=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});Xt.set(t,t.marks),h1("flush",cn.get(t),yt.get(t));for(var _=T(),P;P=(j=yt.get(t))===null||j===void 0?void 0:j[0];){var j,W,V=Mt.get(t);V!==void 0&&(Mt.delete(t),t.marks=V),V&&u===!1&&(u=null);var se=l1(P);(!t.selection||!Q.equals(t.selection,se))&&X.select(t,se),P.diff.text?x.insertText(t,P.diff.text):x.deleteFragment(t),yt.set(t,(W=yt.get(t))===null||W===void 0?void 0:W.filter(ee=>{var{id:K}=ee;return K!==P.id})),i1(t,P)||(_=!1,cn.delete(t),Xt.delete(t),a="action",dn.delete(t),n.cancel(),r.cancel(),F==null||F.unref())}var re=F==null?void 0:F.unref();if(re&&!dn.get(t)&&(!t.selection||!Q.equals(re,t.selection))&&X.select(t,re),k()){h();return}_&&n(),n.flush(),r.flush(),d();var w=Xt.get(t);Xt.delete(t),w!==void 0&&(t.marks=w,t.onChange())},p=F=>{i&&clearTimeout(i),i=setTimeout(()=>{_n.set(t,!1),m()},d1)},g=F=>{_n.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=Ns.get(t);if(P){if(T()||_){P.style.display="none";return}P.style.removeProperty("display")}},v=(F,_)=>{var P,j=(P=yt.get(t))!==null&&P!==void 0?P:[];yt.set(t,j);var W=ue.leaf(t,F),V=j.findIndex(w=>I.equals(w.path,F));if(V<0){var se=jf(W.text,_);se&&j.push({path:F,diff:_,id:l++}),f();return}var re=u1(W.text,j[V].diff,_);if(!re){j.splice(V,1),f();return}j[V]=pa(pa({},j[V]),{},{diff:re})},b=function(_){var{at:P}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,dn.delete(t),n.cancel(),r.cancel(),k()&&m(),cn.set(t,{at:P,run:_}),o=setTimeout(m)},E=F=>{var _;s&&(clearTimeout(s),s=null);var{inputType:P}=F,j=null,W=F.dataTransfer||F.data||void 0;u!==!1&&P!=="insertText"&&P!=="insertCompositionText"&&(u=!1);var[V]=F.getTargetRanges();V&&(j=te.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var se=te.getWindow(t),re=se.getSelection();if(!j&&re&&(V=re,j=te.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),j=(_=j)!==null&&_!==void 0?_:t.selection,!!j){var w=!0;if(P.startsWith("delete")){if(Q.isExpanded(j)){var[ee,K]=Q.edges(j),A=ue.leaf(t,ee.path);if(A.text.length===ee.offset&&K.offset===0){var B=x.next(t,{at:ee.path,match:fe.isText});B&&I.equals(B[1],K.path)&&(j={anchor:K,focus:K})}}var O=P.endsWith("Backward")?"backward":"forward",[M,z]=Q.edges(j),[Y,U]=x.leaf(t,M.path),ne={text:"",start:M.offset,end:z.offset},le=yt.get(t),J=le==null?void 0:le.find(ge=>I.equals(ge.path,U)),pe=J?[J.diff,ne]:[ne],me=Sf(Y.text,...pe);if(me.length===0&&(w=!1),Q.isExpanded(j)){if(w&&I.equals(j.anchor.path,j.focus.path)){var Fe={path:j.anchor.path,offset:M.offset},Be=x.range(t,Fe,Fe);return S(Be),v(j.anchor.path,{text:"",end:z.offset,start:M.offset})}return b(()=>x.deleteFragment(t,{direction:O}),{at:j})}}switch(P){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>x.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=j;if(w&&Q.isCollapsed(j)){var $e=ue.leaf(t,Te.path);if(Te.offset<$e.text.length)return v(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return b(()=>x.deleteForward(t),{at:j})}case"deleteContentBackward":{var Le,{anchor:Ue}=j,et=$s(V)?V.isCollapsed:!!((Le=V)!==null&&Le!==void 0&&Le.collapsed);return w&&et&&Q.isCollapsed(j)&&Ue.offset>0?v(Ue.path,{text:"",start:Ue.offset-1,end:Ue.offset}):b(()=>x.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return b(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return b(()=>x.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return b(()=>x.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return b(()=>x.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return b(()=>x.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return b(()=>x.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return b(()=>x.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return b(()=>x.insertSoftBreak(t),{at:j});case"insertParagraph":return b(()=>x.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(m1(W))return b(()=>te.insertData(t,W),{at:j});var Ae=W??"";if(Mt.get(t)&&(Ae=Ae.replace("\uFEFF","")),P==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
74
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var E;u=o,d=((E=o.textContent)===null||E===void 0?void 0:E.length)||0}var k=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var T=h?k:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!T)return null;var D={anchor:k,focus:T};return Q.isExpanded(D)&&Q.isForward(D)&&Tt(u)&&x.void(e,{at:D.focus,mode:"highest"})&&(D=x.unhangRange(e,D,{voids:!0})),D}};function i1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=ue.get(e,n);if(!fe.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=I.next(n);if(!x.hasPath(e,i))return!1;var s=ue.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Sf(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 s1(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 o1(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 jf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=s1(i,a),o=Math.min(i.length-s,a.length-s),l=o1(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 u1(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=Sf(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 jf(e,{start:r,end:l,text:o})}function l1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ls(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=ue.get(e,n);if(!fe.isText(a))return null;var i=x.above(e,{match:o=>de.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:fe.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function $l(e,t){var n=Ls(e,t.anchor);if(!n)return null;if(Q.isCollapsed(t))return{anchor:n,focus:n};var r=Ls(e,t.focus);return r?{anchor:n,focus:r}:null}function zs(e,t,n){var r=yt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return I.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return _e.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=_e.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=_e.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.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 Ll(e,t,n){var r=zs(e,t.anchor,n);if(!r)return null;if(Q.isCollapsed(t))return{anchor:r,focus:r};var a=zs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function c1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.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!I.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!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.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:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}: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 pa(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){jt(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 d1=25,f1=200,h1=function(){},m1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function p1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var F=dn.get(t);if(dn.delete(t),F){var{selection:_}=t,P=$l(t,F);P&&(!_||!Q.equals(P,_))&&X.select(t,P)}},h=()=>{var F=cn.get(t);if(cn.delete(t),!!F){if(F.at){var _=_e.isPoint(F.at)?Ls(t,F.at):$l(t,F.at);if(!_)return;var P=x.range(t,_);(!t.selection||!Q.equals(t.selection,P))&&X.select(t,_)}F.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!T()&&!k()){d();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var F=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});Xt.set(t,t.marks),h1("flush",cn.get(t),yt.get(t));for(var _=T(),P;P=(j=yt.get(t))===null||j===void 0?void 0:j[0];){var j,W,V=Mt.get(t);V!==void 0&&(Mt.delete(t),t.marks=V),V&&u===!1&&(u=null);var se=l1(P);(!t.selection||!Q.equals(t.selection,se))&&X.select(t,se),P.diff.text?x.insertText(t,P.diff.text):x.deleteFragment(t),yt.set(t,(W=yt.get(t))===null||W===void 0?void 0:W.filter(ee=>{var{id:K}=ee;return K!==P.id})),i1(t,P)||(_=!1,cn.delete(t),Xt.delete(t),a="action",dn.delete(t),n.cancel(),r.cancel(),F==null||F.unref())}var re=F==null?void 0:F.unref();if(re&&!dn.get(t)&&(!t.selection||!Q.equals(re,t.selection))&&X.select(t,re),k()){h();return}_&&n(),n.flush(),r.flush(),d();var C=Xt.get(t);Xt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},p=F=>{i&&clearTimeout(i),i=setTimeout(()=>{_n.set(t,!1),m()},d1)},g=F=>{_n.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=Ns.get(t);if(P){if(T()||_){P.style.display="none";return}P.style.removeProperty("display")}},v=(F,_)=>{var P,j=(P=yt.get(t))!==null&&P!==void 0?P:[];yt.set(t,j);var W=ue.leaf(t,F),V=j.findIndex(C=>I.equals(C.path,F));if(V<0){var se=jf(W.text,_);se&&j.push({path:F,diff:_,id:l++}),f();return}var re=u1(W.text,j[V].diff,_);if(!re){j.splice(V,1),f();return}j[V]=pa(pa({},j[V]),{},{diff:re})},b=function(_){var{at:P}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,dn.delete(t),n.cancel(),r.cancel(),k()&&m(),cn.set(t,{at:P,run:_}),o=setTimeout(m)},E=F=>{var _;s&&(clearTimeout(s),s=null);var{inputType:P}=F,j=null,W=F.dataTransfer||F.data||void 0;u!==!1&&P!=="insertText"&&P!=="insertCompositionText"&&(u=!1);var[V]=F.getTargetRanges();V&&(j=te.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var se=te.getWindow(t),re=se.getSelection();if(!j&&re&&(V=re,j=te.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),j=(_=j)!==null&&_!==void 0?_:t.selection,!!j){var C=!0;if(P.startsWith("delete")){if(Q.isExpanded(j)){var[ee,K]=Q.edges(j),A=ue.leaf(t,ee.path);if(A.text.length===ee.offset&&K.offset===0){var B=x.next(t,{at:ee.path,match:fe.isText});B&&I.equals(B[1],K.path)&&(j={anchor:K,focus:K})}}var O=P.endsWith("Backward")?"backward":"forward",[N,z]=Q.edges(j),[Y,U]=x.leaf(t,N.path),ne={text:"",start:N.offset,end:z.offset},le=yt.get(t),J=le==null?void 0:le.find(ge=>I.equals(ge.path,U)),pe=J?[J.diff,ne]:[ne],me=Sf(Y.text,...pe);if(me.length===0&&(C=!1),Q.isExpanded(j)){if(C&&I.equals(j.anchor.path,j.focus.path)){var Fe={path:j.anchor.path,offset:N.offset},Be=x.range(t,Fe,Fe);return S(Be),v(j.anchor.path,{text:"",end:z.offset,start:N.offset})}return b(()=>x.deleteFragment(t,{direction:O}),{at:j})}}switch(P){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>x.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=j;if(C&&Q.isCollapsed(j)){var $e=ue.leaf(t,Te.path);if(Te.offset<$e.text.length)return v(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return b(()=>x.deleteForward(t),{at:j})}case"deleteContentBackward":{var Le,{anchor:Ue}=j,et=$s(V)?V.isCollapsed:!!((Le=V)!==null&&Le!==void 0&&Le.collapsed);return C&&et&&Q.isCollapsed(j)&&Ue.offset>0?v(Ue.path,{text:"",start:Ue.offset-1,end:Ue.offset}):b(()=>x.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return b(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return b(()=>x.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return b(()=>x.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return b(()=>x.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return b(()=>x.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return b(()=>x.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return b(()=>x.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return b(()=>x.insertSoftBreak(t),{at:j});case"insertParagraph":return b(()=>x.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(m1(W))return b(()=>te.insertData(t,W),{at:j});var Ae=W??"";if(Mt.get(t)&&(Ae=Ae.replace("\uFEFF","")),P==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
75
75
  `))return b(()=>{var ge=Ae.split(`
76
- `);ge.forEach((we,Ge)=>{we&&x.insertText(t,we),Ge!==ge.length-1&&x.insertSoftBreak(t)})},{at:j});if(I.equals(j.anchor.path,j.focus.path)){var[We,be]=Q.edges(j),H={start:We.offset,end:be.offset,text:Ae};if(Ae&&u&&P==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),he=H.start+H.text.search(/\S|$/);he===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,q()):u=!1}else P==="insertText"?u===null?u=H:u&&Q.isCollapsed(j)&&u.end+u.text.length===We.offset?u=pa(pa({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(w){v(We.path,H);return}}return b(()=>x.insertText(t,Ae),{at:j})}}}},k=()=>!!cn.get(t),T=()=>{var F;return!!((F=yt.get(t))!==null&&F!==void 0&&F.length)},D=()=>k()||T(),C=()=>a,S=F=>{dn.set(t,F),s&&(clearTimeout(s),s=null);var{selection:_}=t;if(F){var P=!_||!I.equals(_.anchor.path,F.anchor.path),j=!_||!I.equals(_.anchor.path.slice(0,-1),F.anchor.path.slice(0,-1));(P&&u||j)&&(u=!1),(P||T())&&(s=setTimeout(m,f1))}},L=()=>{(k()||!T())&&m()},N=F=>{T()||(f(!0),setTimeout(f))},q=()=>{k()||(o=setTimeout(m))},$=F=>{if(!(T()||k())&&F.some(P=>jo(t,P,F))){var _;(_=kf.get(t))===null||_===void 0||_()}};return{flush:m,scheduleFlush:q,hasPendingDiffs:T,hasPendingAction:k,hasPendingChanges:D,isFlushing:C,handleUserSelect:S,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:E,handleKeyDown:N,handleDomMutations:$,handleInput:L}}function g1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Wr=Aa?y.useLayoutEffect:y.useEffect;function v1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Wr(()=>{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 b1=["node"];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 y1(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){jt(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 x1={subtree:!0,childList:!0,characterData:!0},D1=gt?e=>{var{node:t}=e,n=ur(e,b1);if(!gt)return null;var r=yn(),a=g1(),[i]=y.useState(()=>p1(y1({editor:r},n)));return v1(t,i.handleDomMutations,x1),To.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,C1=["anchor","focus"],w1=["anchor","focus"],E1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Of=(e,t)=>{var n=ur(e,C1),r=ur(t,w1);return e[lr]===t[lr]&&E1(n,r)},_1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!Q.equals(r,a)||!Of(r,a))return!1}return!0},k1=(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||!Of(r,a))return!1}return!0};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 F1(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){jt(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 A1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=yn(),s=te.findPath(i,a),o=I.parent(s),l=!!n[Ff];return i.isVoid(r)?y.createElement(zi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(zi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(zi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
76
+ `);ge.forEach((we,Ge)=>{we&&x.insertText(t,we),Ge!==ge.length-1&&x.insertSoftBreak(t)})},{at:j});if(I.equals(j.anchor.path,j.focus.path)){var[We,be]=Q.edges(j),H={start:We.offset,end:be.offset,text:Ae};if(Ae&&u&&P==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),he=H.start+H.text.search(/\S|$/);he===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,q()):u=!1}else P==="insertText"?u===null?u=H:u&&Q.isCollapsed(j)&&u.end+u.text.length===We.offset?u=pa(pa({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(C){v(We.path,H);return}}return b(()=>x.insertText(t,Ae),{at:j})}}}},k=()=>!!cn.get(t),T=()=>{var F;return!!((F=yt.get(t))!==null&&F!==void 0&&F.length)},D=()=>k()||T(),w=()=>a,S=F=>{dn.set(t,F),s&&(clearTimeout(s),s=null);var{selection:_}=t;if(F){var P=!_||!I.equals(_.anchor.path,F.anchor.path),j=!_||!I.equals(_.anchor.path.slice(0,-1),F.anchor.path.slice(0,-1));(P&&u||j)&&(u=!1),(P||T())&&(s=setTimeout(m,f1))}},L=()=>{(k()||!T())&&m()},M=F=>{T()||(f(!0),setTimeout(f))},q=()=>{k()||(o=setTimeout(m))},$=F=>{if(!(T()||k())&&F.some(P=>jo(t,P,F))){var _;(_=kf.get(t))===null||_===void 0||_()}};return{flush:m,scheduleFlush:q,hasPendingDiffs:T,hasPendingAction:k,hasPendingChanges:D,isFlushing:w,handleUserSelect:S,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:E,handleKeyDown:M,handleDomMutations:$,handleInput:L}}function g1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Wr=Aa?y.useLayoutEffect:y.useEffect;function v1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Wr(()=>{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 b1=["node"];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 y1(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){jt(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 x1={subtree:!0,childList:!0,characterData:!0},D1=gt?e=>{var{node:t}=e,n=ur(e,b1);if(!gt)return null;var r=yn(),a=g1(),[i]=y.useState(()=>p1(y1({editor:r},n)));return v1(t,i.handleDomMutations,x1),To.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,C1=["anchor","focus"],w1=["anchor","focus"],E1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Of=(e,t)=>{var n=ur(e,C1),r=ur(t,w1);return e[lr]===t[lr]&&E1(n,r)},_1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!Q.equals(r,a)||!Of(r,a))return!1}return!0},k1=(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||!Of(r,a))return!1}return!0};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 F1(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){jt(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 A1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=yn(),s=te.findPath(i,a),o=I.parent(s),l=!!n[Ff];return i.isVoid(r)?y.createElement(zi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(zi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(zi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
77
77
  `?y.createElement(Wl,{isTrailing:!0,text:n.text}):y.createElement(Wl,{text:n.text})},Wl=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
78
- `:""),[i]=y.useState(a);return Wr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(B1,{ref:r},i)},B1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),zi=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",F1({},a),!gt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};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 Pf(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){jt(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 T1=gt?300:0;function S1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Vl(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=E=>y.createElement(P1,Pf({},E))}=e,o=yn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),m=y.useRef(null),p=y.useCallback(E=>{if(S1(l,E==null),E==null){var k;Ns.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(Ns.set(o,E),!l.current){var T=window.ResizeObserver||Py;l.current=new T(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,E)})}l.current.observe(E),u.current=E}},[u,t,o]),g=y.createElement(A1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[lr];if(y.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},T1)):(Vl(m),h(!1)),()=>Vl(m)),[f,h]),f&&d){var v={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:Fr?"inherit":void 0},contentEditable:!1,ref:p}};g=y.createElement(y.Fragment,null,i(v),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},O1=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&&fe.equals(t.leaf,e.leaf)&&t.leaf[lr]===e.leaf[lr]),P1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Pf({},t),n)},M1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=yn(),l=y.useRef(null),u=fe.decorations(s,t),d=te.findKey(o,s),h=[],m=0;m<u.length;m++){var p=u[m];h.push(y.createElement(O1,{isLast:n&&m===u.length-1,key:"".concat(d.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var v=mi.get(o);f?(v==null||v.set(d,f),Bn.set(s,f),Ur.set(f,s)):(v==null||v.delete(d),Bn.delete(s),l.current&&Ur.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},h)},Mf=y.memo(M1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&k1(t.decorations,e.decorations));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 qs(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){jt(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 N1=e=>{var{decorations:t,element:n,renderElement:r=E=>y.createElement(I1,qs({},E)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=yn(),l=z1(),u=o.isInline(n),d=te.findKey(o,n),h=y.useCallback(E=>{var k=mi.get(o);E?(k==null||k.set(d,E),Bn.set(n,E),Ur.set(E,n)):(k==null||k.delete(d),Bn.delete(n))},[o,d,n]),m=Rf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:h};if(u&&(p["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var g=ue.string(n),f=Qd(g);f==="rtl"&&(p.dir=f)}if(x.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var v=u?"span":"div",[[b]]=ue.texts(n);m=y.createElement(v,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Mf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),Ao.set(b,0),Bo.set(b,n)}return r({attributes:p,children:m,element:n})},R1=y.memo(N1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&_1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Q.equals(e.selection,t.selection))),I1=e=>{var{attributes:t,children:n,element:r}=e,a=yn(),i=a.isInline(r)?"span":"div";return y.createElement(i,qs(qs({},t),{},{style:{position:"relative"}}),n)},Nf=y.createContext(()=>[]),$1=()=>y.useContext(Nf),L1=y.createContext(!1),Rf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=$1(),l=yn(),u=te.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],f=te.findKey(l,g),v=x.range(l,p),b=s&&Q.intersection(v,s),E=o([g,p]);for(var k of t){var T=Q.intersection(k,v);T&&E.push(T)}de.isElement(g)?d.push(y.createElement(L1.Provider,{key:"provider-".concat(f.id),value:!!b},y.createElement(R1,{decorations:E,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):d.push(y.createElement(Mf,{decorations:E,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Ao.set(g,m),Bo.set(g,n)}return d},If=y.createContext(!1),z1=()=>y.useContext(If),$f=y.createContext(null),$n=()=>{var e=y.useContext($f);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function q1(){var e=yn(),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 U1=3,W1={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"},H1={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"},V1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ze=e=>{var t=W1[e],n=H1[e],r=V1[e],a=t&&Li(t),i=n&&Li(n),s=r&&Li(r);return o=>!!(a&&a(o)||Il&&i&&i(o)||!Il&&s&&s(o))},Ye={isBold:Ze("bold"),isCompose:Ze("compose"),isMoveBackward:Ze("moveBackward"),isMoveForward:Ze("moveForward"),isDeleteBackward:Ze("deleteBackward"),isDeleteForward:Ze("deleteForward"),isDeleteLineBackward:Ze("deleteLineBackward"),isDeleteLineForward:Ze("deleteLineForward"),isDeleteWordBackward:Ze("deleteWordBackward"),isDeleteWordForward:Ze("deleteWordForward"),isExtendBackward:Ze("extendBackward"),isExtendForward:Ze("extendForward"),isExtendLineBackward:Ze("extendLineBackward"),isExtendLineForward:Ze("extendLineForward"),isItalic:Ze("italic"),isMoveLineBackward:Ze("moveLineBackward"),isMoveLineForward:Ze("moveLineForward"),isMoveWordBackward:Ze("moveWordBackward"),isMoveWordForward:Ze("moveWordForward"),isRedo:Ze("redo"),isSoftBreak:Ze("insertSoftBreak"),isSplitBlock:Ze("splitBlock"),isTransposeCharacter:Ze("transposeCharacter"),isUndo:Ze("undo")},K1=(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}},Z1={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Lf extends y.Component{constructor(){super(...arguments),jt(this,"context",null),jt(this,"manager",null),jt(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,Z1)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=K1(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}}jt(Lf,"contextType",Fo);var Y1=gt?Lf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},G1=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Q1=["text"];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 Lt(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){jt(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 J1=e=>y.createElement(y.Fragment,null,Rf(e)),X1=e=>{var t=y.useCallback(B=>y.createElement(ex,Lt({},B)),[]),{autoFocus:n,decorate:r=tx,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=nx,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=ur(e,G1),f=$n(),[v,b]=y.useState(!1),E=y.useRef(null),k=y.useRef([]),[T,D]=y.useState(),{onUserInput:C,receivedUserInput:S}=q1(),[,L]=y.useReducer(B=>B+1,0);kf.set(f,L),Rs.set(f,s);var N=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{E.current&&n&&E.current.focus()},[n]);var q=y.useRef(),$=y.useMemo(()=>Ov(()=>{var B=q.current;if((gt||!te.isComposing(f))&&(!N.isUpdatingSelection||B!=null&&B.isFlushing())&&!N.isDraggingInternally){var O=te.findDocumentOrShadowRoot(f),{activeElement:M}=O,z=te.toDOMNode(f,f),Y=O.getSelection();if(M===z?(N.latestElement=M,mn.set(f,!0)):mn.delete(f),!Y)return X.deselect(f);var{anchorNode:U,focusNode:ne}=Y,le=te.hasEditableTarget(f,U)||te.isTargetInsideNonReadonlyVoid(f,U),J=te.hasEditableTarget(f,ne)||te.isTargetInsideNonReadonlyVoid(f,ne);if(le&&J){var pe=te.toSlateRange(f,Y,{exactMatch:!1,suppressThrow:!0});pe&&(!te.isComposing(f)&&!(B!=null&&B.hasPendingChanges())&&!(B!=null&&B.isFlushing())?X.select(f,pe):B==null||B.handleUserSelect(pe))}s&&(!le||!J)&&X.deselect(f)}},100),[f,s,N]),F=y.useMemo(()=>Fv($,0),[$]);q.current=D1({node:E,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:F}),Wr(()=>{var B,O,M;E.current&&(M=So(E.current))?(_f.set(f,M),Ba.set(f,E.current),Bn.set(f,E.current),Ur.set(E.current,f)):Bn.delete(f);var{selection:z}=f,Y=te.findDocumentOrShadowRoot(f),U=Y.getSelection();if(!(!U||!te.isFocused(f)||(B=q.current)!==null&&B!==void 0&&B.hasPendingAction())){var ne=me=>{var Fe=U.type!=="None";if(!(!z&&!Fe)){var Be=U.focusNode,Te;if(Qn&&U.rangeCount>1){var $e=U.getRangeAt(0),Le=U.getRangeAt(U.rangeCount-1);$e.startContainer===Be?Te=Le.endContainer:Te=$e.startContainer}else Te=U.anchorNode;var Ue=Ba.get(f),et=!1;if(Ue.contains(Te)&&Ue.contains(Be)&&(et=!0),Fe&&et&&z&&!me){var Ae=te.toSlateRange(f,U,{exactMatch:!0,suppressThrow:!0});if(Ae&&Q.equals(Ae,z)){var We;if(!N.hasMarkPlaceholder||(We=Te)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(z&&!te.hasRange(f,z)){f.selection=te.toSlateRange(f,U,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var be=z&&te.toDOMRange(f,z);return be?(te.isComposing(f)&&!gt?U.collapseToEnd():Q.isBackward(z)?U.setBaseAndExtent(be.endContainer,be.endOffset,be.startContainer,be.startOffset):U.setBaseAndExtent(be.startContainer,be.startOffset,be.endContainer,be.endOffset),d(f,be)):U.removeAllRanges(),be}};U.rangeCount<=1&&ne();var le=((O=q.current)===null||O===void 0?void 0:O.isFlushing())==="action";if(!gt||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var J=null,pe=requestAnimationFrame(()=>{if(le){var me=Fe=>{try{var Be=te.toDOMNode(f,f);Be.focus(),ne(Fe)}catch{}};me(),J=setTimeout(()=>{me(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),J&&clearTimeout(J)}}});var _=y.useCallback(B=>{if(C(),!s&&te.hasEditableTarget(f,B.target)&&!rx(B,a)){var O;if(q.current)return q.current.handleDOMBeforeInput(B);F.flush(),$.flush();var{selection:M}=f,{inputType:z}=B,Y=B.dataTransfer||B.data||void 0,U=z==="insertCompositionText"||z==="deleteCompositionText";if(U&&te.isComposing(f))return;var ne=!1;if(z==="insertText"&&M&&Q.isCollapsed(M)&&B.data&&B.data.length===1&&/[a-z ]/i.test(B.data)&&M.anchor.offset!==0){var le,J;ne=!0,f.marks&&(ne=!1);var{anchor:pe}=M,[me,Fe]=te.toDOMPoint(f,pe),Be=(le=me.parentElement)===null||le===void 0?void 0:le.closest("a"),Te=te.getWindow(f);if(ne&&Be&&te.hasDOMNode(f,Be)){var $e,Le=Te==null?void 0:Te.document.createTreeWalker(Be,NodeFilter.SHOW_TEXT).lastChild();Le===me&&(($e=Le.textContent)===null||$e===void 0?void 0:$e.length)===Fe&&(ne=!1)}if(ne&&me.parentElement&&(Te==null||(J=Te.getComputedStyle(me.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ue=x.above(f,{at:pe.path,match:ae=>de.isElement(ae)&&x.isBlock(f,ae)});Ue&&ue.string(Ue[0]).includes(" ")&&(ne=!1)}}if(!z.startsWith("delete")||z.startsWith("deleteBy")){var[et]=B.getTargetRanges();if(et){var Ae=te.toSlateRange(f,et,{exactMatch:!1,suppressThrow:!1});if(!M||!Q.equals(M,Ae)){ne=!1;var We=!U&&f.selection&&x.rangeRef(f,f.selection);X.select(f,Ae),We&&Sr.set(f,We)}}}if(U)return;if(ne||B.preventDefault(),M&&Q.isExpanded(M)&&z.startsWith("delete")){var be=z.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:be});return}switch(z){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{z==="insertFromComposition"&&te.isComposing(f)&&(b(!1),_n.set(f,!1)),(Y==null?void 0:Y.constructor.name)==="DataTransfer"?te.insertData(f,Y):typeof Y=="string"&&(ne?k.current.push(()=>x.insertText(f,Y)):x.insertText(f,Y));break}}var H=(O=Sr.get(f))===null||O===void 0?void 0:O.unref();Sr.delete(f),H&&(!f.selection||!Q.equals(f.selection,H))&&X.select(f,H)}},[f,$,C,a,s,F]),P=y.useCallback(B=>{B==null?($.cancel(),F.cancel(),Ba.delete(f),Bn.delete(f),E.current&&un&&E.current.removeEventListener("beforeinput",_)):un&&B.addEventListener("beforeinput",_),E.current=B},[$,F,f,_]);Wr(()=>{var B=te.getWindow(f);return B.document.addEventListener("selectionchange",F),()=>{B.document.removeEventListener("selectionchange",F)}},[F]);var j=r([f,[]]),W=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!v,V=y.useCallback(B=>{if(B&&W){var O;D((O=B.getBoundingClientRect())===null||O===void 0?void 0:O.height)}else D(void 0)},[W]);if(W){var se=x.start(f,[]);j.push({[lr]:!0,placeholder:i,onPlaceholderResize:V,anchor:se,focus:se})}var{marks:re}=f;if(N.hasMarkPlaceholder=!1,f.selection&&Q.isCollapsed(f.selection)&&re){var{anchor:w}=f.selection,ee=ue.leaf(f,w.path),K=ur(ee,Q1);if(!fe.equals(ee,re,{loose:!0})){N.hasMarkPlaceholder=!0;var A=Object.fromEntries(Object.keys(K).map(B=>[B,null]));j.push(Lt(Lt(Lt({[Ff]:!0},A),re),{},{anchor:w,focus:w}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:B}=f;if(B){var{anchor:O}=B,M=ue.leaf(f,O.path);if(re&&!fe.equals(M,re,{loose:!0})){Mt.set(f,re);return}}Mt.delete(f)})}),y.createElement(If.Provider,{value:s},y.createElement(Nf.Provider,{value:r},y.createElement(Y1,{node:E,receivedUserInput:S},y.createElement(m,Lt(Lt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:un||!Aa?g.spellCheck:!1,autoCorrect:un||!Aa?g.autoCorrect:"false",autoCapitalize:un||!Aa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:P,style:Lt(Lt({},p?{}:Lt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},T?{minHeight:T}:{})),h),onBeforeInput:y.useCallback(B=>{if(!un&&!s&&!ht(B,g.onBeforeInput)&&te.hasSelectableTarget(f,B.target)&&(B.preventDefault(),!te.isComposing(f))){var O=B.data;x.insertText(f,O)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(B=>{if(!ht(B,g.onInput)){if(q.current){q.current.handleInput();return}for(var O of k.current)O();k.current=[]}},[g.onInput]),onBlur:y.useCallback(B=>{if(!(s||N.isUpdatingSelection||!te.hasSelectableTarget(f,B.target)||ht(B,g.onBlur))){var O=te.findDocumentOrShadowRoot(f);if(N.latestElement!==O.activeElement){var{relatedTarget:M}=B,z=te.toDOMNode(f,f);if(M!==z&&!(Tt(M)&&M.hasAttribute("data-slate-spacer"))){if(M!=null&&pn(M)&&te.hasDOMNode(f,M)){var Y=te.toSlateNode(f,M);if(de.isElement(Y)&&!f.isVoid(Y))return}if(Fr){var U=O.getSelection();U==null||U.removeAllRanges()}mn.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:y.useCallback(B=>{if(te.hasTarget(f,B.target)&&!ht(B,g.onClick)&&pn(B.target)){var O=te.toSlateNode(f,B.target),M=te.findPath(f,O);if(!x.hasPath(f,M)||ue.get(f,M)!==O)return;if(B.detail===U1&&M.length>=1){var z=M;if(!(de.isElement(O)&&x.isBlock(f,O))){var Y,U=x.above(f,{match:Be=>de.isElement(Be)&&x.isBlock(f,Be),at:M});z=(Y=U==null?void 0:U[1])!==null&&Y!==void 0?Y:M.slice(0,1)}var ne=x.range(f,z);X.select(f,ne);return}if(s)return;var le=x.start(f,M),J=x.end(f,M),pe=x.void(f,{at:le}),me=x.void(f,{at:J});if(pe&&me&&I.equals(pe[1],me[1])){var Fe=x.range(f,le);X.select(f,Fe)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(B=>{if(te.hasSelectableTarget(f,B.target)){var O;if(te.isComposing(f)&&Promise.resolve().then(()=>{b(!1),_n.set(f,!1)}),(O=q.current)===null||O===void 0||O.handleCompositionEnd(B),ht(B,g.onCompositionEnd)||gt)return;if(!Fr&&!Vy&&!qy&&!Zy&&!Ky&&B.data){var M=Mt.get(f);Mt.delete(f),M!==void 0&&(Xt.set(f,f.marks),f.marks=M),x.insertText(f,B.data);var z=Xt.get(f);Xt.delete(f),z!==void 0&&(f.marks=z)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(B=>{te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCompositionUpdate)&&(te.isComposing(f)||(b(!0),_n.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(B=>{if(te.hasSelectableTarget(f,B.target)){var O;if((O=q.current)===null||O===void 0||O.handleCompositionStart(B),ht(B,g.onCompositionStart)||gt)return;b(!0);var{selection:M}=f;if(M&&Q.isExpanded(M)){x.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(B=>{te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCopy)&&!Yl(B)&&(B.preventDefault(),te.setFragmentData(f,B.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(B=>{if(!s&&te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCut)&&!Yl(B)){B.preventDefault(),te.setFragmentData(f,B.clipboardData,"cut");var{selection:O}=f;if(O)if(Q.isExpanded(O))x.deleteFragment(f);else{var M=ue.parent(f,O.anchor.path);x.isVoid(f,M)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(B=>{if(te.hasTarget(f,B.target)&&!ht(B,g.onDragOver)){var O=te.toSlateNode(f,B.target);de.isElement(O)&&x.isVoid(f,O)&&B.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(B=>{if(!s&&te.hasTarget(f,B.target)&&!ht(B,g.onDragStart)){var O=te.toSlateNode(f,B.target),M=te.findPath(f,O),z=de.isElement(O)&&x.isVoid(f,O)||x.void(f,{at:M,voids:!0});if(z){var Y=x.range(f,M);X.select(f,Y)}N.isDraggingInternally=!0,te.setFragmentData(f,B.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:y.useCallback(B=>{if(!s&&te.hasTarget(f,B.target)&&!ht(B,g.onDrop)){B.preventDefault();var O=f.selection,M=te.findEventRange(f,B),z=B.dataTransfer;X.select(f,M),N.isDraggingInternally&&O&&!Q.equals(O,M)&&!x.void(f,{at:M,voids:!0})&&X.delete(f,{at:O}),te.insertData(f,z),te.isFocused(f)||te.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:y.useCallback(B=>{!s&&N.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,B.target)&&g.onDragEnd(B),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:y.useCallback(B=>{if(!s&&!N.isUpdatingSelection&&te.hasEditableTarget(f,B.target)&&!ht(B,g.onFocus)){var O=te.toDOMNode(f,f),M=te.findDocumentOrShadowRoot(f);if(N.latestElement=M.activeElement,Qn&&B.target!==O){O.focus();return}mn.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:y.useCallback(B=>{if(!s&&te.hasEditableTarget(f,B.target)){var O;(O=q.current)===null||O===void 0||O.handleKeyDown(B);var{nativeEvent:M}=B;if(te.isComposing(f)&&M.isComposing===!1&&(_n.set(f,!1),b(!1)),ht(B,g.onKeyDown)||te.isComposing(f))return;var{selection:z}=f,Y=f.children[z!==null?z.focus.path[0]:0],U=Qd(ue.string(Y))==="rtl";if(Ye.isRedo(M)){B.preventDefault();var ne=f;typeof ne.redo=="function"&&ne.redo();return}if(Ye.isUndo(M)){B.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ye.isMoveLineBackward(M)){B.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ye.isMoveLineForward(M)){B.preventDefault(),X.move(f,{unit:"line"});return}if(Ye.isExtendLineBackward(M)){B.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ye.isExtendLineForward(M)){B.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ye.isMoveBackward(M)){B.preventDefault(),z&&Q.isCollapsed(z)?X.move(f,{reverse:!U}):X.collapse(f,{edge:U?"end":"start"});return}if(Ye.isMoveForward(M)){B.preventDefault(),z&&Q.isCollapsed(z)?X.move(f,{reverse:U}):X.collapse(f,{edge:U?"start":"end"});return}if(Ye.isMoveWordBackward(M)){B.preventDefault(),z&&Q.isExpanded(z)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!U});return}if(Ye.isMoveWordForward(M)){B.preventDefault(),z&&Q.isExpanded(z)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:U});return}if(un){if((Ef||Fr)&&z&&(Ye.isDeleteBackward(M)||Ye.isDeleteForward(M))&&Q.isCollapsed(z)){var J=ue.parent(f,z.anchor.path);if(de.isElement(J)&&x.isVoid(f,J)&&(x.isInline(f,J)||x.isBlock(f,J))){B.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ye.isBold(M)||Ye.isItalic(M)||Ye.isTransposeCharacter(M)){B.preventDefault();return}if(Ye.isSoftBreak(M)){B.preventDefault(),x.insertSoftBreak(f);return}if(Ye.isSplitBlock(M)){B.preventDefault(),x.insertBreak(f);return}if(Ye.isDeleteBackward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ye.isDeleteForward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ye.isDeleteLineBackward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ye.isDeleteLineForward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ye.isDeleteWordBackward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ye.isDeleteWordForward(M)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(B=>{!s&&te.hasEditableTarget(f,B.target)&&!ht(B,g.onPaste)&&(!un||Qy(B.nativeEvent)||Fr)&&(B.preventDefault(),te.insertData(f,B.clipboardData))},[s,f,g.onPaste])}),y.createElement(J1,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ex=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Lt({},t),n,gt&&y.createElement("br",null))},tx=()=>[],nx=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Q.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Nv(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ht=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Yl=e=>pn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),rx=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},ax=y.createContext(!1),ix=y.createContext({});function sx(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 ox=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],ux=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=ur(e,ox),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(at.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=sx(t),m=y.useCallback(f=>{var v;switch(r&&r(t.children),f==null||(v=f.operation)===null||v===void 0?void 0:v.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(Is.set(t,m),()=>{Is.set(t,()=>{})}),[t,m]);var[p,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),Wr(()=>{var f=()=>g(te.isFocused(t));return wf>=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(ix.Provider,{value:d},y.createElement($f.Provider,{value:l},y.createElement(Fo.Provider,{value:l.editor},y.createElement(ax.Provider,{value:p},n))))},Gl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ql=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return Gl(r,a)&&Gl(a,r)},lx=(e,t)=>{var n=x.range(e,Q.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ql(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ql(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function Jl(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 Xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){jt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cx=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 mi.set(r,new WeakMap),r.addMark=(u,d)=>{var h,m;(h=To.get(r))===null||h===void 0||h(),!Mt.get(r)&&(m=yt.get(r))!==null&&m!==void 0&&m.length&&Mt.set(r,null),Xt.delete(r),o(u,d)},r.removeMark=u=>{var d;!Mt.get(r)&&(d=yt.get(r))!==null&&d!==void 0&&d.length&&Mt.set(r,null),Xt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Q.isCollapsed(r.selection)){var d=x.above(r,{match:g=>de.isElement(g)&&x.isBlock(r,g),at:r.selection});if(d){var[,h]=d,m=x.range(r,h,r.selection.anchor),p=lx(r,m);Q.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var d=[],h=[],m=yt.get(r);if(m!=null&&m.length){var p=m.map(P=>c1(P,u)).filter(Boolean);yt.set(r,p)}var g=dn.get(r);g&&dn.set(r,Ll(r,g,u));var f=cn.get(r);if(f!=null&&f.at){var v=_e.isPoint(f==null?void 0:f.at)?zs(r,f.at,u):Ll(r,f.at,u);cn.set(r,v?Xl(Xl({},f),{},{at:v}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Hn(r,u.path));break}case"set_selection":{var b;(b=Sr.get(r))===null||b===void 0||b.unref(),Sr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Hn(r,I.parent(u.path)));break}case"merge_node":{var E=I.previous(u.path);d.push(...Hn(r,E));break}case"move_node":{var k=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Hn(r,k));var T;I.isBefore(u.path,u.newPath)?(d.push(...Hn(r,I.parent(u.path))),T=u.newPath):(d.push(...Hn(r,I.parent(u.newPath))),T=u.path);var D=ue.get(t,I.parent(T)),C=te.findKey(r,D),S=x.pathRef(r,I.parent(T));h.push([S,C]);break}}a(u);for(var[L,N]of d){var[q]=x.node(r,L);Va.set(q,N)}for(var[$,F]of h)if($.current){var[_]=x.node(r,$.current);Va.set(_,F)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,m]=Q.edges(d),p=x.void(r,{at:h.path}),g=x.void(r,{at:m.path});if(!(Q.isCollapsed(d)&&!p)){var f=te.toDOMRange(r,d),v=f.cloneContents(),b=v.childNodes[0];if(v.childNodes.forEach(q=>{q.textContent&&q.textContent.trim()!==""&&(b=q)}),g){var[E]=g,k=f.cloneRange(),T=te.toDOMNode(r,E);k.setEndAfter(T),v=k.cloneContents()}if(p&&(b=v.querySelector("[data-slate-spacer]")),Array.from(v.querySelectorAll("[data-slate-zero-width]")).forEach(q=>{var $=q.getAttribute("data-slate-zero-width")==="n";q.textContent=$?`
79
- `:""}),Af(b)){var D=b.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(b),v.appendChild(D),b=D}var C=r.getFragment(),S=JSON.stringify(C),L=window.btoa(encodeURIComponent(S));b.setAttribute("data-slate-fragment",L),u.setData("application/".concat(n),L);var N=v.ownerDocument.createElement("div");return N.appendChild(v),N.setAttribute("hidden","true"),v.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Tf(N)),v.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||n1(u);if(d){var h=decodeURIComponent(window.atob(d)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&X.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var d=wf<18?qc.unstable_batchedUpdates:h=>h();d(()=>{var h=Is.get(r);h&&h(u),i(u)})},r},Hn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const Us="MENTION: ",zf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},ec={"mention-popover":35,default:-52},qi=16,qf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(an),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,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,v=k=>{if(!x.hasPath(e,k.path))return!1;const T=ue.get(e,k.path);return x.isEditor(T)||de.isElement(T)?k.offset<=T.children.length:fe.isText(T)?k.offset<=T.text.length:!1};if(f&&(!v(f==null?void 0:f.anchor)||!v(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||zf).getBoundingClientRect();const E=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((E==null?void 0:E.width)||0)/qi}rem`),d=(E==null?void 0:E.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=ec[t]||ec.default,m=((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=`${m/qi}rem`,l.style.left=`${d/qi}rem`},o),r},dx=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===G.link});if(a){const i=a[0],s=ro(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 pt=(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))(pt||{});const Jn={[G.paragraph]:G.paragraph,[G.blockquote]:G.blockquote,[G.codeblock]:G.codeblock,[G.link]:G.link,[G.ul]:G.ul,[G.ol]:G.ol,[G.li]:G.li,[G.mention]:G.mention,[G.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ut.emphasis]:G.italic,[Ut.strong]:G.bold,[Ut.delete]:G.strikethrough,[Ut.code]:G.code,[G.hr]:G.hr,[G.image]:G.image};function tc(e){if(e)throw e}var Ta=Object.prototype.hasOwnProperty,Uf=Object.prototype.toString,nc=Object.defineProperty,rc=Object.getOwnPropertyDescriptor,ac=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Uf.call(t)==="[object Array]"},ic=function(t){if(!t||Uf.call(t)!=="[object Object]")return!1;var n=Ta.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ta.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ta.call(t,a)},sc=function(t,n){nc&&n.name==="__proto__"?nc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},oc=function(t,n){if(n==="__proto__")if(Ta.call(t,n)){if(rc)return rc(t,n).value}else return;return t[n]},fx=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=oc(o,n),a=oc(t,n),o!==a&&(d&&a&&(ic(a)||(i=ac(a)))?(i?(i=!1,s=r&&ac(r)?r:[]):s=r&&ic(r)?r:{},sc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&sc(o,{name:n,newValue:a}));return o};const Ui=Mn(fx);function Ws(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 hx(){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?mx(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 mx(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 jr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uc(e.position):"start"in e||"end"in e?uc(e):"line"in e||"column"in e?Hs(e):""}function Hs(e){return lc(e&&e.line)+":"+lc(e&&e.column)}function uc(e){return Hs(e&&e.start)+"-"+Hs(e&&e.end)}function lc(e){return e&&typeof e=="number"?e:1}class Ct 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=jr(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}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const zt={basename:px,dirname:gx,extname:vx,join:bx,sep:"/"};function px(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yr(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 gx(e){if(Yr(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 vx(e){Yr(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 bx(...e){let t=-1,n;for(;++t<e.length;)Yr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yx(n)}function yx(e){Yr(e);const t=e.codePointAt(0)===47;let n=xx(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xx(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 Yr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Dx={cwd:Cx};function Cx(){return"/"}function Vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wx(e){if(typeof e=="string")e=new URL(e);else if(!Vs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ex(e)}function Ex(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 Wi=["history","path","basename","stem","extname","dirname"];class _x{constructor(t){let n;t?Vs(t)?n={path:t}:typeof t=="string"||kx(t)?n={value:t}:n=t:n={},this.cwd=Dx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Wi.length;){const i=Wi[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)Wi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Vi(t,"basename"),Hi(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){cc(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Hi(t,"extname"),cc(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=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Vs(t)&&(t=wx(t)),Vi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Vi(t,"stem"),Hi(t,"stem"),this.path=zt.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 Ct(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 Hi(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Vi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function cc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Fx=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},Ax={}.hasOwnProperty;class Oo extends Fx{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=hx()}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?(Yi("data",this.frozen),this.namespace[t]=n,this):Ax.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yi("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=ga(t),r=this.parser||this.Parser;return Ki("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ki("process",this.parser||this.Parser),Zi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ga(t),l=r.parse(o);r.run(l,o,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=r.stringify(p,m);Sx(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ki("processSync",this.parser||this.Parser),Zi("processSync",this.compiler||this.Compiler),this.process(t,a),fc("processSync","process",n),r;function a(i,s){n=!0,tc(i),r=s}}run(t,n,r){dc(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=ga(n);a.run(t,l,u);function u(d,h,m){const p=h||t;d?o(d):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),fc("runSync","run",r),a;function i(s,o){tc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ga(n),a=this.compiler||this.Compiler;return Zi("stringify",a),dc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Yi("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,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const f=r[m][1];Ws(f)&&Ws(p)&&(p=Ui(!0,f,p)),r[m]=[u,p,...g]}}}}const Bx=new Oo().freeze();function Ki(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yi(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 dc(e){if(!Ws(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function fc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ga(e){return Tx(e)?e:new _x(e)}function Tx(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Sx(e){return typeof e=="string"||jx(e)}function jx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ox={};function Px(e,t){const n=t||Ox,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(Mx(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 hc(e.children,t,n)}return Array.isArray(e)?hc(e,t,n):""}function hc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Wf(e[a],t,n);return r.join("")}function Mx(e){return!!(e&&typeof e=="object")}const mc=document.createElement("i");function Po(e){const t="&"+e+";";mc.innerHTML=t;const n=mc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function nn(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Bt(e,t){return e.length>0?(nn(e,e.length,0,t),e):t}const pc={}.hasOwnProperty;function Nx(e){const t={};let n=-1;for(;++n<e.length;)Rx(t,e[n]);return t}function Rx(e,t){let n;for(n in t){const a=(pc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){pc.call(a,s)||(a[s]=[]);const o=i[s];Ix(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Ix(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);nn(e,0,0,r)}function Hf(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 nr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qt=xn(/[A-Za-z]/),Nt=xn(/[\dA-Za-z]/),$x=xn(/[#-'*+\--9=?A-Z^-~]/);function Ks(e){return e!==null&&(e<32||e===127)}const Zs=xn(/\d/),Lx=xn(/[\dA-Fa-f]/),zx=xn(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const qx=xn(/\p{P}|\p{S}/u),Ux=xn(/\s/);function xn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const Wx={tokenize:Hx};function Hx(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"),He(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 xe(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const Vx={tokenize:Kx},gc={tokenize:Zx};function Kx(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const T=t.events.length;let D=T,C;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){C=t.events[D][1].end;break}b(r);let S=T;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},C),S++;return nn(t.events,D+1,0,t.events.slice(T)),t.events.length=S,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return m(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gc,d,h)(k)}function d(k){return a&&E(),b(r),m(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function m(k){return t.containerState={},e.attempt(gc,p,g)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),m(k)}function g(k){if(k===null){a&&E(),b(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){v(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return xe(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),f)}function v(k,T){const D=t.sliceStream(k);if(T&&D.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(D),t.parser.lazy[k.start.line]){let C=a.events.length;for(;C--;)if(a.events[C][1].start.offset<s&&(!a.events[C][1].end||a.events[C][1].end.offset>s))return;const S=t.events.length;let L=S,N,q;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(N){q=t.events[L][1].end;break}N=!0}for(b(r),C=S;C<t.events.length;)t.events[C][1].end=Object.assign({},q),C++;nn(t.events,L+1,0,t.events.slice(S)),t.events.length=C}}function b(k){let T=n.length;for(;T-- >k;){const D=n[T];t.containerState=D[1],D[0].exit.call(t,e)}n.length=k}function E(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Zx(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vc(e){if(e===null||Dt(e)||Ux(e))return 1;if(qx(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 Ys={name:"attention",tokenize:Gx,resolveAll:Yx};function Yx(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),m=Object.assign({},e[n][1].start);bc(h,-l),bc(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Bt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Bt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Bt(u,Mo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Bt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Bt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,nn(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 Gx(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=vc(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=vc(l),h=!d||d===2&&a||n.includes(l),m=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(l)}}function bc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Qx={name:"autolink",tokenize:Jx};function Jx(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return qt(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Nt(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Nt(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ks(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):$x(p)?(e.consume(p),u):n(p)}function d(p){return Nt(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Nt(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const pi={tokenize:Xx,partial:!0};function Xx(e,t,n){return r;function r(i){return Pe(i)?He(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||xe(i)?t(i):n(i)}}const Vf={name:"blockQuote",tokenize:eD,continuation:{tokenize:tD},exit:nD};function eD(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 Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function tD(e,t,n){const r=this;return a;function a(s){return Pe(s)?He(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Vf,t,n)(s)}}function nD(e){e.exit("blockQuote")}const Kf={name:"characterEscape",tokenize:rD};function rD(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 zx(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Zf={name:"characterReference",tokenize:aD};function aD(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=Nt,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=Lx,d):(e.enter("characterReferenceValue"),i=7,s=Zs,d(h))}function d(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return s===Nt&&!Po(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const yc={tokenize:sD,partial:!0},xc={name:"codeFenced",tokenize:iD,concrete:!0};function iD(e,t,n){const r=this,a={tokenize:D,partial:!0};let i=0,s=0,o;return l;function l(C){return u(C)}function u(C){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===o?(s++,e.consume(C),d):s<3?n(C):(e.exit("codeFencedFenceSequence"),Pe(C)?He(e,h,"whitespace")(C):h(C))}function h(C){return C===null||xe(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(yc,f,T)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||xe(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):Pe(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(C)):C===96&&C===o?n(C):(e.consume(C),m)}function p(C){return C===null||xe(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||xe(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===o?n(C):(e.consume(C),g)}function f(C){return e.attempt(a,T,v)(C)}function v(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),b}function b(C){return i>0&&Pe(C)?He(e,E,"linePrefix",i+1)(C):E(C)}function E(C){return C===null||xe(C)?e.check(yc,f,T)(C):(e.enter("codeFlowValue"),k(C))}function k(C){return C===null||xe(C)?(e.exit("codeFlowValue"),E(C)):(e.consume(C),k)}function T(C){return e.exit("codeFenced"),t(C)}function D(C,S,L){let N=0;return q;function q(j){return C.enter("lineEnding"),C.consume(j),C.exit("lineEnding"),$}function $(j){return C.enter("codeFencedFence"),Pe(j)?He(C,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):F(j)}function F(j){return j===o?(C.enter("codeFencedFenceSequence"),_(j)):L(j)}function _(j){return j===o?(N++,C.consume(j),_):N>=s?(C.exit("codeFencedFenceSequence"),Pe(j)?He(C,P,"whitespace")(j):P(j)):L(j)}function P(j){return j===null||xe(j)?(C.exit("codeFencedFence"),S(j)):L(j)}}}function sD(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 Gi={name:"codeIndented",tokenize:uD},oD={tokenize:lD,partial:!0};function uD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),He(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):xe(u)?e.attempt(oD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||xe(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function lD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):He(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):xe(s)?a(s):n(s)}}const cD={name:"codeText",tokenize:hD,resolve:dD,previous:fD};function dD(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 fD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hD(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)):xe(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||xe(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 mD{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&&Er(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),Er(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Er(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);Er(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Er(this.left,n.reverse())}}}function Er(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 Yf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new mD(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,pD(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 nn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function pD(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,m=-1,p=n,g=0,f=0;const v=[f];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,v.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),m=v.length;m--;){const b=o.slice(v[m],v[m+1]),E=i.pop();l.push([E,E+b.length-1]),e.splice(E,2,b)}for(l.reverse(),m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const gD={tokenize:yD,resolve:bD},vD={tokenize:xD,partial:!0};function bD(e){return Yf(e),e}function yD(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):xe(o)?e.check(vD,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 xD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,i,"linePrefix")}function i(s){if(s===null||xe(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 Gf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||Ks(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||xe(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function f(b){return!d&&(b===null||b===41||Dt(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,f):b===41?(e.consume(b),d--,f):b===null||b===32||b===40||Ks(b)?n(b):(e.consume(b),b===92?v:f)}function v(b){return b===40||b===41||b===92?(e.consume(b),f):f(b)}}function Qf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):xe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||xe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Pe(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function Jf(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||xe(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===s||m===92?(e.consume(m),d):d(m)}}function Or(e,t){let n;return r;function r(a){return xe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?He(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const DD={name:"definition",tokenize:wD},CD={tokenize:ED,partial:!0};function wD(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Qf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Dt(p)?Or(e,u)(p):u(p)}function u(p){return Gf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(CD,h,h)(p)}function h(p){return Pe(p)?He(e,m,"whitespace")(p):m(p)}function m(p){return p===null||xe(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function ED(e,t,n){return r;function r(o){return Dt(o)?Or(e,a)(o):n(o)}function a(o){return Jf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||xe(o)?t(o):n(o)}}const _D={name:"hardBreakEscape",tokenize:kD};function kD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const FD={name:"headingAtx",tokenize:BD,resolve:AD};function AD(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"},nn(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function BD(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||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Pe(d)?He(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||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const TD=["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"],Dc=["pre","script","style","textarea"],SD={name:"htmlFlow",tokenize:MD,resolveTo:PD,concrete:!0},jD={tokenize:RD,partial:!0},OD={tokenize:ND,partial:!0};function PD(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 MD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),h}function h(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),i=!0,f):A===63?(e.consume(A),a=3,r.interrupt?t:w):qt(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function m(A){return A===45?(e.consume(A),a=2,p):A===91?(e.consume(A),a=5,o=0,g):qt(A)?(e.consume(A),a=4,r.interrupt?t:w):n(A)}function p(A){return A===45?(e.consume(A),r.interrupt?t:w):n(A)}function g(A){const B="CDATA[";return A===B.charCodeAt(o++)?(e.consume(A),o===B.length?r.interrupt?t:F:g):n(A)}function f(A){return qt(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function v(A){if(A===null||A===47||A===62||Dt(A)){const B=A===47,O=s.toLowerCase();return!B&&!i&&Dc.includes(O)?(a=1,r.interrupt?t(A):F(A)):TD.includes(s.toLowerCase())?(a=6,B?(e.consume(A),b):r.interrupt?t(A):F(A)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?E(A):k(A))}return A===45||Nt(A)?(e.consume(A),s+=String.fromCharCode(A),v):n(A)}function b(A){return A===62?(e.consume(A),r.interrupt?t:F):n(A)}function E(A){return Pe(A)?(e.consume(A),E):q(A)}function k(A){return A===47?(e.consume(A),q):A===58||A===95||qt(A)?(e.consume(A),T):Pe(A)?(e.consume(A),k):q(A)}function T(A){return A===45||A===46||A===58||A===95||Nt(A)?(e.consume(A),T):D(A)}function D(A){return A===61?(e.consume(A),C):Pe(A)?(e.consume(A),D):k(A)}function C(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,S):Pe(A)?(e.consume(A),C):L(A)}function S(A){return A===l?(e.consume(A),l=null,N):A===null||xe(A)?n(A):(e.consume(A),S)}function L(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Dt(A)?D(A):(e.consume(A),L)}function N(A){return A===47||A===62||Pe(A)?k(A):n(A)}function q(A){return A===62?(e.consume(A),$):n(A)}function $(A){return A===null||xe(A)?F(A):Pe(A)?(e.consume(A),$):n(A)}function F(A){return A===45&&a===2?(e.consume(A),W):A===60&&a===1?(e.consume(A),V):A===62&&a===4?(e.consume(A),ee):A===63&&a===3?(e.consume(A),w):A===93&&a===5?(e.consume(A),re):xe(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(jD,K,_)(A)):A===null||xe(A)?(e.exit("htmlFlowData"),_(A)):(e.consume(A),F)}function _(A){return e.check(OD,P,K)(A)}function P(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),j}function j(A){return A===null||xe(A)?_(A):(e.enter("htmlFlowData"),F(A))}function W(A){return A===45?(e.consume(A),w):F(A)}function V(A){return A===47?(e.consume(A),s="",se):F(A)}function se(A){if(A===62){const B=s.toLowerCase();return Dc.includes(B)?(e.consume(A),ee):F(A)}return qt(A)&&s.length<8?(e.consume(A),s+=String.fromCharCode(A),se):F(A)}function re(A){return A===93?(e.consume(A),w):F(A)}function w(A){return A===62?(e.consume(A),ee):A===45&&a===2?(e.consume(A),w):F(A)}function ee(A){return A===null||xe(A)?(e.exit("htmlFlowData"),K(A)):(e.consume(A),ee)}function K(A){return e.exit("htmlFlow"),t(A)}}function ND(e,t,n){const r=this;return a;function a(s){return xe(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 RD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(pi,t,n)}}const ID={name:"htmlText",tokenize:$D};function $D(e,t,n){const r=this;let a,i,s;return o;function o(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),l}function l(w){return w===33?(e.consume(w),u):w===47?(e.consume(w),D):w===63?(e.consume(w),k):qt(w)?(e.consume(w),L):n(w)}function u(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),i=0,g):qt(w)?(e.consume(w),E):n(w)}function d(w){return w===45?(e.consume(w),p):n(w)}function h(w){return w===null?n(w):w===45?(e.consume(w),m):xe(w)?(s=h,V(w)):(e.consume(w),h)}function m(w){return w===45?(e.consume(w),p):h(w)}function p(w){return w===62?W(w):w===45?m(w):h(w)}function g(w){const ee="CDATA[";return w===ee.charCodeAt(i++)?(e.consume(w),i===ee.length?f:g):n(w)}function f(w){return w===null?n(w):w===93?(e.consume(w),v):xe(w)?(s=f,V(w)):(e.consume(w),f)}function v(w){return w===93?(e.consume(w),b):f(w)}function b(w){return w===62?W(w):w===93?(e.consume(w),b):f(w)}function E(w){return w===null||w===62?W(w):xe(w)?(s=E,V(w)):(e.consume(w),E)}function k(w){return w===null?n(w):w===63?(e.consume(w),T):xe(w)?(s=k,V(w)):(e.consume(w),k)}function T(w){return w===62?W(w):k(w)}function D(w){return qt(w)?(e.consume(w),C):n(w)}function C(w){return w===45||Nt(w)?(e.consume(w),C):S(w)}function S(w){return xe(w)?(s=S,V(w)):Pe(w)?(e.consume(w),S):W(w)}function L(w){return w===45||Nt(w)?(e.consume(w),L):w===47||w===62||Dt(w)?N(w):n(w)}function N(w){return w===47?(e.consume(w),W):w===58||w===95||qt(w)?(e.consume(w),q):xe(w)?(s=N,V(w)):Pe(w)?(e.consume(w),N):W(w)}function q(w){return w===45||w===46||w===58||w===95||Nt(w)?(e.consume(w),q):$(w)}function $(w){return w===61?(e.consume(w),F):xe(w)?(s=$,V(w)):Pe(w)?(e.consume(w),$):N(w)}function F(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,_):xe(w)?(s=F,V(w)):Pe(w)?(e.consume(w),F):(e.consume(w),P)}function _(w){return w===a?(e.consume(w),a=void 0,j):w===null?n(w):xe(w)?(s=_,V(w)):(e.consume(w),_)}function P(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||Dt(w)?N(w):(e.consume(w),P)}function j(w){return w===47||w===62||Dt(w)?N(w):n(w)}function W(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function V(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),se}function se(w){return Pe(w)?He(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):re(w)}function re(w){return e.enter("htmlTextData"),s(w)}}const No={name:"labelEnd",tokenize:HD,resolveTo:WD,resolveAll:UD},LD={tokenize:VD},zD={tokenize:KD},qD={tokenize:ZD};function UD(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 WD(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=Bt(o,e.slice(i+1,i+r+3)),o=Bt(o,[["enter",d,t]]),o=Bt(o,Mo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Bt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Bt(o,e.slice(s+1)),o=Bt(o,[["exit",l,t]]),nn(e,i,e.length,o),e}function HD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?h(m):(s=r.parser.defined.includes(nr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(LD,d,s?d:h)(m):m===91?e.attempt(zD,d,s?u:h)(m):s?d(m):h(m)}function u(m){return e.attempt(qD,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function VD(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 Dt(h)?Or(e,i)(h):i(h)}function i(h){return h===41?d(h):Gf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Dt(h)?Or(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Jf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Dt(h)?Or(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 KD(e,t,n){const r=this;return a;function a(o){return Qf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function ZD(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 YD={name:"labelStartImage",tokenize:GD,resolveAll:No.resolveAll};function GD(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 QD={name:"labelStartLink",tokenize:JD,resolveAll:No.resolveAll};function JD(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 Qi={name:"lineEnding",tokenize:XD};function XD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Sa={name:"thematicBreak",tokenize:eC};function eC(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||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?He(e,o,"whitespace")(u):o(u))}}const bt={name:"list",tokenize:rC,continuation:{tokenize:aC},exit:sC},tC={tokenize:oC,partial:!0},nC={tokenize:iC,partial:!0};function rC(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Zs(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Sa,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Zs(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(pi,r.interrupt?n:d,e.attempt(tC,m,h))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Pe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function aC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(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(nC,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function iC(e,t,n){const r=this;return He(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 sC(e){e.exit(this.containerState.type)}function oC(e,t,n){const r=this;return He(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!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Cc={name:"setextUnderline",tokenize:lC,resolveTo:uC};function uC(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 lC(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"),Pe(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const cC={tokenize:dC};function dC(e){const t=this,n=e.attempt(pi,r,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(gD,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 fC={resolveAll:eh()},hC=Xf("string"),mC=Xf("text");function Xf(e){return{tokenize:t,resolveAll:eh(e==="text"?pC: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 m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function eh(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 pC(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 gC(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:E,enter:k,exit:T,attempt:S(D),check:S(C),interrupt:S(C,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h($){return s=Bt(s,$),v(),s[s.length-1]!==null?[]:(L(t,0),u.events=Mo(i,u.events,u),u.events)}function m($,F){return bC(p($),F)}function p($){return vC(s,$)}function g(){const{line:$,column:F,offset:_,_index:P,_bufferIndex:j}=r;return{line:$,column:F,offset:_,_index:P,_bufferIndex:j}}function f($){a[$.line]=$.column,q()}function v(){let $;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<F.length;)b(F.charCodeAt(r._bufferIndex));else b(F)}}function b($){d=d($)}function E($){xe($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,q()):$!==-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=$}function k($,F){const _=F||{};return _.type=$,_.start=g(),u.events.push(["enter",_,u]),o.push(_),_}function T($){const F=o.pop();return F.end=g(),u.events.push(["exit",F,u]),F}function D($,F){L($,F.from)}function C($,F){F.restore()}function S($,F){return _;function _(P,j,W){let V,se,re,w;return Array.isArray(P)?K(P):"tokenize"in P?K([P]):ee(P);function ee(M){return z;function z(Y){const U=Y!==null&&M[Y],ne=Y!==null&&M.null,le=[...Array.isArray(U)?U:U?[U]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return K(le)(Y)}}function K(M){return V=M,se=0,M.length===0?W:A(M[se])}function A(M){return z;function z(Y){return w=N(),re=M,M.partial||(u.currentConstruct=M),M.name&&u.parser.constructs.disable.null.includes(M.name)?O():M.tokenize.call(F?Object.assign(Object.create(u),F):u,l,B,O)(Y)}}function B(M){return $(re,w),j}function O(M){return w.restore(),++se<V.length?A(V[se]):W}}}function L($,F){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&nn(u.events,F,u.events.length-F,$.resolve(u.events.slice(F),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function N(){const $=g(),F=u.previous,_=u.currentConstruct,P=u.events.length,j=Array.from(o);return{restore:W,from:P};function W(){r=$,u.previous=F,u.currentConstruct=_,u.events.length=P,o=j,q()}}function q(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function vC(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 bC(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=`
78
+ `:""),[i]=y.useState(a);return Wr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(B1,{ref:r},i)},B1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),zi=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",F1({},a),!gt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};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 Pf(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){jt(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 T1=gt?300:0;function S1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Vl(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=E=>y.createElement(P1,Pf({},E))}=e,o=yn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),m=y.useRef(null),p=y.useCallback(E=>{if(S1(l,E==null),E==null){var k;Ns.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(Ns.set(o,E),!l.current){var T=window.ResizeObserver||Py;l.current=new T(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,E)})}l.current.observe(E),u.current=E}},[u,t,o]),g=y.createElement(A1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[lr];if(y.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},T1)):(Vl(m),h(!1)),()=>Vl(m)),[f,h]),f&&d){var v={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:Fr?"inherit":void 0},contentEditable:!1,ref:p}};g=y.createElement(y.Fragment,null,i(v),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},O1=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&&fe.equals(t.leaf,e.leaf)&&t.leaf[lr]===e.leaf[lr]),P1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Pf({},t),n)},M1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=yn(),l=y.useRef(null),u=fe.decorations(s,t),d=te.findKey(o,s),h=[],m=0;m<u.length;m++){var p=u[m];h.push(y.createElement(O1,{isLast:n&&m===u.length-1,key:"".concat(d.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var v=mi.get(o);f?(v==null||v.set(d,f),Bn.set(s,f),Ur.set(f,s)):(v==null||v.delete(d),Bn.delete(s),l.current&&Ur.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},h)},Mf=y.memo(M1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&k1(t.decorations,e.decorations));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 qs(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){jt(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 N1=e=>{var{decorations:t,element:n,renderElement:r=E=>y.createElement(I1,qs({},E)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=yn(),l=z1(),u=o.isInline(n),d=te.findKey(o,n),h=y.useCallback(E=>{var k=mi.get(o);E?(k==null||k.set(d,E),Bn.set(n,E),Ur.set(E,n)):(k==null||k.delete(d),Bn.delete(n))},[o,d,n]),m=Rf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:h};if(u&&(p["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var g=ue.string(n),f=Qd(g);f==="rtl"&&(p.dir=f)}if(x.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var v=u?"span":"div",[[b]]=ue.texts(n);m=y.createElement(v,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Mf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),Ao.set(b,0),Bo.set(b,n)}return r({attributes:p,children:m,element:n})},R1=y.memo(N1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&_1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Q.equals(e.selection,t.selection))),I1=e=>{var{attributes:t,children:n,element:r}=e,a=yn(),i=a.isInline(r)?"span":"div";return y.createElement(i,qs(qs({},t),{},{style:{position:"relative"}}),n)},Nf=y.createContext(()=>[]),$1=()=>y.useContext(Nf),L1=y.createContext(!1),Rf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=$1(),l=yn(),u=te.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],f=te.findKey(l,g),v=x.range(l,p),b=s&&Q.intersection(v,s),E=o([g,p]);for(var k of t){var T=Q.intersection(k,v);T&&E.push(T)}de.isElement(g)?d.push(y.createElement(L1.Provider,{key:"provider-".concat(f.id),value:!!b},y.createElement(R1,{decorations:E,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):d.push(y.createElement(Mf,{decorations:E,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Ao.set(g,m),Bo.set(g,n)}return d},If=y.createContext(!1),z1=()=>y.useContext(If),$f=y.createContext(null),$n=()=>{var e=y.useContext($f);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function q1(){var e=yn(),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 U1=3,W1={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"},H1={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"},V1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ze=e=>{var t=W1[e],n=H1[e],r=V1[e],a=t&&Li(t),i=n&&Li(n),s=r&&Li(r);return o=>!!(a&&a(o)||Il&&i&&i(o)||!Il&&s&&s(o))},Ye={isBold:Ze("bold"),isCompose:Ze("compose"),isMoveBackward:Ze("moveBackward"),isMoveForward:Ze("moveForward"),isDeleteBackward:Ze("deleteBackward"),isDeleteForward:Ze("deleteForward"),isDeleteLineBackward:Ze("deleteLineBackward"),isDeleteLineForward:Ze("deleteLineForward"),isDeleteWordBackward:Ze("deleteWordBackward"),isDeleteWordForward:Ze("deleteWordForward"),isExtendBackward:Ze("extendBackward"),isExtendForward:Ze("extendForward"),isExtendLineBackward:Ze("extendLineBackward"),isExtendLineForward:Ze("extendLineForward"),isItalic:Ze("italic"),isMoveLineBackward:Ze("moveLineBackward"),isMoveLineForward:Ze("moveLineForward"),isMoveWordBackward:Ze("moveWordBackward"),isMoveWordForward:Ze("moveWordForward"),isRedo:Ze("redo"),isSoftBreak:Ze("insertSoftBreak"),isSplitBlock:Ze("splitBlock"),isTransposeCharacter:Ze("transposeCharacter"),isUndo:Ze("undo")},K1=(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}},Z1={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Lf extends y.Component{constructor(){super(...arguments),jt(this,"context",null),jt(this,"manager",null),jt(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,Z1)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=K1(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}}jt(Lf,"contextType",Fo);var Y1=gt?Lf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},G1=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Q1=["text"];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 Lt(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){jt(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 J1=e=>y.createElement(y.Fragment,null,Rf(e)),X1=e=>{var t=y.useCallback(B=>y.createElement(ex,Lt({},B)),[]),{autoFocus:n,decorate:r=tx,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=nx,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=ur(e,G1),f=$n(),[v,b]=y.useState(!1),E=y.useRef(null),k=y.useRef([]),[T,D]=y.useState(),{onUserInput:w,receivedUserInput:S}=q1(),[,L]=y.useReducer(B=>B+1,0);kf.set(f,L),Rs.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{E.current&&n&&E.current.focus()},[n]);var q=y.useRef(),$=y.useMemo(()=>Ov(()=>{var B=q.current;if((gt||!te.isComposing(f))&&(!M.isUpdatingSelection||B!=null&&B.isFlushing())&&!M.isDraggingInternally){var O=te.findDocumentOrShadowRoot(f),{activeElement:N}=O,z=te.toDOMNode(f,f),Y=O.getSelection();if(N===z?(M.latestElement=N,mn.set(f,!0)):mn.delete(f),!Y)return X.deselect(f);var{anchorNode:U,focusNode:ne}=Y,le=te.hasEditableTarget(f,U)||te.isTargetInsideNonReadonlyVoid(f,U),J=te.hasEditableTarget(f,ne)||te.isTargetInsideNonReadonlyVoid(f,ne);if(le&&J){var pe=te.toSlateRange(f,Y,{exactMatch:!1,suppressThrow:!0});pe&&(!te.isComposing(f)&&!(B!=null&&B.hasPendingChanges())&&!(B!=null&&B.isFlushing())?X.select(f,pe):B==null||B.handleUserSelect(pe))}s&&(!le||!J)&&X.deselect(f)}},100),[f,s,M]),F=y.useMemo(()=>Fv($,0),[$]);q.current=D1({node:E,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:F}),Wr(()=>{var B,O,N;E.current&&(N=So(E.current))?(_f.set(f,N),Ba.set(f,E.current),Bn.set(f,E.current),Ur.set(E.current,f)):Bn.delete(f);var{selection:z}=f,Y=te.findDocumentOrShadowRoot(f),U=Y.getSelection();if(!(!U||!te.isFocused(f)||(B=q.current)!==null&&B!==void 0&&B.hasPendingAction())){var ne=me=>{var Fe=U.type!=="None";if(!(!z&&!Fe)){var Be=U.focusNode,Te;if(Qn&&U.rangeCount>1){var $e=U.getRangeAt(0),Le=U.getRangeAt(U.rangeCount-1);$e.startContainer===Be?Te=Le.endContainer:Te=$e.startContainer}else Te=U.anchorNode;var Ue=Ba.get(f),et=!1;if(Ue.contains(Te)&&Ue.contains(Be)&&(et=!0),Fe&&et&&z&&!me){var Ae=te.toSlateRange(f,U,{exactMatch:!0,suppressThrow:!0});if(Ae&&Q.equals(Ae,z)){var We;if(!M.hasMarkPlaceholder||(We=Te)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(z&&!te.hasRange(f,z)){f.selection=te.toSlateRange(f,U,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var be=z&&te.toDOMRange(f,z);return be?(te.isComposing(f)&&!gt?U.collapseToEnd():Q.isBackward(z)?U.setBaseAndExtent(be.endContainer,be.endOffset,be.startContainer,be.startOffset):U.setBaseAndExtent(be.startContainer,be.startOffset,be.endContainer,be.endOffset),d(f,be)):U.removeAllRanges(),be}};U.rangeCount<=1&&ne();var le=((O=q.current)===null||O===void 0?void 0:O.isFlushing())==="action";if(!gt||!le){setTimeout(()=>{M.isUpdatingSelection=!1});return}var J=null,pe=requestAnimationFrame(()=>{if(le){var me=Fe=>{try{var Be=te.toDOMNode(f,f);Be.focus(),ne(Fe)}catch{}};me(),J=setTimeout(()=>{me(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),J&&clearTimeout(J)}}});var _=y.useCallback(B=>{if(w(),!s&&te.hasEditableTarget(f,B.target)&&!rx(B,a)){var O;if(q.current)return q.current.handleDOMBeforeInput(B);F.flush(),$.flush();var{selection:N}=f,{inputType:z}=B,Y=B.dataTransfer||B.data||void 0,U=z==="insertCompositionText"||z==="deleteCompositionText";if(U&&te.isComposing(f))return;var ne=!1;if(z==="insertText"&&N&&Q.isCollapsed(N)&&B.data&&B.data.length===1&&/[a-z ]/i.test(B.data)&&N.anchor.offset!==0){var le,J;ne=!0,f.marks&&(ne=!1);var{anchor:pe}=N,[me,Fe]=te.toDOMPoint(f,pe),Be=(le=me.parentElement)===null||le===void 0?void 0:le.closest("a"),Te=te.getWindow(f);if(ne&&Be&&te.hasDOMNode(f,Be)){var $e,Le=Te==null?void 0:Te.document.createTreeWalker(Be,NodeFilter.SHOW_TEXT).lastChild();Le===me&&(($e=Le.textContent)===null||$e===void 0?void 0:$e.length)===Fe&&(ne=!1)}if(ne&&me.parentElement&&(Te==null||(J=Te.getComputedStyle(me.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ue=x.above(f,{at:pe.path,match:ae=>de.isElement(ae)&&x.isBlock(f,ae)});Ue&&ue.string(Ue[0]).includes(" ")&&(ne=!1)}}if(!z.startsWith("delete")||z.startsWith("deleteBy")){var[et]=B.getTargetRanges();if(et){var Ae=te.toSlateRange(f,et,{exactMatch:!1,suppressThrow:!1});if(!N||!Q.equals(N,Ae)){ne=!1;var We=!U&&f.selection&&x.rangeRef(f,f.selection);X.select(f,Ae),We&&Sr.set(f,We)}}}if(U)return;if(ne||B.preventDefault(),N&&Q.isExpanded(N)&&z.startsWith("delete")){var be=z.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:be});return}switch(z){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{z==="insertFromComposition"&&te.isComposing(f)&&(b(!1),_n.set(f,!1)),(Y==null?void 0:Y.constructor.name)==="DataTransfer"?te.insertData(f,Y):typeof Y=="string"&&(ne?k.current.push(()=>x.insertText(f,Y)):x.insertText(f,Y));break}}var H=(O=Sr.get(f))===null||O===void 0?void 0:O.unref();Sr.delete(f),H&&(!f.selection||!Q.equals(f.selection,H))&&X.select(f,H)}},[f,$,w,a,s,F]),P=y.useCallback(B=>{B==null?($.cancel(),F.cancel(),Ba.delete(f),Bn.delete(f),E.current&&un&&E.current.removeEventListener("beforeinput",_)):un&&B.addEventListener("beforeinput",_),E.current=B},[$,F,f,_]);Wr(()=>{var B=te.getWindow(f);return B.document.addEventListener("selectionchange",F),()=>{B.document.removeEventListener("selectionchange",F)}},[F]);var j=r([f,[]]),W=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!v,V=y.useCallback(B=>{if(B&&W){var O;D((O=B.getBoundingClientRect())===null||O===void 0?void 0:O.height)}else D(void 0)},[W]);if(W){var se=x.start(f,[]);j.push({[lr]:!0,placeholder:i,onPlaceholderResize:V,anchor:se,focus:se})}var{marks:re}=f;if(M.hasMarkPlaceholder=!1,f.selection&&Q.isCollapsed(f.selection)&&re){var{anchor:C}=f.selection,ee=ue.leaf(f,C.path),K=ur(ee,Q1);if(!fe.equals(ee,re,{loose:!0})){M.hasMarkPlaceholder=!0;var A=Object.fromEntries(Object.keys(K).map(B=>[B,null]));j.push(Lt(Lt(Lt({[Ff]:!0},A),re),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:B}=f;if(B){var{anchor:O}=B,N=ue.leaf(f,O.path);if(re&&!fe.equals(N,re,{loose:!0})){Mt.set(f,re);return}}Mt.delete(f)})}),y.createElement(If.Provider,{value:s},y.createElement(Nf.Provider,{value:r},y.createElement(Y1,{node:E,receivedUserInput:S},y.createElement(m,Lt(Lt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:un||!Aa?g.spellCheck:!1,autoCorrect:un||!Aa?g.autoCorrect:"false",autoCapitalize:un||!Aa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:P,style:Lt(Lt({},p?{}:Lt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},T?{minHeight:T}:{})),h),onBeforeInput:y.useCallback(B=>{if(!un&&!s&&!ht(B,g.onBeforeInput)&&te.hasSelectableTarget(f,B.target)&&(B.preventDefault(),!te.isComposing(f))){var O=B.data;x.insertText(f,O)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(B=>{if(!ht(B,g.onInput)){if(q.current){q.current.handleInput();return}for(var O of k.current)O();k.current=[]}},[g.onInput]),onBlur:y.useCallback(B=>{if(!(s||M.isUpdatingSelection||!te.hasSelectableTarget(f,B.target)||ht(B,g.onBlur))){var O=te.findDocumentOrShadowRoot(f);if(M.latestElement!==O.activeElement){var{relatedTarget:N}=B,z=te.toDOMNode(f,f);if(N!==z&&!(Tt(N)&&N.hasAttribute("data-slate-spacer"))){if(N!=null&&pn(N)&&te.hasDOMNode(f,N)){var Y=te.toSlateNode(f,N);if(de.isElement(Y)&&!f.isVoid(Y))return}if(Fr){var U=O.getSelection();U==null||U.removeAllRanges()}mn.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,g.onBlur]),onClick:y.useCallback(B=>{if(te.hasTarget(f,B.target)&&!ht(B,g.onClick)&&pn(B.target)){var O=te.toSlateNode(f,B.target),N=te.findPath(f,O);if(!x.hasPath(f,N)||ue.get(f,N)!==O)return;if(B.detail===U1&&N.length>=1){var z=N;if(!(de.isElement(O)&&x.isBlock(f,O))){var Y,U=x.above(f,{match:Be=>de.isElement(Be)&&x.isBlock(f,Be),at:N});z=(Y=U==null?void 0:U[1])!==null&&Y!==void 0?Y:N.slice(0,1)}var ne=x.range(f,z);X.select(f,ne);return}if(s)return;var le=x.start(f,N),J=x.end(f,N),pe=x.void(f,{at:le}),me=x.void(f,{at:J});if(pe&&me&&I.equals(pe[1],me[1])){var Fe=x.range(f,le);X.select(f,Fe)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(B=>{if(te.hasSelectableTarget(f,B.target)){var O;if(te.isComposing(f)&&Promise.resolve().then(()=>{b(!1),_n.set(f,!1)}),(O=q.current)===null||O===void 0||O.handleCompositionEnd(B),ht(B,g.onCompositionEnd)||gt)return;if(!Fr&&!Vy&&!qy&&!Zy&&!Ky&&B.data){var N=Mt.get(f);Mt.delete(f),N!==void 0&&(Xt.set(f,f.marks),f.marks=N),x.insertText(f,B.data);var z=Xt.get(f);Xt.delete(f),z!==void 0&&(f.marks=z)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(B=>{te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCompositionUpdate)&&(te.isComposing(f)||(b(!0),_n.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(B=>{if(te.hasSelectableTarget(f,B.target)){var O;if((O=q.current)===null||O===void 0||O.handleCompositionStart(B),ht(B,g.onCompositionStart)||gt)return;b(!0);var{selection:N}=f;if(N&&Q.isExpanded(N)){x.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(B=>{te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCopy)&&!Yl(B)&&(B.preventDefault(),te.setFragmentData(f,B.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(B=>{if(!s&&te.hasSelectableTarget(f,B.target)&&!ht(B,g.onCut)&&!Yl(B)){B.preventDefault(),te.setFragmentData(f,B.clipboardData,"cut");var{selection:O}=f;if(O)if(Q.isExpanded(O))x.deleteFragment(f);else{var N=ue.parent(f,O.anchor.path);x.isVoid(f,N)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(B=>{if(te.hasTarget(f,B.target)&&!ht(B,g.onDragOver)){var O=te.toSlateNode(f,B.target);de.isElement(O)&&x.isVoid(f,O)&&B.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(B=>{if(!s&&te.hasTarget(f,B.target)&&!ht(B,g.onDragStart)){var O=te.toSlateNode(f,B.target),N=te.findPath(f,O),z=de.isElement(O)&&x.isVoid(f,O)||x.void(f,{at:N,voids:!0});if(z){var Y=x.range(f,N);X.select(f,Y)}M.isDraggingInternally=!0,te.setFragmentData(f,B.dataTransfer,"drag")}},[s,f,g.onDragStart,M]),onDrop:y.useCallback(B=>{if(!s&&te.hasTarget(f,B.target)&&!ht(B,g.onDrop)){B.preventDefault();var O=f.selection,N=te.findEventRange(f,B),z=B.dataTransfer;X.select(f,N),M.isDraggingInternally&&O&&!Q.equals(O,N)&&!x.void(f,{at:N,voids:!0})&&X.delete(f,{at:O}),te.insertData(f,z),te.isFocused(f)||te.focus(f)}M.isDraggingInternally=!1},[s,f,g.onDrop,M]),onDragEnd:y.useCallback(B=>{!s&&M.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,B.target)&&g.onDragEnd(B),M.isDraggingInternally=!1},[s,M,g,f]),onFocus:y.useCallback(B=>{if(!s&&!M.isUpdatingSelection&&te.hasEditableTarget(f,B.target)&&!ht(B,g.onFocus)){var O=te.toDOMNode(f,f),N=te.findDocumentOrShadowRoot(f);if(M.latestElement=N.activeElement,Qn&&B.target!==O){O.focus();return}mn.set(f,!0)}},[s,M,f,g.onFocus]),onKeyDown:y.useCallback(B=>{if(!s&&te.hasEditableTarget(f,B.target)){var O;(O=q.current)===null||O===void 0||O.handleKeyDown(B);var{nativeEvent:N}=B;if(te.isComposing(f)&&N.isComposing===!1&&(_n.set(f,!1),b(!1)),ht(B,g.onKeyDown)||te.isComposing(f))return;var{selection:z}=f,Y=f.children[z!==null?z.focus.path[0]:0],U=Qd(ue.string(Y))==="rtl";if(Ye.isRedo(N)){B.preventDefault();var ne=f;typeof ne.redo=="function"&&ne.redo();return}if(Ye.isUndo(N)){B.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ye.isMoveLineBackward(N)){B.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ye.isMoveLineForward(N)){B.preventDefault(),X.move(f,{unit:"line"});return}if(Ye.isExtendLineBackward(N)){B.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ye.isExtendLineForward(N)){B.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ye.isMoveBackward(N)){B.preventDefault(),z&&Q.isCollapsed(z)?X.move(f,{reverse:!U}):X.collapse(f,{edge:U?"end":"start"});return}if(Ye.isMoveForward(N)){B.preventDefault(),z&&Q.isCollapsed(z)?X.move(f,{reverse:U}):X.collapse(f,{edge:U?"start":"end"});return}if(Ye.isMoveWordBackward(N)){B.preventDefault(),z&&Q.isExpanded(z)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!U});return}if(Ye.isMoveWordForward(N)){B.preventDefault(),z&&Q.isExpanded(z)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:U});return}if(un){if((Ef||Fr)&&z&&(Ye.isDeleteBackward(N)||Ye.isDeleteForward(N))&&Q.isCollapsed(z)){var J=ue.parent(f,z.anchor.path);if(de.isElement(J)&&x.isVoid(f,J)&&(x.isInline(f,J)||x.isBlock(f,J))){B.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ye.isBold(N)||Ye.isItalic(N)||Ye.isTransposeCharacter(N)){B.preventDefault();return}if(Ye.isSoftBreak(N)){B.preventDefault(),x.insertSoftBreak(f);return}if(Ye.isSplitBlock(N)){B.preventDefault(),x.insertBreak(f);return}if(Ye.isDeleteBackward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ye.isDeleteForward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ye.isDeleteLineBackward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ye.isDeleteLineForward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ye.isDeleteWordBackward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ye.isDeleteWordForward(N)){B.preventDefault(),z&&Q.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(B=>{!s&&te.hasEditableTarget(f,B.target)&&!ht(B,g.onPaste)&&(!un||Qy(B.nativeEvent)||Fr)&&(B.preventDefault(),te.insertData(f,B.clipboardData))},[s,f,g.onPaste])}),y.createElement(J1,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ex=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Lt({},t),n,gt&&y.createElement("br",null))},tx=()=>[],nx=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Q.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Nv(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ht=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Yl=e=>pn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),rx=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},ax=y.createContext(!1),ix=y.createContext({});function sx(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 ox=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],ux=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=ur(e,ox),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(at.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=sx(t),m=y.useCallback(f=>{var v;switch(r&&r(t.children),f==null||(v=f.operation)===null||v===void 0?void 0:v.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(Is.set(t,m),()=>{Is.set(t,()=>{})}),[t,m]);var[p,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),Wr(()=>{var f=()=>g(te.isFocused(t));return wf>=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(ix.Provider,{value:d},y.createElement($f.Provider,{value:l},y.createElement(Fo.Provider,{value:l.editor},y.createElement(ax.Provider,{value:p},n))))},Gl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ql=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return Gl(r,a)&&Gl(a,r)},lx=(e,t)=>{var n=x.range(e,Q.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ql(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ql(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function Jl(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 Xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){jt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cx=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 mi.set(r,new WeakMap),r.addMark=(u,d)=>{var h,m;(h=To.get(r))===null||h===void 0||h(),!Mt.get(r)&&(m=yt.get(r))!==null&&m!==void 0&&m.length&&Mt.set(r,null),Xt.delete(r),o(u,d)},r.removeMark=u=>{var d;!Mt.get(r)&&(d=yt.get(r))!==null&&d!==void 0&&d.length&&Mt.set(r,null),Xt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Q.isCollapsed(r.selection)){var d=x.above(r,{match:g=>de.isElement(g)&&x.isBlock(r,g),at:r.selection});if(d){var[,h]=d,m=x.range(r,h,r.selection.anchor),p=lx(r,m);Q.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var d=[],h=[],m=yt.get(r);if(m!=null&&m.length){var p=m.map(P=>c1(P,u)).filter(Boolean);yt.set(r,p)}var g=dn.get(r);g&&dn.set(r,Ll(r,g,u));var f=cn.get(r);if(f!=null&&f.at){var v=_e.isPoint(f==null?void 0:f.at)?zs(r,f.at,u):Ll(r,f.at,u);cn.set(r,v?Xl(Xl({},f),{},{at:v}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Hn(r,u.path));break}case"set_selection":{var b;(b=Sr.get(r))===null||b===void 0||b.unref(),Sr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Hn(r,I.parent(u.path)));break}case"merge_node":{var E=I.previous(u.path);d.push(...Hn(r,E));break}case"move_node":{var k=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Hn(r,k));var T;I.isBefore(u.path,u.newPath)?(d.push(...Hn(r,I.parent(u.path))),T=u.newPath):(d.push(...Hn(r,I.parent(u.newPath))),T=u.path);var D=ue.get(t,I.parent(T)),w=te.findKey(r,D),S=x.pathRef(r,I.parent(T));h.push([S,w]);break}}a(u);for(var[L,M]of d){var[q]=x.node(r,L);Va.set(q,M)}for(var[$,F]of h)if($.current){var[_]=x.node(r,$.current);Va.set(_,F)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,m]=Q.edges(d),p=x.void(r,{at:h.path}),g=x.void(r,{at:m.path});if(!(Q.isCollapsed(d)&&!p)){var f=te.toDOMRange(r,d),v=f.cloneContents(),b=v.childNodes[0];if(v.childNodes.forEach(q=>{q.textContent&&q.textContent.trim()!==""&&(b=q)}),g){var[E]=g,k=f.cloneRange(),T=te.toDOMNode(r,E);k.setEndAfter(T),v=k.cloneContents()}if(p&&(b=v.querySelector("[data-slate-spacer]")),Array.from(v.querySelectorAll("[data-slate-zero-width]")).forEach(q=>{var $=q.getAttribute("data-slate-zero-width")==="n";q.textContent=$?`
79
+ `:""}),Af(b)){var D=b.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(b),v.appendChild(D),b=D}var w=r.getFragment(),S=JSON.stringify(w),L=window.btoa(encodeURIComponent(S));b.setAttribute("data-slate-fragment",L),u.setData("application/".concat(n),L);var M=v.ownerDocument.createElement("div");return M.appendChild(v),M.setAttribute("hidden","true"),v.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",Tf(M)),v.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||n1(u);if(d){var h=decodeURIComponent(window.atob(d)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&X.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var d=wf<18?qc.unstable_batchedUpdates:h=>h();d(()=>{var h=Is.get(r);h&&h(u),i(u)})},r},Hn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const Us="MENTION: ",zf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},ec={"mention-popover":35,default:-52},qi=16,qf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(an),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,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,v=k=>{if(!x.hasPath(e,k.path))return!1;const T=ue.get(e,k.path);return x.isEditor(T)||de.isElement(T)?k.offset<=T.children.length:fe.isText(T)?k.offset<=T.text.length:!1};if(f&&(!v(f==null?void 0:f.anchor)||!v(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||zf).getBoundingClientRect();const E=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((E==null?void 0:E.width)||0)/qi}rem`),d=(E==null?void 0:E.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=ec[t]||ec.default,m=((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=`${m/qi}rem`,l.style.left=`${d/qi}rem`},o),r},dx=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===G.link});if(a){const i=a[0],s=ro(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 pt=(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))(pt||{});const Jn={[G.paragraph]:G.paragraph,[G.blockquote]:G.blockquote,[G.codeblock]:G.codeblock,[G.link]:G.link,[G.ul]:G.ul,[G.ol]:G.ol,[G.li]:G.li,[G.mention]:G.mention,[G.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ut.emphasis]:G.italic,[Ut.strong]:G.bold,[Ut.delete]:G.strikethrough,[Ut.code]:G.code,[G.hr]:G.hr,[G.image]:G.image};function tc(e){if(e)throw e}var Ta=Object.prototype.hasOwnProperty,Uf=Object.prototype.toString,nc=Object.defineProperty,rc=Object.getOwnPropertyDescriptor,ac=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Uf.call(t)==="[object Array]"},ic=function(t){if(!t||Uf.call(t)!=="[object Object]")return!1;var n=Ta.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ta.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ta.call(t,a)},sc=function(t,n){nc&&n.name==="__proto__"?nc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},oc=function(t,n){if(n==="__proto__")if(Ta.call(t,n)){if(rc)return rc(t,n).value}else return;return t[n]},fx=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=oc(o,n),a=oc(t,n),o!==a&&(d&&a&&(ic(a)||(i=ac(a)))?(i?(i=!1,s=r&&ac(r)?r:[]):s=r&&ic(r)?r:{},sc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&sc(o,{name:n,newValue:a}));return o};const Ui=Mn(fx);function Ws(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 hx(){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?mx(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 mx(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 jr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uc(e.position):"start"in e||"end"in e?uc(e):"line"in e||"column"in e?Hs(e):""}function Hs(e){return lc(e&&e.line)+":"+lc(e&&e.column)}function uc(e){return Hs(e&&e.start)+"-"+Hs(e&&e.end)}function lc(e){return e&&typeof e=="number"?e:1}class Ct 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=jr(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}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const zt={basename:px,dirname:gx,extname:vx,join:bx,sep:"/"};function px(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yr(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 gx(e){if(Yr(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 vx(e){Yr(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 bx(...e){let t=-1,n;for(;++t<e.length;)Yr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yx(n)}function yx(e){Yr(e);const t=e.codePointAt(0)===47;let n=xx(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xx(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 Yr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Dx={cwd:Cx};function Cx(){return"/"}function Vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wx(e){if(typeof e=="string")e=new URL(e);else if(!Vs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ex(e)}function Ex(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 Wi=["history","path","basename","stem","extname","dirname"];class _x{constructor(t){let n;t?Vs(t)?n={path:t}:typeof t=="string"||kx(t)?n={value:t}:n=t:n={},this.cwd=Dx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Wi.length;){const i=Wi[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)Wi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Vi(t,"basename"),Hi(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){cc(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Hi(t,"extname"),cc(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=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Vs(t)&&(t=wx(t)),Vi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Vi(t,"stem"),Hi(t,"stem"),this.path=zt.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 Ct(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 Hi(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Vi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function cc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Fx=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},Ax={}.hasOwnProperty;class Oo extends Fx{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=hx()}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?(Yi("data",this.frozen),this.namespace[t]=n,this):Ax.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yi("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=ga(t),r=this.parser||this.Parser;return Ki("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ki("process",this.parser||this.Parser),Zi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ga(t),l=r.parse(o);r.run(l,o,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=r.stringify(p,m);Sx(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ki("processSync",this.parser||this.Parser),Zi("processSync",this.compiler||this.Compiler),this.process(t,a),fc("processSync","process",n),r;function a(i,s){n=!0,tc(i),r=s}}run(t,n,r){dc(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=ga(n);a.run(t,l,u);function u(d,h,m){const p=h||t;d?o(d):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),fc("runSync","run",r),a;function i(s,o){tc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ga(n),a=this.compiler||this.Compiler;return Zi("stringify",a),dc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Yi("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,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const f=r[m][1];Ws(f)&&Ws(p)&&(p=Ui(!0,f,p)),r[m]=[u,p,...g]}}}}const Bx=new Oo().freeze();function Ki(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yi(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 dc(e){if(!Ws(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function fc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ga(e){return Tx(e)?e:new _x(e)}function Tx(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Sx(e){return typeof e=="string"||jx(e)}function jx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ox={};function Px(e,t){const n=t||Ox,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(Mx(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 hc(e.children,t,n)}return Array.isArray(e)?hc(e,t,n):""}function hc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Wf(e[a],t,n);return r.join("")}function Mx(e){return!!(e&&typeof e=="object")}const mc=document.createElement("i");function Po(e){const t="&"+e+";";mc.innerHTML=t;const n=mc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function nn(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Bt(e,t){return e.length>0?(nn(e,e.length,0,t),e):t}const pc={}.hasOwnProperty;function Nx(e){const t={};let n=-1;for(;++n<e.length;)Rx(t,e[n]);return t}function Rx(e,t){let n;for(n in t){const a=(pc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){pc.call(a,s)||(a[s]=[]);const o=i[s];Ix(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Ix(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);nn(e,0,0,r)}function Hf(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 nr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qt=xn(/[A-Za-z]/),Nt=xn(/[\dA-Za-z]/),$x=xn(/[#-'*+\--9=?A-Z^-~]/);function Ks(e){return e!==null&&(e<32||e===127)}const Zs=xn(/\d/),Lx=xn(/[\dA-Fa-f]/),zx=xn(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const qx=xn(/\p{P}|\p{S}/u),Ux=xn(/\s/);function xn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const Wx={tokenize:Hx};function Hx(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"),He(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 xe(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const Vx={tokenize:Kx},gc={tokenize:Zx};function Kx(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const T=t.events.length;let D=T,w;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){w=t.events[D][1].end;break}b(r);let S=T;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},w),S++;return nn(t.events,D+1,0,t.events.slice(T)),t.events.length=S,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return m(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gc,d,h)(k)}function d(k){return a&&E(),b(r),m(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function m(k){return t.containerState={},e.attempt(gc,p,g)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),m(k)}function g(k){if(k===null){a&&E(),b(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){v(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return xe(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),f)}function v(k,T){const D=t.sliceStream(k);if(T&&D.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(D),t.parser.lazy[k.start.line]){let w=a.events.length;for(;w--;)if(a.events[w][1].start.offset<s&&(!a.events[w][1].end||a.events[w][1].end.offset>s))return;const S=t.events.length;let L=S,M,q;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(M){q=t.events[L][1].end;break}M=!0}for(b(r),w=S;w<t.events.length;)t.events[w][1].end=Object.assign({},q),w++;nn(t.events,L+1,0,t.events.slice(S)),t.events.length=w}}function b(k){let T=n.length;for(;T-- >k;){const D=n[T];t.containerState=D[1],D[0].exit.call(t,e)}n.length=k}function E(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Zx(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vc(e){if(e===null||Dt(e)||Ux(e))return 1;if(qx(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 Ys={name:"attention",tokenize:Gx,resolveAll:Yx};function Yx(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),m=Object.assign({},e[n][1].start);bc(h,-l),bc(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Bt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Bt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Bt(u,Mo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Bt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Bt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,nn(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 Gx(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=vc(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=vc(l),h=!d||d===2&&a||n.includes(l),m=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(l)}}function bc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Qx={name:"autolink",tokenize:Jx};function Jx(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return qt(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Nt(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Nt(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ks(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):$x(p)?(e.consume(p),u):n(p)}function d(p){return Nt(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Nt(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const pi={tokenize:Xx,partial:!0};function Xx(e,t,n){return r;function r(i){return Pe(i)?He(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||xe(i)?t(i):n(i)}}const Vf={name:"blockQuote",tokenize:eD,continuation:{tokenize:tD},exit:nD};function eD(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 Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function tD(e,t,n){const r=this;return a;function a(s){return Pe(s)?He(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Vf,t,n)(s)}}function nD(e){e.exit("blockQuote")}const Kf={name:"characterEscape",tokenize:rD};function rD(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 zx(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Zf={name:"characterReference",tokenize:aD};function aD(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=Nt,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=Lx,d):(e.enter("characterReferenceValue"),i=7,s=Zs,d(h))}function d(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return s===Nt&&!Po(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const yc={tokenize:sD,partial:!0},xc={name:"codeFenced",tokenize:iD,concrete:!0};function iD(e,t,n){const r=this,a={tokenize:D,partial:!0};let i=0,s=0,o;return l;function l(w){return u(w)}function u(w){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===o?(s++,e.consume(w),d):s<3?n(w):(e.exit("codeFencedFenceSequence"),Pe(w)?He(e,h,"whitespace")(w):h(w))}function h(w){return w===null||xe(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(yc,f,T)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Pe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(w)):w===96&&w===o?n(w):(e.consume(w),m)}function p(w){return w===null||xe(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?n(w):(e.consume(w),g)}function f(w){return e.attempt(a,T,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),b}function b(w){return i>0&&Pe(w)?He(e,E,"linePrefix",i+1)(w):E(w)}function E(w){return w===null||xe(w)?e.check(yc,f,T)(w):(e.enter("codeFlowValue"),k(w))}function k(w){return w===null||xe(w)?(e.exit("codeFlowValue"),E(w)):(e.consume(w),k)}function T(w){return e.exit("codeFenced"),t(w)}function D(w,S,L){let M=0;return q;function q(j){return w.enter("lineEnding"),w.consume(j),w.exit("lineEnding"),$}function $(j){return w.enter("codeFencedFence"),Pe(j)?He(w,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):F(j)}function F(j){return j===o?(w.enter("codeFencedFenceSequence"),_(j)):L(j)}function _(j){return j===o?(M++,w.consume(j),_):M>=s?(w.exit("codeFencedFenceSequence"),Pe(j)?He(w,P,"whitespace")(j):P(j)):L(j)}function P(j){return j===null||xe(j)?(w.exit("codeFencedFence"),S(j)):L(j)}}}function sD(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 Gi={name:"codeIndented",tokenize:uD},oD={tokenize:lD,partial:!0};function uD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),He(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):xe(u)?e.attempt(oD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||xe(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function lD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):He(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):xe(s)?a(s):n(s)}}const cD={name:"codeText",tokenize:hD,resolve:dD,previous:fD};function dD(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 fD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hD(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)):xe(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||xe(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 mD{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&&Er(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),Er(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Er(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);Er(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Er(this.left,n.reverse())}}}function Er(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 Yf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new mD(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,pD(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 nn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function pD(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,m=-1,p=n,g=0,f=0;const v=[f];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,v.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),m=v.length;m--;){const b=o.slice(v[m],v[m+1]),E=i.pop();l.push([E,E+b.length-1]),e.splice(E,2,b)}for(l.reverse(),m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const gD={tokenize:yD,resolve:bD},vD={tokenize:xD,partial:!0};function bD(e){return Yf(e),e}function yD(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):xe(o)?e.check(vD,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 xD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,i,"linePrefix")}function i(s){if(s===null||xe(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 Gf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||Ks(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||xe(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function f(b){return!d&&(b===null||b===41||Dt(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,f):b===41?(e.consume(b),d--,f):b===null||b===32||b===40||Ks(b)?n(b):(e.consume(b),b===92?v:f)}function v(b){return b===40||b===41||b===92?(e.consume(b),f):f(b)}}function Qf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):xe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||xe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Pe(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function Jf(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||xe(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===s||m===92?(e.consume(m),d):d(m)}}function Or(e,t){let n;return r;function r(a){return xe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?He(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const DD={name:"definition",tokenize:wD},CD={tokenize:ED,partial:!0};function wD(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Qf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Dt(p)?Or(e,u)(p):u(p)}function u(p){return Gf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(CD,h,h)(p)}function h(p){return Pe(p)?He(e,m,"whitespace")(p):m(p)}function m(p){return p===null||xe(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function ED(e,t,n){return r;function r(o){return Dt(o)?Or(e,a)(o):n(o)}function a(o){return Jf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||xe(o)?t(o):n(o)}}const _D={name:"hardBreakEscape",tokenize:kD};function kD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const FD={name:"headingAtx",tokenize:BD,resolve:AD};function AD(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"},nn(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function BD(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||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Pe(d)?He(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||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const TD=["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"],Dc=["pre","script","style","textarea"],SD={name:"htmlFlow",tokenize:MD,resolveTo:PD,concrete:!0},jD={tokenize:RD,partial:!0},OD={tokenize:ND,partial:!0};function PD(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 MD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),h}function h(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),i=!0,f):A===63?(e.consume(A),a=3,r.interrupt?t:C):qt(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function m(A){return A===45?(e.consume(A),a=2,p):A===91?(e.consume(A),a=5,o=0,g):qt(A)?(e.consume(A),a=4,r.interrupt?t:C):n(A)}function p(A){return A===45?(e.consume(A),r.interrupt?t:C):n(A)}function g(A){const B="CDATA[";return A===B.charCodeAt(o++)?(e.consume(A),o===B.length?r.interrupt?t:F:g):n(A)}function f(A){return qt(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function v(A){if(A===null||A===47||A===62||Dt(A)){const B=A===47,O=s.toLowerCase();return!B&&!i&&Dc.includes(O)?(a=1,r.interrupt?t(A):F(A)):TD.includes(s.toLowerCase())?(a=6,B?(e.consume(A),b):r.interrupt?t(A):F(A)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?E(A):k(A))}return A===45||Nt(A)?(e.consume(A),s+=String.fromCharCode(A),v):n(A)}function b(A){return A===62?(e.consume(A),r.interrupt?t:F):n(A)}function E(A){return Pe(A)?(e.consume(A),E):q(A)}function k(A){return A===47?(e.consume(A),q):A===58||A===95||qt(A)?(e.consume(A),T):Pe(A)?(e.consume(A),k):q(A)}function T(A){return A===45||A===46||A===58||A===95||Nt(A)?(e.consume(A),T):D(A)}function D(A){return A===61?(e.consume(A),w):Pe(A)?(e.consume(A),D):k(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,S):Pe(A)?(e.consume(A),w):L(A)}function S(A){return A===l?(e.consume(A),l=null,M):A===null||xe(A)?n(A):(e.consume(A),S)}function L(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Dt(A)?D(A):(e.consume(A),L)}function M(A){return A===47||A===62||Pe(A)?k(A):n(A)}function q(A){return A===62?(e.consume(A),$):n(A)}function $(A){return A===null||xe(A)?F(A):Pe(A)?(e.consume(A),$):n(A)}function F(A){return A===45&&a===2?(e.consume(A),W):A===60&&a===1?(e.consume(A),V):A===62&&a===4?(e.consume(A),ee):A===63&&a===3?(e.consume(A),C):A===93&&a===5?(e.consume(A),re):xe(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(jD,K,_)(A)):A===null||xe(A)?(e.exit("htmlFlowData"),_(A)):(e.consume(A),F)}function _(A){return e.check(OD,P,K)(A)}function P(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),j}function j(A){return A===null||xe(A)?_(A):(e.enter("htmlFlowData"),F(A))}function W(A){return A===45?(e.consume(A),C):F(A)}function V(A){return A===47?(e.consume(A),s="",se):F(A)}function se(A){if(A===62){const B=s.toLowerCase();return Dc.includes(B)?(e.consume(A),ee):F(A)}return qt(A)&&s.length<8?(e.consume(A),s+=String.fromCharCode(A),se):F(A)}function re(A){return A===93?(e.consume(A),C):F(A)}function C(A){return A===62?(e.consume(A),ee):A===45&&a===2?(e.consume(A),C):F(A)}function ee(A){return A===null||xe(A)?(e.exit("htmlFlowData"),K(A)):(e.consume(A),ee)}function K(A){return e.exit("htmlFlow"),t(A)}}function ND(e,t,n){const r=this;return a;function a(s){return xe(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 RD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(pi,t,n)}}const ID={name:"htmlText",tokenize:$D};function $D(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),D):C===63?(e.consume(C),k):qt(C)?(e.consume(C),L):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):qt(C)?(e.consume(C),E):n(C)}function d(C){return C===45?(e.consume(C),p):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),m):xe(C)?(s=h,V(C)):(e.consume(C),h)}function m(C){return C===45?(e.consume(C),p):h(C)}function p(C){return C===62?W(C):C===45?m(C):h(C)}function g(C){const ee="CDATA[";return C===ee.charCodeAt(i++)?(e.consume(C),i===ee.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),v):xe(C)?(s=f,V(C)):(e.consume(C),f)}function v(C){return C===93?(e.consume(C),b):f(C)}function b(C){return C===62?W(C):C===93?(e.consume(C),b):f(C)}function E(C){return C===null||C===62?W(C):xe(C)?(s=E,V(C)):(e.consume(C),E)}function k(C){return C===null?n(C):C===63?(e.consume(C),T):xe(C)?(s=k,V(C)):(e.consume(C),k)}function T(C){return C===62?W(C):k(C)}function D(C){return qt(C)?(e.consume(C),w):n(C)}function w(C){return C===45||Nt(C)?(e.consume(C),w):S(C)}function S(C){return xe(C)?(s=S,V(C)):Pe(C)?(e.consume(C),S):W(C)}function L(C){return C===45||Nt(C)?(e.consume(C),L):C===47||C===62||Dt(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),W):C===58||C===95||qt(C)?(e.consume(C),q):xe(C)?(s=M,V(C)):Pe(C)?(e.consume(C),M):W(C)}function q(C){return C===45||C===46||C===58||C===95||Nt(C)?(e.consume(C),q):$(C)}function $(C){return C===61?(e.consume(C),F):xe(C)?(s=$,V(C)):Pe(C)?(e.consume(C),$):M(C)}function F(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,_):xe(C)?(s=F,V(C)):Pe(C)?(e.consume(C),F):(e.consume(C),P)}function _(C){return C===a?(e.consume(C),a=void 0,j):C===null?n(C):xe(C)?(s=_,V(C)):(e.consume(C),_)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Dt(C)?M(C):(e.consume(C),P)}function j(C){return C===47||C===62||Dt(C)?M(C):n(C)}function W(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function V(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),se}function se(C){return Pe(C)?He(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 No={name:"labelEnd",tokenize:HD,resolveTo:WD,resolveAll:UD},LD={tokenize:VD},zD={tokenize:KD},qD={tokenize:ZD};function UD(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 WD(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=Bt(o,e.slice(i+1,i+r+3)),o=Bt(o,[["enter",d,t]]),o=Bt(o,Mo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Bt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Bt(o,e.slice(s+1)),o=Bt(o,[["exit",l,t]]),nn(e,i,e.length,o),e}function HD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?h(m):(s=r.parser.defined.includes(nr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(LD,d,s?d:h)(m):m===91?e.attempt(zD,d,s?u:h)(m):s?d(m):h(m)}function u(m){return e.attempt(qD,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function VD(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 Dt(h)?Or(e,i)(h):i(h)}function i(h){return h===41?d(h):Gf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Dt(h)?Or(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Jf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Dt(h)?Or(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 KD(e,t,n){const r=this;return a;function a(o){return Qf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function ZD(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 YD={name:"labelStartImage",tokenize:GD,resolveAll:No.resolveAll};function GD(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 QD={name:"labelStartLink",tokenize:JD,resolveAll:No.resolveAll};function JD(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 Qi={name:"lineEnding",tokenize:XD};function XD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Sa={name:"thematicBreak",tokenize:eC};function eC(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||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?He(e,o,"whitespace")(u):o(u))}}const bt={name:"list",tokenize:rC,continuation:{tokenize:aC},exit:sC},tC={tokenize:oC,partial:!0},nC={tokenize:iC,partial:!0};function rC(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Zs(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Sa,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Zs(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(pi,r.interrupt?n:d,e.attempt(tC,m,h))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Pe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function aC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(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(nC,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function iC(e,t,n){const r=this;return He(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 sC(e){e.exit(this.containerState.type)}function oC(e,t,n){const r=this;return He(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!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Cc={name:"setextUnderline",tokenize:lC,resolveTo:uC};function uC(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 lC(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"),Pe(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const cC={tokenize:dC};function dC(e){const t=this,n=e.attempt(pi,r,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(gD,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 fC={resolveAll:eh()},hC=Xf("string"),mC=Xf("text");function Xf(e){return{tokenize:t,resolveAll:eh(e==="text"?pC: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 m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function eh(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 pC(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 gC(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:E,enter:k,exit:T,attempt:S(D),check:S(w),interrupt:S(w,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h($){return s=Bt(s,$),v(),s[s.length-1]!==null?[]:(L(t,0),u.events=Mo(i,u.events,u),u.events)}function m($,F){return bC(p($),F)}function p($){return vC(s,$)}function g(){const{line:$,column:F,offset:_,_index:P,_bufferIndex:j}=r;return{line:$,column:F,offset:_,_index:P,_bufferIndex:j}}function f($){a[$.line]=$.column,q()}function v(){let $;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<F.length;)b(F.charCodeAt(r._bufferIndex));else b(F)}}function b($){d=d($)}function E($){xe($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,q()):$!==-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=$}function k($,F){const _=F||{};return _.type=$,_.start=g(),u.events.push(["enter",_,u]),o.push(_),_}function T($){const F=o.pop();return F.end=g(),u.events.push(["exit",F,u]),F}function D($,F){L($,F.from)}function w($,F){F.restore()}function S($,F){return _;function _(P,j,W){let V,se,re,C;return Array.isArray(P)?K(P):"tokenize"in P?K([P]):ee(P);function ee(N){return z;function z(Y){const U=Y!==null&&N[Y],ne=Y!==null&&N.null,le=[...Array.isArray(U)?U:U?[U]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return K(le)(Y)}}function K(N){return V=N,se=0,N.length===0?W:A(N[se])}function A(N){return z;function z(Y){return C=M(),re=N,N.partial||(u.currentConstruct=N),N.name&&u.parser.constructs.disable.null.includes(N.name)?O():N.tokenize.call(F?Object.assign(Object.create(u),F):u,l,B,O)(Y)}}function B(N){return $(re,C),j}function O(N){return C.restore(),++se<V.length?A(V[se]):W}}}function L($,F){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&nn(u.events,F,u.events.length-F,$.resolve(u.events.slice(F),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function M(){const $=g(),F=u.previous,_=u.currentConstruct,P=u.events.length,j=Array.from(o);return{restore:W,from:P};function W(){r=$,u.previous=F,u.currentConstruct=_,u.events.length=P,o=j,q()}}function q(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function vC(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 bC(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=`
80
80
  `;break}case-3:{s=`\r
81
- `;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 yC={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:Vf},xC={91:DD},DC={[-2]:Gi,[-1]:Gi,32:Gi},CC={35:FD,42:Sa,45:[Cc,Sa],60:SD,61:Cc,95:Sa,96:xc,126:xc},wC={38:Zf,92:Kf},EC={[-5]:Qi,[-4]:Qi,[-3]:Qi,33:YD,38:Zf,42:Ys,60:[Qx,ID],91:QD,92:[_D,Kf],93:No,95:Ys,96:cD},_C={null:[Ys,fC]},kC={null:[42,95]},FC={null:[]},AC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kC,contentInitial:xC,disable:FC,document:yC,flow:CC,flowInitial:DC,insideSpan:_C,string:wC,text:EC},Symbol.toStringTag,{value:"Module"}));function BC(e){const n=Nx([AC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(Wx),document:a(Vx),flow:a(cC),string:a(hC),text:a(mC)};return r;function a(i){return s;function s(o){return gC(r,i,o)}}}function TC(e){for(;!Yf(e););return e}const wc=/[\0\t\n\r]/g;function SC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(wc.lastIndex=h,u=wc.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(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=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const jC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OC(e){return e.replace(jC,PC)}function PC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Hf(n.slice(i?2:1),i?16:10)}return Po(n)||e}const th={}.hasOwnProperty;function MC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),NC(n)(TC(BC(n).document().write(SC()(e,t,!0))))}function NC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i($e),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(me),blockQuote:i(U),characterEscape:N,characterReference:N,codeFenced:i(ne),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ne,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(Fe),hardBreakTrailing:i(Fe),htmlFlow:i(Be,s),htmlFlowData:N,htmlText:i(Be,s),htmlTextData:N,image:i(Te),label:s,link:i($e),listItem:i(Ue),listItemValue:m,listOrdered:i(Le,h),listUnordered:i(Le),paragraph:i(et),reference:A,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i(be)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Y,autolinkProtocol:z,blockQuote:l(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:O,characterReferenceMarkerNumeric:O,characterReferenceValue:M,codeFenced:l(v),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:q,codeIndented:l(b),codeText:l(j),codeTextData:q,data:q,definition:l(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(F),hardBreakTrailing:l(F),htmlFlow:l(_),htmlFlowData:q,htmlText:l(P),htmlTextData:q,image:l(V),label:re,labelText:se,lineEnding:$,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:w,resourceTitleString:ee,resource:K,setextHeading:l(L),setextHeadingLineSequence:S,setextHeadingText:C,strong:l(),thematicBreak:l()}};nh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const he={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ge=[];let we=-1;for(;++we<H.length;)if(H[we][1].type==="listOrdered"||H[we][1].type==="listUnordered")if(H[we][0]==="enter")ge.push(we);else{const Ge=ge.pop();we=a(H,Ge,we)}for(we=-1;++we<H.length;){const Ge=t[H[we][0]];th.call(Ge,H[we][1].type)&&Ge[H[we][1].type].call(Object.assign({sliceSerialize:H[we][2].sliceSerialize},he),H[we][1])}if(he.tokenStack.length>0){const Ge=he.tokenStack[he.tokenStack.length-1];(Ge[1]||Ec).call(he,void 0,Ge[0])}for(ae.position={start:ln(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:ln(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ae=t.transforms[we](ae)||ae;return ae}function a(H,ae,he){let ge=ae-1,we=-1,Ge=!1,Qe,ot,ye,Ee;for(;++ge<=he;){const ze=H[ge];switch(ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ze[0]==="enter"?we++:we--,Ee=void 0;break}case"lineEndingBlank":{ze[0]==="enter"&&(Qe&&!Ee&&!we&&!ye&&(ye=ge),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!we&&ze[0]==="enter"&&ze[1].type==="listItemPrefix"||we===-1&&ze[0]==="exit"&&(ze[1].type==="listUnordered"||ze[1].type==="listOrdered")){if(Qe){let nt=ge;for(ot=void 0;nt--;){const ut=H[nt];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;ot&&(H[ot][1].type="lineEndingBlank",Ge=!0),ut[1].type="lineEnding",ot=nt}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}ye&&(!ot||ye<ot)&&(Qe._spread=!0),Qe.end=Object.assign({},ot?H[ot][1].start:ze[1].end),H.splice(ot||ge,0,["exit",Qe,ze[2]]),ge++,he++}if(ze[1].type==="listItemPrefix"){const nt={type:"listItem",_spread:!1,start:Object.assign({},ze[1].start),end:void 0};Qe=nt,H.splice(ge,0,["enter",nt,ze[2]]),ge++,he++,ye=void 0,Ee=!0}}}return H[ae][1]._spread=Ge,he}function i(H,ae){return he;function he(ge){o.call(this,H(ge),ge),ae&&ae.call(this,ge)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,he){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,he]),H.position={start:ln(ae.start),end:void 0}}function l(H){return ae;function ae(he){H&&H.call(this,he),u.call(this,he)}}function u(H,ae){const he=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==H.type&&(ae?ae.call(this,H,ge[0]):(ge[1]||Ec).call(this,H,ge[0]));else throw new Error("Cannot close `"+H.type+"` ("+jr({start:H.start,end:H.end})+"): it’s not open");he.position.end=ln(H.end)}function d(){return Px(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function E(H){const ae=this.resume(),he=this.stack[this.stack.length-1];he.label=ae,he.identifier=nr(this.sliceSerialize(H)).toLowerCase()}function k(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function T(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function D(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const he=this.sliceSerialize(H).length;ae.depth=he}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function N(H){const he=this.stack[this.stack.length-1].children;let ge=he[he.length-1];(!ge||ge.type!=="text")&&(ge=We(),ge.position={start:ln(H.start),end:void 0},he.push(ge)),this.stack.push(ge)}function q(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=ln(H.end)}function $(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ae.children[ae.children.length-1];he.position.end=ln(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(N.call(this,H),q.call(this,H))}function F(){this.data.atHardBreak=!0}function _(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function P(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function j(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function W(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function se(H){const ae=this.sliceSerialize(H),he=this.stack[this.stack.length-2];he.label=OC(ae),he.identifier=nr(ae).toLowerCase()}function re(){const H=this.stack[this.stack.length-1],ae=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const ge=H.children;he.children=ge}else he.alt=ae}function w(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function ee(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function K(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function B(H){const ae=this.resume(),he=this.stack[this.stack.length-1];he.label=ae,he.identifier=nr(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function O(H){this.data.characterReferenceType=H.type}function M(H){const ae=this.sliceSerialize(H),he=this.data.characterReferenceType;let ge;he?(ge=Hf(ae,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=Po(ae);const we=this.stack.pop();we.value+=ge,we.position.end=ln(H.end)}function z(H){q.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function Y(H){q.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function U(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Be(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function $e(){return{type:"link",title:null,url:"",children:[]}}function Le(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ue(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function et(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function be(){return{type:"thematicBreak"}}}function ln(e){return{line:e.line,column:e.column,offset:e.offset}}function nh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nh(e,r):RC(e,r)}}function RC(e,t){let n;for(n in t)if(th.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 Ec(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is still open")}function IC(e){const t=this;t.parser=n;function n(r){return MC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rh(e,t){var l,u,d;const n={...Jn,...t==null?void 0:t.nodeTypes,[G.heading]:{...Jn[G.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[G.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=>rh({...h,ordered:e.ordered||!1},t))),e.type){case pt.heading:return{type:n[G.heading][e.depth||1],children:s};case pt.list:return{type:e.ordered?n[G.ol]:n[G.ul],children:s};case pt.listItem:return{type:n[G.li],children:s};case pt.paragraph:return{type:n[G.paragraph],children:s};case pt.link:return{type:n[G.link],[r]:e.url,children:s};case pt.image:return{type:n[G.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case pt.blockquote:return{type:n[G.blockquote],children:s};case pt.code:return{type:n[G.codeblock],language:e.lang,children:[{text:e.value}]};case pt.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[G.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:G.paragraph,children:[{text:e.value||""}]};case pt.emphasis:return{[n[Ut.emphasis]]:!0,...Ji(s),...va(s)};case pt.strong:return{[n[Ut.strong]]:!0,...Ji(s),...va(s)};case pt.delete:return{[n[Ut.delete]]:!0,...Ji(s),...va(s)};case pt.inlineCode:return{[n[Ut.code]]:!0,text:e.value,...va(s)};case pt.thematicBreak:return{type:n[G.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function va(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const $C=function(t){const n=r=>r.children.map(a=>rh(a,t));this.Compiler=n},LC=(e,t=n=>{})=>{Bx().use(IC).use($C).process(e).then(n=>{const r=kn(n.result),a=s=>{const o=s;[G.li,G.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===G.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===G.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Us)){const h=u,m=d.text.replace(Us,""),p="link"in h&&h.link?h.link:"";h.type=G.mention,h.id=p,h.name=m,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,""),m=o.text.indexOf(d),p=o.text.substring(0,m),g=o.text.substring(m+d.length),f=[{text:p},{text:h,[G.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Ro=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},zC=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},qC=e=>{const{selection:t}=e;return t?x.string(e,t):null},_c=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},UC=e=>{for(const[t]of ue.descendants(e)){const n=t;if(n.type===G.link)return n.link}return null},kc={"mod+b":G.bold,"mod+i":G.italic,"mod+shift+x":G.strikethrough,"mod+k":G.link,"mod+shift+7":G.ol,"mod+shift+8":G.ul,"mod+shift+9":G.blockquote},WC=(e,t,n,r)=>{for(const a in kc)if(Iy(a,e)){e.stopPropagation(),e.preventDefault();const i=kc[a];if(i===G.link){n([{type:"showLinkEditor",value:!0}]);return}if(tw(i)){dh(t,i,r);return}uh(t,i,r)}},ah=(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:G.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||zf),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Ro(r)},HC=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Q.isCollapsed(i)){const[s]=Q.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(nd);if(d){const h=d.index||0,m={path:s.path,offset:h},p={path:s.path,offset:h+d[0].length},g=x.range(e,m,p),f=x.after(e,s),v=x.range(e,s,f);if(x.string(e,v).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const k=d[1];let T=[];r&&(T=await r({name:k})),a([{type:"mentionPopover",value:{show:T.length>0?!0:n!==null,selectedUser:0,possibleUsers:T,position:T.length>0?g:null,numberOfUsers:T.length>0?T.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},ih=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Vn=e=>typeof e.text=="string",VC=[G.hr,G.image,G.mention],Fc="<br>";function sh(e,t={nodeTypes:Jn}){const{nodeTypes:n=Jn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Jn,...n,heading:{...Jn[G.heading],...n[G.heading]}},l=[o[G.ul],o[G.ol]];let u=i;if(!Vn(e)&&s!==G.mention&&(u=e.children.map(d=>{const h=Vn(d)?!1:l.includes(d.type||""),m=l.includes(e.type||"");let p=!1;return!Vn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Vn(g)&&g.type===o.link)),sh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[G.blockquote]||e.parentType===o[G.blockquote]})}).join("")),!r&&(i===""||i===`
81
+ `;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 yC={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:Vf},xC={91:DD},DC={[-2]:Gi,[-1]:Gi,32:Gi},CC={35:FD,42:Sa,45:[Cc,Sa],60:SD,61:Cc,95:Sa,96:xc,126:xc},wC={38:Zf,92:Kf},EC={[-5]:Qi,[-4]:Qi,[-3]:Qi,33:YD,38:Zf,42:Ys,60:[Qx,ID],91:QD,92:[_D,Kf],93:No,95:Ys,96:cD},_C={null:[Ys,fC]},kC={null:[42,95]},FC={null:[]},AC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kC,contentInitial:xC,disable:FC,document:yC,flow:CC,flowInitial:DC,insideSpan:_C,string:wC,text:EC},Symbol.toStringTag,{value:"Module"}));function BC(e){const n=Nx([AC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(Wx),document:a(Vx),flow:a(cC),string:a(hC),text:a(mC)};return r;function a(i){return s;function s(o){return gC(r,i,o)}}}function TC(e){for(;!Yf(e););return e}const wc=/[\0\t\n\r]/g;function SC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(wc.lastIndex=h,u=wc.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(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=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const jC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OC(e){return e.replace(jC,PC)}function PC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Hf(n.slice(i?2:1),i?16:10)}return Po(n)||e}const th={}.hasOwnProperty;function MC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),NC(n)(TC(BC(n).document().write(SC()(e,t,!0))))}function NC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i($e),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(me),blockQuote:i(U),characterEscape:M,characterReference:M,codeFenced:i(ne),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ne,s),codeText:i(le,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(Fe),hardBreakTrailing:i(Fe),htmlFlow:i(Be,s),htmlFlowData:M,htmlText:i(Be,s),htmlTextData:M,image:i(Te),label:s,link:i($e),listItem:i(Ue),listItemValue:m,listOrdered:i(Le,h),listUnordered:i(Le),paragraph:i(et),reference:A,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i(be)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Y,autolinkProtocol:z,blockQuote:l(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:O,characterReferenceMarkerNumeric:O,characterReferenceValue:N,codeFenced:l(v),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:q,codeIndented:l(b),codeText:l(j),codeTextData:q,data:q,definition:l(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(F),hardBreakTrailing:l(F),htmlFlow:l(_),htmlFlowData:q,htmlText:l(P),htmlTextData:q,image:l(V),label:re,labelText:se,lineEnding:$,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:C,resourceTitleString:ee,resource:K,setextHeading:l(L),setextHeadingLineSequence:S,setextHeadingText:w,strong:l(),thematicBreak:l()}};nh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const he={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ge=[];let we=-1;for(;++we<H.length;)if(H[we][1].type==="listOrdered"||H[we][1].type==="listUnordered")if(H[we][0]==="enter")ge.push(we);else{const Ge=ge.pop();we=a(H,Ge,we)}for(we=-1;++we<H.length;){const Ge=t[H[we][0]];th.call(Ge,H[we][1].type)&&Ge[H[we][1].type].call(Object.assign({sliceSerialize:H[we][2].sliceSerialize},he),H[we][1])}if(he.tokenStack.length>0){const Ge=he.tokenStack[he.tokenStack.length-1];(Ge[1]||Ec).call(he,void 0,Ge[0])}for(ae.position={start:ln(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:ln(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ae=t.transforms[we](ae)||ae;return ae}function a(H,ae,he){let ge=ae-1,we=-1,Ge=!1,Qe,ot,ye,Ee;for(;++ge<=he;){const ze=H[ge];switch(ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ze[0]==="enter"?we++:we--,Ee=void 0;break}case"lineEndingBlank":{ze[0]==="enter"&&(Qe&&!Ee&&!we&&!ye&&(ye=ge),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!we&&ze[0]==="enter"&&ze[1].type==="listItemPrefix"||we===-1&&ze[0]==="exit"&&(ze[1].type==="listUnordered"||ze[1].type==="listOrdered")){if(Qe){let nt=ge;for(ot=void 0;nt--;){const ut=H[nt];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;ot&&(H[ot][1].type="lineEndingBlank",Ge=!0),ut[1].type="lineEnding",ot=nt}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}ye&&(!ot||ye<ot)&&(Qe._spread=!0),Qe.end=Object.assign({},ot?H[ot][1].start:ze[1].end),H.splice(ot||ge,0,["exit",Qe,ze[2]]),ge++,he++}if(ze[1].type==="listItemPrefix"){const nt={type:"listItem",_spread:!1,start:Object.assign({},ze[1].start),end:void 0};Qe=nt,H.splice(ge,0,["enter",nt,ze[2]]),ge++,he++,ye=void 0,Ee=!0}}}return H[ae][1]._spread=Ge,he}function i(H,ae){return he;function he(ge){o.call(this,H(ge),ge),ae&&ae.call(this,ge)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,he){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,he]),H.position={start:ln(ae.start),end:void 0}}function l(H){return ae;function ae(he){H&&H.call(this,he),u.call(this,he)}}function u(H,ae){const he=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==H.type&&(ae?ae.call(this,H,ge[0]):(ge[1]||Ec).call(this,H,ge[0]));else throw new Error("Cannot close `"+H.type+"` ("+jr({start:H.start,end:H.end})+"): it’s not open");he.position.end=ln(H.end)}function d(){return Px(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function E(H){const ae=this.resume(),he=this.stack[this.stack.length-1];he.label=ae,he.identifier=nr(this.sliceSerialize(H)).toLowerCase()}function k(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function T(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function D(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const he=this.sliceSerialize(H).length;ae.depth=he}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function M(H){const he=this.stack[this.stack.length-1].children;let ge=he[he.length-1];(!ge||ge.type!=="text")&&(ge=We(),ge.position={start:ln(H.start),end:void 0},he.push(ge)),this.stack.push(ge)}function q(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=ln(H.end)}function $(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ae.children[ae.children.length-1];he.position.end=ln(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(M.call(this,H),q.call(this,H))}function F(){this.data.atHardBreak=!0}function _(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function P(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function j(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function W(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function se(H){const ae=this.sliceSerialize(H),he=this.stack[this.stack.length-2];he.label=OC(ae),he.identifier=nr(ae).toLowerCase()}function re(){const H=this.stack[this.stack.length-1],ae=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const ge=H.children;he.children=ge}else he.alt=ae}function C(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function ee(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function K(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function B(H){const ae=this.resume(),he=this.stack[this.stack.length-1];he.label=ae,he.identifier=nr(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function O(H){this.data.characterReferenceType=H.type}function N(H){const ae=this.sliceSerialize(H),he=this.data.characterReferenceType;let ge;he?(ge=Hf(ae,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=Po(ae);const we=this.stack.pop();we.value+=ge,we.position.end=ln(H.end)}function z(H){q.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function Y(H){q.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function U(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Be(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function $e(){return{type:"link",title:null,url:"",children:[]}}function Le(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ue(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function et(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function be(){return{type:"thematicBreak"}}}function ln(e){return{line:e.line,column:e.column,offset:e.offset}}function nh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nh(e,r):RC(e,r)}}function RC(e,t){let n;for(n in t)if(th.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 Ec(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is still open")}function IC(e){const t=this;t.parser=n;function n(r){return MC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rh(e,t){var l,u,d;const n={...Jn,...t==null?void 0:t.nodeTypes,[G.heading]:{...Jn[G.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[G.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=>rh({...h,ordered:e.ordered||!1},t))),e.type){case pt.heading:return{type:n[G.heading][e.depth||1],children:s};case pt.list:return{type:e.ordered?n[G.ol]:n[G.ul],children:s};case pt.listItem:return{type:n[G.li],children:s};case pt.paragraph:return{type:n[G.paragraph],children:s};case pt.link:return{type:n[G.link],[r]:e.url,children:s};case pt.image:return{type:n[G.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case pt.blockquote:return{type:n[G.blockquote],children:s};case pt.code:return{type:n[G.codeblock],language:e.lang,children:[{text:e.value}]};case pt.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[G.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:G.paragraph,children:[{text:e.value||""}]};case pt.emphasis:return{[n[Ut.emphasis]]:!0,...Ji(s),...va(s)};case pt.strong:return{[n[Ut.strong]]:!0,...Ji(s),...va(s)};case pt.delete:return{[n[Ut.delete]]:!0,...Ji(s),...va(s)};case pt.inlineCode:return{[n[Ut.code]]:!0,text:e.value,...va(s)};case pt.thematicBreak:return{type:n[G.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function va(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const $C=function(t){const n=r=>r.children.map(a=>rh(a,t));this.Compiler=n},LC=(e,t=n=>{})=>{Bx().use(IC).use($C).process(e).then(n=>{const r=kn(n.result),a=s=>{const o=s;[G.li,G.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===G.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===G.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Us)){const h=u,m=d.text.replace(Us,""),p="link"in h&&h.link?h.link:"";h.type=G.mention,h.id=p,h.name=m,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,""),m=o.text.indexOf(d),p=o.text.substring(0,m),g=o.text.substring(m+d.length),f=[{text:p},{text:h,[G.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Ro=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},zC=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},qC=e=>{const{selection:t}=e;return t?x.string(e,t):null},_c=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},UC=e=>{for(const[t]of ue.descendants(e)){const n=t;if(n.type===G.link)return n.link}return null},kc={"mod+b":G.bold,"mod+i":G.italic,"mod+shift+x":G.strikethrough,"mod+k":G.link,"mod+shift+7":G.ol,"mod+shift+8":G.ul,"mod+shift+9":G.blockquote},WC=(e,t,n,r)=>{for(const a in kc)if(Iy(a,e)){e.stopPropagation(),e.preventDefault();const i=kc[a];if(i===G.link){n([{type:"showLinkEditor",value:!0}]);return}if(tw(i)){dh(t,i,r);return}uh(t,i,r)}},ah=(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:G.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||zf),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Ro(r)},HC=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Q.isCollapsed(i)){const[s]=Q.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(nd);if(d){const h=d.index||0,m={path:s.path,offset:h},p={path:s.path,offset:h+d[0].length},g=x.range(e,m,p),f=x.after(e,s),v=x.range(e,s,f);if(x.string(e,v).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const k=d[1];let T=[];r&&(T=await r({name:k})),a([{type:"mentionPopover",value:{show:T.length>0?!0:n!==null,selectedUser:0,possibleUsers:T,position:T.length>0?g:null,numberOfUsers:T.length>0?T.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},ih=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Vn=e=>typeof e.text=="string",VC=[G.hr,G.image,G.mention],Fc="<br>";function sh(e,t={nodeTypes:Jn}){const{nodeTypes:n=Jn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Jn,...n,heading:{...Jn[G.heading],...n[G.heading]}},l=[o[G.ul],o[G.ol]];let u=i;if(!Vn(e)&&s!==G.mention&&(u=e.children.map(d=>{const h=Vn(d)?!1:l.includes(d.type||""),m=l.includes(e.type||"");let p=!1;return!Vn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Vn(g)&&g.type===o.link)),sh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[G.blockquote]||e.parentType===o[G.blockquote]})}).join("")),!r&&(i===""||i===`
82
82
  `)&&e.parentType===o[G.paragraph]&&s!==o[G.mention]&&(s=o[G.paragraph],u=Fc),!(u===""&&!VC.find(d=>o[d]===s)))switch(u!==Fc&&Vn(e)&&(e[G.strikethrough]&&e[G.bold]&&e[G.italic]?u=Kn(u,"~~***"):e[G.bold]&&e[G.italic]?u=Kn(u,"***"):(e[G.bold]&&(u=Kn(u,"**")),e[G.italic]&&(u=Kn(u,"_")),e[G.strikethrough]&&(u=Kn(u,"~~")),e[G.code]&&(u=Kn(u,"`")))),s){case o[G.heading][1]:return`# ${u}
83
83
  `;case o[G.heading][2]:return`## ${u}
84
84
  `;case o[G.heading][3]:return`### ${u}
@@ -98,7 +98,7 @@ ${p}${h?"1.":"-"} ${u}${m?`
98
98
  `:""}`;case o[G.paragraph]:return`${u}
99
99
 
100
100
  `;case o[G.hr]:return`---
101
- `;default:return u}}function Kn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Ac(t)}`;if(r.length===e.length)return a;const i=t+r+Ac(t);return e.replace(n,i)}const Ac=e=>e.split("").reverse().join(""),KC=e=>e.map(t=>sh(t)).join("").trim();const ZC=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=$n(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(an),{show:l,selectedUser:u,possibleUsers:d}=i,h=qf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const m=ih(a);return c.jsx(hr,{parent:m,children:c.jsx(od,{ref:h,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:p,user:g},f)=>c.jsx(en,{element:"li",className:Z({selected:f===u}),member:{id:p,...g,link:!1},functions:{onClick:v=>{v.preventDefault(),v.stopPropagation();const b={...i,selectedUser:f};r([{type:"mentionPopover",value:b}]),ah(n,b,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(en,{element:"li",className:Z("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Vt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Io=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},$o=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ie.useIntl(),u=$n(),{id:d,tabbableOption:h,setFocus:m,openTooltip:p,dispatch:g}=y.useContext(an),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:v=>{v.stopPropagation();const b=[{type:"openTooltip",value:null}];u.selection&&b.push({type:"lastAnchor",value:u.selection.anchor}),g(b)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:Z(e,a,{active:t}),onClick:v=>{v.stopPropagation(),v.preventDefault()},onMouseDown:v=>{v.stopPropagation(),v.preventDefault(),r()},onKeyDown:v=>{var b,E,k,T;if(v.key!=="Tab")switch(v.key){case"Enter":v.stopPropagation(),v.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":v.stopPropagation(),v.preventDefault();const D=v.currentTarget.closest("li");let C=D==null?void 0:D.nextElementSibling;if(v.key==="ArrowLeft"){const N=D==null?void 0:D.previousElementSibling;N?C=N:C=(b=D==null?void 0:D.parentElement)==null?void 0:b.lastElementChild}else C||(C=(E=D==null?void 0:D.parentElement)==null?void 0:E.firstElementChild);const S=C==null?void 0:C.className.split(" ")[0];S&&(m(S),(k=C==null?void 0:C.querySelector("button"))==null||k.focus());break;default:const L=v.currentTarget.closest("fieldset");if(L){(T=L==null?void 0:L.previousElementSibling)==null||T.focus();break}}},children:[c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Rn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Bc=[G.ol,G.ul],oh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},YC=e=>{const[t]=x.nodes(e,{match:n=>n.type===G.blockquote});return!!t},uh=(e,t,n)=>{try{const r=YC(e),a=oh(e,t),i=Bc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&de.isElement(u)&&Bc.includes(u.type)},split:!0});const o={type:a?G.paragraph:i?G.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:m=>{const p=m;return!x.isEditor(m)&&de.isElement(m)&&p.type===G.li}})).forEach(([m,p])=>{ue.string(m).trim()===""&&X.removeNodes(e,{at:p})})}else{if(r){const u={type:G.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},GC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(an),a=$n(),i=oh(a,e);return c.jsx($o,{id:e,active:i,hasDivider:t,callback:()=>{uh(a,e,r),n(i?null:e)}})},Pr=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&de.isElement(n)&&r.type===G.link}});return!!t},QC=(e,t,n,r)=>{e.selection&&Lo(e,t,n,r)},JC=(e,t,n,r)=>{const{selection:a}=e;if(a&&Q.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&de.isElement(o)&&l.type===G.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Ro(n)}}else Lo(e,t,n,r)},Lo=(e,t,n,r=a=>{console.error(a)})=>{try{Pr(e)&&lh(e);const{selection:a}=e,i=a&&Q.isCollapsed(a),s={type:G.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Ro(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},lh=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&de.isElement(t)&&n.type===G.link}})};let Xi=null;const XC=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(an),u=$n(),d=dx(u),h=(d==null?void 0:d.text)||qC(u),m=i!==!1,[p,g]=y.useState(Pr(u)),f=qf(u,"link-editor",`${n}-link`),v=y.useRef(null);y.useEffect(()=>{var D;!p&&r&&((D=v.current)==null||D.focus())},[p]),y.useEffect(()=>{Xi&&clearTimeout(Xi),Xi=setTimeout(()=>{g(Pr(u))},500)},[u.selection]);const b=[],E=["open","edit","remove"].map(D=>{const C={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(b.push({className:D}),D){case"open":C.href=(d==null?void 0:d.full)||"",C.onClick=S=>{S.preventDefault(),S.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},C.children=c.jsxs(c.Fragment,{children:[C.children,c.jsx(Me,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":C.onClick=()=>{g(!1)};break;case"remove":C.onClick=()=>{const S=[{type:"showLinkEditor",value:!1}];Pr(u)&&(lh(u),S.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&S.push({type:"enrichedUrl",value:!1})),s(S)};break}return C}),k=[{id:"url",type:"url",inputRef:v,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!u)return;D.preventDefault(),D.stopPropagation();const C=x.end(u,[]);X.select(u,C),te.focus(u)}}}}];h&&k.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const T=ih(a);return c.jsx(hr,{parent:T,children:c.jsx(Rn,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=v.current)==null?void 0:D.focus()})}},children:p?c.jsx(fr,{wrappers:b,buttons:E}):c.jsx(Yt,{element:"fieldset",id:`${n}-link-editor`,className:Z({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{const C=[{type:"showLinkEditor",value:!1}];let S=D.url;if(D.url){const{full:L}=ro(D.url);S=L,d!=null&&d.full?JC(u,S,n,l):QC(u,S,n,l),C.push({type:"lastAnchor",value:null})}if(s(C),D.url&&o&&(!m||i&&(d==null?void 0:d.full)===i.url)){const L=await o(S);L.url&&s([{type:"enrichedUrl",value:L}])}})}},fields:k,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},ew=()=>{const e=$n(),{setFocus:t,dispatch:n}=y.useContext(an),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Pr(e))},[e.selection]),c.jsx($o,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},tw=e=>[G.bold,G.italic,G.strikethrough].includes(e),ch=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},dh=(e,t,n)=>{try{ch(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},nw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(an),a=$n(),i=ch(a,e);return c.jsx($o,{id:e,active:i,hasDivider:t,callback:()=>{dh(a,e,r),n(i?null:e)}})},Ka=[G.bold,G.italic,G.strikethrough],rw=[G.ol,G.ul,G.blockquote];const aw=({...e})=>{const t=ie.useIntl(),{id:n}=y.useContext(an);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Ka.map((r,a)=>c.jsx(nw,{format:r,hasDivider:a===Ka.length-1},r)),c.jsx(ew,{}),rw.map((r,a)=>c.jsx(GC,{format:r,hasDivider:a===1},r))]})]}),c.jsx(XC,{})]})};function iw(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 Gs(e,t){return Array(t+1).join(e)}function sw(e){return e.replace(/^\n*/,"")}function ow(e){for(var t=e.length;t>0&&e[t-1]===`
101
+ `;default:return u}}function Kn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Ac(t)}`;if(r.length===e.length)return a;const i=t+r+Ac(t);return e.replace(n,i)}const Ac=e=>e.split("").reverse().join(""),KC=e=>e.map(t=>sh(t)).join("").trim();const ZC=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=$n(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(an),{show:l,selectedUser:u,possibleUsers:d}=i,h=qf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const m=ih(a);return c.jsx(hr,{parent:m,children:c.jsx(od,{ref:h,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:p,user:g},f)=>c.jsx(en,{element:"li",className:Z({selected:f===u}),member:{id:p,...g,link:!1},functions:{onClick:v=>{v.preventDefault(),v.stopPropagation();const b={...i,selectedUser:f};r([{type:"mentionPopover",value:b}]),ah(n,b,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(en,{element:"li",className:Z("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Vt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Io=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},$o=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ie.useIntl(),u=$n(),{id:d,tabbableOption:h,setFocus:m,openTooltip:p,dispatch:g}=y.useContext(an),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:v=>{v.stopPropagation();const b=[{type:"openTooltip",value:null}];u.selection&&b.push({type:"lastAnchor",value:u.selection.anchor}),g(b)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:Z(e,a,{active:t}),onClick:v=>{v.stopPropagation(),v.preventDefault()},onMouseDown:v=>{v.stopPropagation(),v.preventDefault(),r()},onKeyDown:v=>{var b,E,k,T;if(v.key!=="Tab")switch(v.key){case"Enter":v.stopPropagation(),v.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":v.stopPropagation(),v.preventDefault();const D=v.currentTarget.closest("li");let w=D==null?void 0:D.nextElementSibling;if(v.key==="ArrowLeft"){const M=D==null?void 0:D.previousElementSibling;M?w=M:w=(b=D==null?void 0:D.parentElement)==null?void 0:b.lastElementChild}else w||(w=(E=D==null?void 0:D.parentElement)==null?void 0:E.firstElementChild);const S=w==null?void 0:w.className.split(" ")[0];S&&(m(S),(k=w==null?void 0:w.querySelector("button"))==null||k.focus());break;default:const L=v.currentTarget.closest("fieldset");if(L){(T=L==null?void 0:L.previousElementSibling)==null||T.focus();break}}},children:[c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Rn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Bc=[G.ol,G.ul],oh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},YC=e=>{const[t]=x.nodes(e,{match:n=>n.type===G.blockquote});return!!t},uh=(e,t,n)=>{try{const r=YC(e),a=oh(e,t),i=Bc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&de.isElement(u)&&Bc.includes(u.type)},split:!0});const o={type:a?G.paragraph:i?G.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:m=>{const p=m;return!x.isEditor(m)&&de.isElement(m)&&p.type===G.li}})).forEach(([m,p])=>{ue.string(m).trim()===""&&X.removeNodes(e,{at:p})})}else{if(r){const u={type:G.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},GC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(an),a=$n(),i=oh(a,e);return c.jsx($o,{id:e,active:i,hasDivider:t,callback:()=>{uh(a,e,r),n(i?null:e)}})},Pr=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&de.isElement(n)&&r.type===G.link}});return!!t},QC=(e,t,n,r)=>{e.selection&&Lo(e,t,n,r)},JC=(e,t,n,r)=>{const{selection:a}=e;if(a&&Q.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&de.isElement(o)&&l.type===G.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Ro(n)}}else Lo(e,t,n,r)},Lo=(e,t,n,r=a=>{console.error(a)})=>{try{Pr(e)&&lh(e);const{selection:a}=e,i=a&&Q.isCollapsed(a),s={type:G.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Ro(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},lh=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&de.isElement(t)&&n.type===G.link}})};let Xi=null;const XC=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(an),u=$n(),d=dx(u),h=(d==null?void 0:d.text)||qC(u),m=i!==!1,[p,g]=y.useState(Pr(u)),f=qf(u,"link-editor",`${n}-link`),v=y.useRef(null);y.useEffect(()=>{var D;!p&&r&&((D=v.current)==null||D.focus())},[p]),y.useEffect(()=>{Xi&&clearTimeout(Xi),Xi=setTimeout(()=>{g(Pr(u))},500)},[u.selection]);const b=[],E=["open","edit","remove"].map(D=>{const w={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(b.push({className:D}),D){case"open":w.href=(d==null?void 0:d.full)||"",w.onClick=S=>{S.preventDefault(),S.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},w.children=c.jsxs(c.Fragment,{children:[w.children,c.jsx(Me,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":w.onClick=()=>{g(!1)};break;case"remove":w.onClick=()=>{const S=[{type:"showLinkEditor",value:!1}];Pr(u)&&(lh(u),S.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&S.push({type:"enrichedUrl",value:!1})),s(S)};break}return w}),k=[{id:"url",type:"url",inputRef:v,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!u)return;D.preventDefault(),D.stopPropagation();const w=x.end(u,[]);X.select(u,w),te.focus(u)}}}}];h&&k.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const T=ih(a);return c.jsx(hr,{parent:T,children:c.jsx(Rn,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=v.current)==null?void 0:D.focus()})}},children:p?c.jsx(fr,{wrappers:b,buttons:E}):c.jsx(Yt,{element:"fieldset",id:`${n}-link-editor`,className:Z({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{const w=[{type:"showLinkEditor",value:!1}];let S=D.url;if(D.url){const{full:L}=ro(D.url);S=L,d!=null&&d.full?JC(u,S,n,l):QC(u,S,n,l),w.push({type:"lastAnchor",value:null})}if(s(w),D.url&&o&&(!m||i&&(d==null?void 0:d.full)===i.url)){const L=await o(S);L.url&&s([{type:"enrichedUrl",value:L}])}})}},fields:k,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},ew=()=>{const e=$n(),{setFocus:t,dispatch:n}=y.useContext(an),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Pr(e))},[e.selection]),c.jsx($o,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},tw=e=>[G.bold,G.italic,G.strikethrough].includes(e),ch=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},dh=(e,t,n)=>{try{ch(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},nw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(an),a=$n(),i=ch(a,e);return c.jsx($o,{id:e,active:i,hasDivider:t,callback:()=>{dh(a,e,r),n(i?null:e)}})},Ka=[G.bold,G.italic,G.strikethrough],rw=[G.ol,G.ul,G.blockquote];const aw=({...e})=>{const t=ie.useIntl(),{id:n}=y.useContext(an);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Ka.map((r,a)=>c.jsx(nw,{format:r,hasDivider:a===Ka.length-1},r)),c.jsx(ew,{}),rw.map((r,a)=>c.jsx(GC,{format:r,hasDivider:a===1},r))]})]}),c.jsx(XC,{})]})};function iw(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 Gs(e,t){return Array(t+1).join(e)}function sw(e){return e.replace(/^\n*/,"")}function ow(e){for(var t=e.length;t>0&&e[t-1]===`
102
102
  `;)t--;return e.substring(0,t)}var uw=["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 zo(e){return qo(e,uw)}var fh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function hh(e){return qo(e,fh)}function lw(e){return ph(e,fh)}var mh=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function cw(e){return qo(e,mh)}function dw(e){return ph(e,mh)}function qo(e,t){return t.indexOf(e.nodeName)>=0}function ph(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var dt={};dt.paragraph={filter:"p",replacement:function(e){return`
103
103
 
104
104
  `+e+`
@@ -158,8 +158,8 @@ ${p}${h?"1.":"-"} ${u}${m?`
158
158
 
159
159
  `:n}};this.options=iw({},t,e),this.rules=new gh(this.options)}Hr.prototype={turndown:function(e){if(!Bw(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=vh.call(this,new bw(e,this.options));return Fw.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return kw.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function vh(e){var t=this;return _w.call(e.childNodes,function(n,r){r=new Dw(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=Aw.call(t,r)),bh(n,a)},"")}function Fw(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=bh(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Aw(e){var t=this.rules.forNode(e),n=vh.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function bh(e,t){var n=ow(e),r=sw(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
160
160
 
161
- `.substring(0,a);return n+i+r}function Bw(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var Tw={isHistory(e){return it(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||hn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||hn.isOperationList(e.undos[0].operations))}},rs=new WeakMap,as=new WeakMap,Xn={isHistoryEditor(e){return Tw.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return as.get(e)},isSaving(e){return rs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Xn.isMerging(e);as.set(e,!1),t(),as.set(e,n)},withoutSaving(e,t){var n=Xn.isSaving(e);rs.set(e,!1),t(),rs.set(e,n)}},Sw=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),Xn.withoutSaving(t,()=>{x.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];Xn.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(hn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Xn.isSaving(t),d=Xn.isMerging(t);if(u==null&&(u=Ow(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=jw(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},jw=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),Ow=(e,t)=>e.type!=="set_selection";const Pw=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===G.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var Mw=$w,Nw=/^(?:\w+:)?\/\/(\S+)$/,Rw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Iw=/^[^\s\.]+\.\S{2,}$/;function $w(e){if(typeof e!="string")return!1;var t=e.match(Nw);if(!t)return!1;var n=t[1];return n?!!(Rw.test(n)||Iw.test(n)):!1}const Lw=Mn(Mw),zw=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[G.link].includes(s.type)||a(i)},e.insertText=i=>{i&&Lw(i)?Lo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},qw=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===G.mention?!0:n(i),e.isVoid=i=>i.type===G.mention?!0:r(i),e.markableVoid=i=>i.type===G.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Uw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===G.link&&ue.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Wo=({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=ym();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:m,clickMentionFallback:p,onChange:g=()=>{},onChangeData:f=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:b=()=>{},reportError:E=O=>{console.error(O)}}=i||{},k=[{type:G.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const T={editorKey:null,originalValue:t||"",initialValue:t?null:k,tabbableOption:Ka[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[D,C]=y.useReducer(Kr,T),{editorKey:S,originalValue:L,initialValue:N,stringValue:q,lastAnchor:$,lastKey:F,hasInteracted:_,hasLoaded:P,enrichedUrl:j,mentionPopover:W}=D,V=O=>{O&&C([{type:"tabbableOption",value:O||Ka[0]}])},se=async O=>{const M=await v(O);M.url&&C([{type:"enrichedUrl",value:M}])},re=`rte-${e}`,w=y.useCallback(O=>c.jsx(wg,{...O}),[]),ee=y.useCallback(O=>c.jsx(Eg,{...O}),[]),K=y.useMemo(()=>Pw(zw(qw(Uw(Sw(cx(hy())),E),E),re,E),E),[]),A=O=>{if(!K||O!==re)return;const M=x.end(K,[]);X.select(K,M),te.focus(K)};y.useEffect(()=>{const O=M=>{var U;const z=M,Y=((U=z==null?void 0:z.detail)==null?void 0:U.id)||null;Y&&A(Y)};return window.addEventListener("focusEditor",O),()=>{window.removeEventListener("focusEditor",O)}},[]),y.useEffect(()=>{if(K.children.length>0&&!P){if(C([{type:"hasLoaded",value:!0}]),!s)return;A(re)}},[K.children.length,N]),y.useEffect(()=>{L&&(async()=>{let M=kn(L);if(M.includes("<")){Hr.prototype.escape=Y=>Y;const z=new Hr;z.addRule("br",{filter:["br"],replacement:Y=>Y+`
161
+ `.substring(0,a);return n+i+r}function Bw(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var Tw={isHistory(e){return it(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||hn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||hn.isOperationList(e.undos[0].operations))}},rs=new WeakMap,as=new WeakMap,Xn={isHistoryEditor(e){return Tw.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return as.get(e)},isSaving(e){return rs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Xn.isMerging(e);as.set(e,!1),t(),as.set(e,n)},withoutSaving(e,t){var n=Xn.isSaving(e);rs.set(e,!1),t(),rs.set(e,n)}},Sw=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),Xn.withoutSaving(t,()=>{x.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];Xn.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(hn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Xn.isSaving(t),d=Xn.isMerging(t);if(u==null&&(u=Ow(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=jw(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},jw=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),Ow=(e,t)=>e.type!=="set_selection";const Pw=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===G.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var Mw=$w,Nw=/^(?:\w+:)?\/\/(\S+)$/,Rw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Iw=/^[^\s\.]+\.\S{2,}$/;function $w(e){if(typeof e!="string")return!1;var t=e.match(Nw);if(!t)return!1;var n=t[1];return n?!!(Rw.test(n)||Iw.test(n)):!1}const Lw=Mn(Mw),zw=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[G.link].includes(s.type)||a(i)},e.insertText=i=>{i&&Lw(i)?Lo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},qw=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===G.mention?!0:n(i),e.isVoid=i=>i.type===G.mention?!0:r(i),e.markableVoid=i=>i.type===G.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Uw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===G.link&&ue.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Wo=({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=ym();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:m,clickMentionFallback:p,onChange:g=()=>{},onChangeData:f=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:b=()=>{},reportError:E=O=>{console.error(O)}}=i||{},k=[{type:G.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const T={editorKey:null,originalValue:t||"",initialValue:t?null:k,tabbableOption:Ka[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[D,w]=y.useReducer(Kr,T),{editorKey:S,originalValue:L,initialValue:M,stringValue:q,lastAnchor:$,lastKey:F,hasInteracted:_,hasLoaded:P,enrichedUrl:j,mentionPopover:W}=D,V=O=>{O&&w([{type:"tabbableOption",value:O||Ka[0]}])},se=async O=>{const N=await v(O);N.url&&w([{type:"enrichedUrl",value:N}])},re=`rte-${e}`,C=y.useCallback(O=>c.jsx(wg,{...O}),[]),ee=y.useCallback(O=>c.jsx(Eg,{...O}),[]),K=y.useMemo(()=>Pw(zw(qw(Uw(Sw(cx(hy())),E),E),re,E),E),[]),A=O=>{if(!K||O!==re)return;const N=x.end(K,[]);X.select(K,N),te.focus(K)};y.useEffect(()=>{const O=N=>{var U;const z=N,Y=((U=z==null?void 0:z.detail)==null?void 0:U.id)||null;Y&&A(Y)};return window.addEventListener("focusEditor",O),()=>{window.removeEventListener("focusEditor",O)}},[]),y.useEffect(()=>{if(K.children.length>0&&!P){if(w([{type:"hasLoaded",value:!0}]),!s)return;A(re)}},[K.children.length,M]),y.useEffect(()=>{L&&(async()=>{let N=kn(L);if(N.includes("<")){Hr.prototype.escape=Y=>Y;const z=new Hr;z.addRule("br",{filter:["br"],replacement:Y=>Y+`
162
162
 
163
- `}),M=z.turndown(M)}o&&o.mentions&&(M=await id({text:M,template:`[${Us}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),LC(M,z=>{const Y=[{type:"initialValue",value:z},{type:"editorKey",value:L.toString()}];o!=null&&o.link&&(Y.push({type:"enrichedUrl",value:o.link}),o.link.url&&se(o.link.url)),C(Y),setTimeout(()=>{C([{type:"stringValue",value:_c(K)}])},150)})})()},[L]),y.useEffect(()=>{if(j===void 0&&K){const M=UC(K);M&&se(M)}const O=M=>{var U;const z=M,Y=((U=z==null?void 0:z.detail)==null?void 0:U.url)||null;Y&&j&&j.url===Y&&C([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",O),()=>{window.removeEventListener("linkRemoved",O)}},[j]),y.useEffect(()=>{if(t){Rr.lastIndex=0;const O=t.match(Rr);O&&O.length===1&&O[0].length===t.length&&!_&&C([{type:"originalValue",value:t}])}t!==""||!K||Oa(L,t)&&!_||(x.withoutNormalizing(K,()=>{X.delete(K,{at:{anchor:x.start(K,[]),focus:x.end(K,[])}}),X.deselect(K),K.children.length!==0&&X.unwrapNodes(K,{at:[0]}),X.insertNodes(K,k,{at:[0]})}),C([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{f({link:j})},[j]),y.useEffect(()=>{q===""&&j&&C([{type:"enrichedUrl",value:void 0}])},[q]);const B=Kc(()=>{HC({editor:K,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:C})},100);return N?c.jsx("div",{id:re,className:"rich-text-editor",children:c.jsxs(an.Provider,{value:{...D,id:re,isInOverlay:h,setFocus:V,dispatch:C,getLinkPreview:v,onMention:b,reportError:E},children:[c.jsxs(ux,{editor:K,initialValue:N,onChange:O=>{if(K.operations.some(z=>z.type!=="set_selection")){let z=KC(O);z==="<br>"&&(z=""),g(z,j),C([{type:"stringValue",value:_c(K)}]),_||C([{type:"hasInteracted",value:!0}]),B(),d&&console.log({serialized:z,json:O})}},...l,children:[c.jsx(X1,{className:"input",renderElement:w,renderLeaf:ee,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async O=>{const M=j!==!1,z=O.clipboardData.getData("text");if((U=>{try{return new URL(U),!0}catch{return!1}})(z)){let U=z;if(z){const{full:ne}=ro(z);U=ne}if(z&&v&&!M){const ne=await v(U);ne.url&&C([{type:"enrichedUrl",value:ne}])}}},onKeyDown:O=>{if(O.key==="Enter"){W.show&&(O.preventDefault(),O.stopPropagation(),ah(K,W,C,re));const{selection:M}=K;if(M){const z=Q.isCollapsed(M),[Y,U]=x.node(K,M,{depth:1});let ne=Y,le=ne.type;const J=ne.children[0];if(J&&[G.ol,G.ul].includes(J.type)&&(ne=J,le=J.type),ne&&de.isElement(ne)&&le!==G.paragraph){if(le===G.blockquote&&!O.shiftKey){O.stopPropagation(),O.preventDefault(),X.insertNodes(K,k);return}if(z){const[pe,me]=x.parent(K,M,{edge:"end"}),Be=pe.type;if([G.ul,G.ol].includes(le))if(O.stopPropagation(),O.preventDefault(),Be===G.li&&F==="Enter"){pe.children.length===1&&"text"in pe.children[0]&&pe.children[0].text===""&&X.removeNodes(K,{at:me}),X.insertNodes(K,k,{at:I.next(U)}),X.select(K,x.end(K,I.next(U)));return}else{const[Te,$e]=zC(K,G.li),Le={type:G.li,children:[{text:""}]};X.insertNodes(K,Le,{at:I.next($e)}),X.select(K,x.end(K,I.next($e)))}}}}}else if(O.key==="Escape"){if(W.show){O.preventDefault(),O.stopPropagation(),C([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(O.key)&&W.show){O.preventDefault(),O.stopPropagation();const{selectedUser:M,possibleUsers:z}=W;let Y=O.key==="ArrowUp"?M-1:M+1;Y<0&&(Y=z.length-1),Y>=z.length+1&&(Y=0),C([{type:"mentionPopover",value:{...W,selectedUser:Y}}])}C([{type:"lastKey",value:O.key}]),WC(O,K,C,E)},onBlur:()=>{K.selection&&C([{type:"lastAnchor",value:K.selection.anchor}])},onFocus:()=>{if($){if(!I.isPath($.path)||!ue.has(K,$.path))return;const O=ue.get(K,$.path);let M=0;if(fe.isText(O)?M=O.text.length:O.children&&(M=O.children.length),$.offset>M)return;try{X.select(K,{anchor:$,focus:$})}catch(z){const Y=z.message;E(`Error focusing editor: ${Y}`)}}}}),j?c.jsx(mo,{data:j,variant:"condensed",onClick:()=>{C([{type:"enrichedUrl",value:!1}]);const O=new CustomEvent("ariaLive",{detail:{message:u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(O)},"aria-label":u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:j.title||u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(aw,{}),m?c.jsx(ZC,{onFallbackClick:p}):c.jsx(c.Fragment,{})]},S),c.jsx(go,{id:`character-limit-${e}`,limit:r,valueLength:ui(q)})]})}):c.jsx(c.Fragment,{})};const Ww=({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 yh({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,m]=y.useState(!1),[p,g]=y.useState(!1),f=y.useRef(null),v=async T=>{m(!0),g(!1);try{const D=T.target.files&&T.target.files[0];if(!D||!t)throw m(!1),new Error("Image file or userID is missing");const C=await a({fileObject:D,userId:t}),S={thumbnail:C.thumbnailURL,full:C.originalURL};d(S),s(S)}catch{g(!0)}finally{m(!1)}m(!1)},{upload:b=o.formatMessage({id:`${l}cta_upload`}),change:E=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:Z("profile-image-change-figure",e),children:[c.jsx(bn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&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:v,hidden:!0,"data-testid":"file-input"}),c.jsx(ke,{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?E:b})]})}const xh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Yt,{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},button:{className:"new"}})};const Hw=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(sm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Dh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,m]=y.useState([]),[p,g]=y.useState(!0),[f,v]=y.useState(d),{formatMessage:b}=ie.useIntl(),E=async D=>{try{await u(h,D.message),m([]),v("SUCCESS")}catch(C){v("ERROR"),l(C)}},k=D=>{D.preventDefault(),v("NOT_SUBMITTED"),g(!0),m([])},T=D=>{D.preventDefault(),o(),v("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="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(Kt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"secondary",onClick:k,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(ke,{onClick:T,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(ke,{onClick:k,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Yt,{id:"invite-form",fields:[{component:Hw,props:{emails:h,setEmails:m,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:b({id:"inviteForm_message_label"}),placeholder:n||b({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:E},button:{text:r,size:"medium",disabled:p}})]})},ja=e=>e.map(t=>({condition:t})),Ft={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Vw=({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=p=>p[Ft.NEW_PASSWORD]!==p[Ft.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Cs(p[Ft.NEW_PASSWORD]).isValid,h=[{"data-testid":Ft.NEW_PASSWORD,id:Ft.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ja(["required",d]),functions:{onChange:p=>l(Cs(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Ft.CONFIRMED_PASSWORD,id:Ft.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ja(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Ft.CURRENT_PASSWORD,id:Ft.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ja(["required"])}),i&&h.push({component:Zd,props:{matchingRules:o}});const m={id:Ft.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Ft.NEW_PASSWORD)||g.includes(Ft.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Yt,{...m}),r&&c.jsx(vn,{variant:"error",text:r})]})};const Ch=({hooks:e,functions:t,meta:n={},gtm:r})=>{var T,D;const a=ie.useIntl(),i="profileForm_",s=y.useContext(st),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:h,onSuccess:m=async C=>{},onCancel:p=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:v,predictPlaces:b}=e.useMaps(),{context:E="ProfileForm",event:k="profile-form-submit-click"}=r||{};return c.jsx(Yt,{id:"profile-details-form",fields:[{component:yh,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:((T=s.location)==null?void 0:T.en)||((D=s.location)==null?void 0:D.country),validation:[{condition:"required"},{condition:({location:C})=>C&&!u?!1:!v(C),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:b}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:Kt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:E,event:k},functions:{onSuccess:async C=>{try{const S={...C,image:o||null,location:u?await f(C==null?void 0:C.location):s.location};s.updateDetails&&s.updateDetails(L=>({...L,...S})),await m(S)}catch{g()}},onCancel:p,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`})}}})};let is=null;const mt="publishArticleForm_",jc={},Oc=10,Kw=({id:e="publish-article-form",values:t=jc,functions:n,meta:r,gtm:a})=>{const i=ie.useIntl(),s=y.useContext(st),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,m]=y.useState(t.body||""),[p,g]=y.useState(!1),[f,v]=y.useState("");y.useEffect(()=>{Oa(t,jc)||Ma(t.body)&&t.body!==h&&t.body!==void 0&&m(t.body)},[t.body]);const b=()=>{!s||!s.id?g(i.formatMessage({id:`${mt}error_loggedOut`})):p&&g(!1)},E=C=>({condition:S=>{const L=S[C];return!L||typeof L!="string"?!0:L.length<Oc},error:i.formatMessage({id:`${mt}error_underMinLength`},{length:Oc})}),k=!h||!Ma(h),T=()=>c.jsxs(c.Fragment,{children:[c.jsx(Kt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${mt}disclaimer`})})]}),D=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${mt}title_label`}),placeholder:i.formatMessage({id:`${mt}title_placeholder`}),functions:{onChange:b},validation:[{condition:"required"},E("title"),{condition:()=>k,error:i.formatMessage({id:`${mt}title_error`})}]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${mt}subtitle_label`}),placeholder:i.formatMessage({id:`${mt}subtitle_placeholder`}),functions:{onChange:b},validation:[{condition:"required"},E("subtitle")]},{component:Io,props:{formID:e,label:{visible:i.formatMessage({id:`${mt}body_label`})},showLabel:!0}},{component:Wo,props:{id:`${e}-input`,value:h,meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:C=>{m(C),b()}},"aria-invalid":!!p,"aria-errormessage":"error-message"}},{component:T}];return c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Yt,{id:e,meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async C=>{if(!s||!s.id||k)return;is&&clearTimeout(is);const S={...C,body:h};try{o&&await o(S),is=setTimeout(()=>{m(""),v(i.formatMessage({id:`${mt}aria_success`})),l(S)},500)}catch{g(!0),v(""),u()}},onFailure:u},fields:D,intlPath:mt,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||k,text:{default:i.formatMessage({id:`${mt}cta_submit`}),submitting:i.formatMessage({id:`${mt}cta_submitting`}),submitted:i.formatMessage({id:`${mt}cta_submitted`})}},gtm:a}),p&&c.jsx(ir,{id:"error-message",className:"error",children:typeof p=="string"&&p.includes(" ")?p:i.formatMessage({id:`${mt}error`})}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:f})]})};const wh=({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);ar(()=>{!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(Me,{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(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Pc=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}])},Zw=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"]}},Yw=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=Zw(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}])},Gw=({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=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Pc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Ud,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>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:p}),privacy:p=>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:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Pc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const Qw=({className:e=""})=>c.jsxs("div",{className:Z("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 Jw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Xw=({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:m=!0,successMessage:p=!0}=a,g={title:u,expectation:d,url:h,logInButton:m,successMessage:p},[f,v]=y.useReducer(Kr,Jw),{validFields:b,emailDetails:E,shouldManuallyApprove:k,shouldDisableButton:T,showSuccessMessage:D,showError:C}=f,[S,L]=Xs.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"]&&v([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{D&&S["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[D]);const q=y.useMemo(()=>Gw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),$=T?!0:k?!Object.values(b).every(F=>F===!0):!b.name||!b.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&D?c.jsx(Qw,{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(ie.FormattedMessage,{id:"signup_title"})}),C&&c.jsx(vn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Yt,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:q,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:$?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/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 Yw({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:f})},onCatch:F=>{r.handleError(F),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const Dn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:Z("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const eE=({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 new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(Dn,{className:Z("download-section",n),styling:{background:"dark"},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(fr,{buttons:r})]})})};const Qs="editSection_";function Eh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tE=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(St,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Qs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(ke,{href:r,variant:"secondary",size:"small",onClick:()=>Eh({href:r,setShowModal:i}),children:n||s({id:`${Qs}placeholder_cta`})})})]})},nE=({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,m]=y.useState(!1),p=()=>m(!1),g=!!n||!!r,f=typeof a=="string"||g;let v;return r&&(v=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async b=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(b)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:Z("edit-section",t),children:[g&&c.jsx(rn,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:p},className:Z("edit-section-modal"),children:v||(n?c.jsx(Yt,{...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 b=>{var E,k;(E=n==null?void 0:n.functions)!=null&&E.onSuccess&&await((k=n==null?void 0:n.functions)==null?void 0:k.onSuccess(b)),m(!1)},onCancel:p}}):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(ke,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Eh({href:a,setShowModal:m}),children:d({id:`${Qs}edit`})})]}),e||c.jsx(tE,{...l,href:a,setShowModal:m,showEditButton:f}),u&&c.jsx(Kt,{})]})};const rE=({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:m=!1,description:p=!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:m?c.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${g}`))})})]})};let ss;const os="contactFooter_",aE=({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(ss),ss=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ss),window.removeEventListener("resize",l)}),[]),c.jsx(Dn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${os}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:`${os}text`})}),c.jsx(gn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${os}email`})})]}),c.jsx(xh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},iE=({activeLink:e,profile:t,...n})=>c.jsx(Dn,{children:c.jsx(zd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Ld,{activeLink:e,profile:t}),c.jsx(fd,{...n})]})})});const us="cookieBanner_",ls=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],cs=new Date(Date.now()+12*30*24*60*60*1e3),_h=()=>{const e=ie.useIntl(),[t,n,r]=Xs.useCookies(ls),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ls.forEach(d=>{n(d,!0,{path:"/",expires:cs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:cs}),ls.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:cs});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:`${us}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${us}title`})}),c.jsx("p",{children:e.formatMessage({id:`${us}text`})}),c.jsx(fr,{buttons:u})]})},Jt={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:Zn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Zn["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:Zn.support,gtmType:"concierge-email-click"},business:{email:Zn.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 er="footer_",Ya="SiteFooter",Mc=({group:e})=>{const t=Jt[e].order||[];let n=!1;return"text"in Jt[e]&&(n=Jt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${er}${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}=Jt[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":Ya,"data-gtm-event-type":i,...s,children:c.jsx(ie.FormattedMessage,{id:`${er}${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:`${er}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${er}${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":Ya,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Ho=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(ni,{element:"hr"}),c.jsx(po,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ya,"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(Mc,{group:e}),Object.keys(Jt[e]).includes("child")&&c.jsx(Mc,{group:Jt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Jt.social.order)&&Jt.social.order.map(e=>{const t=Jt.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":Ya,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${er}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${er}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===wt.ACCOUNT&&t===!1&&n[wt.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 wt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case wt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case wt.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=Uc(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 wt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ie.findFirstChild(u.children,"id",wt.SITE);s=Ie.findFirstChild(d.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case wt.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)}}},Vr={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",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ga=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ie.useIntl(),o=Uc(Vr,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 m=!1;if(o.href){let k=o.gtmType||`${e}-click`;if(k.includes(".")){const T=k.split("."),D=T[T.length-2];k=`${D==="topics"?`${D}-`:""}${T[T.length-1]}`}m={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),d&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let v={},b={},E={};if(f&&(v={...v,"aria-current":"page"}),p){const k=o.menuId||e,T={onClick:D=>Ie.events.onClick(D,{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})};b={...T,id:k===wt.SITE?wt.SITE:wt.ACCOUNT},n&&(g&&(E={...T,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&Ie.events.onClick(D,{id:k,callback:a,isOpen:r[k]})},"aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),b={...b,hidden:k in r?!r[k]:!0}),g||(b={...b})}return c.jsxs("li",{className:Z({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...v,children:[m?y.createElement(d?ke:"a",m,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...E,children:[s.formatMessage({id:h}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[wt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...b,children:o.order.map(k=>{if(!o[k])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[k].order?c.jsxs("li",{className:Z({[o[k].className]:o[k].className}),children:[s.formatMessage({id:`${h}_${k}`}),c.jsx("ul",{children:o[k].order.map(D=>c.jsx(Ga,{id:`${e}.${k}.${D}`,...T},D))})]},k):c.jsx(Ga,{id:`${e}.${k}`,...T},k)})})]},e)};const sE={height:67,height_desktop:83};var wt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(wt||{});const Vo=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=y.useContext(st),r=Nn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Kr,{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]),Yc({scrollPosition:sE[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,b,o)},scrollDown:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,b,o)}}});const m=(b,E,k=!1)=>{Ie.handleMenus({id:b,value:E,menus:h.current.menus,dispatch:o,forceHandle:k})},p=y.useRef(null),g=b=>{b.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(E=>{h.current.menus[E]&&m(E,!1,!0)})};y.useEffect(()=>{var b;return(b=document.getElementById("header"))==null||b.addEventListener("keydown",g),()=>{var E;(E=document.getElementById("header"))==null||E.removeEventListener("keydown",g)}},[]),ar(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),ar(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:p,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:b=>{b.preventDefault(),b.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(wh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),v=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:b=>{b.preventDefault(),b.stopPropagation(),m("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(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Vr.order.map(b=>c.jsx(Ga,{id:b,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:m},b))})]});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(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(po,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[v,f]}):c.jsxs(c.Fragment,{children:[f,v]}),a?c.jsxs("button",{className:"account-button",onClick:b=>Ie.events.onClick(b,{id:"account-navigation",callback:m,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:m}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:m}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(bn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Vr.buttons.order.map(b=>c.jsx(Ga,{id:`buttons.${b}`},b))})]})]}),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 oE=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Vo,{}),c.jsx("div",{id:"content",children:c.jsx(vn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Ho,{})]})},kh=({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:m="default",modal:p="default"}=i,g=Vc(),[f,v]=y.useState(""),b=C=>{const{detail:{message:S}}=C;v(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",b),()=>{document.removeEventListener("ariaLive",b)}),[g]);const E=wa(e,{locale:o}),k=wa(t,{locale:o}),T=wa(n,{locale:o}),D={};return d!=="default"&&(D[d]=!0),h!=="default"&&(D[h]=!0),m!=="default"&&(D[m]=!0),c.jsx(im.ErrorBoundary,{onError:r,fallback:c.jsx(oE,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:Z(s,D,{"has-footer":u}),children:[c.jsx(Vo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:Z("additional-content prepended",{"large-modal":p==="large"}),children:k}),y.createElement(d==="bold"?lo:"div",{id:"content",children:E,className:Z({"large-modal":p==="large"})})]}),T&&c.jsx("div",{className:"additional-content appended",children:T}),u&&c.jsx(Ho,{}),c.jsx(_h,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Nc={default:"tags_",headerTopics:"header_topics_topics_"},ds={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"},uE={getTagDetails:e=>{if(e.includes("topic_")){if(e=ds.topic[e.replace("topic_","")],e){const t=Vr.topics.topics[e].href;return t?{id:e,href:t,text:`${Nc.headerTopics}${e}`}:null}return null}return ds[e]?(e=ds[e],{id:e,text:`${Nc.default}${e}`}):null}};const lE=({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=uE.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)})})};const Fh=25,Ah=({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",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const m=ie.useIntl(),p="membersList",g=y.useContext(st),[f,v]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:Z("members-list",h),children:[u?c.jsxs("h1",{children:[m.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(en,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),c.jsx(gn,{href:"/profiles/me",className:"text-small",onClick:b=>{b==null||b.preventDefault(),b==null||b.stopPropagation(),v(!0)},children:m.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((b,E)=>c.jsxs("li",{children:[c.jsx(en,{member:b,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),b.isAdmin&&c.jsx(Ht,{children:m.formatMessage({id:`${p}_admin`})})]},E)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Fh))].map((b,E)=>c.jsx("li",{children:c.jsx(si,{layout:"member"})},E)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Zr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(vi,{form:s,showModal:f,content:{title:m.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{v(!1)}}}):c.jsx(c.Fragment,{})]})},Js=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},pr=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"};const Qa=({icon:e,className:t="",...n})=>c.jsx(ke,{className:Z("discussion-button",t),variant:"tertiary",icon:e,...n}),cE={showForm:!1},gi=y.createContext(cE),Bh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(gi.Provider,{value:{...t,updateConversation:n},children:e})},dE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ie.useIntl();return t?c.jsx("small",{children:Pt(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,{})},fE=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(Io,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Pt(r.formatMessage,`${e}label_action`,t,"action")},...n})};let ba=null;const Xe="discussion_form_",Gr=({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:m="DiscussionForm"})=>{var et,Ae,We;const p=ie.useIntl(),g=y.useContext(st),[f,v]=y.useState(""),{isLoading:b=!1,isInWrapper:E=!1,isInOverlay:k=!1,isAutoFocused:T=!1,isEditing:D=!1,hasTitleField:C=!1,isPrepopulated:S=!1,showTitle:L=!1,showGuidelines:N=!0,showDivider:q=!1,showSuccessMessage:$=!0,showPostType:F=!1,postCategories:_=[]}=a||{},{onChange:P=()=>{},create:j=()=>{},handleSaveEdit:W=()=>{},handleCancel:V=()=>{},callback:se=()=>{},onMention:re=()=>{},listMembers:w=()=>Promise.resolve([]),clickMentionFallback:ee=()=>{},getLinkPreview:K=()=>Promise.resolve({}),props:A={create:{projectNames:["questions-answers"]}}}=d,[B,O]=y.useState({title:C&&C.text||"",body:D&&D.text||S&&S.text||"",categories:D&&D.categories?D.categories:"",data:h!=null&&h.link?{link:h==null?void 0:h.link}:{}}),[M,z]=y.useState(l.error||!1),[Y,U]=y.useState(!1);if(y.useEffect(()=>{u&&!D&&S&&S!==B.body&&O(be=>({...be,body:S.text||""}))},[S]),b)return c.jsx(Ot,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const ne=(be,H)=>{O(he=>({...he,body:be,data:{link:H}})),P({body:be});let ae;!g||!g.id?ae=Pt(p.formatMessage,`${Xe}error_loggedOut`,n.type,"action"):r?s>0&&be.length>=s&&(ae=`${Xe}error_tooLong`):ae=Pt(p.formatMessage,`${Xe}error_noPermission`,n.type,"action"),ae?z(ae):M&&z(!1)};let le=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const be=((et=n.slugs)==null?void 0:et.reply)||((Ae=n.slugs)==null?void 0:Ae.answer)||((We=n.slugs)==null?void 0:We.question)||"";be&&(le=`${le}-${be.slice(-15)}`)}e&&(le=`${e}-${le}`);const J=async()=>{if(!g||!g.id||!r||Te)return;ba&&clearTimeout(ba),U("submitting");const be=window.location.pathname;try{let H;switch(n.type){case"post":H=await j({title:B.title,content:B.body,categories:B.categories,data:B.data});break;case"question":H=await j({title:B.body,authorId:g&&g.id,data:B.data,...A==null?void 0:A.create});break;case"response":H=await j({questionSlug:n.slugs.question},{body:B.body,authorId:g&&g.id,contentPath:be,data:B.data});break;case"reply":H=await j({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:B.body,authorId:g&&g.id,contentPath:be,data:B.data});break;default:break}await bm(1e3),se&&await se(H),ba=setTimeout(()=>{O({title:"",body:"",categories:"",data:{}}),U("submitted"),v(Pt(p.formatMessage,`${Xe}success`,n.type,"action"));const ae=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ae),pe()},500)}catch(H){const ae=H;let he=`${Xe}error`;ae!=null&&ae.message.includes("entry already exists")&&(he=Pt(p.formatMessage,`${Xe}error_alreadyExists`,n.type,"action")),ae!=null&&ae.message.includes("429")?he=Pt(p.formatMessage,`${Xe}error_tooMany`,n.type,"action"):ae!=null&&ae.message.includes("400")&&(he=`${Xe}error`),z(he),pe()}},pe=()=>{ba=setTimeout(()=>{z(!1),U(!1),v("")},5e3)},me=be=>{O(H=>({...H,data:be}))},Fe=!B.title||!Ma(B.title),Be=!B.body||!Ma(B.body);let Te=Be;C&&(Te=Fe&&Be);const $e=Y==="submitting",Le=[{component:fE,props:{formID:le,intlPath:Xe,showLabel:C!==!1,type:n.type}},{component:Wo,props:{id:`${le}-input`,value:Y==="submitting"&&!M?"":B.body,placeholder:i||Pt(p.formatMessage,`${Xe}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:ne,onChangeData:me,onMention:re,listMembers:w,clickMentionFallback:ee,getLinkPreview:K},data:h,autoFocus:D!==!1||T&&!C,"aria-invalid":!!M,"aria-errormessage":"error-message"}},{component:dE,props:{intlPath:Xe,showGuidelines:N,type:n.type,gtmContext:m}}];q&&Le.push({component:Kt}),C&&Le.unshift({id:"title",type:"text",value:C.text,limit:250,label:p.formatMessage({id:`${Xe}titleField_label`}),placeholder:p.formatMessage({id:`${Xe}titleField_placeholder`}),functions:{onChange:be=>{O({...B,title:be}),P({title:be})}},validation:[{condition:()=>Te,error:p.formatMessage({id:`${Xe}titleField_error`})}]}),F&&Le.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},className:"post-type filters",label:p.formatMessage({id:`${Xe}postType_label`}),options:_.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{O(H=>({...H,categories:be})),P({postType:be})}}});let Ue=!g||!g.id||!r||Te||$e;return D&&(C?Ue=Ue||B.body===D.text&&B.title===C.text:Ue=Ue||B.body===D.text),c.jsxs(c.Fragment,{children:[c.jsxs(Yt,{id:le,className:Z("discussion-card discussion-form",{"no-styling":E&&D}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:D&&!$e||l.cancel},functions:{onSuccess:async be=>{if(D){U("submitting"),W(B);return}await J()},onCancel:V},fields:Le,intlPath:Xe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${D?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Ue,text:{default:!D&&(o!=null&&o.submit)?o==null?void 0:o.submit:p.formatMessage({id:`${Xe}${D?"save":"post"}`}),submitting:p.formatMessage({id:`${Xe}${D?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!B.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:p.formatMessage({id:`${Xe}cancel`})},gtm:{context:m,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[L&&!D&&["question"].includes(n.type)&&c.jsx("h2",{children:Pt(p.formatMessage,`${Xe}title`,n.type,"action")}),c.jsx(en,{member:g?{...g,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}})]}),Y==="submitted"&&$&&c.jsx(ir,{className:"success","data-testid":"success",children:Pt(p.formatMessage,`${Xe}success`,n.type,"action")}),M&&c.jsx(ir,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof M=="string"?M.includes(" ")?M:p.formatMessage({id:M},{action:p.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):M}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:f})]})},hE=Object.freeze(Object.defineProperty({__proto__:null,default:Gr},Symbol.toStringTag,{value:"Module"})),mE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),pE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function gE(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const vE=y.lazy(()=>Promise.resolve().then(()=>JE));let Mr=!1;const fs=()=>{Mr!==!1&&(clearTimeout(Mr),Mr=!1)},bE=5;let hs=null;const Th=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:m=async()=>({next:"",results:[]})}})=>{const p=ie.useIntl(),g={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,v]=y.useReducer(Kr,g),{numberOfLikes:b,userLikedContent:E,ignoreInteractions:k,showLikers:T,tabbableLink:D,showLikesModal:C}=f,S=gE(v);y.useEffect(()=>{v([{type:"userLikedContent",value:a}])},[a]);const L=y.useMemo(()=>pE(n,bE),[n]),N=_=>{if(_.preventDefault(),_.stopPropagation(),v([{type:"showLikers",value:!1}]),Mr)return fs(),!1;if(fs(),k||!s)return!1;Mr=setTimeout(q,350)},q=async()=>{if(fs(),k||!s)return!1;let _=E?b-1:b+1;_<0&&(_=0),v([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:_},{type:"userLikedContent",value:!E}]);try{if(i&&i.slugs){const P=mE(i.slugs);E?await h(P):await d({...P,payload:{contentPath:window.location.pathname}})}}catch{v([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{v([{type:"ignoreInteractions",value:!1}])}},$=()=>{hs=setTimeout(()=>{v([{type:"showLikers",value:!1}])},500)},F=()=>{hs&&clearTimeout(hs)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:_=>{_.key==="Escape"&&v([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),v([{type:"showLikers",value:!0}])},onMouseLeave:()=>{$()}},c.jsxs(c.Fragment,{children:[c.jsx(Qa,{className:Z("discussion-button text-medium action-button",{"show-spinner":k,"is-liked":E,disabled:!s}),icon:{icon:E?"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:N,screenreaderText:s?p.formatMessage({id:`discussion_likes_${E?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":E,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:b})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>$,onClick:_=>{var j;_.preventDefault(),_.stopPropagation(),F(),v([{type:"showLikers",value:!0}]);const P=(j=_.currentTarget.nextSibling)==null?void 0:j.childNodes[0];if(P){const W=P.querySelector("li:first-child a");W&&(v([{type:"tabbableLink",value:0}]),setTimeout(()=>{W.focus()},100))}},onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),_.stopPropagation(),$())},"aria-expanded":T,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Me,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Rn,{id:`likes-tooltip-${i.slug}`,isOpen:T,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[L.map((_,P)=>{if(typeof _=="string")return null;const j={};return D!==P&&(j.tabIndex=-1),c.jsx("li",{"data-index":P,children:c.jsx(gn,{href:_.id?`/profiles/${_.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>F(),onKeyDown:S,...j,children:_.name?_.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},_.id||window.btoa(_.name||""))}),c.jsx("li",{"data-index":L.length,className:"show-all",children:c.jsx(ke,{variant:"tertiary",onClick:()=>{F(),$(),v([{type:"showLikesModal",value:!0}])},onKeyDown:S,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),C&&c.jsx(hr,{children:c.jsx(y.Suspense,{children:c.jsx(vE,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:C,functions:{onClose:()=>v([{type:"showLikesModal",value:!1}]),likes:{list:m}}})})})]})]}))},yE="post",xE="reply",Sh="00000000-0000-0000-0000-000000000000";function Ko({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Zo({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 DE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function CE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function jh(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 wE({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Sh,time:new Date().toISOString(),verb:yE}}function Rc({activity:e,user:t}){return{...e,actor:jh(t),...DE()}}function Ja({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 Oh({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 Xa({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 Ph({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 EE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Sh,kind:xE,parent:t||""}}function Ic({reply:e,user:t}){const n=jh(t);return{...e,user_id:n.id,user:n,...CE()}}function $c({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 _E({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)})}function kE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function FE(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 AE(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 ei(e,t,n){return t?n!=null&&n.append?FE(e,t,n):AE(e,t,n):kE(e)}function Rt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Mh(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 Yo(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 Nh=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Lc,ms=0;const Rh=()=>{y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Lc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ms=0;return}ms++,!(ms>10)&&(Lc=setTimeout(()=>{e(t)},50))}},cr=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}),Zt=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}),Go=Object.freeze({actor:`SU:${cr.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"}),BE=Object.freeze({actor:`SU:${Zt.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"}),TE=Object.freeze({actor:`SU:${cr.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"}),SE=Object.freeze({actor:`SU:${Zt.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:Go.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Zt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Zt.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:Go.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Zt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Zt.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:Zt.id,user:{id:Zt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Go.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:BE.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:Zt.id,user:{id:Zt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:TE.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:SE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ve.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Rc({activity:wE(o),user:i});return ei(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Rc({activity:o,user:i});r.setQueryData(a,ei(d,u,{replace:!0})),setTimeout(()=>{Nh(d.id,"activity")},0)}});return s}function OE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Rt(a,s);return o&&(o.content=i),s}),onError:n});return r}function PE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=Ve.useQueryClient(),h=ii(),m={queryClient:d,queryKey:l},p={mutationHandlers:{error:Ko(m),mutate:Zo(m)},user:h,...m},g=jE({...p,mutationFn:e}),f=OE({...p,mutationFn:t}),v=ME({...p,mutationFn:n}),b=IE({...p,mutationFn:a}),E=$E({...p,mutationFn:i}),k=RE({...p,mutationFn:s}),T=LE({...p,mutationFn:o}),{activities:D,...C}=NE({queryKey:l,queryFn:r,filterOption:u});return{activities:D,mutations:{create:g,edit:f,remove:b,like:v,unlike:E,pin:k,unpin:T},user:h,...C}}function ME({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Rt(s,o);return l&&Ja({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Rt(o,l);u&&Ja({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function NE({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Yo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Rt(s,o);return l&&Xa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Rt(o,l);u&&Xa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function IE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Mh(a,i)),onError:n});return r}function $E({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Rt(i,s);return o&&Oh({activity:o,user:r}),s}),onError:n});return a}function LE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Rt(i,s);return o&&Ph({activity:o,user:r}),s}),onError:n});return a}const zE=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const h=ie.useIntl(),[m,p]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[g,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:v,error:b,fetchNextPage:E,hasNextPage:k,isLoading:T,mutations:{create:D,edit:C,remove:S,like:L,unlike:N,pin:q,unpin:$}}=PE({queryKey:[e,t,"activities",m],queryFns:i,filterOption:m[0]});y.useEffect(()=>{a&&f(g.concat(a==null?void 0:a.map(({slug:j,name:W})=>({id:j,text:W,type:"category"}))))},[a]);const[F,_]=y.useState(null),P=()=>{_(v.length),E()};return Rh(),b?c.jsx(vn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Jo,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:D,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),c.jsx(Id,{className:"activities-feed-filtering",options:g.map(({id:j,text:W})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${W}`,defaultMessage:W})})),defaultOptions:m.map(({id:j,text:W})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${W}`,defaultMessage:W})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:j,previous:W})=>{if(j[0]===W[0])return;p([g.find(re=>re.id===j[0])]);const V=g.find(re=>re.id===j[0]);if(!V)return;const se=new CustomEvent("ariaLive",{detail:{message:h.formatMessage({id:"community_sortSuccess"},{order:h.formatMessage({id:`activitiesFeed_rankingMethod_${V.text}`,defaultMessage:V.text})})}});document.dispatchEvent(se)}}),v==null?void 0:v.map((j,W)=>{var Y,U,ne;const{id:V,own_reactions:se,latest_reactions:re,reaction_counts:w,mentioned_users:ee,total_replies:K,additional_data:A}=j,B=(((Y=re==null?void 0:re.like)==null?void 0:Y.length)||0)>0,O=(((U=se==null?void 0:se.like)==null?void 0:U.length)||0)>0,M=O?se==null?void 0:se.like[0].id:"",z=B?(ne=re==null?void 0:re.like)==null?void 0:ne.map(le=>{var J,pe,me;return{id:(J=le==null?void 0:le.user)==null?void 0:J.id,name:(me=(pe=le==null?void 0:le.user)==null?void 0:pe.data)==null?void 0:me.name}}):!1;return(j==null?void 0:j.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(Qr,{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:V},slug:V,author:pr(j==null?void 0:j.actor),userLiked:O,likes:(w==null?void 0:w.like)||0,comments:K||0,peopleWhoLiked:z,data:{mentions:ee,...A||{}},pinned:(w==null?void 0:w.pin)&&(w==null?void 0:w.pin)>0||!1,categories:(j==null?void 0:j.categories)||[]},links:{post:`${e}/${t}/${V}`,comments:`${e}/${t}/${V}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>S({activityId:V}),updateContent:(le,{body:J})=>C({activityId:V,content:J})},likes:{createLike:()=>L({activityId:V}),deleteLike:()=>N({activityId:V,reactionId:M}),listLikes:le=>u.list({activityId:V,...le})},comments:{openComments:()=>null},pins:{createPin:()=>q({activityId:V}),deletePin:()=>$({activityId:V,reactionId:re==null?void 0:re.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:W===F,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},categories:a,basePath:e,parentId:t})},V)}),!T&&c.jsx(Zr,{hasNextPage:k,loadNextPage:P,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),v.length===0&&!T&&c.jsx(St,{className:"no-activities",variant:"muted",icon:"text--input",children:m[0].type==="category"?c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(ke,{variant:"secondary",size:"small",href:"/communities",children:h.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(Xo,{form:d})]})},qE={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 UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ve.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ic({reply:EE(o),user:i});return ei(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Ic({reply:o,user:i});r.setQueryData(a,ei(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Nh(d.id,"reply")},0)}});return s}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Rt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Ih({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ve.useQueryClient(),l=ii(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ko(u),mutate:Zo(u)},user:l,...u},h=UE({...d,mutationFn:e}),m=WE({...d,mutationFn:t}),p=HE({...d,mutationFn:n}),g=KE({...d,mutationFn:a}),f=ZE({...d,mutationFn:i}),{replies:v,...b}=VE({queryKey:s,queryFn:r});return{replies:v,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...b}}function HE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Rt(s,o);return l&&$c({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Rt(o,l);u&&$c({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function VE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Yo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function KE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Mh(a,i)),onError:n});return r}function ZE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Rt(i,s);return o&&_E({reply:o,user:r}),s}),onError:n});return a}const YE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ie.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:m,isLoading:p,mutations:{create:g,edit:f,like:v,remove:b,unlike:E},user:k}=Ih({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:C=>i.list({...C,reactionId:r})}});eo([p]);const[T,D]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(ke,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${T?"up_left":"down_right"}`,position:"left"},onClick:()=>D(!T),children:l.formatMessage({id:`discussion_thread_${T?"hide":"show"}`},{count:d==null?void 0:d.length})}),T&&c.jsx(Wh,{loadMore:{isLoading:p,hasNextPage:m,loadNextPage:()=>h()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(C,{body:S})=>g({activityId:n,replyId:r,content:S}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(C=>{var w,ee,K,A,B,O,M;const{id:S,own_children:L,latest_children:N,children_counts:q,data:{mentioned_users:$,additional_data:F}}=C,P=(((w=L==null?void 0:L.like)==null?void 0:w.length)||0)>0?(ee=L==null?void 0:L.like)==null?void 0:ee.find(z=>{var Y;return((Y=z==null?void 0:z.user)==null?void 0:Y.id)===(k==null?void 0:k.id)}):!1,j=P?P==null?void 0:P.id:"",W=!!P,se=(((K=N==null?void 0:N.like)==null?void 0:K.length)||0)>0?(A=N==null?void 0:N.like)==null?void 0:A.map(z=>{var Y,U,ne;return{id:(Y=z==null?void 0:z.user)==null?void 0:Y.id,name:(ne=(U=z==null?void 0:z.user)==null?void 0:U.data)==null?void 0:ne.name}}):!1,re=typeof C.data.content=="string"?(B=C==null?void 0:C.data)==null?void 0:B.content:((M=(O=C==null?void 0:C.data)==null?void 0:O.content)==null?void 0:M.text)||"";return c.jsx(Qr,{isCommunity:!0,content:{id:S,type:"reply",body:re,canLike:a,createdAt:C==null?void 0:C.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:C==null?void 0:C.parent},slug:"",author:pr(C==null?void 0:C.user),userLiked:W,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:se,data:{mentions:$,...F||{}}},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:S}),updateContent:(z,{body:Y})=>f({replyId:S,content:Y})},likes:{createLike:()=>v({replyId:S}),deleteLike:()=>E({replyId:S,reactionId:j}),listLikes:z=>o.list({replyId:S,...z})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},basePath:e,parentId:t},S)}):null})]})};const $h=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d})=>{const h=ie.useIntl(),{replies:m,fetchNextPage:p,hasNextPage:g,isLoading:f,mutations:{create:v,edit:b,like:E,remove:k,unlike:T},user:D}=Ih({queryKey:[e,t,n,"replies"],queryFns:u}),C=()=>{L(m.length),p()},[S,L]=y.useState(null);return eo([f]),Rh(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(Uh,{type:"comment",responses:r,isLoading:f}),c.jsx(Jo,{form:{content:{type:"reply",slugs:{}},functions:{create:(N,{body:q})=>v({activityId:n,content:q}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:h.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:s,leave:o,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),m==null?void 0:m.map((N,q)=>{var B,O,M,z,Y,U,ne;const{id:$,own_children:F,latest_children:_,children_counts:P,data:{mentioned_users:j,additional_data:W}}=N,se=(((B=F==null?void 0:F.like)==null?void 0:B.length)||0)>0?(O=F==null?void 0:F.like)==null?void 0:O.find(le=>{var J;return((J=le==null?void 0:le.user)==null?void 0:J.id)===(D==null?void 0:D.id)}):!1,re=se?se==null?void 0:se.id:"",w=!!se,K=(((M=_==null?void 0:_.like)==null?void 0:M.length)||0)>0?(z=_==null?void 0:_.like)==null?void 0:z.map(le=>{var J,pe,me;return{id:(J=le==null?void 0:le.user)==null?void 0:J.id,name:(me=(pe=le==null?void 0:le.user)==null?void 0:pe.data)==null?void 0:me.name}}):!1,A=typeof N.data.content=="string"?(Y=N==null?void 0:N.data)==null?void 0:Y.content:((ne=(U=N==null?void 0:N.data)==null?void 0:U.content)==null?void 0:ne.text)||"";return c.jsx(Bh,{children:c.jsx(Qr,{isCommunity:!0,content:{id:$,type:"reply",body:A,canLike:a,createdAt:N==null?void 0:N.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:$},slug:$,author:pr(N==null?void 0:N.user),userLiked:w,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:K,data:{mentions:j,...W||{}}},functions:{content:{createContent:()=>null,deleteContent:()=>k({replyId:$}),updateContent:(le,{body:J})=>b({replyId:$,content:J})},likes:{createLike:()=>E({replyId:$}),deleteLike:()=>T({replyId:$,reactionId:re}),listLikes:le=>l.list({replyId:$,...le})},comments:{},form:i},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},children:c.jsx(YE,{basePath:e,parentId:t,activityId:n,replyId:$,isMember:a,functions:{reactions:u,form:i,likes:l}}),styling:{showShareLinkButton:!0},setFocus:q===S,basePath:e,parentId:t},$)},$)}),!f&&c.jsx(Zr,{hasNextPage:g,loadNextPage:C,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),c.jsx(Xo,{form:d})]})};function GE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Yo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function QE({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=GE({queryKey:t,queryFn:e});return{likes:n,...r}}function Lh({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=QE({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?pr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Ah,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const zh=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ie.useIntl();return c.jsx(rn,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:Z("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(Lh,{...i,likeCount:r??0,functions:{likes:n}})})},JE=Object.freeze(Object.defineProperty({__proto__:null,default:zh},Symbol.toStringTag,{value:"Module"})),ps=({children:e,class:t,...n})=>{const r={...n,class:Z("subtle",t)};return c.jsx("blockquote",{...r,children:e})},XE=280,Qo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?rr(e,typeof t=="number"?t:XE):e;a=a.trim();const i=`<br>
163
+ `}),N=z.turndown(N)}o&&o.mentions&&(N=await id({text:N,template:`[${Us}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),LC(N,z=>{const Y=[{type:"initialValue",value:z},{type:"editorKey",value:L.toString()}];o!=null&&o.link&&(Y.push({type:"enrichedUrl",value:o.link}),o.link.url&&se(o.link.url)),w(Y),setTimeout(()=>{w([{type:"stringValue",value:_c(K)}])},150)})})()},[L]),y.useEffect(()=>{if(j===void 0&&K){const N=UC(K);N&&se(N)}const O=N=>{var U;const z=N,Y=((U=z==null?void 0:z.detail)==null?void 0:U.url)||null;Y&&j&&j.url===Y&&w([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",O),()=>{window.removeEventListener("linkRemoved",O)}},[j]),y.useEffect(()=>{if(t){Rr.lastIndex=0;const O=t.match(Rr);O&&O.length===1&&O[0].length===t.length&&!_&&w([{type:"originalValue",value:t}])}t!==""||!K||Oa(L,t)&&!_||(x.withoutNormalizing(K,()=>{X.delete(K,{at:{anchor:x.start(K,[]),focus:x.end(K,[])}}),X.deselect(K),K.children.length!==0&&X.unwrapNodes(K,{at:[0]}),X.insertNodes(K,k,{at:[0]})}),w([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{f({link:j})},[j]),y.useEffect(()=>{q===""&&j&&w([{type:"enrichedUrl",value:void 0}])},[q]);const B=Kc(()=>{HC({editor:K,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:w})},100);return M?c.jsx("div",{id:re,className:"rich-text-editor",children:c.jsxs(an.Provider,{value:{...D,id:re,isInOverlay:h,setFocus:V,dispatch:w,getLinkPreview:v,onMention:b,reportError:E},children:[c.jsxs(ux,{editor:K,initialValue:M,onChange:O=>{if(K.operations.some(z=>z.type!=="set_selection")){let z=KC(O);z==="<br>"&&(z=""),g(z,j),w([{type:"stringValue",value:_c(K)}]),_||w([{type:"hasInteracted",value:!0}]),B(),d&&console.log({serialized:z,json:O})}},...l,children:[c.jsx(X1,{className:"input",renderElement:C,renderLeaf:ee,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async O=>{const N=j!==!1,z=O.clipboardData.getData("text");if((U=>{try{return new URL(U),!0}catch{return!1}})(z)){let U=z;if(z){const{full:ne}=ro(z);U=ne}if(z&&v&&!N){const ne=await v(U);ne.url&&w([{type:"enrichedUrl",value:ne}])}}},onKeyDown:O=>{if(O.key==="Enter"){W.show&&(O.preventDefault(),O.stopPropagation(),ah(K,W,w,re));const{selection:N}=K;if(N){const z=Q.isCollapsed(N),[Y,U]=x.node(K,N,{depth:1});let ne=Y,le=ne.type;const J=ne.children[0];if(J&&[G.ol,G.ul].includes(J.type)&&(ne=J,le=J.type),ne&&de.isElement(ne)&&le!==G.paragraph){if(le===G.blockquote&&!O.shiftKey){O.stopPropagation(),O.preventDefault(),X.insertNodes(K,k);return}if(z){const[pe,me]=x.parent(K,N,{edge:"end"}),Be=pe.type;if([G.ul,G.ol].includes(le))if(O.stopPropagation(),O.preventDefault(),Be===G.li&&F==="Enter"){pe.children.length===1&&"text"in pe.children[0]&&pe.children[0].text===""&&X.removeNodes(K,{at:me}),X.insertNodes(K,k,{at:I.next(U)}),X.select(K,x.end(K,I.next(U)));return}else{const[Te,$e]=zC(K,G.li),Le={type:G.li,children:[{text:""}]};X.insertNodes(K,Le,{at:I.next($e)}),X.select(K,x.end(K,I.next($e)))}}}}}else if(O.key==="Escape"){if(W.show){O.preventDefault(),O.stopPropagation(),w([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(O.key)&&W.show){O.preventDefault(),O.stopPropagation();const{selectedUser:N,possibleUsers:z}=W;let Y=O.key==="ArrowUp"?N-1:N+1;Y<0&&(Y=z.length-1),Y>=z.length+1&&(Y=0),w([{type:"mentionPopover",value:{...W,selectedUser:Y}}])}w([{type:"lastKey",value:O.key}]),WC(O,K,w,E)},onBlur:()=>{K.selection&&w([{type:"lastAnchor",value:K.selection.anchor}])},onFocus:()=>{if($){if(!I.isPath($.path)||!ue.has(K,$.path))return;const O=ue.get(K,$.path);let N=0;if(fe.isText(O)?N=O.text.length:O.children&&(N=O.children.length),$.offset>N)return;try{X.select(K,{anchor:$,focus:$})}catch(z){const Y=z.message;E(`Error focusing editor: ${Y}`)}}}}),j?c.jsx(mo,{data:j,variant:"condensed",onClick:()=>{w([{type:"enrichedUrl",value:!1}]);const O=new CustomEvent("ariaLive",{detail:{message:u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(O)},"aria-label":u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:j.title||u.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(aw,{}),m?c.jsx(ZC,{onFallbackClick:p}):c.jsx(c.Fragment,{})]},S),c.jsx(go,{id:`character-limit-${e}`,limit:r,valueLength:ui(q)})]})}):c.jsx(c.Fragment,{})};const Ww=({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 yh({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,m]=y.useState(!1),[p,g]=y.useState(!1),f=y.useRef(null),v=async T=>{m(!0),g(!1);try{const D=T.target.files&&T.target.files[0];if(!D||!t)throw m(!1),new Error("Image file or userID is missing");const w=await a({fileObject:D,userId:t}),S={thumbnail:w.thumbnailURL,full:w.originalURL};d(S),s(S)}catch{g(!0)}finally{m(!1)}m(!1)},{upload:b=o.formatMessage({id:`${l}cta_upload`}),change:E=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:Z("profile-image-change-figure",e),children:[c.jsx(bn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&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:v,hidden:!0,"data-testid":"file-input"}),c.jsx(ke,{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?E:b})]})}const xh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Yt,{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},button:{className:"new"}})};const Hw=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(sm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Dh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,m]=y.useState([]),[p,g]=y.useState(!0),[f,v]=y.useState(d),{formatMessage:b}=ie.useIntl(),E=async D=>{try{await u(h,D.message),m([]),v("SUCCESS")}catch(w){v("ERROR"),l(w)}},k=D=>{D.preventDefault(),v("NOT_SUBMITTED"),g(!0),m([])},T=D=>{D.preventDefault(),o(),v("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="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(Kt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"secondary",onClick:k,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(ke,{onClick:T,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(ke,{onClick:k,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Yt,{id:"invite-form",fields:[{component:Hw,props:{emails:h,setEmails:m,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:b({id:"inviteForm_message_label"}),placeholder:n||b({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:E},button:{text:r,size:"medium",disabled:p}})]})},ja=e=>e.map(t=>({condition:t})),Ft={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Vw=({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=p=>p[Ft.NEW_PASSWORD]!==p[Ft.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Cs(p[Ft.NEW_PASSWORD]).isValid,h=[{"data-testid":Ft.NEW_PASSWORD,id:Ft.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ja(["required",d]),functions:{onChange:p=>l(Cs(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Ft.CONFIRMED_PASSWORD,id:Ft.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ja(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Ft.CURRENT_PASSWORD,id:Ft.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ja(["required"])}),i&&h.push({component:Zd,props:{matchingRules:o}});const m={id:Ft.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Ft.NEW_PASSWORD)||g.includes(Ft.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Yt,{...m}),r&&c.jsx(vn,{variant:"error",text:r})]})};const Ch=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a})=>{var S,L;const i=ie.useIntl(),s="profileForm_",o=y.useContext(st),[l,u]=y.useState(o.image),[d,h]=y.useState(!1),{uploadImage:m=()=>{},onSuccess:p=async M=>{},onCancel:g=()=>{},onFailure:f=()=>{}}=n,{buildLocation:v,isValidPlace:b,predictPlaces:E}=t.useMaps(),{context:k="ProfileForm",event:T="profile-form-submit-click"}=a||{},D=[{id:"jobTitle",type:"text",label:i.formatMessage({id:`${s}jobTitle`}),placeholder:i.formatMessage({id:`${s}jobTitle_placeholder`}),value:o.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:i.formatMessage({id:`${s}organization`}),placeholder:i.formatMessage({id:`${s}organization_placeholder`}),value:o.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:i.formatMessage({id:`${s}location`}),placeholder:i.formatMessage({id:`${s}location_placeholder`}),value:((S=o.location)==null?void 0:S.en)||((L=o.location)==null?void 0:L.country),validation:[{condition:"required"},{condition:({location:M})=>M&&!d?!1:!b(M),error:i.formatMessage({id:`${s}location_error`})}],functions:{onChange:()=>{d||h(!0)},onKeyInput:E}}],w=[{component:yh,props:{userName:o.name,userId:o.id,src:l,uploadImage:m,callback:u,button:{text:{upload:i.formatMessage({id:`${s}image`})}}}},{id:"name",type:"text",label:i.formatMessage({id:`${s}name`}),placeholder:i.formatMessage({id:`${s}name_placeholder`}),value:o.name,autoComplete:"name",validation:[{condition:"required"}]},...D,{id:"biography",type:"textarea",label:i.formatMessage({id:`${s}bio`}),placeholder:i.formatMessage({id:`${s}bio_placeholder`}),limit:1e3,value:o.biography},{component:Kt}];return c.jsx(Yt,{id:"profile-details-form",fields:e?D:w,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:s,gtm:{context:k,event:T},functions:{onSuccess:async M=>{try{const q={...M,image:l||null,location:d?await v(M==null?void 0:M.location):o.location};o.updateDetails&&o.updateDetails($=>({...$,...q})),await p(q)}catch{f()}},onCancel:g,onFailure:f},button:{size:"large",text:{default:i.formatMessage({id:`${s}cta`}),submitting:i.formatMessage({id:`${s}cta_submitting`}),submitted:i.formatMessage({id:`${s}cta_submitted`})}}})};let is=null;const mt="publishArticleForm_",jc={},Oc=10,Kw=({id:e="publish-article-form",values:t=jc,functions:n,meta:r,gtm:a})=>{const i=ie.useIntl(),s=y.useContext(st),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,m]=y.useState(t.body||""),[p,g]=y.useState(!1),[f,v]=y.useState("");y.useEffect(()=>{Oa(t,jc)||Ma(t.body)&&t.body!==h&&t.body!==void 0&&m(t.body)},[t.body]);const b=()=>{!s||!s.id?g(i.formatMessage({id:`${mt}error_loggedOut`})):p&&g(!1)},E=w=>({condition:S=>{const L=S[w];return!L||typeof L!="string"?!0:L.length<Oc},error:i.formatMessage({id:`${mt}error_underMinLength`},{length:Oc})}),k=!h||!Ma(h),T=()=>c.jsxs(c.Fragment,{children:[c.jsx(Kt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${mt}disclaimer`})})]}),D=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${mt}title_label`}),placeholder:i.formatMessage({id:`${mt}title_placeholder`}),functions:{onChange:b},validation:[{condition:"required"},E("title"),{condition:()=>k,error:i.formatMessage({id:`${mt}title_error`})}]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${mt}subtitle_label`}),placeholder:i.formatMessage({id:`${mt}subtitle_placeholder`}),functions:{onChange:b},validation:[{condition:"required"},E("subtitle")]},{component:Io,props:{formID:e,label:{visible:i.formatMessage({id:`${mt}body_label`})},showLabel:!0}},{component:Wo,props:{id:`${e}-input`,value:h,meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:w=>{m(w),b()}},"aria-invalid":!!p,"aria-errormessage":"error-message"}},{component:T}];return c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Yt,{id:e,meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async w=>{if(!s||!s.id||k)return;is&&clearTimeout(is);const S={...w,body:h};try{o&&await o(S),is=setTimeout(()=>{m(""),v(i.formatMessage({id:`${mt}aria_success`})),l(S)},500)}catch{g(!0),v(""),u()}},onFailure:u},fields:D,intlPath:mt,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||k,text:{default:i.formatMessage({id:`${mt}cta_submit`}),submitting:i.formatMessage({id:`${mt}cta_submitting`}),submitted:i.formatMessage({id:`${mt}cta_submitted`})}},gtm:a}),p&&c.jsx(ir,{id:"error-message",className:"error",children:typeof p=="string"&&p.includes(" ")?p:i.formatMessage({id:`${mt}error`})}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:f})]})};const wh=({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);ar(()=>{!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(Me,{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(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Pc=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}])},Zw=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"]}},Yw=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=Zw(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}])},Gw=({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=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Pc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Ud,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>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:p}),privacy:p=>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:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Pc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const Qw=({className:e=""})=>c.jsxs("div",{className:Z("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 Jw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Xw=({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:m=!0,successMessage:p=!0}=a,g={title:u,expectation:d,url:h,logInButton:m,successMessage:p},[f,v]=y.useReducer(Kr,Jw),{validFields:b,emailDetails:E,shouldManuallyApprove:k,shouldDisableButton:T,showSuccessMessage:D,showError:w}=f,[S,L]=Xs.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(()=>{k===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[k]),y.useEffect(()=>{S["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{D&&S["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[D]);const q=y.useMemo(()=>Gw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:M,state:f,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,M,g,f]),$=T?!0:k?!Object.values(b).every(F=>F===!0):!b.name||!b.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&D?c.jsx(Qw,{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(ie.FormattedMessage,{id:"signup_title"})}),w&&c.jsx(vn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Yt,{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:$?{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 Yw({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:f})},onCatch:F=>{r.handleError(F),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const Dn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:Z("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const eE=({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 new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(Dn,{className:Z("download-section",n),styling:{background:"dark"},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(fr,{buttons:r})]})})};const Qs="editSection_";function Eh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tE=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(St,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Qs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(ke,{href:r,variant:"secondary",size:"small",onClick:()=>Eh({href:r,setShowModal:i}),children:n||s({id:`${Qs}placeholder_cta`})})})]})},nE=({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,m]=y.useState(!1),p=()=>m(!1),g=!!n||!!r,f=typeof a=="string"||g;let v;return r&&(v=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async b=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(b)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:Z("edit-section",t),children:[g&&c.jsx(rn,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:p},className:Z("edit-section-modal"),children:v||(n?c.jsx(Yt,{...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 b=>{var E,k;(E=n==null?void 0:n.functions)!=null&&E.onSuccess&&await((k=n==null?void 0:n.functions)==null?void 0:k.onSuccess(b)),m(!1)},onCancel:p}}):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(ke,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Eh({href:a,setShowModal:m}),children:d({id:`${Qs}edit`})})]}),e||c.jsx(tE,{...l,href:a,setShowModal:m,showEditButton:f}),u&&c.jsx(Kt,{})]})};const rE=({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:m=!1,description:p=!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:m?c.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${g}`))})})]})};let ss;const os="contactFooter_",aE=({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(ss),ss=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ss),window.removeEventListener("resize",l)}),[]),c.jsx(Dn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${os}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:`${os}text`})}),c.jsx(gn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${os}email`})})]}),c.jsx(xh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},iE=({activeLink:e,profile:t,...n})=>c.jsx(Dn,{children:c.jsx(zd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Ld,{activeLink:e,profile:t}),c.jsx(fd,{...n})]})})});const us="cookieBanner_",ls=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],cs=new Date(Date.now()+12*30*24*60*60*1e3),_h=()=>{const e=ie.useIntl(),[t,n,r]=Xs.useCookies(ls),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ls.forEach(d=>{n(d,!0,{path:"/",expires:cs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:cs}),ls.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:cs});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:`${us}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${us}title`})}),c.jsx("p",{children:e.formatMessage({id:`${us}text`})}),c.jsx(fr,{buttons:u})]})},Jt={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:Zn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Zn["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:Zn.support,gtmType:"concierge-email-click"},business:{email:Zn.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 er="footer_",Ya="SiteFooter",Mc=({group:e})=>{const t=Jt[e].order||[];let n=!1;return"text"in Jt[e]&&(n=Jt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${er}${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}=Jt[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":Ya,"data-gtm-event-type":i,...s,children:c.jsx(ie.FormattedMessage,{id:`${er}${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:`${er}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${er}${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":Ya,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Ho=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(ni,{element:"hr"}),c.jsx(po,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ya,"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(Mc,{group:e}),Object.keys(Jt[e]).includes("child")&&c.jsx(Mc,{group:Jt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Jt.social.order)&&Jt.social.order.map(e=>{const t=Jt.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":Ya,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${er}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${er}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===wt.ACCOUNT&&t===!1&&n[wt.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 wt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case wt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case wt.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=Uc(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 wt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ie.findFirstChild(u.children,"id",wt.SITE);s=Ie.findFirstChild(d.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case wt.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)}}},Vr={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",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ga=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ie.useIntl(),o=Uc(Vr,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 m=!1;if(o.href){let k=o.gtmType||`${e}-click`;if(k.includes(".")){const T=k.split("."),D=T[T.length-2];k=`${D==="topics"?`${D}-`:""}${T[T.length-1]}`}m={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),d&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let v={},b={},E={};if(f&&(v={...v,"aria-current":"page"}),p){const k=o.menuId||e,T={onClick:D=>Ie.events.onClick(D,{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})};b={...T,id:k===wt.SITE?wt.SITE:wt.ACCOUNT},n&&(g&&(E={...T,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&Ie.events.onClick(D,{id:k,callback:a,isOpen:r[k]})},"aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),b={...b,hidden:k in r?!r[k]:!0}),g||(b={...b})}return c.jsxs("li",{className:Z({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...v,children:[m?y.createElement(d?ke:"a",m,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...E,children:[s.formatMessage({id:h}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[wt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...b,children:o.order.map(k=>{if(!o[k])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[k].order?c.jsxs("li",{className:Z({[o[k].className]:o[k].className}),children:[s.formatMessage({id:`${h}_${k}`}),c.jsx("ul",{children:o[k].order.map(D=>c.jsx(Ga,{id:`${e}.${k}.${D}`,...T},D))})]},k):c.jsx(Ga,{id:`${e}.${k}`,...T},k)})})]},e)};const sE={height:67,height_desktop:83};var wt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(wt||{});const Vo=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=y.useContext(st),r=Nn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Kr,{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]),Yc({scrollPosition:sE[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,b,o)},scrollDown:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,b,o)}}});const m=(b,E,k=!1)=>{Ie.handleMenus({id:b,value:E,menus:h.current.menus,dispatch:o,forceHandle:k})},p=y.useRef(null),g=b=>{b.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(E=>{h.current.menus[E]&&m(E,!1,!0)})};y.useEffect(()=>{var b;return(b=document.getElementById("header"))==null||b.addEventListener("keydown",g),()=>{var E;(E=document.getElementById("header"))==null||E.removeEventListener("keydown",g)}},[]),ar(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),ar(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:p,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:b=>{b.preventDefault(),b.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(wh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),v=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:b=>{b.preventDefault(),b.stopPropagation(),m("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(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Vr.order.map(b=>c.jsx(Ga,{id:b,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:m},b))})]});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(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(po,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[v,f]}):c.jsxs(c.Fragment,{children:[f,v]}),a?c.jsxs("button",{className:"account-button",onClick:b=>Ie.events.onClick(b,{id:"account-navigation",callback:m,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:m}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:m}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(bn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Vr.buttons.order.map(b=>c.jsx(Ga,{id:`buttons.${b}`},b))})]})]}),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 oE=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Vo,{}),c.jsx("div",{id:"content",children:c.jsx(vn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Ho,{})]})},kh=({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:m="default",modal:p="default"}=i,g=Vc(),[f,v]=y.useState(""),b=w=>{const{detail:{message:S}}=w;v(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",b),()=>{document.removeEventListener("ariaLive",b)}),[g]);const E=wa(e,{locale:o}),k=wa(t,{locale:o}),T=wa(n,{locale:o}),D={};return d!=="default"&&(D[d]=!0),h!=="default"&&(D[h]=!0),m!=="default"&&(D[m]=!0),c.jsx(im.ErrorBoundary,{onError:r,fallback:c.jsx(oE,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:Z(s,D,{"has-footer":u}),children:[c.jsx(Vo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:Z("additional-content prepended",{"large-modal":p==="large"}),children:k}),y.createElement(d==="bold"?lo:"div",{id:"content",children:E,className:Z({"large-modal":p==="large"})})]}),T&&c.jsx("div",{className:"additional-content appended",children:T}),u&&c.jsx(Ho,{}),c.jsx(_h,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Nc={default:"tags_",headerTopics:"header_topics_topics_"},ds={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"},uE={getTagDetails:e=>{if(e.includes("topic_")){if(e=ds.topic[e.replace("topic_","")],e){const t=Vr.topics.topics[e].href;return t?{id:e,href:t,text:`${Nc.headerTopics}${e}`}:null}return null}return ds[e]?(e=ds[e],{id:e,text:`${Nc.default}${e}`}):null}};const lE=({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=uE.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)})})};const Fh=25,Ah=({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",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const m=ie.useIntl(),p="membersList",g=y.useContext(st),[f,v]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:Z("members-list",h),children:[u?c.jsxs("h1",{children:[m.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(en,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),c.jsx(gn,{href:"/profiles/me",className:"text-small",onClick:b=>{b==null||b.preventDefault(),b==null||b.stopPropagation(),v(!0)},children:m.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((b,E)=>c.jsxs("li",{children:[c.jsx(en,{member:b,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),b.isAdmin&&c.jsx(Ht,{children:m.formatMessage({id:`${p}_admin`})})]},E)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Fh))].map((b,E)=>c.jsx("li",{children:c.jsx(si,{layout:"member"})},E)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Zr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(vi,{form:s,showModal:f,content:{title:m.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{v(!1)}}}):c.jsx(c.Fragment,{})]})},Js=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},pr=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"};const Qa=({icon:e,className:t="",...n})=>c.jsx(ke,{className:Z("discussion-button",t),variant:"tertiary",icon:e,...n}),cE={showForm:!1},gi=y.createContext(cE),Bh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(gi.Provider,{value:{...t,updateConversation:n},children:e})},dE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ie.useIntl();return t?c.jsx("small",{children:Pt(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,{})},fE=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(Io,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Pt(r.formatMessage,`${e}label_action`,t,"action")},...n})};let ba=null;const Xe="discussion_form_",Gr=({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:m="DiscussionForm"})=>{var et,Ae,We;const p=ie.useIntl(),g=y.useContext(st),[f,v]=y.useState(""),{isLoading:b=!1,isInWrapper:E=!1,isInOverlay:k=!1,isAutoFocused:T=!1,isEditing:D=!1,hasTitleField:w=!1,isPrepopulated:S=!1,showTitle:L=!1,showGuidelines:M=!0,showDivider:q=!1,showSuccessMessage:$=!0,showPostType:F=!1,postCategories:_=[]}=a||{},{onChange:P=()=>{},create:j=()=>{},handleSaveEdit:W=()=>{},handleCancel:V=()=>{},callback:se=()=>{},onMention:re=()=>{},listMembers:C=()=>Promise.resolve([]),clickMentionFallback:ee=()=>{},getLinkPreview:K=()=>Promise.resolve({}),props:A={create:{projectNames:["questions-answers"]}}}=d,[B,O]=y.useState({title:w&&w.text||"",body:D&&D.text||S&&S.text||"",categories:D&&D.categories?D.categories:"",data:h!=null&&h.link?{link:h==null?void 0:h.link}:{}}),[N,z]=y.useState(l.error||!1),[Y,U]=y.useState(!1);if(y.useEffect(()=>{u&&!D&&S&&S!==B.body&&O(be=>({...be,body:S.text||""}))},[S]),b)return c.jsx(Ot,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const ne=(be,H)=>{O(he=>({...he,body:be,data:{link:H}})),P({body:be});let ae;!g||!g.id?ae=Pt(p.formatMessage,`${Xe}error_loggedOut`,n.type,"action"):r?s>0&&be.length>=s&&(ae=`${Xe}error_tooLong`):ae=Pt(p.formatMessage,`${Xe}error_noPermission`,n.type,"action"),ae?z(ae):N&&z(!1)};let le=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const be=((et=n.slugs)==null?void 0:et.reply)||((Ae=n.slugs)==null?void 0:Ae.answer)||((We=n.slugs)==null?void 0:We.question)||"";be&&(le=`${le}-${be.slice(-15)}`)}e&&(le=`${e}-${le}`);const J=async()=>{if(!g||!g.id||!r||Te)return;ba&&clearTimeout(ba),U("submitting");const be=window.location.pathname;try{let H;switch(n.type){case"post":H=await j({title:B.title,content:B.body,categories:B.categories,data:B.data});break;case"question":H=await j({title:B.body,authorId:g&&g.id,data:B.data,...A==null?void 0:A.create});break;case"response":H=await j({questionSlug:n.slugs.question},{body:B.body,authorId:g&&g.id,contentPath:be,data:B.data});break;case"reply":H=await j({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:B.body,authorId:g&&g.id,contentPath:be,data:B.data});break;default:break}await bm(1e3),se&&await se(H),ba=setTimeout(()=>{O({title:"",body:"",categories:"",data:{}}),U("submitted"),v(Pt(p.formatMessage,`${Xe}success`,n.type,"action"));const ae=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ae),pe()},500)}catch(H){const ae=H;let he=`${Xe}error`;ae!=null&&ae.message.includes("entry already exists")&&(he=Pt(p.formatMessage,`${Xe}error_alreadyExists`,n.type,"action")),ae!=null&&ae.message.includes("429")?he=Pt(p.formatMessage,`${Xe}error_tooMany`,n.type,"action"):ae!=null&&ae.message.includes("400")&&(he=`${Xe}error`),z(he),pe()}},pe=()=>{ba=setTimeout(()=>{z(!1),U(!1),v("")},5e3)},me=be=>{O(H=>({...H,data:be}))},Fe=!B.title||!Ma(B.title),Be=!B.body||!Ma(B.body);let Te=Be;w&&(Te=Fe&&Be);const $e=Y==="submitting",Le=[{component:fE,props:{formID:le,intlPath:Xe,showLabel:w!==!1,type:n.type}},{component:Wo,props:{id:`${le}-input`,value:Y==="submitting"&&!N?"":B.body,placeholder:i||Pt(p.formatMessage,`${Xe}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:ne,onChangeData:me,onMention:re,listMembers:C,clickMentionFallback:ee,getLinkPreview:K},data:h,autoFocus:D!==!1||T&&!w,"aria-invalid":!!N,"aria-errormessage":"error-message"}},{component:dE,props:{intlPath:Xe,showGuidelines:M,type:n.type,gtmContext:m}}];q&&Le.push({component:Kt}),w&&Le.unshift({id:"title",type:"text",value:w.text,limit:250,label:p.formatMessage({id:`${Xe}titleField_label`}),placeholder:p.formatMessage({id:`${Xe}titleField_placeholder`}),functions:{onChange:be=>{O({...B,title:be}),P({title:be})}},validation:[{condition:()=>Te,error:p.formatMessage({id:`${Xe}titleField_error`})}]}),F&&Le.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},className:"post-type filters",label:p.formatMessage({id:`${Xe}postType_label`}),options:_.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{O(H=>({...H,categories:be})),P({postType:be})}}});let Ue=!g||!g.id||!r||Te||$e;return D&&(w?Ue=Ue||B.body===D.text&&B.title===w.text:Ue=Ue||B.body===D.text),c.jsxs(c.Fragment,{children:[c.jsxs(Yt,{id:le,className:Z("discussion-card discussion-form",{"no-styling":E&&D}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:D&&!$e||l.cancel},functions:{onSuccess:async be=>{if(D){U("submitting"),W(B);return}await J()},onCancel:V},fields:Le,intlPath:Xe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${D?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Ue,text:{default:!D&&(o!=null&&o.submit)?o==null?void 0:o.submit:p.formatMessage({id:`${Xe}${D?"save":"post"}`}),submitting:p.formatMessage({id:`${Xe}${D?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!B.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:p.formatMessage({id:`${Xe}cancel`})},gtm:{context:m,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[L&&!D&&["question"].includes(n.type)&&c.jsx("h2",{children:Pt(p.formatMessage,`${Xe}title`,n.type,"action")}),c.jsx(en,{member:g?{...g,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}})]}),Y==="submitted"&&$&&c.jsx(ir,{className:"success","data-testid":"success",children:Pt(p.formatMessage,`${Xe}success`,n.type,"action")}),N&&c.jsx(ir,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof N=="string"?N.includes(" ")?N:p.formatMessage({id:N},{action:p.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):N}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:f})]})},hE=Object.freeze(Object.defineProperty({__proto__:null,default:Gr},Symbol.toStringTag,{value:"Module"})),mE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),pE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function gE(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const vE=y.lazy(()=>Promise.resolve().then(()=>JE));let Mr=!1;const fs=()=>{Mr!==!1&&(clearTimeout(Mr),Mr=!1)},bE=5;let hs=null;const Th=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:m=async()=>({next:"",results:[]})}})=>{const p=ie.useIntl(),g={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,v]=y.useReducer(Kr,g),{numberOfLikes:b,userLikedContent:E,ignoreInteractions:k,showLikers:T,tabbableLink:D,showLikesModal:w}=f,S=gE(v);y.useEffect(()=>{v([{type:"userLikedContent",value:a}])},[a]);const L=y.useMemo(()=>pE(n,bE),[n]),M=_=>{if(_.preventDefault(),_.stopPropagation(),v([{type:"showLikers",value:!1}]),Mr)return fs(),!1;if(fs(),k||!s)return!1;Mr=setTimeout(q,350)},q=async()=>{if(fs(),k||!s)return!1;let _=E?b-1:b+1;_<0&&(_=0),v([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:_},{type:"userLikedContent",value:!E}]);try{if(i&&i.slugs){const P=mE(i.slugs);E?await h(P):await d({...P,payload:{contentPath:window.location.pathname}})}}catch{v([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{v([{type:"ignoreInteractions",value:!1}])}},$=()=>{hs=setTimeout(()=>{v([{type:"showLikers",value:!1}])},500)},F=()=>{hs&&clearTimeout(hs)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:_=>{_.key==="Escape"&&v([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),v([{type:"showLikers",value:!0}])},onMouseLeave:()=>{$()}},c.jsxs(c.Fragment,{children:[c.jsx(Qa,{className:Z("discussion-button text-medium action-button",{"show-spinner":k,"is-liked":E,disabled:!s}),icon:{icon:E?"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:M,screenreaderText:s?p.formatMessage({id:`discussion_likes_${E?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":E,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:b})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>$,onClick:_=>{var j;_.preventDefault(),_.stopPropagation(),F(),v([{type:"showLikers",value:!0}]);const P=(j=_.currentTarget.nextSibling)==null?void 0:j.childNodes[0];if(P){const W=P.querySelector("li:first-child a");W&&(v([{type:"tabbableLink",value:0}]),setTimeout(()=>{W.focus()},100))}},onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),_.stopPropagation(),$())},"aria-expanded":T,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Me,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Rn,{id:`likes-tooltip-${i.slug}`,isOpen:T,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[L.map((_,P)=>{if(typeof _=="string")return null;const j={};return D!==P&&(j.tabIndex=-1),c.jsx("li",{"data-index":P,children:c.jsx(gn,{href:_.id?`/profiles/${_.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>F(),onKeyDown:S,...j,children:_.name?_.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},_.id||window.btoa(_.name||""))}),c.jsx("li",{"data-index":L.length,className:"show-all",children:c.jsx(ke,{variant:"tertiary",onClick:()=>{F(),$(),v([{type:"showLikesModal",value:!0}])},onKeyDown:S,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),w&&c.jsx(hr,{children:c.jsx(y.Suspense,{children:c.jsx(vE,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:w,functions:{onClose:()=>v([{type:"showLikesModal",value:!1}]),likes:{list:m}}})})})]})]}))},yE="post",xE="reply",Sh="00000000-0000-0000-0000-000000000000";function Ko({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Zo({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 DE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function CE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function jh(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 wE({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Sh,time:new Date().toISOString(),verb:yE}}function Rc({activity:e,user:t}){return{...e,actor:jh(t),...DE()}}function Ja({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 Oh({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 Xa({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 Ph({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 EE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Sh,kind:xE,parent:t||""}}function Ic({reply:e,user:t}){const n=jh(t);return{...e,user_id:n.id,user:n,...CE()}}function $c({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 _E({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)})}function kE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function FE(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 AE(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 ei(e,t,n){return t?n!=null&&n.append?FE(e,t,n):AE(e,t,n):kE(e)}function Rt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Mh(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 Yo(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 Nh=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Lc,ms=0;const Rh=()=>{y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Lc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ms=0;return}ms++,!(ms>10)&&(Lc=setTimeout(()=>{e(t)},50))}},cr=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}),Zt=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}),Go=Object.freeze({actor:`SU:${cr.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"}),BE=Object.freeze({actor:`SU:${Zt.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"}),TE=Object.freeze({actor:`SU:${cr.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"}),SE=Object.freeze({actor:`SU:${Zt.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:Go.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Zt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Zt.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:Go.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Zt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Zt.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:Zt.id,user:{id:Zt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Go.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:BE.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:Zt.id,user:{id:Zt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:TE.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:SE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ve.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Rc({activity:wE(o),user:i});return ei(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Rc({activity:o,user:i});r.setQueryData(a,ei(d,u,{replace:!0})),setTimeout(()=>{Nh(d.id,"activity")},0)}});return s}function OE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Rt(a,s);return o&&(o.content=i),s}),onError:n});return r}function PE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=Ve.useQueryClient(),h=ii(),m={queryClient:d,queryKey:l},p={mutationHandlers:{error:Ko(m),mutate:Zo(m)},user:h,...m},g=jE({...p,mutationFn:e}),f=OE({...p,mutationFn:t}),v=ME({...p,mutationFn:n}),b=IE({...p,mutationFn:a}),E=$E({...p,mutationFn:i}),k=RE({...p,mutationFn:s}),T=LE({...p,mutationFn:o}),{activities:D,...w}=NE({queryKey:l,queryFn:r,filterOption:u});return{activities:D,mutations:{create:g,edit:f,remove:b,like:v,unlike:E,pin:k,unpin:T},user:h,...w}}function ME({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Rt(s,o);return l&&Ja({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Rt(o,l);u&&Ja({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function NE({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Yo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Rt(s,o);return l&&Xa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Rt(o,l);u&&Xa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function IE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Mh(a,i)),onError:n});return r}function $E({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Rt(i,s);return o&&Oh({activity:o,user:r}),s}),onError:n});return a}function LE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Rt(i,s);return o&&Ph({activity:o,user:r}),s}),onError:n});return a}const zE=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const h=ie.useIntl(),[m,p]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[g,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:v,error:b,fetchNextPage:E,hasNextPage:k,isLoading:T,mutations:{create:D,edit:w,remove:S,like:L,unlike:M,pin:q,unpin:$}}=PE({queryKey:[e,t,"activities",m],queryFns:i,filterOption:m[0]});y.useEffect(()=>{a&&f(g.concat(a==null?void 0:a.map(({slug:j,name:W})=>({id:j,text:W,type:"category"}))))},[a]);const[F,_]=y.useState(null),P=()=>{_(v.length),E()};return Rh(),b?c.jsx(vn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Jo,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:D,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),c.jsx(Id,{className:"activities-feed-filtering",options:g.map(({id:j,text:W})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${W}`,defaultMessage:W})})),defaultOptions:m.map(({id:j,text:W})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${W}`,defaultMessage:W})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:j,previous:W})=>{if(j[0]===W[0])return;p([g.find(re=>re.id===j[0])]);const V=g.find(re=>re.id===j[0]);if(!V)return;const se=new CustomEvent("ariaLive",{detail:{message:h.formatMessage({id:"community_sortSuccess"},{order:h.formatMessage({id:`activitiesFeed_rankingMethod_${V.text}`,defaultMessage:V.text})})}});document.dispatchEvent(se)}}),v==null?void 0:v.map((j,W)=>{var Y,U,ne;const{id:V,own_reactions:se,latest_reactions:re,reaction_counts:C,mentioned_users:ee,total_replies:K,additional_data:A}=j,B=(((Y=re==null?void 0:re.like)==null?void 0:Y.length)||0)>0,O=(((U=se==null?void 0:se.like)==null?void 0:U.length)||0)>0,N=O?se==null?void 0:se.like[0].id:"",z=B?(ne=re==null?void 0:re.like)==null?void 0:ne.map(le=>{var J,pe,me;return{id:(J=le==null?void 0:le.user)==null?void 0:J.id,name:(me=(pe=le==null?void 0:le.user)==null?void 0:pe.data)==null?void 0:me.name}}):!1;return(j==null?void 0:j.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(Qr,{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:V},slug:V,author:pr(j==null?void 0:j.actor),userLiked:O,likes:(C==null?void 0:C.like)||0,comments:K||0,peopleWhoLiked:z,data:{mentions:ee,...A||{}},pinned:(C==null?void 0:C.pin)&&(C==null?void 0:C.pin)>0||!1,categories:(j==null?void 0:j.categories)||[]},links:{post:`${e}/${t}/${V}`,comments:`${e}/${t}/${V}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>S({activityId:V}),updateContent:(le,{body:J})=>w({activityId:V,content:J})},likes:{createLike:()=>L({activityId:V}),deleteLike:()=>M({activityId:V,reactionId:N}),listLikes:le=>u.list({activityId:V,...le})},comments:{openComments:()=>null},pins:{createPin:()=>q({activityId:V}),deletePin:()=>$({activityId:V,reactionId:re==null?void 0:re.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:W===F,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},categories:a,basePath:e,parentId:t})},V)}),!T&&c.jsx(Zr,{hasNextPage:k,loadNextPage:P,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),v.length===0&&!T&&c.jsx(St,{className:"no-activities",variant:"muted",icon:"text--input",children:m[0].type==="category"?c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(ke,{variant:"secondary",size:"small",href:"/communities",children:h.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(Xo,{form:d})]})},qE={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 UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ve.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ic({reply:EE(o),user:i});return ei(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Ic({reply:o,user:i});r.setQueryData(a,ei(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Nh(d.id,"reply")},0)}});return s}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Rt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Ih({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ve.useQueryClient(),l=ii(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ko(u),mutate:Zo(u)},user:l,...u},h=UE({...d,mutationFn:e}),m=WE({...d,mutationFn:t}),p=HE({...d,mutationFn:n}),g=KE({...d,mutationFn:a}),f=ZE({...d,mutationFn:i}),{replies:v,...b}=VE({queryKey:s,queryFn:r});return{replies:v,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...b}}function HE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Rt(s,o);return l&&$c({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Rt(o,l);u&&$c({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function VE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Yo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function KE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Mh(a,i)),onError:n});return r}function ZE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Rt(i,s);return o&&_E({reply:o,user:r}),s}),onError:n});return a}const YE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ie.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:m,isLoading:p,mutations:{create:g,edit:f,like:v,remove:b,unlike:E},user:k}=Ih({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:w=>i.list({...w,reactionId:r})}});eo([p]);const[T,D]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(ke,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${T?"up_left":"down_right"}`,position:"left"},onClick:()=>D(!T),children:l.formatMessage({id:`discussion_thread_${T?"hide":"show"}`},{count:d==null?void 0:d.length})}),T&&c.jsx(Wh,{loadMore:{isLoading:p,hasNextPage:m,loadNextPage:()=>h()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(w,{body:S})=>g({activityId:n,replyId:r,content:S}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(w=>{var C,ee,K,A,B,O,N;const{id:S,own_children:L,latest_children:M,children_counts:q,data:{mentioned_users:$,additional_data:F}}=w,P=(((C=L==null?void 0:L.like)==null?void 0:C.length)||0)>0?(ee=L==null?void 0:L.like)==null?void 0:ee.find(z=>{var Y;return((Y=z==null?void 0:z.user)==null?void 0:Y.id)===(k==null?void 0:k.id)}):!1,j=P?P==null?void 0:P.id:"",W=!!P,se=(((K=M==null?void 0:M.like)==null?void 0:K.length)||0)>0?(A=M==null?void 0:M.like)==null?void 0:A.map(z=>{var Y,U,ne;return{id:(Y=z==null?void 0:z.user)==null?void 0:Y.id,name:(ne=(U=z==null?void 0:z.user)==null?void 0:U.data)==null?void 0:ne.name}}):!1,re=typeof w.data.content=="string"?(B=w==null?void 0:w.data)==null?void 0:B.content:((N=(O=w==null?void 0:w.data)==null?void 0:O.content)==null?void 0:N.text)||"";return c.jsx(Qr,{isCommunity:!0,content:{id:S,type:"reply",body:re,canLike:a,createdAt:w==null?void 0:w.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:w==null?void 0:w.parent},slug:"",author:pr(w==null?void 0:w.user),userLiked:W,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:se,data:{mentions:$,...F||{}}},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:S}),updateContent:(z,{body:Y})=>f({replyId:S,content:Y})},likes:{createLike:()=>v({replyId:S}),deleteLike:()=>E({replyId:S,reactionId:j}),listLikes:z=>o.list({replyId:S,...z})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},basePath:e,parentId:t},S)}):null})]})};const $h=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d})=>{const h=ie.useIntl(),{replies:m,fetchNextPage:p,hasNextPage:g,isLoading:f,mutations:{create:v,edit:b,like:E,remove:k,unlike:T},user:D}=Ih({queryKey:[e,t,n,"replies"],queryFns:u}),w=()=>{L(m.length),p()},[S,L]=y.useState(null);return eo([f]),Rh(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(Uh,{type:"comment",responses:r,isLoading:f}),c.jsx(Jo,{form:{content:{type:"reply",slugs:{}},functions:{create:(M,{body:q})=>v({activityId:n,content:q}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:h.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:s,leave:o,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),m==null?void 0:m.map((M,q)=>{var B,O,N,z,Y,U,ne;const{id:$,own_children:F,latest_children:_,children_counts:P,data:{mentioned_users:j,additional_data:W}}=M,se=(((B=F==null?void 0:F.like)==null?void 0:B.length)||0)>0?(O=F==null?void 0:F.like)==null?void 0:O.find(le=>{var J;return((J=le==null?void 0:le.user)==null?void 0:J.id)===(D==null?void 0:D.id)}):!1,re=se?se==null?void 0:se.id:"",C=!!se,K=(((N=_==null?void 0:_.like)==null?void 0:N.length)||0)>0?(z=_==null?void 0:_.like)==null?void 0:z.map(le=>{var J,pe,me;return{id:(J=le==null?void 0:le.user)==null?void 0:J.id,name:(me=(pe=le==null?void 0:le.user)==null?void 0:pe.data)==null?void 0:me.name}}):!1,A=typeof M.data.content=="string"?(Y=M==null?void 0:M.data)==null?void 0:Y.content:((ne=(U=M==null?void 0:M.data)==null?void 0:U.content)==null?void 0:ne.text)||"";return c.jsx(Bh,{children:c.jsx(Qr,{isCommunity:!0,content:{id:$,type:"reply",body:A,canLike:a,createdAt:M==null?void 0:M.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:$},slug:$,author:pr(M==null?void 0:M.user),userLiked:C,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:K,data:{mentions:j,...W||{}}},functions:{content:{createContent:()=>null,deleteContent:()=>k({replyId:$}),updateContent:(le,{body:J})=>b({replyId:$,content:J})},likes:{createLike:()=>E({replyId:$}),deleteLike:()=>T({replyId:$,reactionId:re}),listLikes:le=>l.list({replyId:$,...le})},comments:{},form:i},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},children:c.jsx(YE,{basePath:e,parentId:t,activityId:n,replyId:$,isMember:a,functions:{reactions:u,form:i,likes:l}}),styling:{showShareLinkButton:!0},setFocus:q===S,basePath:e,parentId:t},$)},$)}),!f&&c.jsx(Zr,{hasNextPage:g,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),c.jsx(Xo,{form:d})]})};function GE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ve.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Yo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function QE({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=GE({queryKey:t,queryFn:e});return{likes:n,...r}}function Lh({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=QE({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?pr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Ah,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const zh=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ie.useIntl();return c.jsx(rn,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:Z("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(Lh,{...i,likeCount:r??0,functions:{likes:n}})})},JE=Object.freeze(Object.defineProperty({__proto__:null,default:zh},Symbol.toStringTag,{value:"Module"})),ps=({children:e,class:t,...n})=>{const r={...n,class:Z("subtle",t)};return c.jsx("blockquote",{...r,children:e})},XE=280,Qo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?rr(e,typeof t=="number"?t:XE):e;a=a.trim();const i=`<br>
164
164
 
165
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await id({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const e_=3e3,t_=({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(Qa,{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})},e_)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Rn,{className:Z({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},$t="discussion_",n_=195;let ya=null;const Qr=({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:m=!1,styling:{showShareLinkButton:p=!1,showMoreMenuButton:g=!0}={},setFocus:f=!1,isCommunity:v=!1,badges:b,categories:E,basePath:k,parentId:T})=>{var We,be,H,ae,he,ge,we,Ge,Qe,ot;const D=ie.useIntl(),C=y.useContext(st),S=y.useContext(gi),{createContent:L=async()=>{},deleteContent:N=async()=>{},updateContent:q=async()=>{}}=o.content||{},{createLike:$=()=>{},deleteLike:F=()=>{},listLikes:_=async()=>({})}=o.likes||{},{openComments:P=()=>{}}=o.comments||{},{listMembers:j=()=>Promise.resolve([]),clickMentionFallback:W=()=>{}}=o.form||{},{author:V,canLike:se,createdAt:re,id:w,likes:ee=0,userLiked:K,comments:A=0,data:B}=t,O=C&&C.id&&typeof V!="string"&&V.id&&V.id===C.id||!1,M=typeof se=="boolean"?se:!0,z=O&&(!t.createdAt||gm(t.createdAt,10,"seconds")),Y=y.useRef(null),[U,ne]=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)||"",data:t&&t.data||{}}),[le,J]=y.useState(!1),[pe,me]=y.useState(z?"highlighted":"default"),[Fe,Be]=y.useState("");y.useEffect(()=>{const ye=Y.current;if(!(!ye||pe==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),ye.addEventListener("transitionend",$e),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),ye.removeEventListener("transitionend",$e)}},[]),y.useEffect(()=>{ne(ye=>({...ye,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Ee=await Qo(U.body,m,B==null?void 0:B.mentions,j);ne(ze=>({...ze,postBody:Ee}))})()},[U.body,B==null?void 0:B.mentions]);const Te=()=>{setTimeout(()=>{me("fading")},1e3)},$e=({propertyName:ye})=>{ye==="background-color"&&me(Ee=>(Ee==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),Y.current&&Y.current.removeEventListener("transitionend",$e)),Ee==="fading"?"default":Ee))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||U.postBody===""&&t.title==="")return c.jsx(Ot,{className:"discussion-card"});const Le=async({title:ye,body:Ee,data:ze})=>{ye||(ye=""),Ee||(Ee=""),Be("");try{if(!Oa(ye,U.title)||!Oa(Ee,U.body)){const nt=t.type==="question"?{title:Ee}:{title:ye,body:Ee,data:ze};await q(Js(t.slugs),nt)}ne(nt=>({...nt,title:ye||"",body:Ee||"",data:{...nt.data,...ze},isEditing:!1,didEdit:!0}))}catch{Be(`${$t}form_error`)}},Ue=()=>{if(S&&S.updateConversation){const ye={showForm:!0},Ee=t.author;Ee&&Ee.id&&(v&&(ye.prepopulateForm=`@{{${Ee.id}}}`),ye.mentionData={id:Ee.id,name:Ee.name}),S.updateConversation(ye)}setTimeout(()=>{var ut,Ln,on;const Ee=`reply-form-${(t.type==="answer"?t.slug:((ut=t.slugs)==null?void 0:ut.reply)||((Ln=t.slugs)==null?void 0:Ln.answer)||((on=t.slugs)==null?void 0:on.question)||"").toLowerCase().slice(-15)}`,ze=document.getElementById(Ee),nt=document.getElementById(`${Ee}-input`);nt&&nt.focus(),ze&&ze.scrollIntoView({behavior:"smooth"})},0)},et=async()=>{J(!1);try{await N(Js(t.slugs))}catch{Be("delete-error")}},Ae=[{text:D.formatMessage({id:`${$t}moreMenu_report`}),onClick:ye=>{ye.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(D.formatMessage({id:`${$t}report_subject`}))}&body=${encodeURI(D.formatMessage({id:`${$t}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&O&&Ae.push({text:D.formatMessage({id:`${$t}moreMenu_edit`}),onClick:()=>ne(ye=>({...ye,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:D.formatMessage({id:`${$t}moreMenu_delete`}),onClick:ye=>{ye.preventDefault(),ye.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Rd(`delete-${t.slug}-modal`,le)}),r&&o.pins&&Ae.push({text:D.formatMessage({id:`${$t}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&&((We=Y==null?void 0:Y.current)==null||We.focus(),(be=Y==null?void 0:Y.current)==null||be.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:Z("discussion-post",u,{[pe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!U.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Y,tabIndex:f?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ye=>{if(!l.post||U.isEditing)return;ye.preventDefault(),ye.stopPropagation(),ya&&clearTimeout(ya),ya=setTimeout(()=>{window.location.href=l.post},150);const Ee=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ya}});document.dispatchEvent(Ee)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:w||t.slug,className:Z("discussion-card",t.type,{editing:U.isEditing,"has-link":l.post&&!U.isEditing}),children:[!U.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(en,{member:V,additionalContent:{createdAt:re,didEdit:U.didEdit,customMessage:U.memberCustomMessage},className:typeof V!="string"&&V.id===i?"highlighted":"",styling:{additionalContentNewLine:!!U.memberCustomMessage},gtmContext:d,gtmType:"profile-click",badges:b}),t.pinned&&c.jsx(Ht,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Me,{children:"Pinned Post"})})]}),U.isEditing?c.jsx(Gr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:U.title!==""?{text:U.title}:!1,isEditing:{text:U.body,categories:t.categories},isPrepopulated:!1},isCommunity:v,maxLength:t.type==="question"?250:5e4,forceShow:{error:Fe!==""&&Fe!=="delete-error"?D.formatMessage({id:Fe},{action:D.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:L,handleSaveEdit:Le,handleCancel:()=>{Be(""),ne(ye=>({...ye,isEditing:!1}))},listMembers:j,clickMentionFallback:W},gtmContext:`${d}Form`,data:B}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(U==null?void 0:U.title)&&c.jsx("p",{className:"content-title",children:U==null?void 0:U.title}),U.postBody.length>n_?c.jsx(dd,{text:U.postBody,markdownOptions:{overrides:{a:Es,blockquote:{component:ps}}}}):c.jsx(Tn,{options:{overrides:{a:Es,blockquote:{component:ps}}},children:U.postBody})]}):c.jsxs(c.Fragment,{children:[(U==null?void 0:U.title)&&c.jsx("p",{className:"content-title",children:U==null?void 0:U.title}),c.jsx(Tn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:ps}}},children:U.postBody})]}),(H=U.data)!=null&&H.link?c.jsx(mo,{data:U.data.link}):c.jsx(c.Fragment,{}),E&&((ae=t.categories)!=null&&ae.length)?c.jsx("ul",{className:"categories-list",children:t.categories.map(ye=>{const Ee=E==null?void 0:E.find(ze=>ze.slug===ye);return Ee?c.jsx(Ht,{size:"small",element:"li",children:Ee.name},Ee.slug):null})}):c.jsx(c.Fragment,{})]}),!U.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(Th,{element:"li",likes:ee,isShort:!1,userLiked:K,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:M,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,functions:{createLike:$,deleteLike:F,listLikes:_},basePath:k,parentId:T}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Qa,{onClick:ye=>{ye.preventDefault(),ye.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof P=="function"&&P()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:D.formatMessage({id:`${$t}comments_screenReader`},{count:A}),children:D.formatMessage({id:`${$t}comments`},{count:A})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Qa,{styling:{muted:!0},onClick:Ue,icon:{icon:"speech-bubble_square"},children:D.formatMessage({id:`${$t}reply`})})}),p&&c.jsx(t_,{url:(he=t.slugs)!=null&&he.reply?`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(we=t.slugs)==null?void 0:we.answer}#${(Ge=t.slugs)==null?void 0:Ge.reply}`:`${window.location.origin}${(Qe=t.slugs)==null?void 0:Qe.question}/${(ot=t.slugs)==null?void 0:ot.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),g&&c.jsx($d,{element:"li",id:`more-${t.slug}`,options:Ae})]})]}),h,c.jsx(rn,{id:`delete-${t.slug}-modal`,isOpen:le,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:Fe==="delete-error"?D.formatMessage({id:"discussion_delete_error"},{action:D.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:D.formatMessage({id:"discussion_delete_title"},{action:D.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:D.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:et,children:D.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:ye=>c.jsx("p",{children:ye}),action:D.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const r_=y.lazy(()=>Promise.resolve().then(()=>m_)),a_=65,qh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(st)||"community",l=oi(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||sd("showPost")==="true"||!1,warning:!1}),[m,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const b=await Qo(m.title||m.body||"",a_,m.mentions);p(E=>({...E,prettifiedText:b}))})()},[m.showCachedText,m.title,m.body]);const g=v=>{if(!m.showCachedText||typeof d.warning=="string")return;let b;if("detail"in v&&v.detail.link)v.detail.timeout&&clearTimeout(v.detail.timeout),b=v.detail.link;else{const E=v;E.preventDefault(),E.stopPropagation();const T=E.target.closest("a");b=T&&T.getAttribute("href")}h(E=>({...E,warning:b||!1}))};y.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,g),document.addEventListener(rt.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[m.showCachedText]),y.useEffect(()=>{const v=b=>{if(!(!m.showCachedText||d.warning!==!1))return b.preventDefault(),b.returnValue=""};return window.addEventListener("beforeunload",v,{capture:!0}),()=>{window.removeEventListener("beforeunload",v,{capture:!0})}},[m.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return m.showCachedText&&(m.title||m.body)&&(f=m.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:Z("discussion-form-card",n),onClick:v=>{v.preventDefault(),v.stopPropagation(),h(b=>({...b,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(bn,{name:l.name,src:l.image,alt:""}),c.jsx(Tn,{className:Z("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:At,blockquote:At,br:At,em:At,li:At,ol:At,p:At,s:At,span:At,strong:At,ul:At}},children:f})]}),c.jsxs(hr,{children:[c.jsx(r_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{h(v=>({...v,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),c.jsx(rn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(v=>({...v,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:v=>{v.preventDefault(),v.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`})})})]})]})},i_=y.lazy(()=>Promise.resolve().then(()=>hE)),Jo=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(vn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(ho,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...m}=t,p={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...m,id:`add-post-${m.id||""}`};return e?c.jsx(qh,{form:p}):c.jsx(i_,{...p})},Xo=({form:e})=>{const t=y.useContext(st),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{_m(t)||a(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(vi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const gs="discussion_responses_",Uh=({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:`${gs}title`},{action:r.formatMessage({id:`${gs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Pt(r.formatMessage,`${gs}empty`,e,e)})]})};const Wh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(gi),o=wa(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(Zr,{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(Gr,{...r})]})};function s_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.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 o_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ve.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function u_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ve.useQueryClient(),l=ii(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ko(u),mutate:Zo(u)},user:l,...u},h=s_({...d,mutationFn:t}),m=l_({...d,mutationFn:n}),p=c_({...d,mutationFn:r}),g=d_({...d,mutationFn:a}),f=f_({...d,mutationFn:i}),{activity:v,...b}=o_({queryKey:s,queryFn:e});return{activity:v,mutations:{edit:h,like:m,unlike:p,pin:g,unpin:f},user:l,...b}}function l_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ja({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ja({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function c_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Oh({activity:s,user:r}),s)),onError:n});return a}function d_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Xa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Xa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function f_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Ph({activity:s,user:r}),s))),onError:n});return a}const h_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:m,categories:p})=>{var W,V,se,re,w,ee;const g=ie.useIntl(),{activity:f,error:v,isLoading:b,mutations:{edit:E,like:k,unlike:T,pin:D,unpin:C}}=u_({queryFns:s,queryKey:[e,t,n]});if(b)return c.jsx(Ot,{style:{height:"400px"}});if(v||!f)return c.jsx(vn,{variant:"error",text:g.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:S,latest_reactions:L,mentioned_users:N,additional_data:q}=f,$=(((W=L==null?void 0:L.like)==null?void 0:W.length)||0)>0,F=(((V=S==null?void 0:S.like)==null?void 0:V.length)||0)>0,_=F?S==null?void 0:S.like[0].id:"",P=$?(se=L==null?void 0:L.like)==null?void 0:se.map(K=>{var A,B,O;return{id:(A=K==null?void 0:K.user)==null?void 0:A.id,name:(O=(B=K==null?void 0:K.user)==null?void 0:B.data)==null?void 0:O.name}}):!1,j=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Qr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:(f==null?void 0:f.categories)||[],canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:pr(j),userLiked:F,likes:((re=f==null?void 0:f.reaction_counts)==null?void 0:re.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:P,data:{mentions:N,...q||{}},pinned:((w=f==null?void 0:f.reaction_counts)==null?void 0:w.pin)&&((ee=f==null?void 0:f.reaction_counts)==null?void 0:ee.pin)>0||!1},originalAuthorId:j==null?void 0:j.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(K,{title:A,body:B})=>E({title:A,content:B})},likes:{createLike:()=>k({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:_}),listLikes:K=>o.list({activityId:n,...K})},comments:{openComments:()=>{}},pins:{createPin:()=>D({activityId:n}),deletePin:()=>{var K;return C({activityId:n,reactionId:(K=L==null?void 0:L.pin)==null?void 0:K[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},categories:p,basePath:e,parentId:t},n),c.jsx($h,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:m})]})};const Hh=({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:m="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(rn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(m!==""||p!=="")&&l(v=>({...v,showCachedText:!0})),o()}},className:Z("discussion-form-modal",a),children:c.jsx(Gr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:m},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:v=>{l(b=>({...b,...v}))},onMention:({id:v,name:b}={})=>{if(!v||!b)return;const E=g||{};E[v]={created_at:"",updated_at:"",id:v,data:{name:b}},l(k=>({...k,mentions:E}))},create:async v=>{o(),h.create&&await h.create(v),l({showCachedText:!1})},handleSaveEdit:async v=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(v),l({showCachedText:!1})}}})})},m_=Object.freeze(Object.defineProperty({__proto__:null,default:Hh},Symbol.toStringTag,{value:"Module"}));const p_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=ie.useIntl();return a||(a=h.formatMessage({id:"inviteModal_formTitle"})),i||(i=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(rn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:Z("invite-modal",e,{success:!!n}),children:c.jsx(Dh,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const vi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(sd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(rn,{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(Ch,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var m;try{(m=i==null?void 0:i.functions)!=null&&m.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},g_=Object.freeze(Object.defineProperty({__proto__:null,default:vi},Symbol.toStringTag,{value:"Module"}));const v_=({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(bn,{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(rn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Tn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const b_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:Z("testimonial-block",a),children:[c.jsx(Wt,{className:"testimonial",children:n}),r?c.jsx(en,{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})})]})]}),y_=y.memo(b_);const x_=({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(St,{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 bi=({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,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text: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 D_=({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(In,{...n,className:Z("banner",e),image:{...t,aspect:"banner"}})):null;const C_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],w_=({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"},m={};d.forEach(v=>{if(!t[v]){m[v]=!1;return}if(!s[v]){if(typeof t[v]=="object"){m[v]=t[v];const{text:b,element:E}=t[v];if(E&&C_.includes(E.toLowerCase()))return;m[v]={text:b,element:h[v]};return}m[v]={text:t[v],element:h[v]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=v=>{v.preventDefault(),v.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),c.jsx(Dn,{className:Z("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(v=>{if(m[v]&&typeof m[v]=="object"){const{text:b,element:E=""}=m[v];return v==="text"?c.jsx(Tn,{overrideType:"text-only",className:"text",children:b},v):y.createElement(E,{key:v,className:v},b)}return null}),l,p&&c.jsx(ke,{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(In,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},E_=y.memo(w_);const __=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(Dn,{className:Z("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const k_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Tn,{children:n}):n;return c.jsxs(Dn,{className:Z("highlight-section",t),children:[r&&c.jsx("div",{className:Z("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(In,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),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})})})]})},F_=y.memo(k_);const A_=({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(ke,{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&&Ds(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"}):no(d)});if(o)return c.jsx(Ht,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&Ds(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},T_={title:66,text:3e3,secondaryText:1e3,partner:34},ti={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"}},S_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,v;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,m=e.contentType;let p="";if((f=ti[m])!=null&&f.gtmEvent&&(p=ti[m].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":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?c.jsx(ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&d!=="premium"){const b=i.loading||i.registered||((v=e==null?void 0:e.members)==null?void 0:v.isMember),E=async k=>{if(k.preventDefault(),k.stopPropagation(),!(b||!t||!t.onClick)){s(T=>({...T,loading:!0}));try{const T=await t.onClick(e);s(T==="success"?()=>({registered:!0,loading:!1}):D=>({...D,loading:!1}))}catch{s(D=>({...D,loading:!1}))}}};return c.jsx("p",{className:Z("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(ke,{onClick:E,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function j_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(st),[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(Ht,{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 eu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var $,F;const u=ie.useIntl(),d=y.useContext(st),h=!!(d!=null&&d.id),m=y.useRef(null),[p,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(_=>{g({data:_,isLoading:!1})}).catch(()=>g(_=>({..._,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:v}=p;if(v||!f)return c.jsx(Ot,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:b}=f;if(!b||!ti[b])return c.jsx(Ot,{element:"li",className:"card-wrapper"});const{basePath:E="",className:k,length:T,gtmEvent:D}=ti[b];let C=f.slug?`${E}${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")&&(C=f.slug);const S=_=>{C&&(_.preventDefault(),_.stopPropagation(),window.location.href=C)},L={...T_,...T};let N={className:"card"},q={};return C&&(q={href:C,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${D}-click`,"data-testid":"link"},f.openInNewTab&&(q.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${D}-click`}),l&&(N={...N,tabIndex:"0"},($=m==null?void 0:m.current)==null||$.focus(),(F=m==null?void 0:m.current)==null||F.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:Z("card-wrapper text-medium",k,t,{"has-link":C,"no-link":!C,"has-image":f.banner}),"data-testid":`${b}-card`,children:c.jsxs("div",{...N,ref:m,children:[c.jsx(ud,{className:"card-label",contentType:b,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),b==="communityPage"&&(f==null?void 0:f.createdAt)&&vm(f==null?void 0:f.createdAt,60)&&c.jsx(Ht,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Ht,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):rd(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Ht,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(In,{image:{...f.banner,description:""}})]}):k==="people"?c.jsx(bn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(uo,{contributors:{data:f.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(b)?u.formatMessage({id:`card_contributors_${b}`}):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}):rr(f.partner[0],L.partner)}),["title","text","secondaryText"].map(_=>{const P=f[_];if(!P)return null;const j=Jc(_),W={key:_,className:j,"data-testid":j},V={wrapper:"p",forceWrapper:!0,forceInline:!0},se=rr(P,L[_]);return["title","text"].includes(_)&&C?(V.wrapper="a",c.jsx("p",{...W,children:c.jsx(Wt,{options:V,...q,children:se})})):c.jsx(Wt,{options:V,...W,children:se})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(j_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(B_,{type:k||"",data:f}),c.jsx(S_,{data:f,cta:i,link:C||"",gtmContext:s})]})})};const Vh=({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(eu,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),O_=(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},P_=({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: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 vs={fourCards:1024,threeCards:769,twoCards:480};let xa=null,bs=null;const M_=({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:m,isLoading:p}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:v,loadedPages:b}=g,[E,k]=y.useState(""),T=t.length,D=Math.ceil(T/m),C=y.useRef(null),S=Nn(!0,!0,C==null?void 0:C.current);y.useEffect(()=>{let _=1;S&&(S>=vs.fourCards?_=4:S>=vs.threeCards?_=3:S>=vs.twoCards&&(_=2),_>T&&(_=T)),h(P=>({...P,cardsPerPage:_,isLoading:!1}))},[S,T]);const L=(_="next")=>{bs&&clearTimeout(bs);let P=v;if(typeof _=="string")if(_==="next")if(v<D-1)P=v+1;else return;else if(v>0)P=v-1;else return;else P=_;k(""),f(W=>({...W,currentPage:P,loadedPages:[...new Set([...b,P])]}));const j=()=>{const W=P*d.cardsPerPage,V=W+d.cardsPerPage;return t.slice(W,V).length};bs=setTimeout(()=>{k(l.formatMessage({id:`${u}ariaLive${typeof _=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof _=="string"?_:"next"}`}),slide:typeof _=="string"?1:_+1,count:j()}))},500)},N=_=>{xa=_.touches[0].clientX},q=_=>{if(xa===null)return;const P=_.touches[0].clientX,j=xa-P;j>5?L("next"):j<-5&&L("previous"),xa=null},$={"--width":`${S||0}px`,"--total-cards":T,"--cards-per-page":m,"--page":v};if(p)return c.jsx(si,{layout:`carousel${a?"-with-title":""}`});const F=(_,P)=>{var W;let j=null;return(W=_==null?void 0:_.sys)!=null&&W.id?j=`card-${_.sys.id}`:_!=null&&_.slug?j=`card-${_.slug}`:[n[P],_.contentType].includes("customCard")&&(j=`card-${window.btoa(`${_.title} ${_.createdAt}`)}-${P}`),j};return c.jsxs("section",{ref:C,className:Z("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(P_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:N,onTouchMove:q,style:$,"data-testid":"carousel-list",children:t.map((_,P)=>{let j=F(_,P);return j&&O_(P,m,v,b)?c.jsx(eu,{id:j,card:{..._,contentType:n[P]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${P}`,c.jsx(Ot,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),D<=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(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:_=>{_.preventDefault(),_.stopPropagation(),L("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:v<=0})}),[...Array(D)].map((_,P)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:Z("page-indicator",{selected:P===v}),onClick:j=>{j.preventDefault(),j.stopPropagation(),L(P)},children:c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:P+1,total:D})})})},`page-indicator-${P}`)),c.jsx("li",{className:"arrow next",children:c.jsx(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:_=>{_.preventDefault(),_.stopPropagation(),L("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:v>=D-1})})]}),c.jsx(Me,{"aria-live":E===""?"off":"polite",showOnFocus:!1,children:E})]})]})},N_=({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(si,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Kt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(M_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Kt,{})]},`carousel-${d}`)});const R_=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:Z("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Z("img",{private:o,"no-image":!a}),children:a&&c.jsx(In,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const I_=({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: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(bi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(oo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Kh=({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 Zh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=ri(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):ed(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(bi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const $_=({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(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(ai,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${m}time_completed`}):c.jsx(bi,{time:s,appendedText:a?h.formatMessage({id:`${m}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:v,icon:b,image:E,isIntroduction:k,optional:T,slug:D,subsectionId:C,title:S,type:L})=>{const N=a&&t||k,q={};return E&&(q.style={"--image":`url(${E})`}),c.jsx("li",{className:Z({article:v===_r.ARTICLE,discussion:v===_r.DISCUSSION,quiz:v===_r.QUIZ,completed:g&&v===_r.ARTICLE,locked:!N}),...q,children:c.jsx(gn,{href:N?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Xc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Kh,{sectionId:i,subsectionId:C,title:S,className:"course-title"})," ",c.jsx(Zh,{completionTime:f,icon:b,optional:T,type:L,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const L_=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(ke,{...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":""}`})})},z_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),zc=[{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 Da="notFoundError_",q_=()=>{const e=ie.useIntl(),t=[];return zc.forEach((n,r)=>{n.title=e.formatMessage({id:`${Da}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(kh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(Dn,{children:[c.jsx(Vh,{cards:zc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(ke,{href:"/solution-articles/",children:e.formatMessage({id:`${Da}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Da}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Da}text`})})]})};exports.ASSETS_BUCKET=Vt;exports.ActivitiesFeed=zE;exports.ActivitySection=h_;exports.AddPost=Jo;exports.Badge=Cd;exports.BadgeScope=ct;exports.Badges=wd;exports.BadgesContext=ao;exports.BadgesProvider=md;exports.Banner=D_;exports.BannerSection=E_;exports.Breadcrumbs=tg;exports.Buckets=Om;exports.Button=ke;exports.ButtonWrapper=fr;exports.COURSE_CONTENT_TYPES=_r;exports.CacheProvider=pd;exports.Card=eu;exports.CardBlock=Vh;exports.Carousel=N_;exports.CharacterLimit=go;exports.CollapsibleSection=ai;exports.Columns=zd;exports.CommunityDetails=eg;exports.ContactFooter=aE;exports.ContactForm=xh;exports.ContentTypeLabel=ud;exports.Contributors=uo;exports.ConversationContext=gi;exports.CookieBanner=_h;exports.CourseProgression=I_;exports.CourseStructure=$_;exports.CustomContentBanner=__;exports.CustomEvents=rt;exports.DELETED_USER_ID=Nr;exports.Directory=v_;exports.DiscussionConversation=Bh;exports.DiscussionForm=Gr;exports.DiscussionFormCard=qh;exports.DiscussionFormModal=Hh;exports.DiscussionLikes=Th;exports.DiscussionPost=Qr;exports.DiscussionThread=Wh;exports.Divider=Kt;exports.DownloadSection=eE;exports.EMAILS=Zn;exports.EditSection=nE;exports.EmailHelperTextBox=Ud;exports.EmptyStateBox=vn;exports.EnrichedUrl=mo;exports.FeatureFlags=vd;exports.Filters=Id;exports.FlagsProvider=gd;exports.Footer=Ho;exports.Form=Yt;exports.Formatting=G;exports.Fragment=At;exports.FullWidthSection=Dn;exports.GET_STREAM_USER_PREFIX=xs;exports.GlobalProviders=Km;exports.Header=Vo;exports.HelperTextBox=cd;exports.HiddenFromScreenReaders=ni;exports.HideShowTextBox=dd;exports.HighlightSection=F_;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=td;exports.IconBulletedList=Nm;exports.ImageContainer=Bm;exports.IntlProvider=bd;exports.InviteForm=Dh;exports.InviteModal=p_;exports.JoinButton=ho;exports.Label=Io;exports.LanguageContext=io;exports.LanguageSwitcher=rg;exports.LessonName=Kh;exports.LessonType=Zh;exports.LikesFeed=Lh;exports.LikesModal=zh;exports.Link=gn;exports.LoadMore=Zr;exports.LoadingBlock=Qm;exports.LoadingPlaceholder=Ot;exports.LoadingState=si;exports.Logo=po;exports.LogoSection=rE;exports.MEMBERS_PER_PAGE=Fh;exports.MENTION_REGEX=nd;exports.MarkCompleteButton=L_;exports.MarkdownText=Tn;exports.MarketingBlock=A_;exports.Marks=Ut;exports.Member=en;exports.MembersList=Ah;exports.Modal=lo;exports.MoreMenu=$d;exports.NUMBER_OF_COUNTRIES=mm;exports.NUMBER_OF_USERS=hm;exports.NarrowCard=R_;exports.NavigationMenu=Ld;exports.NotFoundError=q_;exports.Overlay=rn;exports.OverlayContext=so;exports.OverlayProvider=Dd;exports.PageHeading=fd;exports.PageLayout=kh;exports.PasswordForm=Vw;exports.PasswordRules=Zd;exports.Pill=Ht;exports.Popover=od;exports.Portal=hr;exports.ProfileForm=Ch;exports.ProfileImageChange=yh;exports.ProfileModal=vi;exports.ProfileModalLauncher=Xo;exports.ProfilePicture=bn;exports.ProgressBar=oo;exports.ProgressTracker=Sm;exports.PublishArticleForm=Kw;exports.Rating=Dg;exports.RepliesFeed=$h;exports.ResponsesHeading=Uh;exports.ResponsiveImage=In;exports.ReturnToNavButton=jm;exports.RichTextEditor=Wo;exports.SearchForm=wh;exports.ShareLinks=lg;exports.SignupForm=Xw;exports.Span=Es;exports.StatusBanner=ir;exports.TableOfContents=x_;exports.Tabs=cg;exports.Tags=lE;exports.TestimonialBlock=y_;exports.TimeToComplete=bi;exports.Toggle=Ww;exports.Tooltip=Rn;exports.TopLevelPage=iE;exports.UUID_V4_REGEX=Rr;exports.UserContext=st;exports.UserProvider=yd;exports.VisuallyHidden=Me;exports.addAriaProps=Rd;exports.basicReducer=Kr;exports.camelCaseToDashCase=Jc;exports.checkIntlPathExists=ri;exports.generateConditions=ja;exports.generateCssIcon=pm;exports.getAuthorData=pr;exports.getCharacterLimitProps=qd;exports.getLongDate=no;exports.getMember=oi;exports.getPostBody=Qo;exports.getShortDate=rd;exports.getValueLength=ui;exports.headerData=Vr;exports.mapGetStreamData=z_;exports.pageReady=ad;exports.passwordValidator=Cs;exports.repliesFeedMock=qE;exports.supportedLanguages=Ea;exports.toCamelCase=Xc;exports.toCapitalisedCase=fm;exports.toSentenceCase=ed;exports.transformSlugs=Js;exports.useBadges=hd;exports.useCurrentPath=Vc;exports.useEffectAfterMount=ar;exports.useElementWidth=Nn;exports.useOverlay=xd;exports.useScrollListener=Yc;exports.useScrollToHash=eo;exports.useTooltips=to;exports.useUser=ii;
165
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await id({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const e_=3e3,t_=({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(Qa,{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})},e_)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Rn,{className:Z({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},$t="discussion_",n_=195;let ya=null;const Qr=({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:m=!1,styling:{showShareLinkButton:p=!1,showMoreMenuButton:g=!0}={},setFocus:f=!1,isCommunity:v=!1,badges:b,categories:E,basePath:k,parentId:T})=>{var We,be,H,ae,he,ge,we,Ge,Qe,ot;const D=ie.useIntl(),w=y.useContext(st),S=y.useContext(gi),{createContent:L=async()=>{},deleteContent:M=async()=>{},updateContent:q=async()=>{}}=o.content||{},{createLike:$=()=>{},deleteLike:F=()=>{},listLikes:_=async()=>({})}=o.likes||{},{openComments:P=()=>{}}=o.comments||{},{listMembers:j=()=>Promise.resolve([]),clickMentionFallback:W=()=>{}}=o.form||{},{author:V,canLike:se,createdAt:re,id:C,likes:ee=0,userLiked:K,comments:A=0,data:B}=t,O=w&&w.id&&typeof V!="string"&&V.id&&V.id===w.id||!1,N=typeof se=="boolean"?se:!0,z=O&&(!t.createdAt||gm(t.createdAt,10,"seconds")),Y=y.useRef(null),[U,ne]=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)||"",data:t&&t.data||{}}),[le,J]=y.useState(!1),[pe,me]=y.useState(z?"highlighted":"default"),[Fe,Be]=y.useState("");y.useEffect(()=>{const ye=Y.current;if(!(!ye||pe==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),ye.addEventListener("transitionend",$e),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),ye.removeEventListener("transitionend",$e)}},[]),y.useEffect(()=>{ne(ye=>({...ye,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Ee=await Qo(U.body,m,B==null?void 0:B.mentions,j);ne(ze=>({...ze,postBody:Ee}))})()},[U.body,B==null?void 0:B.mentions]);const Te=()=>{setTimeout(()=>{me("fading")},1e3)},$e=({propertyName:ye})=>{ye==="background-color"&&me(Ee=>(Ee==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Te),Y.current&&Y.current.removeEventListener("transitionend",$e)),Ee==="fading"?"default":Ee))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||U.postBody===""&&t.title==="")return c.jsx(Ot,{className:"discussion-card"});const Le=async({title:ye,body:Ee,data:ze})=>{ye||(ye=""),Ee||(Ee=""),Be("");try{if(!Oa(ye,U.title)||!Oa(Ee,U.body)){const nt=t.type==="question"?{title:Ee}:{title:ye,body:Ee,data:ze};await q(Js(t.slugs),nt)}ne(nt=>({...nt,title:ye||"",body:Ee||"",data:{...nt.data,...ze},isEditing:!1,didEdit:!0}))}catch{Be(`${$t}form_error`)}},Ue=()=>{if(S&&S.updateConversation){const ye={showForm:!0},Ee=t.author;Ee&&Ee.id&&(v&&(ye.prepopulateForm=`@{{${Ee.id}}}`),ye.mentionData={id:Ee.id,name:Ee.name}),S.updateConversation(ye)}setTimeout(()=>{var ut,Ln,on;const Ee=`reply-form-${(t.type==="answer"?t.slug:((ut=t.slugs)==null?void 0:ut.reply)||((Ln=t.slugs)==null?void 0:Ln.answer)||((on=t.slugs)==null?void 0:on.question)||"").toLowerCase().slice(-15)}`,ze=document.getElementById(Ee),nt=document.getElementById(`${Ee}-input`);nt&&nt.focus(),ze&&ze.scrollIntoView({behavior:"smooth"})},0)},et=async()=>{J(!1);try{await M(Js(t.slugs))}catch{Be("delete-error")}},Ae=[{text:D.formatMessage({id:`${$t}moreMenu_report`}),onClick:ye=>{ye.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(D.formatMessage({id:`${$t}report_subject`}))}&body=${encodeURI(D.formatMessage({id:`${$t}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&O&&Ae.push({text:D.formatMessage({id:`${$t}moreMenu_edit`}),onClick:()=>ne(ye=>({...ye,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:D.formatMessage({id:`${$t}moreMenu_delete`}),onClick:ye=>{ye.preventDefault(),ye.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Rd(`delete-${t.slug}-modal`,le)}),r&&o.pins&&Ae.push({text:D.formatMessage({id:`${$t}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&&((We=Y==null?void 0:Y.current)==null||We.focus(),(be=Y==null?void 0:Y.current)==null||be.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:Z("discussion-post",u,{[pe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!U.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Y,tabIndex:f?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ye=>{if(!l.post||U.isEditing)return;ye.preventDefault(),ye.stopPropagation(),ya&&clearTimeout(ya),ya=setTimeout(()=>{window.location.href=l.post},150);const Ee=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ya}});document.dispatchEvent(Ee)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:C||t.slug,className:Z("discussion-card",t.type,{editing:U.isEditing,"has-link":l.post&&!U.isEditing}),children:[!U.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(en,{member:V,additionalContent:{createdAt:re,didEdit:U.didEdit,customMessage:U.memberCustomMessage},className:typeof V!="string"&&V.id===i?"highlighted":"",styling:{additionalContentNewLine:!!U.memberCustomMessage},gtmContext:d,gtmType:"profile-click",badges:b}),t.pinned&&c.jsx(Ht,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Me,{children:"Pinned Post"})})]}),U.isEditing?c.jsx(Gr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:U.title!==""?{text:U.title}:!1,isEditing:{text:U.body,categories:t.categories},isPrepopulated:!1},isCommunity:v,maxLength:t.type==="question"?250:5e4,forceShow:{error:Fe!==""&&Fe!=="delete-error"?D.formatMessage({id:Fe},{action:D.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:L,handleSaveEdit:Le,handleCancel:()=>{Be(""),ne(ye=>({...ye,isEditing:!1}))},listMembers:j,clickMentionFallback:W},gtmContext:`${d}Form`,data:B}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(U==null?void 0:U.title)&&c.jsx("p",{className:"content-title",children:U==null?void 0:U.title}),U.postBody.length>n_?c.jsx(dd,{text:U.postBody,markdownOptions:{overrides:{a:Es,blockquote:{component:ps}}}}):c.jsx(Tn,{options:{overrides:{a:Es,blockquote:{component:ps}}},children:U.postBody})]}):c.jsxs(c.Fragment,{children:[(U==null?void 0:U.title)&&c.jsx("p",{className:"content-title",children:U==null?void 0:U.title}),c.jsx(Tn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:ps}}},children:U.postBody})]}),(H=U.data)!=null&&H.link?c.jsx(mo,{data:U.data.link}):c.jsx(c.Fragment,{}),E&&((ae=t.categories)!=null&&ae.length)?c.jsx("ul",{className:"categories-list",children:t.categories.map(ye=>{const Ee=E==null?void 0:E.find(ze=>ze.slug===ye);return Ee?c.jsx(Ht,{size:"small",element:"li",children:Ee.name},Ee.slug):null})}):c.jsx(c.Fragment,{})]}),!U.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(Th,{element:"li",likes:ee,isShort:!1,userLiked:K,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:N,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,functions:{createLike:$,deleteLike:F,listLikes:_},basePath:k,parentId:T}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Qa,{onClick:ye=>{ye.preventDefault(),ye.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof P=="function"&&P()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:D.formatMessage({id:`${$t}comments_screenReader`},{count:A}),children:D.formatMessage({id:`${$t}comments`},{count:A})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Qa,{styling:{muted:!0},onClick:Ue,icon:{icon:"speech-bubble_square"},children:D.formatMessage({id:`${$t}reply`})})}),p&&c.jsx(t_,{url:(he=t.slugs)!=null&&he.reply?`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(we=t.slugs)==null?void 0:we.answer}#${(Ge=t.slugs)==null?void 0:Ge.reply}`:`${window.location.origin}${(Qe=t.slugs)==null?void 0:Qe.question}/${(ot=t.slugs)==null?void 0:ot.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),g&&c.jsx($d,{element:"li",id:`more-${t.slug}`,options:Ae})]})]}),h,c.jsx(rn,{id:`delete-${t.slug}-modal`,isOpen:le,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:Fe==="delete-error"?D.formatMessage({id:"discussion_delete_error"},{action:D.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:D.formatMessage({id:"discussion_delete_title"},{action:D.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:D.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:et,children:D.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:ye=>c.jsx("p",{children:ye}),action:D.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const r_=y.lazy(()=>Promise.resolve().then(()=>m_)),a_=65,qh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(st)||"community",l=oi(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||sd("showPost")==="true"||!1,warning:!1}),[m,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const b=await Qo(m.title||m.body||"",a_,m.mentions);p(E=>({...E,prettifiedText:b}))})()},[m.showCachedText,m.title,m.body]);const g=v=>{if(!m.showCachedText||typeof d.warning=="string")return;let b;if("detail"in v&&v.detail.link)v.detail.timeout&&clearTimeout(v.detail.timeout),b=v.detail.link;else{const E=v;E.preventDefault(),E.stopPropagation();const T=E.target.closest("a");b=T&&T.getAttribute("href")}h(E=>({...E,warning:b||!1}))};y.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,g),document.addEventListener(rt.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[m.showCachedText]),y.useEffect(()=>{const v=b=>{if(!(!m.showCachedText||d.warning!==!1))return b.preventDefault(),b.returnValue=""};return window.addEventListener("beforeunload",v,{capture:!0}),()=>{window.removeEventListener("beforeunload",v,{capture:!0})}},[m.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return m.showCachedText&&(m.title||m.body)&&(f=m.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:Z("discussion-form-card",n),onClick:v=>{v.preventDefault(),v.stopPropagation(),h(b=>({...b,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(bn,{name:l.name,src:l.image,alt:""}),c.jsx(Tn,{className:Z("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:At,blockquote:At,br:At,em:At,li:At,ol:At,p:At,s:At,span:At,strong:At,ul:At}},children:f})]}),c.jsxs(hr,{children:[c.jsx(r_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{h(v=>({...v,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),c.jsx(rn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(v=>({...v,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:v=>{v.preventDefault(),v.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`})})})]})]})},i_=y.lazy(()=>Promise.resolve().then(()=>hE)),Jo=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(vn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(ho,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...m}=t,p={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...m,id:`add-post-${m.id||""}`};return e?c.jsx(qh,{form:p}):c.jsx(i_,{...p})},Xo=({form:e})=>{const t=y.useContext(st),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{_m(t)||a(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(vi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const gs="discussion_responses_",Uh=({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:`${gs}title`},{action:r.formatMessage({id:`${gs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Pt(r.formatMessage,`${gs}empty`,e,e)})]})};const Wh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(gi),o=wa(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(Zr,{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(Gr,{...r})]})};function s_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ve.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 o_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ve.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function u_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ve.useQueryClient(),l=ii(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ko(u),mutate:Zo(u)},user:l,...u},h=s_({...d,mutationFn:t}),m=l_({...d,mutationFn:n}),p=c_({...d,mutationFn:r}),g=d_({...d,mutationFn:a}),f=f_({...d,mutationFn:i}),{activity:v,...b}=o_({queryKey:s,queryFn:e});return{activity:v,mutations:{edit:h,like:m,unlike:p,pin:g,unpin:f},user:l,...b}}function l_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ja({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ja({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function c_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Oh({activity:s,user:r}),s)),onError:n});return a}function d_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ve.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Xa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Xa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function f_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ve.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Ph({activity:s,user:r}),s))),onError:n});return a}const h_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:m,categories:p})=>{var W,V,se,re,C,ee;const g=ie.useIntl(),{activity:f,error:v,isLoading:b,mutations:{edit:E,like:k,unlike:T,pin:D,unpin:w}}=u_({queryFns:s,queryKey:[e,t,n]});if(b)return c.jsx(Ot,{style:{height:"400px"}});if(v||!f)return c.jsx(vn,{variant:"error",text:g.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:S,latest_reactions:L,mentioned_users:M,additional_data:q}=f,$=(((W=L==null?void 0:L.like)==null?void 0:W.length)||0)>0,F=(((V=S==null?void 0:S.like)==null?void 0:V.length)||0)>0,_=F?S==null?void 0:S.like[0].id:"",P=$?(se=L==null?void 0:L.like)==null?void 0:se.map(K=>{var A,B,O;return{id:(A=K==null?void 0:K.user)==null?void 0:A.id,name:(O=(B=K==null?void 0:K.user)==null?void 0:B.data)==null?void 0:O.name}}):!1,j=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Qr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:(f==null?void 0:f.categories)||[],canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:pr(j),userLiked:F,likes:((re=f==null?void 0:f.reaction_counts)==null?void 0:re.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:P,data:{mentions:M,...q||{}},pinned:((C=f==null?void 0:f.reaction_counts)==null?void 0:C.pin)&&((ee=f==null?void 0:f.reaction_counts)==null?void 0:ee.pin)>0||!1},originalAuthorId:j==null?void 0:j.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(K,{title:A,body:B})=>E({title:A,content:B})},likes:{createLike:()=>k({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:_}),listLikes:K=>o.list({activityId:n,...K})},comments:{openComments:()=>{}},pins:{createPin:()=>D({activityId:n}),deletePin:()=>{var K;return w({activityId:n,reactionId:(K=L==null?void 0:L.pin)==null?void 0:K[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},categories:p,basePath:e,parentId:t},n),c.jsx($h,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:m})]})};const Hh=({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:m="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(rn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(m!==""||p!=="")&&l(v=>({...v,showCachedText:!0})),o()}},className:Z("discussion-form-modal",a),children:c.jsx(Gr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:m},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:v=>{l(b=>({...b,...v}))},onMention:({id:v,name:b}={})=>{if(!v||!b)return;const E=g||{};E[v]={created_at:"",updated_at:"",id:v,data:{name:b}},l(k=>({...k,mentions:E}))},create:async v=>{o(),h.create&&await h.create(v),l({showCachedText:!1})},handleSaveEdit:async v=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(v),l({showCachedText:!1})}}})})},m_=Object.freeze(Object.defineProperty({__proto__:null,default:Hh},Symbol.toStringTag,{value:"Module"}));const p_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=ie.useIntl();return a||(a=h.formatMessage({id:"inviteModal_formTitle"})),i||(i=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(rn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:Z("invite-modal",e,{success:!!n}),children:c.jsx(Dh,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const vi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(sd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(rn,{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(Ch,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var m;try{(m=i==null?void 0:i.functions)!=null&&m.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},g_=Object.freeze(Object.defineProperty({__proto__:null,default:vi},Symbol.toStringTag,{value:"Module"}));const v_=({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(bn,{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(rn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Tn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const b_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:Z("testimonial-block",a),children:[c.jsx(Wt,{className:"testimonial",children:n}),r?c.jsx(en,{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})})]})]}),y_=y.memo(b_);const x_=({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(St,{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 bi=({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,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text: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 D_=({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(In,{...n,className:Z("banner",e),image:{...t,aspect:"banner"}})):null;const C_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],w_=({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"},m={};d.forEach(v=>{if(!t[v]){m[v]=!1;return}if(!s[v]){if(typeof t[v]=="object"){m[v]=t[v];const{text:b,element:E}=t[v];if(E&&C_.includes(E.toLowerCase()))return;m[v]={text:b,element:h[v]};return}m[v]={text:t[v],element:h[v]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=v=>{v.preventDefault(),v.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),c.jsx(Dn,{className:Z("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(v=>{if(m[v]&&typeof m[v]=="object"){const{text:b,element:E=""}=m[v];return v==="text"?c.jsx(Tn,{overrideType:"text-only",className:"text",children:b},v):y.createElement(E,{key:v,className:v},b)}return null}),l,p&&c.jsx(ke,{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(In,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},E_=y.memo(w_);const __=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(Dn,{className:Z("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const k_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Tn,{children:n}):n;return c.jsxs(Dn,{className:Z("highlight-section",t),children:[r&&c.jsx("div",{className:Z("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(In,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),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})})})]})},F_=y.memo(k_);const A_=({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(ke,{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&&Ds(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"}):no(d)});if(o)return c.jsx(Ht,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&Ds(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},T_={title:66,text:3e3,secondaryText:1e3,partner:34},ti={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"}},S_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,v;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,m=e.contentType;let p="";if((f=ti[m])!=null&&f.gtmEvent&&(p=ti[m].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":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?c.jsx(ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&d!=="premium"){const b=i.loading||i.registered||((v=e==null?void 0:e.members)==null?void 0:v.isMember),E=async k=>{if(k.preventDefault(),k.stopPropagation(),!(b||!t||!t.onClick)){s(T=>({...T,loading:!0}));try{const T=await t.onClick(e);s(T==="success"?()=>({registered:!0,loading:!1}):D=>({...D,loading:!1}))}catch{s(D=>({...D,loading:!1}))}}};return c.jsx("p",{className:Z("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(ke,{onClick:E,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function j_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(st),[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(Ht,{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 eu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var $,F;const u=ie.useIntl(),d=y.useContext(st),h=!!(d!=null&&d.id),m=y.useRef(null),[p,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(_=>{g({data:_,isLoading:!1})}).catch(()=>g(_=>({..._,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:v}=p;if(v||!f)return c.jsx(Ot,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:b}=f;if(!b||!ti[b])return c.jsx(Ot,{element:"li",className:"card-wrapper"});const{basePath:E="",className:k,length:T,gtmEvent:D}=ti[b];let w=f.slug?`${E}${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")&&(w=f.slug);const S=_=>{w&&(_.preventDefault(),_.stopPropagation(),window.location.href=w)},L={...T_,...T};let M={className:"card"},q={};return w&&(q={href:w,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${D}-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":`${D}-click`}),l&&(M={...M,tabIndex:"0"},($=m==null?void 0:m.current)==null||$.focus(),(F=m==null?void 0:m.current)==null||F.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:Z("card-wrapper text-medium",k,t,{"has-link":w,"no-link":!w,"has-image":f.banner}),"data-testid":`${b}-card`,children:c.jsxs("div",{...M,ref:m,children:[c.jsx(ud,{className:"card-label",contentType:b,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),b==="communityPage"&&(f==null?void 0:f.createdAt)&&vm(f==null?void 0:f.createdAt,60)&&c.jsx(Ht,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Ht,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):rd(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Ht,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(In,{image:{...f.banner,description:""}})]}):k==="people"?c.jsx(bn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(uo,{contributors:{data:f.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(b)?u.formatMessage({id:`card_contributors_${b}`}):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}):rr(f.partner[0],L.partner)}),["title","text","secondaryText"].map(_=>{const P=f[_];if(!P)return null;const j=Jc(_),W={key:_,className:j,"data-testid":j},V={wrapper:"p",forceWrapper:!0,forceInline:!0},se=rr(P,L[_]);return["title","text"].includes(_)&&w?(V.wrapper="a",c.jsx("p",{...W,children:c.jsx(Wt,{options:V,...q,children:se})})):c.jsx(Wt,{options:V,...W,children:se})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(j_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(B_,{type:k||"",data:f}),c.jsx(S_,{data:f,cta:i,link:w||"",gtmContext:s})]})})};const Vh=({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(eu,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),O_=(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},P_=({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: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 vs={fourCards:1024,threeCards:769,twoCards:480};let xa=null,bs=null;const M_=({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:m,isLoading:p}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:v,loadedPages:b}=g,[E,k]=y.useState(""),T=t.length,D=Math.ceil(T/m),w=y.useRef(null),S=Nn(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let _=1;S&&(S>=vs.fourCards?_=4:S>=vs.threeCards?_=3:S>=vs.twoCards&&(_=2),_>T&&(_=T)),h(P=>({...P,cardsPerPage:_,isLoading:!1}))},[S,T]);const L=(_="next")=>{bs&&clearTimeout(bs);let P=v;if(typeof _=="string")if(_==="next")if(v<D-1)P=v+1;else return;else if(v>0)P=v-1;else return;else P=_;k(""),f(W=>({...W,currentPage:P,loadedPages:[...new Set([...b,P])]}));const j=()=>{const W=P*d.cardsPerPage,V=W+d.cardsPerPage;return t.slice(W,V).length};bs=setTimeout(()=>{k(l.formatMessage({id:`${u}ariaLive${typeof _=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof _=="string"?_:"next"}`}),slide:typeof _=="string"?1:_+1,count:j()}))},500)},M=_=>{xa=_.touches[0].clientX},q=_=>{if(xa===null)return;const P=_.touches[0].clientX,j=xa-P;j>5?L("next"):j<-5&&L("previous"),xa=null},$={"--width":`${S||0}px`,"--total-cards":T,"--cards-per-page":m,"--page":v};if(p)return c.jsx(si,{layout:`carousel${a?"-with-title":""}`});const F=(_,P)=>{var W;let j=null;return(W=_==null?void 0:_.sys)!=null&&W.id?j=`card-${_.sys.id}`:_!=null&&_.slug?j=`card-${_.slug}`:[n[P],_.contentType].includes("customCard")&&(j=`card-${window.btoa(`${_.title} ${_.createdAt}`)}-${P}`),j};return c.jsxs("section",{ref:w,className:Z("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(P_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:M,onTouchMove:q,style:$,"data-testid":"carousel-list",children:t.map((_,P)=>{let j=F(_,P);return j&&O_(P,m,v,b)?c.jsx(eu,{id:j,card:{..._,contentType:n[P]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${P}`,c.jsx(Ot,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),D<=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(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:_=>{_.preventDefault(),_.stopPropagation(),L("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:v<=0})}),[...Array(D)].map((_,P)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:Z("page-indicator",{selected:P===v}),onClick:j=>{j.preventDefault(),j.stopPropagation(),L(P)},children:c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:P+1,total:D})})})},`page-indicator-${P}`)),c.jsx("li",{className:"arrow next",children:c.jsx(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:_=>{_.preventDefault(),_.stopPropagation(),L("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:v>=D-1})})]}),c.jsx(Me,{"aria-live":E===""?"off":"polite",showOnFocus:!1,children:E})]})]})},N_=({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(si,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Kt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(M_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Kt,{})]},`carousel-${d}`)});const R_=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:Z("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Z("img",{private:o,"no-image":!a}),children:a&&c.jsx(In,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const I_=({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: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(bi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(oo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Kh=({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 Zh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=ri(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):ed(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(bi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const $_=({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(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(ai,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${m}time_completed`}):c.jsx(bi,{time:s,appendedText:a?h.formatMessage({id:`${m}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:v,icon:b,image:E,isIntroduction:k,optional:T,slug:D,subsectionId:w,title:S,type:L})=>{const M=a&&t||k,q={};return E&&(q.style={"--image":`url(${E})`}),c.jsx("li",{className:Z({article:v===_r.ARTICLE,discussion:v===_r.DISCUSSION,quiz:v===_r.QUIZ,completed:g&&v===_r.ARTICLE,locked:!M}),...q,children:c.jsx(gn,{href:M?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Xc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Kh,{sectionId:i,subsectionId:w,title:S,className:"course-title"})," ",c.jsx(Zh,{completionTime:f,icon:b,optional:T,type:L,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const L_=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(ke,{...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":""}`})})},z_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),zc=[{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 Da="notFoundError_",q_=()=>{const e=ie.useIntl(),t=[];return zc.forEach((n,r)=>{n.title=e.formatMessage({id:`${Da}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(kh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(Dn,{children:[c.jsx(Vh,{cards:zc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(ke,{href:"/solution-articles/",children:e.formatMessage({id:`${Da}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Da}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Da}text`})})]})};exports.ASSETS_BUCKET=Vt;exports.ActivitiesFeed=zE;exports.ActivitySection=h_;exports.AddPost=Jo;exports.Badge=Cd;exports.BadgeScope=ct;exports.Badges=wd;exports.BadgesContext=ao;exports.BadgesProvider=md;exports.Banner=D_;exports.BannerSection=E_;exports.Breadcrumbs=tg;exports.Buckets=Om;exports.Button=ke;exports.ButtonWrapper=fr;exports.COURSE_CONTENT_TYPES=_r;exports.CacheProvider=pd;exports.Card=eu;exports.CardBlock=Vh;exports.Carousel=N_;exports.CharacterLimit=go;exports.CollapsibleSection=ai;exports.Columns=zd;exports.CommunityDetails=eg;exports.ContactFooter=aE;exports.ContactForm=xh;exports.ContentTypeLabel=ud;exports.Contributors=uo;exports.ConversationContext=gi;exports.CookieBanner=_h;exports.CourseProgression=I_;exports.CourseStructure=$_;exports.CustomContentBanner=__;exports.CustomEvents=rt;exports.DELETED_USER_ID=Nr;exports.Directory=v_;exports.DiscussionConversation=Bh;exports.DiscussionForm=Gr;exports.DiscussionFormCard=qh;exports.DiscussionFormModal=Hh;exports.DiscussionLikes=Th;exports.DiscussionPost=Qr;exports.DiscussionThread=Wh;exports.Divider=Kt;exports.DownloadSection=eE;exports.EMAILS=Zn;exports.EditSection=nE;exports.EmailHelperTextBox=Ud;exports.EmptyStateBox=vn;exports.EnrichedUrl=mo;exports.FeatureFlags=vd;exports.Filters=Id;exports.FlagsProvider=gd;exports.Footer=Ho;exports.Form=Yt;exports.Formatting=G;exports.Fragment=At;exports.FullWidthSection=Dn;exports.GET_STREAM_USER_PREFIX=xs;exports.GlobalProviders=Km;exports.Header=Vo;exports.HelperTextBox=cd;exports.HiddenFromScreenReaders=ni;exports.HideShowTextBox=dd;exports.HighlightSection=F_;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=td;exports.IconBulletedList=Nm;exports.ImageContainer=Bm;exports.IntlProvider=bd;exports.InviteForm=Dh;exports.InviteModal=p_;exports.JoinButton=ho;exports.Label=Io;exports.LanguageContext=io;exports.LanguageSwitcher=rg;exports.LessonName=Kh;exports.LessonType=Zh;exports.LikesFeed=Lh;exports.LikesModal=zh;exports.Link=gn;exports.LoadMore=Zr;exports.LoadingBlock=Qm;exports.LoadingPlaceholder=Ot;exports.LoadingState=si;exports.Logo=po;exports.LogoSection=rE;exports.MEMBERS_PER_PAGE=Fh;exports.MENTION_REGEX=nd;exports.MarkCompleteButton=L_;exports.MarkdownText=Tn;exports.MarketingBlock=A_;exports.Marks=Ut;exports.Member=en;exports.MembersList=Ah;exports.Modal=lo;exports.MoreMenu=$d;exports.NUMBER_OF_COUNTRIES=mm;exports.NUMBER_OF_USERS=hm;exports.NarrowCard=R_;exports.NavigationMenu=Ld;exports.NotFoundError=q_;exports.Overlay=rn;exports.OverlayContext=so;exports.OverlayProvider=Dd;exports.PageHeading=fd;exports.PageLayout=kh;exports.PasswordForm=Vw;exports.PasswordRules=Zd;exports.Pill=Ht;exports.Popover=od;exports.Portal=hr;exports.ProfileForm=Ch;exports.ProfileImageChange=yh;exports.ProfileModal=vi;exports.ProfileModalLauncher=Xo;exports.ProfilePicture=bn;exports.ProgressBar=oo;exports.ProgressTracker=Sm;exports.PublishArticleForm=Kw;exports.Rating=Dg;exports.RepliesFeed=$h;exports.ResponsesHeading=Uh;exports.ResponsiveImage=In;exports.ReturnToNavButton=jm;exports.RichTextEditor=Wo;exports.SearchForm=wh;exports.ShareLinks=lg;exports.SignupForm=Xw;exports.Span=Es;exports.StatusBanner=ir;exports.TableOfContents=x_;exports.Tabs=cg;exports.Tags=lE;exports.TestimonialBlock=y_;exports.TimeToComplete=bi;exports.Toggle=Ww;exports.Tooltip=Rn;exports.TopLevelPage=iE;exports.UUID_V4_REGEX=Rr;exports.UserContext=st;exports.UserProvider=yd;exports.VisuallyHidden=Me;exports.addAriaProps=Rd;exports.basicReducer=Kr;exports.camelCaseToDashCase=Jc;exports.checkIntlPathExists=ri;exports.generateConditions=ja;exports.generateCssIcon=pm;exports.getAuthorData=pr;exports.getCharacterLimitProps=qd;exports.getLongDate=no;exports.getMember=oi;exports.getPostBody=Qo;exports.getShortDate=rd;exports.getValueLength=ui;exports.headerData=Vr;exports.mapGetStreamData=z_;exports.pageReady=ad;exports.passwordValidator=Cs;exports.repliesFeedMock=qE;exports.supportedLanguages=Ea;exports.toCamelCase=Xc;exports.toCapitalisedCase=fm;exports.toSentenceCase=ed;exports.transformSlugs=Js;exports.useBadges=hd;exports.useCurrentPath=Vc;exports.useEffectAfterMount=ar;exports.useElementWidth=Nn;exports.useOverlay=xd;exports.useScrollListener=Yc;exports.useScrollToHash=eo;exports.useTooltips=to;exports.useUser=ii;