@apolitical/component-library 4.7.15-beta.3 → 4.7.15-beta.5

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.
Files changed (4) hide show
  1. package/index.js +30 -30
  2. package/index.mjs +1337 -1336
  3. package/package.json +1 -1
  4. package/style.css +1 -1
package/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var Yo;function Hh(){if(Yo)return cr;Yo=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,m={},p=null,h=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(m[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)m[c]===void 0&&(m[c]=l[c]);return{$$typeof:t,type:o,key:p,ref:h,props:m,_owner:a.current}}return cr.Fragment=n,cr.jsx=s,cr.jsxs=s,cr}var dr={};/**
13
+ */var Yo;function Hh(){if(Yo)return cr;Yo=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},p=null,h=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(h=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:h,props:m,_owner:a.current}}return cr.Fragment=n,cr.jsx=s,cr.jsxs=s,cr}var dr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,50 +18,50 @@
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 Go;function Vh(){return Go||(Go=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"),c=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b(O){if(O===null||typeof O!="object")return null;var oe=g&&O[g]||O[f];return typeof oe=="function"?oe:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(O){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];F("error",O,ce)}}function F(O,oe,ce){{var De=v.ReactDebugCurrentFrame,je=De.getStackAddendum();je!==""&&(oe+="%s",ce=ce.concat([je]));var $e=ce.map(function(Se){return String(Se)});$e.unshift("Warning: "+oe),Function.prototype.apply.call(console[O],console,$e)}}var x=!1,w=!1,B=!1,S=!1,z=!1,M;M=Symbol.for("react.module.reference");function $(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||z||O===a||O===u||O===c||S||O===h||x||w||B||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===M||O.getModuleId!==void 0))}function R(O,oe,ce){var De=O.displayName;if(De)return De;var je=oe.displayName||oe.name||"";return je!==""?ce+"("+je+")":ce}function k(O){return O.displayName||"Context"}function A(O){if(O==null)return null;if(typeof O.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var oe=O;return k(oe)+".Consumer";case s:var ce=O;return k(ce._context)+".Provider";case l:return R(O,O.render,"ForwardRef");case m:var De=O.displayName||null;return De!==null?De:A(O.type)||"Memo";case p:{var je=O,$e=je._payload,Se=je._init;try{return A(Se($e))}catch{return null}}}return null}var j=Object.assign,L=0,H,Z,Q,ae,C,q,Y;function E(){}E.__reactDisabledLog=!0;function T(){{if(L===0){H=console.log,Z=console.info,Q=console.warn,ae=console.error,C=console.group,q=console.groupCollapsed,Y=console.groupEnd;var O={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}L++}}function N(){{if(L--,L===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:H}),info:j({},O,{value:Z}),warn:j({},O,{value:Q}),error:j({},O,{value:ae}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:q}),groupEnd:j({},O,{value:Y})})}L<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=v.ReactCurrentDispatcher,U;function ne(O,oe,ce){{if(U===void 0)try{throw Error()}catch(je){var De=je.stack.trim().match(/\n( *(at )?)/);U=De&&De[1]||""}return`
21
+ */var Go;function Vh(){return Go||(Go=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"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b(O){if(O===null||typeof O!="object")return null;var oe=g&&O[g]||O[f];return typeof oe=="function"?oe:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(O){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];F("error",O,ce)}}function F(O,oe,ce){{var De=v.ReactDebugCurrentFrame,je=De.getStackAddendum();je!==""&&(oe+="%s",ce=ce.concat([je]));var $e=ce.map(function(Se){return String(Se)});$e.unshift("Warning: "+oe),Function.prototype.apply.call(console[O],console,$e)}}var x=!1,w=!1,B=!1,S=!1,z=!1,M;M=Symbol.for("react.module.reference");function $(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||z||O===a||O===u||O===d||S||O===h||x||w||B||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===M||O.getModuleId!==void 0))}function R(O,oe,ce){var De=O.displayName;if(De)return De;var je=oe.displayName||oe.name||"";return je!==""?ce+"("+je+")":ce}function k(O){return O.displayName||"Context"}function A(O){if(O==null)return null;if(typeof O.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var oe=O;return k(oe)+".Consumer";case s:var ce=O;return k(ce._context)+".Provider";case l:return R(O,O.render,"ForwardRef");case m:var De=O.displayName||null;return De!==null?De:A(O.type)||"Memo";case p:{var je=O,$e=je._payload,Se=je._init;try{return A(Se($e))}catch{return null}}}return null}var j=Object.assign,L=0,H,Z,Q,ae,C,q,Y;function E(){}E.__reactDisabledLog=!0;function T(){{if(L===0){H=console.log,Z=console.info,Q=console.warn,ae=console.error,C=console.group,q=console.groupCollapsed,Y=console.groupEnd;var O={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}L++}}function N(){{if(L--,L===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:H}),info:j({},O,{value:Z}),warn:j({},O,{value:Q}),error:j({},O,{value:ae}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:q}),groupEnd:j({},O,{value:Y})})}L<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=v.ReactCurrentDispatcher,U;function ne(O,oe,ce){{if(U===void 0)try{throw Error()}catch(je){var De=je.stack.trim().match(/\n( *(at )?)/);U=De&&De[1]||""}return`
22
22
  `+U+O}}var te=!1,ie;{var le=typeof WeakMap=="function"?WeakMap:Map;ie=new le}function J(O,oe){if(!O||te)return"";{var ce=ie.get(O);if(ce!==void 0)return ce}var De;te=!0;var je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $e;$e=I.current,I.current=null,T();try{if(oe){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(Ht){De=Ht}Reflect.construct(O,[],Se)}else{try{Se.call()}catch(Ht){De=Ht}O.call(Se.prototype)}}else{try{throw Error()}catch(Ht){De=Ht}O()}}catch(Ht){if(Ht&&De&&typeof Ht.stack=="string"){for(var Be=Ht.stack.split(`
23
23
  `),it=De.stack.split(`
24
24
  `),Ge=Be.length-1,Qe=it.length-1;Ge>=1&&Qe>=0&&Be[Ge]!==it[Qe];)Qe--;for(;Ge>=1&&Qe>=0;Ge--,Qe--)if(Be[Ge]!==it[Qe]){if(Ge!==1||Qe!==1)do if(Ge--,Qe--,Qe<0||Be[Ge]!==it[Qe]){var Ct=`
25
- `+Be[Ge].replace(" at new "," at ");return O.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",O.displayName)),typeof O=="function"&&ie.set(O,Ct),Ct}while(Ge>=1&&Qe>=0);break}}}finally{te=!1,I.current=$e,N(),Error.prepareStackTrace=je}var In=O?O.displayName||O.name:"",Zo=In?ne(In):"";return typeof O=="function"&&ie.set(O,Zo),Zo}function ge(O,oe,ce){return J(O,!1)}function he(O){var oe=O.prototype;return!!(oe&&oe.isReactComponent)}function pe(O,oe,ce){if(O==null)return"";if(typeof O=="function")return J(O,he(O));if(typeof O=="string")return ne(O);switch(O){case u:return ne("Suspense");case c:return ne("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return ge(O.render);case m:return pe(O.type,oe,ce);case p:{var De=O,je=De._payload,$e=De._init;try{return pe($e(je),oe,ce)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,_e={},Le=v.ReactDebugCurrentFrame;function Te(O){if(O){var oe=O._owner,ce=pe(O.type,O._source,oe?oe.type:null);Le.setExtraStackFrame(ce)}else Le.setExtraStackFrame(null)}function Ae(O,oe,ce,De,je){{var $e=Function.call.bind(xe);for(var Se in O)if($e(O,Se)){var Be=void 0;try{if(typeof O[Se]!="function"){var it=Error((De||"React class")+": "+ce+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw it.name="Invariant Violation",it}Be=O[Se](oe,Se,De,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){Be=Ge}Be&&!(Be instanceof Error)&&(Te(je),_("%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,Se,typeof Be),Te(null)),Be instanceof Error&&!(Be.message in _e)&&(_e[Be.message]=!0,Te(je),_("Failed %s type: %s",ce,Be.message),Te(null))}}}var Pe=Array.isArray;function ke(O){return Pe(O)}function Ve(O){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function qe(O){try{return W(O),!1}catch{return!0}}function W(O){return""+O}function re(O){if(qe(O))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(O)),W(O)}var me=v.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ze,Ye;Ye={};function gt(O){if(xe.call(O,"ref")){var oe=Object.getOwnPropertyDescriptor(O,"ref").get;if(oe&&oe.isReactWarning)return!1}return O.ref!==void 0}function Ut(O){if(xe.call(O,"key")){var oe=Object.getOwnPropertyDescriptor(O,"key").get;if(oe&&oe.isReactWarning)return!1}return O.key!==void 0}function Bt(O,oe){if(typeof O.ref=="string"&&me.current&&oe&&me.current.stateNode!==oe){var ce=A(me.current.type);Ye[ce]||(_('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',A(me.current.type),O.ref),Ye[ce]=!0)}}function tt(O,oe){{var ce=function(){we||(we=!0,_("%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(O,"key",{get:ce,configurable:!0})}}function Ot(O,oe){{var ce=function(){Ze||(Ze=!0,_("%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(O,"ref",{get:ce,configurable:!0})}}var vt=function(O,oe,ce,De,je,$e,Se){var Be={$$typeof:t,type:O,key:oe,ref:ce,props:Se,_owner:$e};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function di(O,oe,ce,De,je){{var $e,Se={},Be=null,it=null;ce!==void 0&&(re(ce),Be=""+ce),Ut(oe)&&(re(oe.key),Be=""+oe.key),gt(oe)&&(it=oe.ref,Bt(oe,je));for($e in oe)xe.call(oe,$e)&&!ve.hasOwnProperty($e)&&(Se[$e]=oe[$e]);if(O&&O.defaultProps){var Ge=O.defaultProps;for($e in Ge)Se[$e]===void 0&&(Se[$e]=Ge[$e])}if(Be||it){var Qe=typeof O=="function"?O.displayName||O.name||"Unknown":O;Be&&tt(Se,Qe),it&&Ot(Se,Qe)}return vt(O,Be,it,je,De,me.current,Se)}}var lr=v.ReactCurrentOwner,Kr=v.ReactDebugCurrentFrame;function Mn(O){if(O){var oe=O._owner,ce=pe(O.type,O._source,oe?oe.type:null);Kr.setExtraStackFrame(ce)}else Kr.setExtraStackFrame(null)}var fi;fi=!1;function hi(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Wo(){{if(lr.current){var O=A(lr.current.type);if(O)return`
25
+ `+Be[Ge].replace(" at new "," at ");return O.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",O.displayName)),typeof O=="function"&&ie.set(O,Ct),Ct}while(Ge>=1&&Qe>=0);break}}}finally{te=!1,I.current=$e,N(),Error.prepareStackTrace=je}var In=O?O.displayName||O.name:"",Zo=In?ne(In):"";return typeof O=="function"&&ie.set(O,Zo),Zo}function ge(O,oe,ce){return J(O,!1)}function he(O){var oe=O.prototype;return!!(oe&&oe.isReactComponent)}function pe(O,oe,ce){if(O==null)return"";if(typeof O=="function")return J(O,he(O));if(typeof O=="string")return ne(O);switch(O){case u:return ne("Suspense");case d:return ne("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return ge(O.render);case m:return pe(O.type,oe,ce);case p:{var De=O,je=De._payload,$e=De._init;try{return pe($e(je),oe,ce)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,_e={},Le=v.ReactDebugCurrentFrame;function Te(O){if(O){var oe=O._owner,ce=pe(O.type,O._source,oe?oe.type:null);Le.setExtraStackFrame(ce)}else Le.setExtraStackFrame(null)}function Ae(O,oe,ce,De,je){{var $e=Function.call.bind(xe);for(var Se in O)if($e(O,Se)){var Be=void 0;try{if(typeof O[Se]!="function"){var it=Error((De||"React class")+": "+ce+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw it.name="Invariant Violation",it}Be=O[Se](oe,Se,De,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){Be=Ge}Be&&!(Be instanceof Error)&&(Te(je),_("%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,Se,typeof Be),Te(null)),Be instanceof Error&&!(Be.message in _e)&&(_e[Be.message]=!0,Te(je),_("Failed %s type: %s",ce,Be.message),Te(null))}}}var Pe=Array.isArray;function ke(O){return Pe(O)}function Ve(O){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function qe(O){try{return W(O),!1}catch{return!0}}function W(O){return""+O}function re(O){if(qe(O))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(O)),W(O)}var me=v.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ze,Ye;Ye={};function gt(O){if(xe.call(O,"ref")){var oe=Object.getOwnPropertyDescriptor(O,"ref").get;if(oe&&oe.isReactWarning)return!1}return O.ref!==void 0}function Ut(O){if(xe.call(O,"key")){var oe=Object.getOwnPropertyDescriptor(O,"key").get;if(oe&&oe.isReactWarning)return!1}return O.key!==void 0}function Bt(O,oe){if(typeof O.ref=="string"&&me.current&&oe&&me.current.stateNode!==oe){var ce=A(me.current.type);Ye[ce]||(_('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',A(me.current.type),O.ref),Ye[ce]=!0)}}function tt(O,oe){{var ce=function(){we||(we=!0,_("%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(O,"key",{get:ce,configurable:!0})}}function Ot(O,oe){{var ce=function(){Ze||(Ze=!0,_("%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(O,"ref",{get:ce,configurable:!0})}}var vt=function(O,oe,ce,De,je,$e,Se){var Be={$$typeof:t,type:O,key:oe,ref:ce,props:Se,_owner:$e};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function di(O,oe,ce,De,je){{var $e,Se={},Be=null,it=null;ce!==void 0&&(re(ce),Be=""+ce),Ut(oe)&&(re(oe.key),Be=""+oe.key),gt(oe)&&(it=oe.ref,Bt(oe,je));for($e in oe)xe.call(oe,$e)&&!ve.hasOwnProperty($e)&&(Se[$e]=oe[$e]);if(O&&O.defaultProps){var Ge=O.defaultProps;for($e in Ge)Se[$e]===void 0&&(Se[$e]=Ge[$e])}if(Be||it){var Qe=typeof O=="function"?O.displayName||O.name||"Unknown":O;Be&&tt(Se,Qe),it&&Ot(Se,Qe)}return vt(O,Be,it,je,De,me.current,Se)}}var lr=v.ReactCurrentOwner,Kr=v.ReactDebugCurrentFrame;function Mn(O){if(O){var oe=O._owner,ce=pe(O.type,O._source,oe?oe.type:null);Kr.setExtraStackFrame(ce)}else Kr.setExtraStackFrame(null)}var fi;fi=!1;function hi(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Wo(){{if(lr.current){var O=A(lr.current.type);if(O)return`
26
26
 
27
27
  Check the render method of \``+O+"`."}return""}}function Th(O){{if(O!==void 0){var oe=O.fileName.replace(/^.*[\\\/]/,""),ce=O.lineNumber;return`
28
28
 
29
29
  Check your code at `+oe+":"+ce+"."}return""}}var Uo={};function Sh(O){{var oe=Wo();if(!oe){var ce=typeof O=="string"?O:O.displayName||O.name;ce&&(oe=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return oe}}function Ho(O,oe){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=Sh(oe);if(Uo[ce])return;Uo[ce]=!0;var De="";O&&O._owner&&O._owner!==lr.current&&(De=" It was passed a child from "+A(O._owner.type)+"."),Mn(O),_('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),Mn(null)}}function Vo(O,oe){{if(typeof O!="object")return;if(ke(O))for(var ce=0;ce<O.length;ce++){var De=O[ce];hi(De)&&Ho(De,oe)}else if(hi(O))O._store&&(O._store.validated=!0);else if(O){var je=b(O);if(typeof je=="function"&&je!==O.entries)for(var $e=je.call(O),Se;!(Se=$e.next()).done;)hi(Se.value)&&Ho(Se.value,oe)}}}function jh(O){{var oe=O.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===m))ce=oe.propTypes;else return;if(ce){var De=A(oe);Ae(ce,O.props,"prop",De,O)}else if(oe.PropTypes!==void 0&&!fi){fi=!0;var je=A(oe);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Oh(O){{for(var oe=Object.keys(O.props),ce=0;ce<oe.length;ce++){var De=oe[ce];if(De!=="children"&&De!=="key"){Mn(O),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),Mn(null);break}}O.ref!==null&&(Mn(O),_("Invalid attribute `ref` supplied to `React.Fragment`."),Mn(null))}}function Ko(O,oe,ce,De,je,$e){{var Se=$(O);if(!Se){var Be="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Be+=" 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 it=Th(je);it?Be+=it:Be+=Wo();var Ge;O===null?Ge="null":ke(O)?Ge="array":O!==void 0&&O.$$typeof===t?(Ge="<"+(A(O.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof O,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,Be)}var Qe=di(O,oe,ce,je,$e);if(Qe==null)return Qe;if(Se){var Ct=oe.children;if(Ct!==void 0)if(De)if(ke(Ct)){for(var In=0;In<Ct.length;In++)Vo(Ct[In],O);Object.freeze&&Object.freeze(Ct)}else _("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 Vo(Ct,O)}return O===r?Oh(Qe):jh(Qe),Qe}}function Ph(O,oe,ce){return Ko(O,oe,ce,!0)}function Nh(O,oe,ce){return Ko(O,oe,ce,!1)}var Mh=Nh,Ih=Ph;dr.Fragment=r,dr.jsx=Mh,dr.jsxs=Ih}()),dr}process.env.NODE_ENV==="production"?fs.exports=Hh():fs.exports=Vh();var d=fs.exports;const Nc=()=>{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},Xn=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Mc(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(),c=y.useRef(e),m=y.useRef(!0);c.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,_=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var F=y.useMemo(function(){var x=function($){var R=o.current,k=l.current;return o.current=l.current=null,i.current=$,u.current=c.current.apply(k,R)},w=function($,R){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame($):setTimeout($,R)},B=function($){if(!m.current)return!1;var R=$-a.current;return!a.current||R>=t||R<0||b&&$-i.current>=_},S=function($){return s.current=null,f&&o.current?x($):(o.current=l.current=null,u.current)},z=function $(){var R=Date.now();if(B(R))return S(R);if(m.current){var k=t-(R-a.current),A=b?Math.min(k,_-(R-i.current)):k;w($,A)}},M=function(){if(p||v){var $=Date.now(),R=B($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,R){if(!s.current&&m.current)return i.current=a.current,w(z,t),g?x(a.current):u.current;if(b)return w(z,t),x(a.current)}return s.current||w(z,t),u.current}};return M.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?S(Date.now()):u.current},M},[g,b,t,_,f,h,p,v]);return F}function Ic(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Mc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let mi;const On=(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(mi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:m}=c;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=Ic(()=>{s()!==r&&(t&&(clearTimeout(mi),document.body.classList.add("is-resizing"),mi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Rc=({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 c=window.scrollY,m=a.current,p=c-m,h=p>0?"down":"up";if(i({current:c,past:m}),h==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Ic(()=>{l()},250);return a},Vs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);Xn(()=>{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)},Ks=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Qo={},Pn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=se.useIntl(),m=y.useRef(null),p=u||m,[h,g]=y.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:b=!1,hasForm:v=!1}=t,{onOpen:_=()=>{},onClose:F=()=>{}}=o;e||(e=Date.now().toString());const x=Qo[e];y.useEffect(()=>{const z=p==null?void 0:p.current;if(z)return z.addEventListener("transitionend",w),z.addEventListener("keydown",B),()=>{z.removeEventListener("transitionend",w),z.removeEventListener("keydown",B)}},[]);const w=({propertyName:z})=>{z==="opacity"&&(x!==!1&&clearTimeout(x),g(M=>(M==="open"?_():M==="closed"&&F(),M==="opening"?"open":M==="closing"?"closed":M==="closed"?"hidden":M)))},B=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Xn(()=>{x!==!1&&clearTimeout(x);let z="open";n?g("opening"):(g("closing"),z="hidden"),Qo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:p,className:G("tooltip text-medium",h,i,{loading:r,"extra-padding":f,"has-pointer":b,bottom:b==="bottom","has-form":v}),...S,children:d.jsx("div",{className:"content",hidden:h==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),zr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=xn(e);return t.forEach(({type:r,value:a})=>{Rh(n,r,a)}),n},$c=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Lc=(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},zc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),qc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Wc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Kh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),zt="https://storage.googleapis.com/apolitical-assets/",Wn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},yr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},hs="SU:",Uc="Invalid token error: Logging user out...",Zh="200,000+",Yh="160+",Tr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Hc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Gh(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const Dn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Vc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Zs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ms=e=>{let t;const n=Ba(),r=Ba(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/Dn.milliseconds.inHour,i=Math.floor(t/Dn.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<=Dn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/Dn.year.days)}},Ba=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Qh=(e,t,n)=>{let r;const a=Ba(),i=Ba(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/Dn.milliseconds.inSecond<=t;case"minutes":return r/Dn.milliseconds.inMinute<=t;case"hours":return r/Dn.milliseconds.inHour<=t}return!1},Jh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Xh=e=>new Promise(t=>setTimeout(t,e)),em=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},ir={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_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",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_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 Ho(O,oe){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=Sh(oe);if(Uo[ce])return;Uo[ce]=!0;var De="";O&&O._owner&&O._owner!==lr.current&&(De=" It was passed a child from "+A(O._owner.type)+"."),Mn(O),_('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),Mn(null)}}function Vo(O,oe){{if(typeof O!="object")return;if(ke(O))for(var ce=0;ce<O.length;ce++){var De=O[ce];hi(De)&&Ho(De,oe)}else if(hi(O))O._store&&(O._store.validated=!0);else if(O){var je=b(O);if(typeof je=="function"&&je!==O.entries)for(var $e=je.call(O),Se;!(Se=$e.next()).done;)hi(Se.value)&&Ho(Se.value,oe)}}}function jh(O){{var oe=O.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===m))ce=oe.propTypes;else return;if(ce){var De=A(oe);Ae(ce,O.props,"prop",De,O)}else if(oe.PropTypes!==void 0&&!fi){fi=!0;var je=A(oe);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Oh(O){{for(var oe=Object.keys(O.props),ce=0;ce<oe.length;ce++){var De=oe[ce];if(De!=="children"&&De!=="key"){Mn(O),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),Mn(null);break}}O.ref!==null&&(Mn(O),_("Invalid attribute `ref` supplied to `React.Fragment`."),Mn(null))}}function Ko(O,oe,ce,De,je,$e){{var Se=$(O);if(!Se){var Be="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Be+=" 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 it=Th(je);it?Be+=it:Be+=Wo();var Ge;O===null?Ge="null":ke(O)?Ge="array":O!==void 0&&O.$$typeof===t?(Ge="<"+(A(O.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof O,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,Be)}var Qe=di(O,oe,ce,je,$e);if(Qe==null)return Qe;if(Se){var Ct=oe.children;if(Ct!==void 0)if(De)if(ke(Ct)){for(var In=0;In<Ct.length;In++)Vo(Ct[In],O);Object.freeze&&Object.freeze(Ct)}else _("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 Vo(Ct,O)}return O===r?Oh(Qe):jh(Qe),Qe}}function Ph(O,oe,ce){return Ko(O,oe,ce,!0)}function Nh(O,oe,ce){return Ko(O,oe,ce,!1)}var Mh=Nh,Ih=Ph;dr.Fragment=r,dr.jsx=Mh,dr.jsxs=Ih}()),dr}process.env.NODE_ENV==="production"?fs.exports=Hh():fs.exports=Vh();var c=fs.exports;const Nc=()=>{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},Xn=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Mc(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),m=y.useRef(!0);d.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,_=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var F=y.useMemo(function(){var x=function($){var R=o.current,k=l.current;return o.current=l.current=null,i.current=$,u.current=d.current.apply(k,R)},w=function($,R){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame($):setTimeout($,R)},B=function($){if(!m.current)return!1;var R=$-a.current;return!a.current||R>=t||R<0||b&&$-i.current>=_},S=function($){return s.current=null,f&&o.current?x($):(o.current=l.current=null,u.current)},z=function $(){var R=Date.now();if(B(R))return S(R);if(m.current){var k=t-(R-a.current),A=b?Math.min(k,_-(R-i.current)):k;w($,A)}},M=function(){if(p||v){var $=Date.now(),R=B($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,R){if(!s.current&&m.current)return i.current=a.current,w(z,t),g?x(a.current):u.current;if(b)return w(z,t),x(a.current)}return s.current||w(z,t),u.current}};return M.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?S(Date.now()):u.current},M},[g,b,t,_,f,h,p,v]);return F}function Ic(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Mc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let mi;const On=(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(mi),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:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=Ic(()=>{s()!==r&&(t&&(clearTimeout(mi),document.body.classList.add("is-resizing"),mi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Rc=({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,m=a.current,p=d-m,h=p>0?"down":"up";if(i({current:d,past:m}),h==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Ic(()=>{l()},250);return a},Vs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);Xn(()=>{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)},Ks=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Qo={},Pn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const d=se.useIntl(),m=y.useRef(null),p=u||m,[h,g]=y.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:b=!1,hasForm:v=!1}=t,{onOpen:_=()=>{},onClose:F=()=>{}}=o;e||(e=Date.now().toString());const x=Qo[e];y.useEffect(()=>{const z=p==null?void 0:p.current;if(z)return z.addEventListener("transitionend",w),z.addEventListener("keydown",B),()=>{z.removeEventListener("transitionend",w),z.removeEventListener("keydown",B)}},[]);const w=({propertyName:z})=>{z==="opacity"&&(x!==!1&&clearTimeout(x),g(M=>(M==="open"?_():M==="closed"&&F(),M==="opening"?"open":M==="closing"?"closed":M==="closed"?"hidden":M)))},B=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Xn(()=>{x!==!1&&clearTimeout(x);let z="open";n?g("opening"):(g("closing"),z="hidden"),Qo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),c.jsx("aside",{ref:p,className:G("tooltip text-medium",h,i,{loading:r,"extra-padding":f,"has-pointer":b,bottom:b==="bottom","has-form":v}),...S,children:c.jsx("div",{className:"content",hidden:h==="hidden",children:r?c.jsx("p",{children:d.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),zr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=xn(e);return t.forEach(({type:r,value:a})=>{Rh(n,r,a)}),n},$c=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Lc=(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},zc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),qc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Wc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Kh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),zt="https://storage.googleapis.com/apolitical-assets/",Wn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},yr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},hs="SU:",Uc="Invalid token error: Logging user out...",Zh="200,000+",Yh="160+",Tr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Hc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Gh(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const Dn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Vc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Zs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ms=e=>{let t;const n=Ba(),r=Ba(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/Dn.milliseconds.inHour,i=Math.floor(t/Dn.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<=Dn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/Dn.year.days)}},Ba=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Qh=(e,t,n)=>{let r;const a=Ba(),i=Ba(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/Dn.milliseconds.inSecond<=t;case"minutes":return r/Dn.milliseconds.inMinute<=t;case"hours":return r/Dn.milliseconds.inHour<=t}return!1},Jh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Xh=e=>new Promise(t=>setTimeout(t,e)),em=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},ir={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_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",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_profile:"Update profile",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",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"},tm={...ir,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>"},nm={...ir,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"},rm={...ir,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>"},am=Object.freeze(Object.defineProperty({__proto__:null,en:ir,es:tm,fr:nm,pt:rm},Symbol.toStringTag,{value:"Module"})),Ga=(e,t=ir)=>e in t,At=(e,t,n,r,a={})=>{let i="";return Ga(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},im=(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},ba=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Kc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},sm=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},om=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Zc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Tr);if(!a)return e;for(const s of a){const o=s.replace(Tr,(c,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const c=l;if(c.startsWith(hs))try{const m=c.replace(hs,"");u.id=m,await r({id:m}).then(p=>{const{name:h}=p;u.name=h||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?om(e,u,t):s)}return e},Yc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Gc=e=>new URLSearchParams(window.location.search).get(e),Jo=(e="")=>e.replace(/\s+/g,"").length>0,ps=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 Fe=({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:c=!1,children:m=!1,...p})=>{const g=On(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Ks(!!u);if(typeof t=="object"&&typeof g=="number"){const x=Object.assign({},t),w=$c(Object.keys(x));t=Lc(g,w,x)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const _={...p,className:G(e,o,v,{"no-text":!m,disabled:l,button:a}),onClick:x=>{(!a||a[0]==="#")&&s&&(x.preventDefault(),x.stopPropagation()),s&&s(x)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",_.href=a);const F=y.createElement(i,_,m||(c?d.jsx(Ie,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...b,children:[d.jsx(Pn,{isOpen:f,children:u}),F]}):F},sr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(Fe,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Fe,{...s})},o)});return y.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const qt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},Xo={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},um=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Xo[e]:Xo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},lm=({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},pi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${lm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const or=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:m}=e,{range:p,sizes:h}=um(e),g=pi({format:"avif",query:s,range:p,url:o}),f=pi({format:"webp",query:s,range:p,url:o}),b=pi({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:h,"data-testid":"source"}),d.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const cm=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(or,{image:{...e},className:"image"})}),dn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:G("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Qc=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),qr=({parent:e=document.body,children:t})=>typeof document=="object"?Sc.createPortal(t,e):null,dm=Object.freeze(Object.defineProperty({__proto__:null,default:qr},Symbol.toStringTag,{value:"Module"}));const fm=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{children:d.jsx(se.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const hm=({elementId:e,offset:t=20})=>{const n=se.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(Fe,{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 mm=({items:e,className:t="",...n})=>d.jsx("ul",{className:G("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),eu=300,tu="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:eu,easing:tu}),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:eu,easing:tu}),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 Qa=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=se.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new pm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},nu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},gm=e=>{let t=e;return Object.keys(nu).includes(e)&&(t=nu[e]),`url(${zt}icons/${t}.svg)`};const ru={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Jc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.useIntl(),i=t?{"--custom-icon":gm(t)}:{},s=Ga(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:G("content-type-label text-small",e in ru?ru[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const jt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${zt}icons/${t}.svg)`}:{};return d.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const fn=({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=On(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),p=$c(Object.keys(m));a=Lc(s,p,m)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(jt,{variant:"subtle",className:G("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Lt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Fe,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const gs=({children:e,...t})=>d.jsx("p",{...t,children:e}),Xc={q:gs,blockquote:gs};for(let e=1;e<=6;e++)Xc[`h${e}`]={component:gs,props:{className:"title"}};const ed=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>d.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Lt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:Xc},children:r}):d.jsx("p",{children:r})]});const td=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=se.useIntl(),l=y.useRef(null);e||(e=Date.now().toString());const[u,c]=y.useState(""),[m,p]=y.useState("closed");y.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",h),()=>{f.removeEventListener("transitionend",h)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
36
- `);c(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
37
- `))},[a]),y.useEffect(()=>{m==="ready-to-close"&&p("closing")},[m]);const h=({propertyName:f})=>{f==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!a)return null;const g=["opening","open"].includes(m);return d.jsxs(jt,{variant:"subtle",className:G("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:G("content",m),children:[d.jsx(Lt,{options:{forceBlock:!0,...i},children:m==="closed"?u:a}),m!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Fe,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const vm=({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:G("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(y.Fragment,{children:[d.jsx("dt",{style:m,children:d.jsx(Lt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:m,children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},u)})})},rt=()=>y.Fragment,bm=({children:e})=>d.jsx(jt,{variant:"secondary",children:e}),ym=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Dm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Cm=({children:e})=>{const t=se.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Dm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Qa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},xm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(jt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},wt=({children:e})=>d.jsx(d.Fragment,{children:e}),wm=e=>{const t=se.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},au=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Em=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&y.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||au(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!y.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&au(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Fe,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},vs=({children:e,...t})=>d.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const _m={default:{a:Em,CollapsibleSection:Qa,TextBox:jt,CaseStudy:bm,style:rt,details:Cm,div:xm,iframe:wm,center:ym},"text-only":{h1:rt,h2:rt,h3:rt,h4:rt,h5:rt,h6:rt,style:rt,details:rt,div:rt,TextBox:rt,CollapsibleSection:rt,CaseStudy:rt,blockquote:rt,iframe:rt,button:rt}},kn=({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=_m[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:G("markdown-text",t,{"highlight-titles":s}),children:d.jsx(Lt,{options:{...o,...n,overrides:l},children:r})})};const nd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:G("page-heading",a),children:[d.jsxs("div",{className:G("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 ln=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${zt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ks(!!a),c=d.jsx("span",{...u,className:G("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(Pn,{isOpen:l,children:a}),c]}):c};const Sr=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const km=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=se.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:G(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:y.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Ys=y.memo(km);const gi="loadingBlock_",Fm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=se.useIntl();t||(t={0:{text:r.formatMessage({id:`${gi}loading`})},75:{text:r.formatMessage({id:`${gi}almostDone`})},100:{text:r.formatMessage({id:`${gi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${zt}icons/${t[a].icon}.svg)`}:{};return d.jsxs(jt,{className:G("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(Ys,{progress:e})]})},Bm=y.memo(Fm);const Ft=({element:e="div",className:t="",...n})=>d.jsx(Ya,{element:e,className:G("loading-placeholder",t),...n});const bs={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},rd=(e,t)=>e in bs?d.jsx("div",{className:e,children:bs[e].map((n,r)=>rd(n,r))},t):d.jsx(Ft,{className:e},t),Gs=({layout:e="overview-page",...t})=>d.jsx("div",{className:G("loading-state",e),...t,children:bs[e].map((n,r)=>rd(n,r))}),ad=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):""},Yr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Am=e=>{const t=Math.ceil(26/Yr.length),n=ad(e).toLowerCase();if(n==="")return Yr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Yr.length;a++)if(r<=t*(a+1))return Yr[a]};const iu=256,hn=({className:e="",src:t="",name:n,alt:r,width:a=iu,height:i=iu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),c=y.useRef(null),m=r??n;y.useEffect(()=>{const h=c.current;if(!h)return;const g=h.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=f*window.devicePixelRatio,h.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Am(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ad(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),d.jsx("figure",{className:G("profile-picture",e,{error:l}),...o,children:p?d.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?d.jsx("canvas",{ref:c}):d.jsx("span",{className:"fallback"})})},id=({showDevTools:e=!0,children:t})=>{const n=new We.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(We.QueryClientProvider,{client:n,children:[t,e&&d.jsx($h.ReactQueryDevtools,{initialIsOpen:!1})]})};var sd=y.createContext({client:va});function Tm(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&&(va.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),va.init(r,a)),va)},[n,r]);return y.createElement(sd.Provider,{value:{client:i}},t)}var Sm=function(){var e=y.useContext(sd).client;return e};function jm(e){var t=Sm(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const od=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Tm,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e});var Qs=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Qs||{});const ud=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...am[r],...n||{}};return d.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},Js=y.createContext({}),ya={en:"English",es:"Español",fr:"Français",pt:"Português"},mt=y.createContext({isLoading:!0});function Ja(){return y.useContext(mt)}const ld=({children:e,user:t,updateDetails:n})=>d.jsx(mt.Provider,{value:{...t,updateDetails:n},children:e}),Xs=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),cd=()=>y.useContext(Xs),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 d.jsx(Xs.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Om=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=y.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return y.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Kc(5e3)}).catch(c=>{c.message===Uc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(Js.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(ud,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Hs.CookiesProvider,{children:d.jsx(ld,{user:a,updateDetails:i,children:d.jsx(dd,{children:d.jsx(id,{showDevTools:r,children:d.jsx(od,{user:a,children:t})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const Xa=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Pm=({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=Jn(l,r)),l};const Nm=y.lazy(()=>Promise.resolve().then(()=>dm)),Mm=y.lazy(()=>Promise.resolve().then(()=>ZE));let Gr=null;const Yt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",...u})=>{const c=se.useIntl(),{profile:m,...p}=i,{size:h="medium",variant:g="inline",isCondensed:f=!0}=a,b=y.useContext(mt),v=m&&b&&typeof b.id=="string",[_,F]=y.useState(!1),x=Xa(t);x.name||(x.name=c.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:w,image:B}=x;let{url:S}=x;t.link!==void 0&&(t.link===!1?S=void 0:S=t.link);const z=Pm(x),M=r&&r.createdAt?ms(r.createdAt):!1,$=r&&r.createdAt?Zs(r.createdAt):"";return y.createElement(e,{...u,className:G("member text-medium",h,g,l,{"has-profile-link":v}),...p,children:d.jsxs(d.Fragment,{children:[d.jsxs(dn,{href:S,gtmType:o,gtmContext:s,onClick:R=>{R==null||R.preventDefault(),R==null||R.stopPropagation(),Gr&&clearTimeout(Gr),Gr=setTimeout(()=>{window.location.href=S},150);const k=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:S,timeout:Gr}});document.dispatchEvent(k)},children:[d.jsx(hn,{name:w,src:B,alt:n}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{"data-testid":"member-name",children:[w,r&&d.jsxs("span",{className:"additional-content",children:[r.createdAt&&M&&d.jsx("span",{className:"date",title:$,"aria-label":$,"data-testid":"date",children:c.formatMessage({id:`dates_${M.path}`},{number:M.number})}),r.didEdit&&d.jsx("em",{children:c.formatMessage({id:"discussion_edited"})})]})]}),z&&d.jsx("small",{className:G({"text-medium":h==="large"}),"data-testid":"member-details",children:f?z:d.jsxs(d.Fragment,{children:[x.role,d.jsx("span",{className:"location",children:x.country})]})})]})]}),z&&m&&v?d.jsxs(d.Fragment,{children:[d.jsx(Fe,{variant:"tertiary",size:"small",onClick:R=>{R.preventDefault(),R.stopPropagation(),F(!0)},"data-testid":"profile-button",children:c.formatMessage({id:"member_profile"})}),d.jsx(Nm,{children:d.jsx(Mm,{form:m,showModal:_,content:{title:c.formatMessage({id:"member_profile"})},functions:{onClose:()=>{F(!1)}},className:"in-portal"})})]}):d.jsx(d.Fragment,{})]})})},Im=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));const su={small:24,medium:48},eo=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const m=se.useIntl();return!n||n.length===0?null:y.createElement(e,{...c,className:G("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,h)=>{let g,f="";if(h<o){const{name:b="",image:v=""}=Xa(p);if(s)return d.jsx(Ft,{element:"li",className:"contributor"},h);g=d.jsx(hn,{name:b,src:v,width:su[a||"medium"],height:su[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=d.jsxs("small",{className:G({"large-number":b>99}),children:["+",im(b,0)]}),f="number-left"}return g?d.jsx("li",{className:G("contributor",f),children:g},h):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Jn(n[0].name||"",20):l||null})]})})};const to=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:G("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});var ys={exports:{}},Qr={exports:{}},Ne={};/** @license React v16.13.1
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",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"},tm={...ir,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>"},nm={...ir,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"},rm={...ir,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>"},am=Object.freeze(Object.defineProperty({__proto__:null,en:ir,es:tm,fr:nm,pt:rm},Symbol.toStringTag,{value:"Module"})),Ga=(e,t=ir)=>e in t,At=(e,t,n,r,a={})=>{let i="";return Ga(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},im=(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},ba=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Kc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},sm=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},om=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Zc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Tr);if(!a)return e;for(const s of a){const o=s.replace(Tr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const d=l;if(d.startsWith(hs))try{const m=d.replace(hs,"");u.id=m,await r({id:m}).then(p=>{const{name:h}=p;u.name=h||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?om(e,u,t):s)}return e},Yc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Gc=e=>new URLSearchParams(window.location.search).get(e),Jo=(e="")=>e.replace(/\s+/g,"").length>0,ps=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 Fe=({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:m=!1,...p})=>{const g=On(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Ks(!!u);if(typeof t=="object"&&typeof g=="number"){const x=Object.assign({},t),w=$c(Object.keys(x));t=Lc(g,w,x)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const _={...p,className:G(e,o,v,{"no-text":!m,disabled:l,button:a}),onClick:x=>{(!a||a[0]==="#")&&s&&(x.preventDefault(),x.stopPropagation()),s&&s(x)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",_.href=a);const F=y.createElement(i,_,m||(d?c.jsx(Ie,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Pn,{isOpen:f,children:u}),F]}):F},sr=({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(Fe,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Fe,{...s})},o)});return y.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const qt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},Xo={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},um=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Xo[e]:Xo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},lm=({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},pi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${lm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const or=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:p,sizes:h}=um(e),g=pi({format:"avif",query:s,range:p,url:o}),f=pi({format:"webp",query:s,range:p,url:o}),b=pi({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"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:h,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:h,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const cm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(or,{image:{...e},className:"image"})}),dn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:G("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const Qc=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),qr=({parent:e=document.body,children:t})=>typeof document=="object"?Sc.createPortal(t,e):null,dm=Object.freeze(Object.defineProperty({__proto__:null,default:qr},Symbol.toStringTag,{value:"Module"}));const fm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ie,{children:c.jsx(se.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const hm=({elementId:e,offset:t=20})=>{const n=se.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Fe,{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 mm=({items:e,className:t="",...n})=>c.jsx("ul",{className:G("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))}),eu=300,tu="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:eu,easing:tu}),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:eu,easing:tu}),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 Qa=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=se.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new pm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},nu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},gm=e=>{let t=e;return Object.keys(nu).includes(e)&&(t=nu[e]),`url(${zt}icons/${t}.svg)`};const ru={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Jc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.useIntl(),i=t?{"--custom-icon":gm(t)}:{},s=Ga(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:G("content-type-label text-small",e in ru?ru[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const jt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${zt}icons/${t}.svg)`}:{};return c.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const fn=({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=On(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),p=$c(Object.keys(m));a=Lc(s,p,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(jt,{variant:"subtle",className:G("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Lt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Fe,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const gs=({children:e,...t})=>c.jsx("p",{...t,children:e}),Xc={q:gs,blockquote:gs};for(let e=1;e<=6;e++)Xc[`h${e}`]={component:gs,props:{className:"title"}};const ed=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Lt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:Xc},children:r}):c.jsx("p",{children:r})]});const td=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=se.useIntl(),l=y.useRef(null);e||(e=Date.now().toString());const[u,d]=y.useState(""),[m,p]=y.useState("closed");y.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",h),()=>{f.removeEventListener("transitionend",h)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
36
+ `);d(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
37
+ `))},[a]),y.useEffect(()=>{m==="ready-to-close"&&p("closing")},[m]);const h=({propertyName:f})=>{f==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!a)return null;const g=["opening","open"].includes(m);return c.jsxs(jt,{variant:"subtle",className:G("hide-show-text-box",t),children:[c.jsxs("div",{ref:l,id:e,className:G("content",m),children:[c.jsx(Lt,{options:{forceBlock:!0,...i},children:m==="closed"?u:a}),m!=="closed"&&s]}),c.jsx("p",{className:"cta",children:c.jsx(Fe,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const vm=({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:G("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},m={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Lt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Lt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(Lt,{options:d,children:l.text}):l.text},u)})})},rt=()=>y.Fragment,bm=({children:e})=>c.jsx(jt,{variant:"secondary",children:e}),ym=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Dm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Cm=({children:e})=>{const t=se.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Dm.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(Qa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},xm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(jt,{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})},wt=({children:e})=>c.jsx(c.Fragment,{children:e}),wm=e=>{const t=se.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:`content-after-iframe-${n}`})]})},au=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Em=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&y.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||au(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!y.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&au(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Fe,{variant:"primary",size:"medium",...n,children:r})})):c.jsx("a",{...n,children:r})},vs=({children:e,...t})=>c.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const _m={default:{a:Em,CollapsibleSection:Qa,TextBox:jt,CaseStudy:bm,style:rt,details:Cm,div:xm,iframe:wm,center:ym},"text-only":{h1:rt,h2:rt,h3:rt,h4:rt,h5:rt,h6:rt,style:rt,details:rt,div:rt,TextBox:rt,CollapsibleSection:rt,CaseStudy:rt,blockquote:rt,iframe:rt,button:rt}},kn=({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=_m[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:G("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Lt,{options:{...o,...n,overrides:l},children:r})})};const nd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:G("page-heading",a),children:[c.jsxs("div",{className:G("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 ln=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${zt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ks(!!a),d=c.jsx("span",{...u,className:G("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?c.jsxs("span",{className:"pill-wrapper",children:[c.jsx(Pn,{isOpen:l,children:a}),d]}):d};const Sr=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const km=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=se.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:G(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Ys=y.memo(km);const gi="loadingBlock_",Fm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=se.useIntl();t||(t={0:{text:r.formatMessage({id:`${gi}loading`})},75:{text:r.formatMessage({id:`${gi}almostDone`})},100:{text:r.formatMessage({id:`${gi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${zt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(jt,{className:G("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(Ys,{progress:e})]})},Bm=y.memo(Fm);const Ft=({element:e="div",className:t="",...n})=>c.jsx(Ya,{element:e,className:G("loading-placeholder",t),...n});const bs={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},rd=(e,t)=>e in bs?c.jsx("div",{className:e,children:bs[e].map((n,r)=>rd(n,r))},t):c.jsx(Ft,{className:e},t),Gs=({layout:e="overview-page",...t})=>c.jsx("div",{className:G("loading-state",e),...t,children:bs[e].map((n,r)=>rd(n,r))}),ad=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):""},Yr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Am=e=>{const t=Math.ceil(26/Yr.length),n=ad(e).toLowerCase();if(n==="")return Yr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Yr.length;a++)if(r<=t*(a+1))return Yr[a]};const iu=256,hn=({className:e="",src:t="",name:n,alt:r,width:a=iu,height:i=iu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const h=d.current;if(!h)return;const g=h.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=f*window.devicePixelRatio,h.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Am(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ad(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:G("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},id=({showDevTools:e=!0,children:t})=>{const n=new We.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(We.QueryClientProvider,{client:n,children:[t,e&&c.jsx($h.ReactQueryDevtools,{initialIsOpen:!1})]})};var sd=y.createContext({client:va});function Tm(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&&(va.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),va.init(r,a)),va)},[n,r]);return y.createElement(sd.Provider,{value:{client:i}},t)}var Sm=function(){var e=y.useContext(sd).client;return e};function jm(e){var t=Sm(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const od=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Tm,{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 Qs=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Qs||{});const ud=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...am[r],...n||{}};return c.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},Js=y.createContext({}),ya={en:"English",es:"Español",fr:"Français",pt:"Português"},mt=y.createContext({isLoading:!0});function Ja(){return y.useContext(mt)}const ld=({children:e,user:t,updateDetails:n})=>c.jsx(mt.Provider,{value:{...t,updateDetails:n},children:e}),Xs=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),cd=()=>y.useContext(Xs),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(Xs.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Om=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=y.useState(s),u=d=>{localStorage.setItem("language",d),l(d)};return y.useEffect(()=>{e().then(d=>{i({...d,isLoading:!1}),Kc(5e3)}).catch(d=>{d.message===Uc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),c.jsx(Js.Provider,{value:{language:o,updateLanguage:u},children:c.jsx(ud,{locale:o,messages:n==null?void 0:n.messages,children:c.jsx(Hs.CookiesProvider,{children:c.jsx(ld,{user:a,updateDetails:i,children:c.jsx(dd,{children:c.jsx(id,{showDevTools:r,children:c.jsx(od,{user:a,children:t})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const Xa=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Pm=({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=Jn(l,r)),l};const Nm=y.lazy(()=>Promise.resolve().then(()=>dm)),Mm=y.lazy(()=>Promise.resolve().then(()=>ZE));let Gr=null;const Yt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",...u})=>{const d=se.useIntl(),{profile:m,...p}=i,{size:h="medium",variant:g="inline",isCondensed:f=!0}=a,b=y.useContext(mt),v=m&&b&&typeof b.id=="string",[_,F]=y.useState(!1),x=Xa(t);x.name||(x.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:w,image:B}=x;let{url:S}=x;t.link!==void 0&&(t.link===!1?S=void 0:S=t.link);const z=Pm(x),M=r&&r.createdAt?ms(r.createdAt):!1,$=r&&r.createdAt?Zs(r.createdAt):"";return y.createElement(e,{...u,className:G("member text-medium",h,g,l,{"has-profile-link":v}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(dn,{href:S,gtmType:o,gtmContext:s,onClick:R=>{R==null||R.preventDefault(),R==null||R.stopPropagation(),Gr&&clearTimeout(Gr),Gr=setTimeout(()=>{window.location.href=S},150);const k=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:S,timeout:Gr}});document.dispatchEvent(k)},children:[c.jsx(hn,{name:w,src:B,alt:n}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{"data-testid":"member-name",children:[w,r&&c.jsxs("span",{className:"additional-content",children:[r.createdAt&&M&&c.jsx("span",{className:"date",title:$,"aria-label":$,"data-testid":"date",children:d.formatMessage({id:`dates_${M.path}`},{number:M.number})}),r.didEdit&&c.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]})]}),z&&c.jsx("small",{className:G({"text-medium":h==="large"}),"data-testid":"member-details",children:f?z:c.jsxs(c.Fragment,{children:[x.role,x.organisation?` — ${x.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:x.country})]})})]})]}),z&&m&&v?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"tertiary",size:"small",onClick:R=>{R.preventDefault(),R.stopPropagation(),F(!0)},"data-testid":"profile-button",children:d.formatMessage({id:"member_profile"})}),c.jsx(Nm,{children:c.jsx(Mm,{form:m,showModal:_,content:{title:d.formatMessage({id:"member_profile"})},functions:{onClose:()=>{F(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Im=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));const su={small:24,medium:48},eo=({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 m=se.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:G("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,h)=>{let g,f="";if(h<o){const{name:b="",image:v=""}=Xa(p);if(s)return c.jsx(Ft,{element:"li",className:"contributor"},h);g=c.jsx(hn,{name:b,src:v,width:su[a||"medium"],height:su[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:G({"large-number":b>99}),children:["+",im(b,0)]}),f="number-left"}return g?c.jsx("li",{className:G("contributor",f),children:g},h):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Jn(n[0].name||"",20):l||null})]})})};const to=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:G("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var ys={exports:{}},Qr={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 ou;function Rm(){if(ou)return Ne;ou=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(w){if(typeof w=="object"&&w!==null){var B=w.$$typeof;switch(B){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case m:return w;default:switch(w=w&&w.$$typeof,w){case o:case c:case g:case h:case s:return w;default:return B}}case n:return B}}}function x(w){return F(w)===u}return Ne.AsyncMode=l,Ne.ConcurrentMode=u,Ne.ContextConsumer=o,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=c,Ne.Fragment=r,Ne.Lazy=g,Ne.Memo=h,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=a,Ne.Suspense=m,Ne.isAsyncMode=function(w){return x(w)||F(w)===l},Ne.isConcurrentMode=x,Ne.isContextConsumer=function(w){return F(w)===o},Ne.isContextProvider=function(w){return F(w)===s},Ne.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Ne.isForwardRef=function(w){return F(w)===c},Ne.isFragment=function(w){return F(w)===r},Ne.isLazy=function(w){return F(w)===g},Ne.isMemo=function(w){return F(w)===h},Ne.isPortal=function(w){return F(w)===n},Ne.isProfiler=function(w){return F(w)===i},Ne.isStrictMode=function(w){return F(w)===a},Ne.isSuspense=function(w){return F(w)===m},Ne.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===m||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===h||w.$$typeof===s||w.$$typeof===o||w.$$typeof===c||w.$$typeof===b||w.$$typeof===v||w.$$typeof===_||w.$$typeof===f)},Ne.typeOf=F,Ne}var Me={};/** @license React v16.13.1
44
+ */var ou;function Rm(){if(ou)return Ne;ou=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,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(w){if(typeof w=="object"&&w!==null){var B=w.$$typeof;switch(B){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case m:return w;default:switch(w=w&&w.$$typeof,w){case o:case d:case g:case h:case s:return w;default:return B}}case n:return B}}}function x(w){return F(w)===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=h,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=a,Ne.Suspense=m,Ne.isAsyncMode=function(w){return x(w)||F(w)===l},Ne.isConcurrentMode=x,Ne.isContextConsumer=function(w){return F(w)===o},Ne.isContextProvider=function(w){return F(w)===s},Ne.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Ne.isForwardRef=function(w){return F(w)===d},Ne.isFragment=function(w){return F(w)===r},Ne.isLazy=function(w){return F(w)===g},Ne.isMemo=function(w){return F(w)===h},Ne.isPortal=function(w){return F(w)===n},Ne.isProfiler=function(w){return F(w)===i},Ne.isStrictMode=function(w){return F(w)===a},Ne.isSuspense=function(w){return F(w)===m},Ne.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===m||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===h||w.$$typeof===s||w.$$typeof===o||w.$$typeof===d||w.$$typeof===b||w.$$typeof===v||w.$$typeof===_||w.$$typeof===f)},Ne.typeOf=F,Ne}var Me={};/** @license React v16.13.1
45
45
  * react-is.development.js
46
46
  *
47
47
  * Copyright (c) Facebook, Inc. and its affiliates.
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var uu;function $m(){return uu||(uu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===m||J===p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===h||J.$$typeof===s||J.$$typeof===o||J.$$typeof===c||J.$$typeof===b||J.$$typeof===v||J.$$typeof===_||J.$$typeof===f)}function x(J){if(typeof J=="object"&&J!==null){var ge=J.$$typeof;switch(ge){case t:var he=J.type;switch(he){case l:case u:case r:case i:case a:case m:return he;default:var pe=he&&he.$$typeof;switch(pe){case o:case c:case g:case h:case s:return pe;default:return ge}}case n:return ge}}}var w=l,B=u,S=o,z=s,M=t,$=c,R=r,k=g,A=h,j=n,L=i,H=a,Z=m,Q=!1;function ae(J){return Q||(Q=!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)||x(J)===l}function C(J){return x(J)===u}function q(J){return x(J)===o}function Y(J){return x(J)===s}function E(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function T(J){return x(J)===c}function N(J){return x(J)===r}function I(J){return x(J)===g}function U(J){return x(J)===h}function ne(J){return x(J)===n}function te(J){return x(J)===i}function ie(J){return x(J)===a}function le(J){return x(J)===m}Me.AsyncMode=w,Me.ConcurrentMode=B,Me.ContextConsumer=S,Me.ContextProvider=z,Me.Element=M,Me.ForwardRef=$,Me.Fragment=R,Me.Lazy=k,Me.Memo=A,Me.Portal=j,Me.Profiler=L,Me.StrictMode=H,Me.Suspense=Z,Me.isAsyncMode=ae,Me.isConcurrentMode=C,Me.isContextConsumer=q,Me.isContextProvider=Y,Me.isElement=E,Me.isForwardRef=T,Me.isFragment=N,Me.isLazy=I,Me.isMemo=U,Me.isPortal=ne,Me.isProfiler=te,Me.isStrictMode=ie,Me.isSuspense=le,Me.isValidElementType=F,Me.typeOf=x}()),Me}var lu;function fd(){return lu||(lu=1,process.env.NODE_ENV==="production"?Qr.exports=Rm():Qr.exports=$m()),Qr.exports}/*
51
+ */var uu;function $m(){return uu||(uu=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,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===m||J===p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===h||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===b||J.$$typeof===v||J.$$typeof===_||J.$$typeof===f)}function x(J){if(typeof J=="object"&&J!==null){var ge=J.$$typeof;switch(ge){case t:var he=J.type;switch(he){case l:case u:case r:case i:case a:case m:return he;default:var pe=he&&he.$$typeof;switch(pe){case o:case d:case g:case h:case s:return pe;default:return ge}}case n:return ge}}}var w=l,B=u,S=o,z=s,M=t,$=d,R=r,k=g,A=h,j=n,L=i,H=a,Z=m,Q=!1;function ae(J){return Q||(Q=!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)||x(J)===l}function C(J){return x(J)===u}function q(J){return x(J)===o}function Y(J){return x(J)===s}function E(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function T(J){return x(J)===d}function N(J){return x(J)===r}function I(J){return x(J)===g}function U(J){return x(J)===h}function ne(J){return x(J)===n}function te(J){return x(J)===i}function ie(J){return x(J)===a}function le(J){return x(J)===m}Me.AsyncMode=w,Me.ConcurrentMode=B,Me.ContextConsumer=S,Me.ContextProvider=z,Me.Element=M,Me.ForwardRef=$,Me.Fragment=R,Me.Lazy=k,Me.Memo=A,Me.Portal=j,Me.Profiler=L,Me.StrictMode=H,Me.Suspense=Z,Me.isAsyncMode=ae,Me.isConcurrentMode=C,Me.isContextConsumer=q,Me.isContextProvider=Y,Me.isElement=E,Me.isForwardRef=T,Me.isFragment=N,Me.isLazy=I,Me.isMemo=U,Me.isPortal=ne,Me.isProfiler=te,Me.isStrictMode=ie,Me.isSuspense=le,Me.isValidElementType=F,Me.typeOf=x}()),Me}var lu;function fd(){return lu||(lu=1,process.env.NODE_ENV==="production"?Qr.exports=Rm():Qr.exports=$m()),Qr.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var vi,cu;function Lm(){if(cu)return vi;cu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return vi=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},vi}var bi,du;function no(){if(du)return bi;du=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return bi=e,bi}var yi,fu;function hd(){return fu||(fu=1,yi=Function.call.bind(Object.prototype.hasOwnProperty)),yi}var Di,hu;function zm(){if(hu)return Di;hu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=no(),n={},r=hd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var m;try{if(typeof i[c]!="function"){var p=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}m=i[c](s,c,l,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+m.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Di=a,Di}var Ci,mu;function qm(){if(mu)return Ci;mu=1;var e=fd(),t=Lm(),n=no(),r=hd(),a=zm(),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 Ci=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function m(C){var q=C&&(u&&C[u]||C[c]);if(typeof q=="function")return q}var p="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:_(),arrayOf:F,element:x(),elementType:w(),instanceOf:B,node:$(),objectOf:z,oneOf:S,oneOfType:M,shape:k,exact:A};function g(C,q){return C===q?C!==0||1/C===1/q:C!==C&&q!==q}function f(C,q){this.message=C,this.data=q&&typeof q=="object"?q:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var q={},Y=0;function E(N,I,U,ne,te,ie,le){if(ne=ne||p,ie=ie||U,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 ge=ne+":"+U;!q[ge]&&Y<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+ne+"`. 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."),q[ge]=!0,Y++)}}return I[U]==null?N?I[U]===null?new f("The "+te+" `"+ie+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new f("The "+te+" `"+ie+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:C(I,U,ne,te,ie)}var T=E.bind(null,!1);return T.isRequired=E.bind(null,!0),T}function v(C){function q(Y,E,T,N,I,U){var ne=Y[E],te=H(ne);if(te!==C){var ie=Z(ne);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ie+"` supplied to `"+T+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(q)}function _(){return b(s)}function F(C){function q(Y,E,T,N,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=Y[E];if(!Array.isArray(U)){var ne=H(U);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected an array."))}for(var te=0;te<U.length;te++){var ie=C(U,te,T,N,I+"["+te+"]",n);if(ie instanceof Error)return ie}return null}return b(q)}function x(){function C(q,Y,E,T,N){var I=q[Y];if(!o(I)){var U=H(I);return new f("Invalid "+T+" `"+N+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return b(C)}function w(){function C(q,Y,E,T,N){var I=q[Y];if(!e.isValidElementType(I)){var U=H(I);return new f("Invalid "+T+" `"+N+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return b(C)}function B(C){function q(Y,E,T,N,I){if(!(Y[E]instanceof C)){var U=C.name||p,ne=ae(Y[E]);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return b(q)}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 q(Y,E,T,N,I){for(var U=Y[E],ne=0;ne<C.length;ne++)if(g(U,C[ne]))return null;var te=JSON.stringify(C,function(le,J){var ge=Z(J);return ge==="symbol"?String(J):J});return new f("Invalid "+N+" `"+I+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+te+"."))}return b(q)}function z(C){function q(Y,E,T,N,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected an object."));for(var te in U)if(r(U,te)){var ie=C(U,te,T,N,I+"."+te,n);if(ie instanceof Error)return ie}return null}return b(q)}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 q=0;q<C.length;q++){var Y=C[q];if(typeof Y!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Q(Y)+" at index "+q+"."),s}function E(T,N,I,U,ne){for(var te=[],ie=0;ie<C.length;ie++){var le=C[ie],J=le(T,N,I,U,ne,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&te.push(J.data.expectedType)}var ge=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new f("Invalid "+U+" `"+ne+"` supplied to "+("`"+I+"`"+ge+"."))}return b(E)}function $(){function C(q,Y,E,T,N){return j(q[Y])?null:new f("Invalid "+T+" `"+N+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return b(C)}function R(C,q,Y,E,T){return new f((C||"React class")+": "+q+" type `"+Y+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function k(C){function q(Y,E,T,N,I){var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type `"+ne+"` "+("supplied to `"+T+"`, expected `object`."));for(var te in C){var ie=C[te];if(typeof ie!="function")return R(T,N,I,te,Z(ie));var le=ie(U,te,T,N,I+"."+te,n);if(le)return le}return null}return b(q)}function A(C){function q(Y,E,T,N,I){var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type `"+ne+"` "+("supplied to `"+T+"`, expected `object`."));var te=t({},Y[E],C);for(var ie in te){var le=C[ie];if(r(C,ie)&&typeof le!="function")return R(T,N,I,ie,Z(le));if(!le)return new f("Invalid "+N+" `"+I+"` key `"+ie+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(Y[E],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var J=le(U,ie,T,N,I+"."+ie,n);if(J)return J}return null}return b(q)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var q=m(C);if(q){var Y=q.call(C),E;if(q!==C.entries){for(;!(E=Y.next()).done;)if(!j(E.value))return!1}else for(;!(E=Y.next()).done;){var T=E.value;if(T&&!j(T[1]))return!1}}else return!1;return!0;default:return!1}}function L(C,q){return C==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function H(C){var q=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":L(q,C)?"symbol":q}function Z(C){if(typeof C>"u"||C===null)return""+C;var q=H(C);if(q==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return q}function Q(C){var q=Z(C);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return h.checkPropTypes=a,h.resetWarningCache=a.resetWarningCache,h.PropTypes=h,h},Ci}var xi,pu;function Wm(){if(pu)return xi;pu=1;var e=no();function t(){}function n(){}return n.resetWarningCache=t,xi=function(){function r(s,o,l,u,c,m){if(m!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},xi}if(process.env.NODE_ENV!=="production"){var Um=fd(),Hm=!0;ys.exports=qm()(Um.isElement,Hm)}else ys.exports=Wm()();var Vm=ys.exports;/*!
55
+ */var vi,cu;function Lm(){if(cu)return vi;cu=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 vi=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 m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},vi}var bi,du;function no(){if(du)return bi;du=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return bi=e,bi}var yi,fu;function hd(){return fu||(fu=1,yi=Function.call.bind(Object.prototype.hasOwnProperty)),yi}var Di,hu;function zm(){if(hu)return Di;hu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=no(),n={},r=hd();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 m;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}m=i[d](s,d,l,o,null,t)}catch(g){m=g}if(m&&!(m 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 m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+m.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Di=a,Di}var Ci,mu;function qm(){if(mu)return Ci;mu=1;var e=fd(),t=Lm(),n=no(),r=hd(),a=zm(),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 Ci=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(C){var q=C&&(u&&C[u]||C[d]);if(typeof q=="function")return q}var p="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:_(),arrayOf:F,element:x(),elementType:w(),instanceOf:B,node:$(),objectOf:z,oneOf:S,oneOfType:M,shape:k,exact:A};function g(C,q){return C===q?C!==0||1/C===1/q:C!==C&&q!==q}function f(C,q){this.message=C,this.data=q&&typeof q=="object"?q:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var q={},Y=0;function E(N,I,U,ne,te,ie,le){if(ne=ne||p,ie=ie||U,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 ge=ne+":"+U;!q[ge]&&Y<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+ne+"`. 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."),q[ge]=!0,Y++)}}return I[U]==null?N?I[U]===null?new f("The "+te+" `"+ie+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new f("The "+te+" `"+ie+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:C(I,U,ne,te,ie)}var T=E.bind(null,!1);return T.isRequired=E.bind(null,!0),T}function v(C){function q(Y,E,T,N,I,U){var ne=Y[E],te=H(ne);if(te!==C){var ie=Z(ne);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ie+"` supplied to `"+T+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(q)}function _(){return b(s)}function F(C){function q(Y,E,T,N,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=Y[E];if(!Array.isArray(U)){var ne=H(U);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected an array."))}for(var te=0;te<U.length;te++){var ie=C(U,te,T,N,I+"["+te+"]",n);if(ie instanceof Error)return ie}return null}return b(q)}function x(){function C(q,Y,E,T,N){var I=q[Y];if(!o(I)){var U=H(I);return new f("Invalid "+T+" `"+N+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return b(C)}function w(){function C(q,Y,E,T,N){var I=q[Y];if(!e.isValidElementType(I)){var U=H(I);return new f("Invalid "+T+" `"+N+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return b(C)}function B(C){function q(Y,E,T,N,I){if(!(Y[E]instanceof C)){var U=C.name||p,ne=ae(Y[E]);return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return b(q)}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 q(Y,E,T,N,I){for(var U=Y[E],ne=0;ne<C.length;ne++)if(g(U,C[ne]))return null;var te=JSON.stringify(C,function(le,J){var ge=Z(J);return ge==="symbol"?String(J):J});return new f("Invalid "+N+" `"+I+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+te+"."))}return b(q)}function z(C){function q(Y,E,T,N,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type "+("`"+ne+"` supplied to `"+T+"`, expected an object."));for(var te in U)if(r(U,te)){var ie=C(U,te,T,N,I+"."+te,n);if(ie instanceof Error)return ie}return null}return b(q)}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 q=0;q<C.length;q++){var Y=C[q];if(typeof Y!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Q(Y)+" at index "+q+"."),s}function E(T,N,I,U,ne){for(var te=[],ie=0;ie<C.length;ie++){var le=C[ie],J=le(T,N,I,U,ne,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&te.push(J.data.expectedType)}var ge=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new f("Invalid "+U+" `"+ne+"` supplied to "+("`"+I+"`"+ge+"."))}return b(E)}function $(){function C(q,Y,E,T,N){return j(q[Y])?null:new f("Invalid "+T+" `"+N+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return b(C)}function R(C,q,Y,E,T){return new f((C||"React class")+": "+q+" type `"+Y+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function k(C){function q(Y,E,T,N,I){var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type `"+ne+"` "+("supplied to `"+T+"`, expected `object`."));for(var te in C){var ie=C[te];if(typeof ie!="function")return R(T,N,I,te,Z(ie));var le=ie(U,te,T,N,I+"."+te,n);if(le)return le}return null}return b(q)}function A(C){function q(Y,E,T,N,I){var U=Y[E],ne=H(U);if(ne!=="object")return new f("Invalid "+N+" `"+I+"` of type `"+ne+"` "+("supplied to `"+T+"`, expected `object`."));var te=t({},Y[E],C);for(var ie in te){var le=C[ie];if(r(C,ie)&&typeof le!="function")return R(T,N,I,ie,Z(le));if(!le)return new f("Invalid "+N+" `"+I+"` key `"+ie+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(Y[E],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var J=le(U,ie,T,N,I+"."+ie,n);if(J)return J}return null}return b(q)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var q=m(C);if(q){var Y=q.call(C),E;if(q!==C.entries){for(;!(E=Y.next()).done;)if(!j(E.value))return!1}else for(;!(E=Y.next()).done;){var T=E.value;if(T&&!j(T[1]))return!1}}else return!1;return!0;default:return!1}}function L(C,q){return C==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function H(C){var q=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":L(q,C)?"symbol":q}function Z(C){if(typeof C>"u"||C===null)return""+C;var q=H(C);if(q==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return q}function Q(C){var q=Z(C);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return h.checkPropTypes=a,h.resetWarningCache=a.resetWarningCache,h.PropTypes=h,h},Ci}var xi,pu;function Wm(){if(pu)return xi;pu=1;var e=no();function t(){}function n(){}return n.resetWarningCache=t,xi=function(){function r(s,o,l,u,d,m){if(m!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},xi}if(process.env.NODE_ENV!=="production"){var Um=fd(),Hm=!0;ys.exports=qm()(Um.isElement,Hm)}else ys.exports=Wm()();var Vm=ys.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var md=["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])"],Aa=md.join(","),pd=typeof Element>"u",Fn=pd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ta=!pd&&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},Sa=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},Km=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},gd=function(t,n,r){if(Sa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Aa));return n&&Fn.call(t,Aa)&&a.unshift(t),a=a.filter(r),a},vd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Sa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=Fn.call(s,Aa);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Sa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&p){var h=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,h):a.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return a},bd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},sn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Km(t))&&!bd(t)?0:t.tabIndex},Zm=function(t,n){var r=sn(t);return r<0&&n&&!bd(t)?0:r},Ym=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},yd=function(t){return t.tagName==="INPUT"},Gm=function(t){return yd(t)&&t.type==="hidden"},Qm=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Jm=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Xm=function(t){if(!t.name)return!0;var n=t.form||Ta(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=Jm(a,t.form);return!i||i===t},ep=function(t){return yd(t)&&t.type==="radio"},tp=function(t){return ep(t)&&!Xm(t)},np=function(t){var n,r=t&&Ta(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,m;r=Ta(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(m=c.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},gu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},rp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Fn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Fn.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=Ta(t);if(l&&!l.shadowRoot&&a(l)===!0)return gu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(np(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gu(t);return!1},ap=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 Fn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},ja=function(t,n){return!(n.disabled||Sa(n)||Gm(n)||rp(n,t)||Qm(n)||ap(n))},Ds=function(t,n){return!(tp(n)||sn(n)<0||!ja(t,n))},ip=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},sp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Zm(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(Ym).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Dd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=vd([t],n.includeContainer,{filter:Ds.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ip}):r=gd(t,n.includeContainer,Ds.bind(null,n)),sp(r)},Cd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=vd([t],n.includeContainer,{filter:ja.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=gd(t,n.includeContainer,ja.bind(null,n)),r},bn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,Aa)===!1?!1:Ds(n,t)},op=md.concat("iframe").join(","),Da=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,op)===!1?!1:ja(n,t)};const up=Object.freeze(Object.defineProperty({__proto__:null,focusable:Cd,getTabIndex:sn,isFocusable:Da,isTabbable:bn,tabbable:Dd},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var md=["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])"],Aa=md.join(","),pd=typeof Element>"u",Fn=pd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ta=!pd&&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},Sa=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},Km=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},gd=function(t,n,r){if(Sa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Aa));return n&&Fn.call(t,Aa)&&a.unshift(t),a=a.filter(r),a},vd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Sa(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=Fn.call(s,Aa);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Sa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&p){var h=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,h):a.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return a},bd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},sn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Km(t))&&!bd(t)?0:t.tabIndex},Zm=function(t,n){var r=sn(t);return r<0&&n&&!bd(t)?0:r},Ym=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},yd=function(t){return t.tagName==="INPUT"},Gm=function(t){return yd(t)&&t.type==="hidden"},Qm=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Jm=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Xm=function(t){if(!t.name)return!0;var n=t.form||Ta(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=Jm(a,t.form);return!i||i===t},ep=function(t){return yd(t)&&t.type==="radio"},tp=function(t){return ep(t)&&!Xm(t)},np=function(t){var n,r=t&&Ta(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,m;r=Ta(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},gu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},rp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Fn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Fn.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=Ta(t);if(l&&!l.shadowRoot&&a(l)===!0)return gu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(np(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gu(t);return!1},ap=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 Fn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},ja=function(t,n){return!(n.disabled||Sa(n)||Gm(n)||rp(n,t)||Qm(n)||ap(n))},Ds=function(t,n){return!(tp(n)||sn(n)<0||!ja(t,n))},ip=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},sp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Zm(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(Ym).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Dd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=vd([t],n.includeContainer,{filter:Ds.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ip}):r=gd(t,n.includeContainer,Ds.bind(null,n)),sp(r)},Cd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=vd([t],n.includeContainer,{filter:ja.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=gd(t,n.includeContainer,ja.bind(null,n)),r},bn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,Aa)===!1?!1:Ds(n,t)},op=md.concat("iframe").join(","),Da=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,op)===!1?!1:ja(n,t)};const up=Object.freeze(Object.defineProperty({__proto__:null,focusable:Cd,getTabIndex:sn,isFocusable:Da,isTabbable:bn,tabbable:Dd},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 vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){lp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lp(e,t,n){return t=dp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cp(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 dp(e){var t=cp(e,"string");return typeof t=="symbol"?t:String(t)}var yu={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()}},fp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},hp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},mp=function(t){return xr(t)&&!t.shiftKey},pp=function(t){return xr(t)&&t.shiftKey},Du=function(t){return setTimeout(t,0)},Cu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},fr=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},Jr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},gp=[],vp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||gp,i=bu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:mp,isKeyBackward:pp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(k,A,j){return k&&k[A]!==void 0?k[A]:i[j||A]},u=function(k,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(L){var H=L.container,Z=L.tabbableNodes;return H.contains(k)||(j==null?void 0:j.includes(H))||Z.find(function(Q){return Q===k})})},c=function(k){var A=i[k];if(typeof A=="function"){for(var j=arguments.length,L=new Array(j>1?j-1:0),H=1;H<j;H++)L[H-1]=arguments[H];A=A.apply(void 0,L)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(k,"` was specified but was not a node, or did not return a node"))}var Z=A;if(typeof A=="string"&&(Z=r.querySelector(A),!Z))throw new Error("`".concat(k,"` as selector refers to no known node"));return Z},m=function(){var k=c("initialFocus");if(k===!1)return!1;if(k===void 0||!Da(k,i.tabbableOptions))if(u(r.activeElement)>=0)k=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;k=j||c("fallbackFocus")}if(!k)throw new Error("Your focus-trap needs to have at least one focusable element");return k},p=function(){if(s.containerGroups=s.containers.map(function(k){var A=Dd(k,i.tabbableOptions),j=Cd(k,i.tabbableOptions),L=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,Z=j.find(function(C){return bn(C)}),Q=j.slice().reverse().find(function(C){return bn(C)}),ae=!!A.find(function(C){return sn(C)>0});return{container:k,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:L,lastTabbableNode:H,firstDomTabbableNode:Z,lastDomTabbableNode:Q,nextTabbableNode:function(q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,E=A.indexOf(q);return E<0?Y?j.slice(j.indexOf(q)+1).find(function(T){return bn(T)}):j.slice(0,j.indexOf(q)).reverse().find(function(T){return bn(T)}):A[E+(Y?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(k){return k.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(k){return k.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function R(k){var A=k.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?R(A.shadowRoot):A},g=function R(k){if(k!==!1&&k!==h(document)){if(!k||!k.focus){R(m());return}k.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=k,fp(k)&&k.select()}},f=function(k){var A=c("setReturnFocus",k);return A||(A===!1?!1:k)},b=function(k){var A=k.target,j=k.event,L=k.isBackward,H=L===void 0?!1:L;A=A||Jr(j),p();var Z=null;if(s.tabbableGroups.length>0){var Q=u(A,j),ae=Q>=0?s.containerGroups[Q]:void 0;if(Q<0)H?Z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Z=s.tabbableGroups[0].firstTabbableNode;else if(H){var C=Cu(s.tabbableGroups,function(I){var U=I.firstTabbableNode;return A===U});if(C<0&&(ae.container===A||Da(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A,!1))&&(C=Q),C>=0){var q=C===0?s.tabbableGroups.length-1:C-1,Y=s.tabbableGroups[q];Z=sn(A)>=0?Y.lastTabbableNode:Y.lastDomTabbableNode}else xr(j)||(Z=ae.nextTabbableNode(A,!1))}else{var E=Cu(s.tabbableGroups,function(I){var U=I.lastTabbableNode;return A===U});if(E<0&&(ae.container===A||Da(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A))&&(E=Q),E>=0){var T=E===s.tabbableGroups.length-1?0:E+1,N=s.tabbableGroups[T];Z=sn(A)>=0?N.firstTabbableNode:N.firstDomTabbableNode}else xr(j)||(Z=ae.nextTabbableNode(A))}}else Z=c("fallbackFocus");return Z},v=function(k){var A=Jr(k);if(!(u(A,k)>=0)){if(fr(i.clickOutsideDeactivates,k)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}fr(i.allowOutsideClick,k)||k.preventDefault()}},_=function(k){var A=Jr(k),j=u(A,k)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{k.stopImmediatePropagation();var L,H=!0;if(s.mostRecentlyFocusedNode)if(sn(s.mostRecentlyFocusedNode)>0){var Z=u(s.mostRecentlyFocusedNode),Q=s.containerGroups[Z].tabbableNodes;if(Q.length>0){var ae=Q.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(i.isKeyForward(s.recentNavEvent)?ae+1<Q.length&&(L=Q[ae+1],H=!1):ae-1>=0&&(L=Q[ae-1],H=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(q){return sn(q)>0})})||(H=!1);else H=!1;H&&(L=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(L||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},F=function(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=k;var j=b({event:k,isBackward:A});j&&(xr(k)&&k.preventDefault(),g(j))},x=function(k){if(hp(k)&&fr(i.escapeDeactivates,k)!==!1){k.preventDefault(),o.deactivate();return}(i.isKeyForward(k)||i.isKeyBackward(k))&&F(k,i.isKeyBackward(k))},w=function(k){var A=Jr(k);u(A,k)>=0||fr(i.clickOutsideDeactivates,k)||fr(i.allowOutsideClick,k)||(k.preventDefault(),k.stopImmediatePropagation())},B=function(){if(s.active)return yu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Du(function(){g(m())}):g(m()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",x,!0),o},z=function(k){var A=k.some(function(j){var L=Array.from(j.removedNodes);return L.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(m())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(k){M.observe(k,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(k){if(s.active)return this;var A=l(k,"onActivate"),j=l(k,"onPostActivate"),L=l(k,"checkCanFocusTrap");L||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){L&&p(),B(),$(),j==null||j()};return L?(L(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(k){if(!s.active)return this;var A=bu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},k);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,$(),yu.deactivateTrap(a,o);var j=l(A,"onDeactivate"),L=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),Z=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var Q=function(){Du(function(){Z&&g(f(s.nodeFocusedBeforeActivation)),L==null||L()})};return Z&&H?(H(f(s.nodeFocusedBeforeActivation)).then(Q,Q),this):(Q(),this)},pause:function(k){if(s.paused||!s.active)return this;var A=l(k,"onPause"),j=l(k,"onPostPause");return s.paused=!0,A==null||A(),S(),$(),j==null||j(),this},unpause:function(k){if(!s.paused||!s.active)return this;var A=l(k,"onUnpause"),j=l(k,"onPostUnpause");return s.paused=!1,A==null||A(),p(),B(),$(),j==null||j(),this},updateContainerElements:function(k){var A=[].concat(k).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),$(),this}},o.updateContainerElements(t),o};const bp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:vp},Symbol.toStringTag,{value:"Module"})),yp=Oc(bp),Dp=Oc(up);function er(e){"@babel/helpers - typeof";return er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(e)}function Cp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xu(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,xd(r.key),r)}}function xp(e,t,n){return t&&xu(e.prototype,t),n&&xu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wp(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&&Cs(e,t)}function Cs(e,t){return Cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Cs(e,t)}function Ep(e){var t=kp();return function(){var r=Oa(e),a;if(t){var i=Oa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return _p(this,a)}}function _p(e,t){if(t&&(er(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dr(e)}function Dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kp(){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 Oa(e){return Oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Oa(e)}function Fp(e,t,n){return t=xd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xd(e){var t=Bp(e,"string");return er(t)==="symbol"?t:String(t)}function Bp(e,t){if(er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=y,be=Vm,Ap=yp,Tp=Ap.createFocusTrap,Sp=Dp,jp=Sp.isFocusable,ro=function(e){wp(n,e);var t=Ep(n);function n(r){var a;Cp(this,n),a=t.call(this,r),Fp(Dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,m=new Array(c>1?c-1:0),p=1;p<c;p++)m[p-1]=arguments[p];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(Dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Dr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return xp(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&&!jp(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Xr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Xr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Xr.cloneElement(i,{ref:s});return o}return null}}]),n}(Xr.Component),hr=typeof Element>"u"?Function:Element;ro.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(hr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(hr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(hr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(hr)),children:be.oneOfType([be.element,be.instanceOf(hr)])};ro.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Tp};var Op=ro;const Pp=jn(Op);const mn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:m="Modal"})=>{const p=se.useIntl(),{registerOverlay:h,unregisterOverlay:g}=cd(),[f,b]=y.useState(t),[v,_]=y.useState(null),F=y.useRef(null),x=M=>{M.key==="Escape"&&S(!1)},w=M=>{_(M.target)},B=M=>{v===F.current&&M.target===F.current&&S(!1),_(null)};y.useEffect(()=>(window.addEventListener("keyup",x),()=>{window.removeEventListener("keyup",x)})),y.useEffect(()=>{const M=F.current;return M&&(M.addEventListener("mousedown",w),M.addEventListener("mouseup",B)),()=>{M&&(M.removeEventListener("mousedown",w),M.removeEventListener("mouseup",B))}},[v]);const S=M=>{if(b(M),M)a(),h(e);else{if(f===M)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const z=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{id:`${e}-overlay`,ref:F,className:G("overlay",{open:f,"in-portal":c.includes("in-portal")}),role:"dialog",children:d.jsx(to,{id:e,className:G("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:z,children:t&&d.jsx(Pp,{containerElements:[F.current],children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(Fe,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(qt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(qt,{}),d.jsx(sr,{buttons:u})]}),s&&d.jsx(Sr,{className:"error",children:s})]})})})})},wd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const mr="joinCommunityButton",ao=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(mt),l=o&&typeof o.id=="string",u=r||!l,[c,m]=y.useState(e),[p,h]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?h("joined"):p==="leaving"&&h("notJoined")},[c]);const g={},f={};return c&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${mr}_leave`}),g["aria-label"]=s.formatMessage({id:`${mr}_member_aria`}),f["aria-hidden"]="true"),d.jsx(Fe,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${mr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),h(c?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${mr}_aria_live`},{action:c?"leaving":"joining"})}});document.dispatchEvent(v);const _=c?i:a;typeof _=="function"&&setTimeout(async()=>{await _()},500),m(!c)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${mr}${["joining","leaving"].includes(p)?`_${p}`:c?"_member":n?"_short":""}`})})})};const wi="communityDetails_",Np=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=se.useIntl(),u=5,c=a||i.length,m=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,h=t||n,g=!n&&!t;return d.jsxs("div",{className:G("community-details",e),children:[h&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${wi}members`}),d.jsx("span",{className:"count",children:c})]}),!p&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${wi}viewAll`})})})]}),d.jsx(eo,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(ao,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Fe,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${wi}invite`})})]})};const Mp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:G("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(dn,{href:s?void 0:i,...l,children:Jn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Ip=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=y.useState(t?["all"]:[]),u=(c,m)=>{let p=[];o.includes(c)?p=o.filter(h=>h!==c):c==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),c]:p=[c],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),m&&typeof m=="function"&&m()};return d.jsx("ul",{className:G("filters",a),children:s.map(({id:c,text:m,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),d.jsx("li",{children:d.jsx("button",{className:G(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,h)},...g,children:m})},c)})})},Rp=(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 ea="languageSwitcher_",$p=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:c=()=>{}}=y.useContext(Js),[m,p]=y.useState(e);if(y.useEffect(()=>{e!==m&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=m!==e;return d.jsxs("div",{className:G("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${ea}label`})}),d.jsx("ul",{children:g.map(b=>{var F;if(!ya[b])return null;const v=(F=r[b])==null?void 0:F.post_name;let _={className:b};if(m===b)_["aria-label"]=u.formatMessage({id:`${ea}selected`},{language:ya[b]});else{const x=Rp(b,v,i);_={..._,href:typeof x=="string"?x:x.url,onClick:w=>{p(b),c(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof x=="string"?x:x.urlForRouter))}}}return d.jsx("li",{children:d.jsx(dn,{..._,fallbackElement:"span",children:ya[b]})},b)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${ea}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${ea}disclaimer`},{email:Wn.support,link:b=>{const v=`mailto:${b}`;return d.jsx("a",{href:v,children:b})}})})]})};const Ei=se.createIntl({locale:"en",messages:ir}),Wr=({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:Ei.formatMessage({id:"loadMore_button"}),endOfFeed:Ei.formatMessage({id:"loadMore_endOfFeed"}),error:Ei.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,m]=y.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:G("load-more",l),children:!c&&e?d.jsx(Fe,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const io=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:d.jsx(Ie,{children:d.jsx(se.FormattedMessage,{id:"apolitical"})})})});let ta=!1;const Ed=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Fe,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:m,icon:p,...h},g)=>{const f={...h,onClick:b=>{o(!1),typeof c=="function"&&c(b)},onFocus:()=>{ta&&(clearTimeout(ta),ta=!1)},onBlur:()=>{ta=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Fe,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},Lp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const zp=y.lazy(()=>Promise.resolve().then(()=>Im)),qp=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],_d=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(mt),a=r&&typeof r.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[qp.map(({key:i,href:s})=>{const o=Lp(s,e),l={};return o&&(l["aria-current"]="page"),d.jsx("li",{className:G(i,{active:o}),children:d.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&&d.jsx(zp,{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"})]})},pr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Wp=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${pr(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(`${pr(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(`${pr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
62
+ */function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){lp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lp(e,t,n){return t=dp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cp(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 dp(e){var t=cp(e,"string");return typeof t=="symbol"?t:String(t)}var yu={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()}},fp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},hp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},mp=function(t){return xr(t)&&!t.shiftKey},pp=function(t){return xr(t)&&t.shiftKey},Du=function(t){return setTimeout(t,0)},Cu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},fr=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},Jr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},gp=[],vp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||gp,i=bu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:mp,isKeyBackward:pp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(k,A,j){return k&&k[A]!==void 0?k[A]:i[j||A]},u=function(k,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(L){var H=L.container,Z=L.tabbableNodes;return H.contains(k)||(j==null?void 0:j.includes(H))||Z.find(function(Q){return Q===k})})},d=function(k){var A=i[k];if(typeof A=="function"){for(var j=arguments.length,L=new Array(j>1?j-1:0),H=1;H<j;H++)L[H-1]=arguments[H];A=A.apply(void 0,L)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(k,"` was specified but was not a node, or did not return a node"))}var Z=A;if(typeof A=="string"&&(Z=r.querySelector(A),!Z))throw new Error("`".concat(k,"` as selector refers to no known node"));return Z},m=function(){var k=d("initialFocus");if(k===!1)return!1;if(k===void 0||!Da(k,i.tabbableOptions))if(u(r.activeElement)>=0)k=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;k=j||d("fallbackFocus")}if(!k)throw new Error("Your focus-trap needs to have at least one focusable element");return k},p=function(){if(s.containerGroups=s.containers.map(function(k){var A=Dd(k,i.tabbableOptions),j=Cd(k,i.tabbableOptions),L=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,Z=j.find(function(C){return bn(C)}),Q=j.slice().reverse().find(function(C){return bn(C)}),ae=!!A.find(function(C){return sn(C)>0});return{container:k,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:L,lastTabbableNode:H,firstDomTabbableNode:Z,lastDomTabbableNode:Q,nextTabbableNode:function(q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,E=A.indexOf(q);return E<0?Y?j.slice(j.indexOf(q)+1).find(function(T){return bn(T)}):j.slice(0,j.indexOf(q)).reverse().find(function(T){return bn(T)}):A[E+(Y?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(k){return k.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(k){return k.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function R(k){var A=k.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?R(A.shadowRoot):A},g=function R(k){if(k!==!1&&k!==h(document)){if(!k||!k.focus){R(m());return}k.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=k,fp(k)&&k.select()}},f=function(k){var A=d("setReturnFocus",k);return A||(A===!1?!1:k)},b=function(k){var A=k.target,j=k.event,L=k.isBackward,H=L===void 0?!1:L;A=A||Jr(j),p();var Z=null;if(s.tabbableGroups.length>0){var Q=u(A,j),ae=Q>=0?s.containerGroups[Q]:void 0;if(Q<0)H?Z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Z=s.tabbableGroups[0].firstTabbableNode;else if(H){var C=Cu(s.tabbableGroups,function(I){var U=I.firstTabbableNode;return A===U});if(C<0&&(ae.container===A||Da(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A,!1))&&(C=Q),C>=0){var q=C===0?s.tabbableGroups.length-1:C-1,Y=s.tabbableGroups[q];Z=sn(A)>=0?Y.lastTabbableNode:Y.lastDomTabbableNode}else xr(j)||(Z=ae.nextTabbableNode(A,!1))}else{var E=Cu(s.tabbableGroups,function(I){var U=I.lastTabbableNode;return A===U});if(E<0&&(ae.container===A||Da(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A))&&(E=Q),E>=0){var T=E===s.tabbableGroups.length-1?0:E+1,N=s.tabbableGroups[T];Z=sn(A)>=0?N.firstTabbableNode:N.firstDomTabbableNode}else xr(j)||(Z=ae.nextTabbableNode(A))}}else Z=d("fallbackFocus");return Z},v=function(k){var A=Jr(k);if(!(u(A,k)>=0)){if(fr(i.clickOutsideDeactivates,k)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}fr(i.allowOutsideClick,k)||k.preventDefault()}},_=function(k){var A=Jr(k),j=u(A,k)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{k.stopImmediatePropagation();var L,H=!0;if(s.mostRecentlyFocusedNode)if(sn(s.mostRecentlyFocusedNode)>0){var Z=u(s.mostRecentlyFocusedNode),Q=s.containerGroups[Z].tabbableNodes;if(Q.length>0){var ae=Q.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(i.isKeyForward(s.recentNavEvent)?ae+1<Q.length&&(L=Q[ae+1],H=!1):ae-1>=0&&(L=Q[ae-1],H=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(q){return sn(q)>0})})||(H=!1);else H=!1;H&&(L=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(L||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},F=function(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=k;var j=b({event:k,isBackward:A});j&&(xr(k)&&k.preventDefault(),g(j))},x=function(k){if(hp(k)&&fr(i.escapeDeactivates,k)!==!1){k.preventDefault(),o.deactivate();return}(i.isKeyForward(k)||i.isKeyBackward(k))&&F(k,i.isKeyBackward(k))},w=function(k){var A=Jr(k);u(A,k)>=0||fr(i.clickOutsideDeactivates,k)||fr(i.allowOutsideClick,k)||(k.preventDefault(),k.stopImmediatePropagation())},B=function(){if(s.active)return yu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Du(function(){g(m())}):g(m()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",x,!0),o},z=function(k){var A=k.some(function(j){var L=Array.from(j.removedNodes);return L.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(m())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(k){M.observe(k,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(k){if(s.active)return this;var A=l(k,"onActivate"),j=l(k,"onPostActivate"),L=l(k,"checkCanFocusTrap");L||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){L&&p(),B(),$(),j==null||j()};return L?(L(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(k){if(!s.active)return this;var A=bu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},k);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,$(),yu.deactivateTrap(a,o);var j=l(A,"onDeactivate"),L=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),Z=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var Q=function(){Du(function(){Z&&g(f(s.nodeFocusedBeforeActivation)),L==null||L()})};return Z&&H?(H(f(s.nodeFocusedBeforeActivation)).then(Q,Q),this):(Q(),this)},pause:function(k){if(s.paused||!s.active)return this;var A=l(k,"onPause"),j=l(k,"onPostPause");return s.paused=!0,A==null||A(),S(),$(),j==null||j(),this},unpause:function(k){if(!s.paused||!s.active)return this;var A=l(k,"onUnpause"),j=l(k,"onPostUnpause");return s.paused=!1,A==null||A(),p(),B(),$(),j==null||j(),this},updateContainerElements:function(k){var A=[].concat(k).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),$(),this}},o.updateContainerElements(t),o};const bp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:vp},Symbol.toStringTag,{value:"Module"})),yp=Oc(bp),Dp=Oc(up);function er(e){"@babel/helpers - typeof";return er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(e)}function Cp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xu(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,xd(r.key),r)}}function xp(e,t,n){return t&&xu(e.prototype,t),n&&xu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wp(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&&Cs(e,t)}function Cs(e,t){return Cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Cs(e,t)}function Ep(e){var t=kp();return function(){var r=Oa(e),a;if(t){var i=Oa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return _p(this,a)}}function _p(e,t){if(t&&(er(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dr(e)}function Dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kp(){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 Oa(e){return Oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Oa(e)}function Fp(e,t,n){return t=xd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xd(e){var t=Bp(e,"string");return er(t)==="symbol"?t:String(t)}function Bp(e,t){if(er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=y,be=Vm,Ap=yp,Tp=Ap.createFocusTrap,Sp=Dp,jp=Sp.isFocusable,ro=function(e){wp(n,e);var t=Ep(n);function n(r){var a;Cp(this,n),a=t.call(this,r),Fp(Dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),p=1;p<d;p++)m[p-1]=arguments[p];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(Dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Dr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return xp(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&&!jp(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?Xr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Xr.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=Xr.cloneElement(i,{ref:s});return o}return null}}]),n}(Xr.Component),hr=typeof Element>"u"?Function:Element;ro.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(hr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(hr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(hr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(hr)),children:be.oneOfType([be.element,be.instanceOf(hr)])};ro.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Tp};var Op=ro;const Pp=jn(Op);const mn=({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:m="Modal"})=>{const p=se.useIntl(),{registerOverlay:h,unregisterOverlay:g}=cd(),[f,b]=y.useState(t),[v,_]=y.useState(null),F=y.useRef(null),x=M=>{M.key==="Escape"&&S(!1)},w=M=>{_(M.target)},B=M=>{v===F.current&&M.target===F.current&&S(!1),_(null)};y.useEffect(()=>(window.addEventListener("keyup",x),()=>{window.removeEventListener("keyup",x)})),y.useEffect(()=>{const M=F.current;return M&&(M.addEventListener("mousedown",w),M.addEventListener("mouseup",B)),()=>{M&&(M.removeEventListener("mousedown",w),M.removeEventListener("mouseup",B))}},[v]);const S=M=>{if(b(M),M)a(),h(e);else{if(f===M)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const z=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:F,className:G("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(to,{id:e,className:G("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:z,children:t&&c.jsx(Pp,{containerElements:[F.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(Fe,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(qt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(qt,{}),c.jsx(sr,{buttons:u})]}),s&&c.jsx(Sr,{className:"error",children:s})]})})})})},wd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const mr="joinCommunityButton",ao=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(mt),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[p,h]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?h("joined"):p==="leaving"&&h("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${mr}_leave`}),g["aria-label"]=s.formatMessage({id:`${mr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Fe,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${mr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),h(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${mr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const _=d?i:a;typeof _=="function"&&setTimeout(async()=>{await _()},500),m(!d)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${mr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const wi="communityDetails_",Np=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=se.useIntl(),u=5,d=a||i.length,m=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,h=t||n,g=!n&&!t;return c.jsxs("div",{className:G("community-details",e),children:[h&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${wi}members`}),c.jsx("span",{className:"count",children:d})]}),!p&&c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${wi}viewAll`})})})]}),c.jsx(eo,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(ao,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(Fe,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${wi}invite`})})]})};const Mp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:G("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(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(dn,{href:s?void 0:i,...l,children:Jn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Ip=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=y.useState(t?["all"]:[]),u=(d,m)=>{let p=[];o.includes(d)?p=o.filter(h=>h!==d):d==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),d]:p=[d],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:G("filters",a),children:s.map(({id:d,text:m,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:G(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,h)},...g,children:m})},d)})})},Rp=(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 ea="languageSwitcher_",$p=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(Js),[m,p]=y.useState(e);if(y.useEffect(()=>{e!==m&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=m!==e;return c.jsxs("div",{className:G("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${ea}label`})}),c.jsx("ul",{children:g.map(b=>{var F;if(!ya[b])return null;const v=(F=r[b])==null?void 0:F.post_name;let _={className:b};if(m===b)_["aria-label"]=u.formatMessage({id:`${ea}selected`},{language:ya[b]});else{const x=Rp(b,v,i);_={..._,href:typeof x=="string"?x:x.url,onClick:w=>{p(b),d(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof x=="string"?x:x.urlForRouter))}}}return c.jsx("li",{children:c.jsx(dn,{..._,fallbackElement:"span",children:ya[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ea}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ea}disclaimer`},{email:Wn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Ei=se.createIntl({locale:"en",messages:ir}),Wr=({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:Ei.formatMessage({id:"loadMore_button"}),endOfFeed:Ei.formatMessage({id:"loadMore_endOfFeed"}),error:Ei.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:G("load-more",l),children:!d&&e?c.jsx(Fe,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const io=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:c.jsx(Ie,{children:c.jsx(se.FormattedMessage,{id:"apolitical"})})})});let ta=!1;const Ed=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Fe,{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:m,icon:p,...h},g)=>{const f={...h,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ta&&(clearTimeout(ta),ta=!1)},onBlur:()=>{ta=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Fe,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},Lp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const zp=y.lazy(()=>Promise.resolve().then(()=>Im)),qp=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],_d=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(mt),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[qp.map(({key:i,href:s})=>{const o=Lp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:G(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(zp,{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"})]})},pr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Wp=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${pr(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(`${pr(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(`${pr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
63
63
 
64
- ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:pr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Up="shareLinks_",Hp=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Wp({title:e,link:t,referrer:n});return d.jsxs("aside",{className:G("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),d.jsx("li",{children:d.jsx(Fe,{size:a,variant:"tertiary",icon:{icon:c||u},href:m,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:`${Up}link_${u}`}),...g})},u)})})]})};const Vp=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=On(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),c=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const _=r(e[v].id,e[v].text,v),F=document.getElementById(`tab-${_}`);F==null||F.focus(),u(_);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:_,hasCarousel:F,breakpoint:x},w)=>{if(x&&!m(x))return;f=r(f,b,w);const B=s===f,S={};_||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(d.jsx("section",{id:f,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":B?"assertive":"off",children:typeof v=="string"?d.jsx("p",{children:v}):v},`section-${f}`))),p.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:_||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:G({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:z=>c(z,w),...S,children:b})},`tab-${f}`))}),d.jsxs("div",{className:G("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:p}),d.jsx("div",{className:"tab-content",children:h})]})};const Kp={"2-1":901,"1-3":769,"1-1":769},kd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=On(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Kp[e]?null:o)})};const so=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,c=n>t;return d.jsxs(d.Fragment,{children:[d.jsx("small",{id:e,className:G("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":c?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:c?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),d.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ei=e=>(e==null?void 0:e.toString().length)||0,Fd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ei(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const na="emailHelperTextBox_",Bd=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${na}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),c=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${na}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>c(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${na}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=na,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>c(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>d.jsx("a",{...s[g],children:f}):f=>f}),d.jsx(ed,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?d.jsxs(d.Fragment,{children:[d.jsx(Ft,{element:"span"}),d.jsx(Ft,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>d.jsx("strong",{children:g}),em:g=>d.jsx("em",{children:g}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:s.error})})},Un=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...c})=>{const m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(c!=null&&c.autoComplete)&&["email"].includes(o)&&(c.autoComplete="email"),y.createElement(t,{ref:p,...c,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:h=>{const g=h.target;a.onChange(g.value)}})};const Rn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Zp=500,Yp=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||m(w=>({...w,debouncedInput:l}))},Zp);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{c&&!g?(async()=>{try{const w=await o(c)||[];f(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(B=>({...B,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[c,g]),y.useEffect(()=>{h>=0&&p[h]&&m(x=>({...x,displayInput:p[h].description}))},[h,p]);const v=x=>{[Rn.DOWN,Rn.UP,Rn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Rn.DOWN&&h<p.length-1?f(w=>({...w,activePredictionIndex:h+1})):x.key===Rn.UP&&h>0?f(w=>({...w,activePredictionIndex:h-1})):x.key===Rn.ENTER&&h>-1&&(s(p[h].description),m(w=>({...w,input:p[h].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},_=x=>{s(x.target.value),m(w=>({...w,input:x.target.value,displayInput:x.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},F=x=>{s(x.description),m(w=>({...w,input:x.description,displayInput:x.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((x,w)=>d.jsx("li",{onClick:()=>F(x),onMouseEnter:()=>f(B=>({...B,activePredictionIndex:w})),className:G("predictions-list-item",{active:w===h}),children:x.description},w))})]})};const Ad=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(c?null:l)},b=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const _=v.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},b)};const Gp=y.memo(function({direction:t="down"}){return d.jsx(Ya,{className:G("rotating-chevron",`direction-${t}`)})});const Qp=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:F,...x}=a,w=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(M=>M!==S.id):z=[...f,S.id],b([...z]),_&&_([...z])}else b([S]),_&&_(S.id),p(!1)},B=S=>{if(S==="all"){const z=(t==null?void 0:t.map(M=>M.id))||[];b(z),_&&_(z)}else b([]),_&&_([])};return d.jsxs("div",{className:G("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,d.jsx(Gp,{direction:m?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(M=>M.id===S.target.value);w(z)},hidden:!m,...x,children:t==null?void 0:t.map(S=>d.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))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${f==null?void 0:f.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(Fe,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Fe,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),w(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:G({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Fe,{variant:"secondary",onClick:()=>{F&&F(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Jp=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...m})=>{const p=se.useIntl(),h=i?c:[],g=c;return d.jsx("ul",{...m,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:_=!1})=>{const F=`${r}_${f}`,x=()=>{if(_)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return d.jsx(Ad,{element:"li",id:F,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},F)})})};const Xp=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[c,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),d.jsx(Un,{inputRef:o,type:c,autoComplete:r,...a})]})};const $n={text:{component:Un},email:{component:Un},url:{component:Un},textarea:{component:Un,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ad},checkboxes:{component:Jp,props:{multiSelect:!0}},select:{component:Qp},password:{component:Xp},autocomplete:{component:Yp}},eg=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:$})=>$==="required"),g=ei(u),f=o&&$n[o]&&$n[o].component?$n[o].component:Un,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),_=r&&`error-${e}`,F=`character-limit-${e}`,x={};b?x.element="legend":x.htmlFor=e;let w={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:xn(a),value:u};const B=$=>{w["aria-describedby"]?w["aria-describedby"]+=` ${$}`:w["aria-describedby"]=$};if(i>0){const $=Fd(i,a.onChange);B(`${F}-info`),w={...w,...$},$.functions&&typeof $.functions=="object"&&(w.functions={...w.functions,...$.functions})}o&&$n[o]&&$n[o].props&&(w={...w,...$n[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=_,B(_));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...$})=>r?y.createElement($.as||"p",{id:_,className:"error text-small",...$},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...w,label:S,className:G("field-wrapper",n)}),d.jsx(z,{as:"p"})]});const M=$=>y.createElement($.element||"label",{...$,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsx(d.Fragment,{children:y.createElement(b?"fieldset":"div",{className:G("field-wrapper text-medium",n)},d.jsxs(d.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},d.jsx(d.Fragment,{children:d.jsxs(M,{...x,children:[S,h&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(b||v?"div":"p",{className:"field-component"},d.jsxs(d.Fragment,{children:[d.jsx(f,{...w}),d.jsx(so,{id:F,limit:i,valueLength:g})]})),d.jsx(z,{})]}))})},tg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?xn(e.errors):{},i=e.values?xn(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:c}=r,m=xn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let _i=null;const Jt=({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:c={context:"Form",event:"form-submit-click"},functions:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:_=!0,shouldHide:F=!0,showRequiredLabels:x=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:B=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:M=()=>{}}=m||{},$=se.useIntl(),R={};t.length&&t.forEach(T=>{const N=T.id||T.name;N&&(R[N]=T.value||"")});const[k,A]=y.useReducer(tg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:R}),{errors:j,isSubmitting:L,formSubmitted:H,values:Z}=k;y.useEffect(()=>{_&&H&&(_i=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),y.useEffect(()=>()=>{_i&&clearTimeout(_i)},[]),y.useEffect(()=>{const T=N=>{A({type:"updateValue",payload:{key:N.detail.id,value:N.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const Q=y.useRef(null),ae=a||Q;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=$.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const q=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:$}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await B(T),A({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(N){z(N),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,N)=>{M(T,N),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:$}})}},E=[{...f,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),L)return;let N=0;if((U=ae==null?void 0:ae.current)!=null&&U.id){const ne=document.getElementById(ae.current.id);ne&&(N=ne.getBoundingClientRect().top+window.scrollY)}const I=document.getElementById("header");I&&(N=N-I.offsetHeight-b),N<0&&(N=0),window.scrollTo({top:N,behavior:"smooth"}),q()},disabled:L||H||s.disabled,"data-gtm-event-context":c.context,"data-gtm-event-type":c.event,children:C[L?"submitting":H?"submitted":"default"]}];return v&&E.unshift({...o,className:"gtm-trackable","data-gtm-event-context":c.context,"data-gtm-event-type":c.event,disabled:L||H,onClick:S,children:o.text||$.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[y.createElement(e,{...p,id:r,className:G("form",n),ref:ae},d.jsxs(d.Fragment,{children:[j!=null&&j.general?d.jsx(fn,{variant:"error",text:$.formatMessage({id:"form_error_generalError"})}):null,u,(!F||!L&&!H||h)&&t.map((T,N)=>{const{id:I=T.name||N,component:U,functions:ne={onChange:()=>{}},submitOnEnter:te=!1}=T;if(U)return d.jsx(U,{...T.props||{}},`component-${I}-${N}`);const ie=(Z==null?void 0:Z[I])||"",le={...ne,onChange:J=>{A({type:"updateValue",payload:{key:I,value:J}}),ne.onChange(J&&J.toString(),A)}};return te&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),q()),ne.onKeyDown&&ne.onKeyDown(J)}),d.jsx(eg,{intlPath:i,...T,showRequiredLabels:x,value:ie,error:j==null?void 0:j[I],functions:le},I)}),g?null:(L||H)&&h?h:d.jsx(sr,{className:G("cta",{center:L||H,submitted:H}),buttons:E})]})),w&&H&&d.jsx(Sr,{className:"success",children:typeof w=="string"?w:$.formatMessage({id:"form_success"})})]})};const ra="passwordRules_",Td="isMoreThanEightCharacters",Sd="includesNumberAndSymbol",jd="includesLowerAndUppercase",ng={[Td]:"8Characters",[Sd]:"numberSymbol",[jd]:"lowercaseUppercase"},rg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return d.jsxs("aside",{className:G("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${ra}intro`})}),d.jsx("ul",{children:[Td,Sd,jd].map(r=>d.jsxs("li",{className:G({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${ra}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${ra}rule_${ng[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${ra}notMet`})]})]},`rule-${r}`))})]})},Od=y.memo(rg);const ag=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(_=>({..._,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(_=>({..._,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(Ft,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(_=>({..._,rating:v,disabled:!0})),await r({id:m,value:v})}catch(_){u(F=>({...F,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return d.jsxs("div",{className:G("rating",i),children:[d.jsx("span",{className:"label",children:f[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const _=v+1;return d.jsx("li",{className:G({selected:p&&_<=p}),children:d.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),b(_)},disabled:h})},`rating-${_}`)})})]})};function ig(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 xs(e,t){return Array(t+1).join(e)}function sg(e){return e.replace(/^\n*/,"")}function og(e){for(var t=e.length;t>0&&e[t-1]===`
64
+ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:pr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Up="shareLinks_",Hp=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Wp({title:e,link:t,referrer:n});return c.jsxs("aside",{className:G("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:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),c.jsx("li",{children:c.jsx(Fe,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,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:`${Up}link_${u}`}),...g})},u)})})]})};const Vp=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=On(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const _=r(e[v].id,e[v].text,v),F=document.getElementById(`tab-${_}`);F==null||F.focus(),u(_);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:_,hasCarousel:F,breakpoint:x},w)=>{if(x&&!m(x))return;f=r(f,b,w);const B=s===f,S={};_||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(c.jsx("section",{id:f,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":B?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:_||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:G({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:z=>d(z,w),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:G("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:h})]})};const Kp={"2-1":901,"1-3":769,"1-1":769},kd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=On(!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:G("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Kp[e]?null:o)})};const so=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:G("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(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ei=e=>(e==null?void 0:e.toString().length)||0,Fd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ei(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const na="emailHelperTextBox_",Bd=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${na}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${na}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${na}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=na,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>d(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(ed,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{element:"span"}),c.jsx(Ft,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,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})})},Un=({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 m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:h=>{const g=h.target;a.onChange(g.value)}})};const Rn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Zp=500,Yp=({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},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||m(w=>({...w,debouncedInput:l}))},Zp);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const w=await o(d)||[];f(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(B=>({...B,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[d,g]),y.useEffect(()=>{h>=0&&p[h]&&m(x=>({...x,displayInput:p[h].description}))},[h,p]);const v=x=>{[Rn.DOWN,Rn.UP,Rn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Rn.DOWN&&h<p.length-1?f(w=>({...w,activePredictionIndex:h+1})):x.key===Rn.UP&&h>0?f(w=>({...w,activePredictionIndex:h-1})):x.key===Rn.ENTER&&h>-1&&(s(p[h].description),m(w=>({...w,input:p[h].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},_=x=>{s(x.target.value),m(w=>({...w,input:x.target.value,displayInput:x.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},F=x=>{s(x.description),m(w=>({...w,input:x.description,displayInput:x.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((x,w)=>c.jsx("li",{onClick:()=>F(x),onMouseEnter:()=>f(B=>({...B,activePredictionIndex:w})),className:G("predictions-list-item",{active:w===h}),children:x.description},w))})]})};const Ad=({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,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const _=v.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},b)};const Gp=y.memo(function({direction:t="down"}){return c.jsx(Ya,{className:G("rotating-chevron",`direction-${t}`)})});const Qp=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:F,...x}=a,w=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(M=>M!==S.id):z=[...f,S.id],b([...z]),_&&_([...z])}else b([S]),_&&_(S.id),p(!1)},B=S=>{if(S==="all"){const z=(t==null?void 0:t.map(M=>M.id))||[];b(z),_&&_(z)}else b([]),_&&_([])};return c.jsxs("div",{className:G("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Gp,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(M=>M.id===S.target.value);w(z)},hidden:!m,...x,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:!m,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(Fe,{variant:"tertiary",size:"small",onClick:()=>B("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(Fe,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),w(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:G({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Fe,{variant:"secondary",onClick:()=>{F&&F(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Jp=({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,...m})=>{const p=se.useIntl(),h=i?d:[],g=d;return c.jsx("ul",{...m,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:_=!1})=>{const F=`${r}_${f}`,x=()=>{if(_)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return c.jsx(Ad,{element:"li",id:F,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},F)})})};const Xp=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Un,{inputRef:o,type:d,autoComplete:r,...a})]})};const $n={text:{component:Un},email:{component:Un},url:{component:Un},textarea:{component:Un,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ad},checkboxes:{component:Jp,props:{multiSelect:!0}},select:{component:Qp},password:{component:Xp},autocomplete:{component:Yp}},eg=({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,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:$})=>$==="required"),g=ei(u),f=o&&$n[o]&&$n[o].component?$n[o].component:Un,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),_=r&&`error-${e}`,F=`character-limit-${e}`,x={};b?x.element="legend":x.htmlFor=e;let w={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:xn(a),value:u};const B=$=>{w["aria-describedby"]?w["aria-describedby"]+=` ${$}`:w["aria-describedby"]=$};if(i>0){const $=Fd(i,a.onChange);B(`${F}-info`),w={...w,...$},$.functions&&typeof $.functions=="object"&&(w.functions={...w.functions,...$.functions})}o&&$n[o]&&$n[o].props&&(w={...w,...$n[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=_,B(_));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...$})=>r?y.createElement($.as||"p",{id:_,className:"error text-small",...$},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:S,className:G("field-wrapper",n)}),c.jsx(z,{as:"p"})]});const M=$=>y.createElement($.element||"label",{...$,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:G("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(M,{...x,children:[S,h&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(so,{id:F,limit:i,valueLength:g})]})),c.jsx(z,{})]}))})},tg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?xn(e.errors):{},i=e.values?xn(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,m=xn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let _i=null;const Jt=({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:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:_=!0,shouldHide:F=!0,showRequiredLabels:x=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:B=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:M=()=>{}}=m||{},$=se.useIntl(),R={};t.length&&t.forEach(T=>{const N=T.id||T.name;N&&(R[N]=T.value||"")});const[k,A]=y.useReducer(tg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:R}),{errors:j,isSubmitting:L,formSubmitted:H,values:Z}=k;y.useEffect(()=>{_&&H&&(_i=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),y.useEffect(()=>()=>{_i&&clearTimeout(_i)},[]),y.useEffect(()=>{const T=N=>{A({type:"updateValue",payload:{key:N.detail.id,value:N.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const Q=y.useRef(null),ae=a||Q;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=$.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const q=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:$}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await B(T),A({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(N){z(N),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,N)=>{M(T,N),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:$}})}},E=[{...f,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),L)return;let N=0;if((U=ae==null?void 0:ae.current)!=null&&U.id){const ne=document.getElementById(ae.current.id);ne&&(N=ne.getBoundingClientRect().top+window.scrollY)}const I=document.getElementById("header");I&&(N=N-I.offsetHeight-b),N<0&&(N=0),window.scrollTo({top:N,behavior:"smooth"}),q()},disabled:L||H||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[L?"submitting":H?"submitted":"default"]}];return v&&E.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:L||H,onClick:S,children:o.text||$.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:G("form",n),ref:ae},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(fn,{variant:"error",text:$.formatMessage({id:"form_error_generalError"})}):null,u,(!F||!L&&!H||h)&&t.map((T,N)=>{const{id:I=T.name||N,component:U,functions:ne={onChange:()=>{}},submitOnEnter:te=!1}=T;if(U)return c.jsx(U,{...T.props||{}},`component-${I}-${N}`);const ie=(Z==null?void 0:Z[I])||"",le={...ne,onChange:J=>{A({type:"updateValue",payload:{key:I,value:J}}),ne.onChange(J&&J.toString(),A)}};return te&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),q()),ne.onKeyDown&&ne.onKeyDown(J)}),c.jsx(eg,{intlPath:i,...T,showRequiredLabels:x,value:ie,error:j==null?void 0:j[I],functions:le},I)}),g?null:(L||H)&&h?h:c.jsx(sr,{className:G("cta",{center:L||H,submitted:H}),buttons:E})]})),w&&H&&c.jsx(Sr,{className:"success",children:typeof w=="string"?w:$.formatMessage({id:"form_success"})})]})};const ra="passwordRules_",Td="isMoreThanEightCharacters",Sd="includesNumberAndSymbol",jd="includesLowerAndUppercase",ng={[Td]:"8Characters",[Sd]:"numberSymbol",[jd]:"lowercaseUppercase"},rg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:G("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ra}intro`})}),c.jsx("ul",{children:[Td,Sd,jd].map(r=>c.jsxs("li",{className:G({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${ra}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ra}rule_${ng[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${ra}notMet`})]})]},`rule-${r}`))})]})},Od=y.memo(rg);const ag=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(_=>({..._,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(_=>({..._,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ft,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(_=>({..._,rating:v,disabled:!0})),await r({id:m,value:v})}catch(_){u(F=>({...F,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return c.jsxs("div",{className:G("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const _=v+1;return c.jsx("li",{className:G({selected:p&&_<=p}),children:c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),b(_)},disabled:h})},`rating-${_}`)})})]})};function ig(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 xs(e,t){return Array(t+1).join(e)}function sg(e){return e.replace(/^\n*/,"")}function og(e){for(var t=e.length;t>0&&e[t-1]===`
65
65
  `;)t--;return e.substring(0,t)}var ug=["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 oo(e){return uo(e,ug)}var Pd=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Nd(e){return uo(e,Pd)}function lg(e){return Id(e,Pd)}var Md=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function cg(e){return uo(e,Md)}function dg(e){return Id(e,Md)}function uo(e,t){return t.indexOf(e.nodeName)>=0}function Id(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var at={};at.paragraph={filter:"p",replacement:function(e){return`
66
66
 
67
67
  `+e+`
@@ -93,11 +93,11 @@ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
93
93
  `+t.firstChild.textContent.replace(/\n/g,`
94
94
  `)+`
95
95
 
96
- `}};at.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=xs(s,o);return`
96
+ `}};at.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=xs(s,o);return`
97
97
 
98
- `+c+a+`
98
+ `+d+a+`
99
99
  `+i.replace(/\n$/,"")+`
100
- `+c+`
100
+ `+d+`
101
101
 
102
102
  `}};at.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
103
103
 
@@ -109,7 +109,7 @@ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
109
109
  `)+`
110
110
 
111
111
  `,this.references=[]),t}};at.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};at.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};at.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};at.image={filter:"img",replacement:function(e,t){var n=Pa(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=Pa(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function Pa(e){return e?e.replace(/(\n+\s*)+/g,`
112
- `):""}function Rd(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}Rd.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ki(this.array,e,this.options))||(t=ki(this._keep,e,this.options))||(t=ki(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ki(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(fg(a,t,n))return a}}function fg(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function hg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=wu(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=Fi(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=Fi(l);continue}var c=wu(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||Fi(i))}}function Fi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function wu(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var lo=typeof window<"u"?window:{};function mg(){var e=lo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function pg(){var e=function(){};return gg()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function gg(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{lo.ActiveXObject&&(e=!0)}return e}var vg=mg()?lo.DOMParser:pg();function bg(e,t){var n;if(typeof e=="string"){var r=yg().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return hg({element:n,isBlock:oo,isVoid:Nd,isPre:t.preformattedCode?Dg:null}),n}var Bi;function yg(){return Bi=Bi||new vg,Bi}function Dg(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Cg(e,t){return e.isBlock=oo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=xg(e),e.flankingWhitespace=wg(e,t),e}function xg(e){return!Nd(e)&&!cg(e)&&/^\s*$/i.test(e.textContent)&&!lg(e)&&!dg(e)}function wg(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Eg(e.textContent);return n.leadingAscii&&Eu("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Eu("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Eg(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Eu(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!oo(r)&&(i=a.test(r.textContent))),i}var _g=Array.prototype.reduce,kg=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function jr(e){if(!(this instanceof jr))return new jr(e);var t={rules:at,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
112
+ `):""}function Rd(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}Rd.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ki(this.array,e,this.options))||(t=ki(this._keep,e,this.options))||(t=ki(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ki(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(fg(a,t,n))return a}}function fg(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function hg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=wu(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=Fi(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=Fi(l);continue}var d=wu(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||Fi(i))}}function Fi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function wu(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var lo=typeof window<"u"?window:{};function mg(){var e=lo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function pg(){var e=function(){};return gg()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function gg(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{lo.ActiveXObject&&(e=!0)}return e}var vg=mg()?lo.DOMParser:pg();function bg(e,t){var n;if(typeof e=="string"){var r=yg().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return hg({element:n,isBlock:oo,isVoid:Nd,isPre:t.preformattedCode?Dg:null}),n}var Bi;function yg(){return Bi=Bi||new vg,Bi}function Dg(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Cg(e,t){return e.isBlock=oo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=xg(e),e.flankingWhitespace=wg(e,t),e}function xg(e){return!Nd(e)&&!cg(e)&&/^\s*$/i.test(e.textContent)&&!lg(e)&&!dg(e)}function wg(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Eg(e.textContent);return n.leadingAscii&&Eu("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Eu("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Eg(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Eu(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!oo(r)&&(i=a.test(r.textContent))),i}var _g=Array.prototype.reduce,kg=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function jr(e){if(!(this instanceof jr))return new jr(e);var t={rules:at,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
113
113
 
114
114
  `:""},keepReplacement:function(n,r){return r.isBlock?`
115
115
 
@@ -126,20 +126,20 @@ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
126
126
  *
127
127
  * Copyright (c) 2014-2017, Jon Schlinkert.
128
128
  * Released under the MIT License.
129
- */function _u(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return _u(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(_u(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var zd=Symbol.for("immer-nothing"),ku=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state"),Tg=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 ft(e,...t){if(process.env.NODE_ENV!=="production"){const n=Tg[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 tr=Object.getPrototypeOf;function Bn(e){return!!e&&!!e[yt]}function An(e){var t;return e?qd(e)||Array.isArray(e)||!!e[ku]||!!((t=e.constructor)!=null&&t[ku])||ni(e)||ri(e):!1}var Sg=Object.prototype.constructor.toString();function qd(e){if(!e||typeof e!="object")return!1;const t=tr(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)===Sg}function Na(e,t){ti(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ti(e){const t=e[yt];return t?t.type_:Array.isArray(e)?1:ni(e)?2:ri(e)?3:0}function ws(e,t){return ti(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Wd(e,t,n){const r=ti(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function jg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ni(e){return e instanceof Map}function ri(e){return e instanceof Set}function yn(e){return e.copy_||e.base_}function Es(e,t){if(ni(e))return new Map(e);if(ri(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=qd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[yt];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(tr(e),r)}else{const r=tr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function co(e,t=!1){return ai(e)||Bn(e)||!An(e)||(ti(e)>1&&(e.set=e.add=e.clear=e.delete=Og),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>co(r,!0))),e}function Og(){ft(2)}function ai(e){return Object.isFrozen(e)}var Pg={};function Tn(e){const t=Pg[e];return t||ft(0,e),t}var Or;function Ud(){return Or}function Ng(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Fu(e,t){t&&(Tn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _s(e){ks(e),e.drafts_.forEach(Mg),e.drafts_=null}function ks(e){e===Or&&(Or=e.parent_)}function Bu(e){return Or=Ng(Or,e)}function Mg(e){const t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Au(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[yt].modified_&&(_s(t),ft(4)),An(e)&&(e=Ma(t,e),t.parent_||Ia(t,e)),t.patches_&&Tn("Patches").generateReplacementPatches_(n[yt].base_,e,t.patches_,t.inversePatches_)):e=Ma(t,n,[]),_s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==zd?e:void 0}function Ma(e,t,n){if(ai(t))return t;const r=t[yt];if(!r)return Na(t,(a,i)=>Tu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ia(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),Na(i,(o,l)=>Tu(e,r,a,o,l,n,s)),Ia(e,a,!1),n&&e.patches_&&Tn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Tu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&ft(5),Bn(a)){const o=i&&t&&t.type_!==3&&!ws(t.assigned_,r)?i.concat(r):void 0,l=Ma(e,a,o);if(Wd(n,r,l),Bn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(An(a)&&!ai(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ma(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ia(e,a)}}function Ia(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&co(t,n)}function Ig(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ud(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=fo;n&&(a=[r],i=Pr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var fo={get(e,t){if(t===yt)return e;const n=yn(e);if(!ws(n,t))return Rg(e,n,t);const r=n[t];return e.finalized_||!An(r)?r:r===Ai(e.base_,t)?(Ti(e),e.copy_[t]=Bs(r,e)):r},has(e,t){return t in yn(e)},ownKeys(e){return Reflect.ownKeys(yn(e))},set(e,t,n){const r=Hd(yn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Ai(yn(e),t),i=a==null?void 0:a[yt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(jg(n,a)&&(n!==void 0||ws(e.base_,t)))return!0;Ti(e),Fs(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 Ai(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ti(e),Fs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=yn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ft(11)},getPrototypeOf(e){return tr(e.base_)},setPrototypeOf(){ft(12)}},Pr={};Na(fo,(e,t)=>{Pr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Pr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ft(13),Pr.set.call(this,e,t,void 0)};Pr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ft(14),fo.set.call(this,e[0],t,n,e[0])};function Ai(e,t){const n=e[yt];return(n?yn(n):e)[t]}function Rg(e,t,n){var a;const r=Hd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Hd(e,t){if(!(t in e))return;let n=tr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=tr(n)}}function Fs(e){e.modified_||(e.modified_=!0,e.parent_&&Fs(e.parent_))}function Ti(e){e.copy_||(e.copy_=Es(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $g=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&ft(6),r!==void 0&&typeof r!="function"&&ft(7);let a;if(An(t)){const i=Bu(this),s=Bs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?_s(i):ks(i)}return Fu(i,r),Au(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===zd&&(a=void 0),this.autoFreeze_&&co(a,!0),r){const i=[],s=[];Tn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else ft(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){An(e)||ft(8),Bn(e)&&(e=Lg(e));const t=Bu(this),n=Bs(e,void 0);return n[yt].isManual_=!0,ks(t),n}finishDraft(e,t){const n=e&&e[yt];(!n||!n.isManual_)&&ft(9);const{scope_:r}=n;return Fu(r,t),Au(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=Tn("Patches").applyPatches_;return Bn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Bs(e,t){const n=ni(e)?Tn("MapSet").proxyMap_(e,t):ri(e)?Tn("MapSet").proxySet_(e,t):Ig(e,t);return(t?t.scope_:Ud()).drafts_.push(n),n}function Lg(e){return Bn(e)||ft(10,e),Vd(e)}function Vd(e){if(!An(e)||ai(e))return e;const t=e[yt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Es(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Es(e,!0);return Na(n,(r,a)=>{Wd(n,r,Vd(a))}),t&&(t.finalized_=!1),n}var Dt=new $g,ho=Dt.produce;Dt.produceWithPatches.bind(Dt);Dt.setAutoFreeze.bind(Dt);Dt.setUseStrictShallowCopy.bind(Dt);Dt.applyPatches.bind(Dt);var Su=Dt.createDraft.bind(Dt),ju=Dt.finishDraft.bind(Dt),zg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},qg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ee.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Wg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ra=new WeakMap,$a=new WeakMap,wr=new WeakMap,Kd=new WeakMap,Ou=new WeakMap,Pu=new WeakMap,Nu=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:m,newPath:p}=t;if(P.equals(m,p))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var h=p.slice();return P.endsBefore(m,p)&&m.length<p.length&&(h[m.length-1]-=1),h.concat(r.slice(m.length))}else P.isSibling(m,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[p.length-1]+=1):P.endsBefore(m,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Nr(e){"@babel/helpers - typeof";return Nr=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},Nr(e)}function Ug(e,t){if(Nr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Nr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hg(e){var t=Ug(e,"string");return Nr(t)==="symbol"?t:String(t)}function lt(e,t,n){return t=Hg(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vg=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of V.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:m}=n;if(m.length===0)break;var p=ue.leaf(e,u),h=p.text.slice(0,c),g=p.text.slice(c);if(p.text=h+m+g,t)for(var[f,b]of V.points(t))t[b]=Ee.transform(f,n);break}case"merge_node":{var{path:v}=n,_=ue.get(e,v),F=P.previous(v),x=ue.get(e,F),w=ue.parent(e,v),B=v[v.length-1];if(fe.isText(_)&&fe.isText(x))x.text+=_.text;else if(!fe.isText(_)&&!fe.isText(x))x.children.push(..._.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(_)," ").concat(et.stringify(x)));if(w.children.splice(B,1),t)for(var[S,z]of V.points(t))t[z]=Ee.transform(S,n);break}case"move_node":{var{path:M,newPath:$}=n;if(P.isAncestor(M,$))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat($,"] because the destination is inside itself."));var R=ue.get(e,M),k=ue.parent(e,M),A=M[M.length-1];k.children.splice(A,1);var j=P.transform(M,n),L=ue.get(e,P.parent(j)),H=j[j.length-1];if(L.children.splice(H,0,R),t)for(var[Z,Q]of V.points(t))t[Q]=Ee.transform(Z,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],q=ue.parent(e,ae);if(q.children.splice(C,1),t)for(var[Y,E]of V.points(t)){var T=Ee.transform(Y,n);if(t!=null&&T!=null)t[E]=T;else{var N=void 0,I=void 0;for(var[U,ne]of ue.texts(e))if(P.compare(ne,ae)===-1)N=[U,ne];else{I=[U,ne];break}var te=!1;N&&I&&(P.equals(I[1],ae)?te=!P.hasPrevious(I[1]):te=P.common(N[1],ae).length<P.common(I[1],ae).length),N&&!te?(Y.path=N[1],Y.offset=N[0].text.length):I?(Y.path=I[1],Y.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:le,text:J}=n;if(J.length===0)break;var ge=ue.leaf(e,ie),he=ge.text.slice(0,le),pe=ge.text.slice(le+J.length);if(ge.text=he+pe,t)for(var[xe,_e]of V.points(t))t[_e]=Ee.transform(xe,n);break}case"set_node":{var{path:Le,properties:Te,newProperties:Ae}=n;if(Le.length===0)throw new Error("Cannot set properties on the root node!");var Pe=ue.get(e,Le);for(var ke in Ae){if(ke==="children"||ke==="text")throw new Error('Cannot set the "'.concat(ke,'" property of nodes!'));var Ve=Ae[ke];Ve==null?delete Pe[ke]:Pe[ke]=Ve}for(var qe in Te)Ae.hasOwnProperty(qe)||delete Pe[qe];break}case"set_selection":{var{newProperties:W}=n;if(W==null)t=W;else{if(t==null){if(!V.isRange(W))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(W)," when there is no current selection."));t=gr({},W)}for(var re in W){var me=W[re];if(me==null){if(re==="anchor"||re==="focus")throw new Error('Cannot remove the "'.concat(re,'" selection property'));delete t[re]}else t[re]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ze}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Ye=ue.get(e,ve),gt=ue.parent(e,ve),Ut=ve[ve.length-1],Bt;if(fe.isText(Ye)){var tt=Ye.text.slice(0,we),Ot=Ye.text.slice(we);Ye.text=tt,Bt=gr(gr({},Ze),{},{text:Ot})}else{var vt=Ye.children.slice(0,we),di=Ye.children.slice(we);Ye.children=vt,Bt=gr(gr({},Ze),{},{children:di})}if(gt.children.splice(Ut+1,0,Bt),t)for(var[lr,Kr]of V.points(t))t[Kr]=Ee.transform(lr,n);break}}return t},Kg={transform(e,t){e.children=Su(e.children);var n=e.selection&&Su(e.selection);try{n=Vg(e,n,t)}finally{e.children=ju(e.children),n?e.selection=Bn(n)?ju(n):n:e.selection=null}}},Zg={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)}},Yg={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)}},Zd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!Zd(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 Gg(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 Gt(e,t){if(e==null)return{};var n=Gg(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 Qg=["anchor","focus"];function Iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Iu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Gt(e,Qg),[r,a]=V.edges(e),[i,s]=V.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:Jg({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ee.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ee.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return nt(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ho(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ee.transform(r.anchor,t,{affinity:i}),u=Ee.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Ru=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),de={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:Ru,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 Ru(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Xg=["children"],ev=["text"],$u=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(et.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Gt(e,Xg);return t}else{var t=Gt(e,ev);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(et.stringify(e)));var n=ho({children:e.children},r=>{var[a,i]=V.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!V.includes(t,h)}});for(var[,o]of s){if(!V.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=ue.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=ue.leaf(r,o);m.text=m.text.slice(a.offset)}}D.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(et.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=$u.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return $u.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(et.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||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?P.isBefore(o,i):P.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;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(ue.has(e,c)){o=c,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=ue.get(e,o);continue}o=P.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ue.get(e,n);if(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 Lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var on={isNodeOperation(e){return on.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&nt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>on.isOperation(t))},isSelectionOperation(e){return on.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return on.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ue(Ue({},e),{},{type:"remove_node"});case"insert_text":return Ue(Ue({},e),{},{type:"remove_text"});case"merge_node":return Ue(Ue({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return Ue(Ue({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ue(Ue({},e),{},{path:r,newPath:a})}case"remove_node":return Ue(Ue({},e),{},{type:"insert_node"});case"remove_text":return Ue(Ue({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ue(Ue({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ue(Ue({},e),{},{properties:l,newProperties:null}):l==null?Ue(Ue({},e),{},{properties:null,newProperties:o}):Ue(Ue({},e),{},{properties:l,newProperties:o})}case"split_node":return Ue(Ue({},e),{},{type:"merge_node",path:P.next(e.path)})}}},zu=new WeakMap,tv=e=>{var t=zu.get(e);if(t!==void 0)return t;if(!nt(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||nt(e.marks))&&(e.selection===null||V.isRange(e.selection))&&ue.isNodeList(e.children)&&on.isOperationList(e.operations);return zu.set(e,n),n},D={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return tv(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)}},nv={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ee={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ee.compare(e,t)===1},isBefore(e,t){return Ee.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ho(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=P.transform(i,t,Wu(Wu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Uu=void 0,et={setScrubber(e){Uu=e},stringify(e){return JSON.stringify(e,Uu)}},rv=["text"],av=["anchor","focus"];function Hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Gt(i,rv);return s}return Zd(r?a(e):e,r?a(t):t)},isText(e){return nt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>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=[Vt({},e)];for(var r of t){var a=Gt(r,av),[i,s]=V.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var m of n){var{length:p}=m.text,h=l;if(l+=p,u<=h&&l<=c){Object.assign(m,a),o.push(m);continue}if(u!==c&&(u===l||c===h)||u>l||c<h||c===h&&h!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(c<l){var v=c-h;b=Vt(Vt({},g),{},{text:g.text.slice(v)}),g=Vt(Vt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var _=u-h;f=Vt(Vt({},g),{},{text:g.text.slice(0,_)}),g=Vt(Vt({},g),{},{text:g.text.slice(_)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},mo=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],ur=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},po=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?cv(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var m=c.codePointAt(0);if(!m)break;var p=xv(c,m);if([i,s]=r?[s,p]:[p,i],Hn(i,Ce.ZWJ)&&Hn(s,Ce.ExtPict)&&(r?l=Vu(t.substring(0,o)):l=Vu(t.substring(0,t.length-o)),!l)||Hn(i,Ce.RI)&&Hn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Fv(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Ev(i,s))break;o+=c.length}return o||1},iv=/\s/,sv=/[\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]/,ov=/['\u2018\u2019]/,uv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=po(t,n),[s,o]=go(t,i,n);if(lv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},go=(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)]},lv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(iv.test(t))return!1;if(ov.test(t)){var a=po(n,r),[i,s]=go(n,a,r);if(e(i,s,r))return!0}return!sv.test(t)},cv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(fv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(dv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},dv=e=>e>=55296&&e<=56319,fv=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 hv=/^(?:[\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])$/,mv=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,pv=/^(?:[\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])$/,gv=/^[\u1100-\u115F\uA960-\uA97C]$/,vv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,bv=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,yv=/^[\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]$/,Dv=/^[\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]$/,Cv=/^(?:[\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])$/,xv=(e,t)=>{var n=Ce.Any;return e.search(hv)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(mv)!==-1&&(n|=Ce.Prepend),e.search(pv)!==-1&&(n|=Ce.SpacingMark),e.search(gv)!==-1&&(n|=Ce.L),e.search(vv)!==-1&&(n|=Ce.V),e.search(bv)!==-1&&(n|=Ce.T),e.search(yv)!==-1&&(n|=Ce.LV),e.search(Dv)!==-1&&(n|=Ce.LVT),e.search(Cv)!==-1&&(n|=Ce.ExtPict),n};function Hn(e,t){return(e&t)!==0}var wv=[[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 Ev(e,t){return wv.findIndex(n=>Hn(e,n[0])&&Hn(t,n[1]))===-1}var _v=/(?:[\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$/,Vu=e=>e.search(_v)!==-1,kv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Fv=e=>{var t=e.match(kv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Bv={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=mo(e)}=n;if(P.isPath(a)&&(a=D.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&D.void(e,{at:i}))return;var s=V.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:m,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:p,text:t})}})}};function Ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function aa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ku(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=aa(aa(aa(aa({},Kg),Zg),Yg),Bv),Ca=new WeakMap,Av=e=>Ca.get(e)||!1,Tv=(e,t,n)=>{var r=Ca.get(e)||!1;Ca.set(e,!0);try{t(),n()}finally{Ca.set(e,r)}};function Yd(e,t,n){var r=Ra.get(e)||[],a=$a.get(e)||new Set,i,s,o=m=>{if(m){var p=m.join(",");s.has(p)||(s.add(p),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);Ra.set(e,i),$a.set(e,s)}var Sv=(e,t)=>{for(var n of D.pathRefs(e))zg.transform(n,t);for(var r of D.pointRefs(e))qg.transform(r,t);for(var a of D.rangeRefs(e))Wg.transform(a,t);if(!Av(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Yd(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),wr.get(e)||(wr.set(e,!0),Promise.resolve().then(()=>{wr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},jv=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(ue.nodes(r),$=>{var[,R]=$;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:m}=t;if(P.equals(c,m))return[];var p=[],h=[];for(var g of P.ancestors(c)){var f=P.transform(g,t);p.push(f)}for(var b of P.ancestors(m)){var v=P.transform(b,t);h.push(v)}var _=h[h.length-1],F=m[m.length-1],x=_.concat(F);return[...p,...h,x]}case"remove_node":{var{path:w}=t,B=P.ancestors(w);return[...B]}case"split_node":{var{path:S}=t,z=P.levels(S),M=P.next(S);return[...z,M]}default:return[]}},Ov=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Pv=(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=D.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],c=l.children[s-1],m=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(c==null||!fe.isText(c)){var h={text:""};X.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Nv=(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},Mv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=D.path(t,i),l=a==="lowest";for(var[u,c]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(V.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Iv=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,p)=>{if(!fe.isText(m))return!1;var[h,g]=D.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=Yu(Yu({},D.marks(e)||{}),{},{[t]:n});e.marks=c,wr.get(e)||e.onChange()}}};function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Qu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of D.positions(t,Qu(Qu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ju(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var $v=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of D.positions(t,Xu(Xu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},Lv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},zv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&X.delete(e,{unit:t})},qv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Wv=(e,t)=>[D.start(e,t),D.end(e,t)];function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){lt(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 Uv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,tl(tl({},n),{},{match:r=>de.isElement(r)&&D.isElementReadOnly(t,r)}))},Hv=(e,t)=>D.point(e,t,{edge:"end"}),Vv=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},Kv=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){lt(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 Zv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,rl(rl({},n),{},{match:r=>de.isElement(r)&&D.isVoid(t,r)}))},Yv=(e,t)=>t.children.some(n=>de.isElement(n)&&D.isBlock(e,n)),Gv=(e,t)=>t.children.some(n=>fe.isText(n)||D.isInline(e,n)),Qv=(e,t)=>ue.has(e,t),Jv=(e,t)=>t.children.every(n=>fe.isText(n)),Xv=e=>{X.splitNodes(e,{always:!0})},e0=(e,t,n)=>{X.insertNodes(e,t,n)},t0=e=>{X.splitNodes(e,{always:!0})};function al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function n0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var r0=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=n0({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},a0=(e,t)=>!e.isInline(t),i0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),s0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},o0=(e,t,n)=>{var r=D.end(e,n);return Ee.equals(t,r)},u0=e=>{var t=Kd.get(e);return t===void 0?!0:t},l0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return Ee.equals(t,r)},c0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},d0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function f0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var h0=["text"],m0=["text"],p0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Gt(u,h0);return c}else return{}}var{path:m}=a,[p]=D.leaf(t,m);if(a.offset===0){var h=D.previous(t,{at:m,match:fe.isText}),g=D.above(t,{match:x=>de.isElement(x)&&D.isVoid(t,x)&&t.markableVoid(x)});if(!g){var f=D.above(t,{match:x=>de.isElement(x)&&D.isBlock(t,x)});if(h&&f){var[b,v]=h,[,_]=f;P.isAncestor(_,v)&&(p=b)}}}var F=Gt(p,m0);return F},g0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=D.after(t,s,{voids:a});if(o){var[,l]=D.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=D.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},v0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function b0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(nv.isSpan(n))u=n[0],c=n[1];else{var m=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:m,c=i?m:p}var h=ue.nodes(e,{reverse:i,from:u,to:c,pass:x=>{var[w]=x;return de.isElement(w)?!!(!s&&(D.isVoid(e,w)||D.isElementReadOnly(e,w))||o&&!D.isSelectable(e,w)):!1}}),g=[],f;for(var[b,v]of h)if(!(o&&de.isElement(b)&&!D.isSelectable(e,b))){var _=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&_)){if(!l(b,v)){if(a&&!_&&fe.isText(b))return;continue}if(r==="lowest"&&_){f=[b,v];continue}var F=r==="lowest"?f:[b,v];F&&(a?g.push(F):yield F),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var y0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>Ra.get(c)||[],s=c=>$a.get(c)||new Set,o=c=>{var m=i(c).pop(),p=m.join(",");return s(c).delete(p),m};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),c=>{var[,m]=c;return m}),u=new Set(l.map(c=>c.join(",")));Ra.set(t,l),$a.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var c of i(t))if(ue.has(t,c)){var m=D.node(t,c),[p,h]=m;de.isElement(p)&&p.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var _=D.node(t,v);t.normalizeNode(_,{operation:a})}b++,g=i(t)}})}},D0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=P.parent(a),s=D.node(t,i);return s},C0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},x0=e=>{var t=Ou.get(e);return t||(t=new Set,Ou.set(e,t)),t},w0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=P.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},E0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},_0=e=>{var t=Pu.get(e);return t||(t=new Set,Pu.set(e,t)),t},k0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!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(V.isRange(n)){var[u,c]=V.edges(n);return a==="start"?u:c}return n};function F0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=D.range(e,n),[l,u]=V.edges(o),c=a?u:l,m=!1,p="",h=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var _=P.isAncestor(v,u.path)?u:D.end(e,v),F=P.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:F,focus:_},{voids:i}),m=!0}}if(fe.isText(b)){var x=P.equals(v,c.path);for(x?(g=a?c.offset:b.text.length-c.offset,f=c.offset):(g=b.text.length,f=a?g:0),(x||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(h===0){if(p==="")break;h=w(p,r,a),p=go(p,h,a)[1]}if(f=a?f-h:f+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:f}}}}function w(B,S,z){return S==="character"?po(B,z):S==="word"?uv(B,z):S==="line"||S==="block"?B.length:1}}()}var B0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=D.before(t,s,{voids:a});if(o){var[,l]=D.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=D.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},T0=e=>{var t=Nu.get(e);return t||(t=new Set,Nu.set(e,t)),t},S0=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};function 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 j0(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){lt(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 O0=(e,t)=>{var{selection:n}=e;if(n){var r=(c,m)=>{if(!fe.isText(c))return!1;var[p,h]=D.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=j0({},D.marks(e)||{});delete u[t],e.marks=u,wr.get(e)||e.onChange()}}},P0=(e,t)=>{Kd.set(e,t)},N0=(e,t)=>D.point(e,t,{edge:"start"}),M0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=V.edges(i),l="";for(var[u,c]of D.nodes(t,{at:i,match:fe.isText,voids:a})){var m=u.text;P.equals(c,o.path)&&(m=m.slice(0,o.offset)),P.equals(c,s.path)&&(m=m.slice(s.offset)),l+=m}return l},I0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>de.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),c={anchor:u,focus:s},m=!0;for(var[p,h]of D.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(p.text!==""||P.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},R0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},$0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var m=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(m=!0,u=u.anchor),Ee.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},c=!0}}if(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!c){var[,b]=V.edges(u),v=D.end(t,[]);Ee.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[_,F]=V.edges(u),x=D.above(t,{match:he=>de.isElement(he)&&D.isBlock(t,he),at:_,voids:l}),w=D.above(t,{match:he=>de.isElement(he)&&D.isBlock(t,he),at:F,voids:l}),B=x&&w&&!P.equals(x[1],w[1]),S=P.equals(_.path,F.path),z=l?null:(r=D.void(t,{at:_,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:_,mode:"highest"}),M=l?null:(a=D.void(t,{at:F,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:F,mode:"highest"});if(z){var $=D.before(t,_);$&&x&&P.isAncestor(x[1],$.path)&&(_=$)}if(M){var R=D.after(t,F);R&&w&&P.isAncestor(w[1],R.path)&&(F=R)}var k=[],A;for(var j of D.nodes(t,{at:u,voids:l})){var[L,H]=j;A&&P.compare(H,A)===0||(!l&&de.isElement(L)&&(D.isVoid(t,L)||D.isElementReadOnly(t,L))||!P.isCommon(H,_.path)&&!P.isCommon(H,F.path))&&(k.push(j),A=H)}var Z=Array.from(k,he=>{var[,pe]=he;return D.pathRef(t,pe)}),Q=D.pointRef(t,_),ae=D.pointRef(t,F),C="";if(!S&&!z){var q=Q.current,[Y]=D.leaf(t,q),{path:E}=q,{offset:T}=_,N=Y.text.slice(T);N.length>0&&(t.apply({type:"remove_text",path:E,offset:T,text:N}),C=N)}if(Z.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>X.removeNodes(t,{at:he,voids:l})),!M){var I=ae.current,[U]=D.leaf(t,I),{path:ne}=I,te=S?_.offset:0,ie=U.text.slice(te,F.offset);ie.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:ie}),C=ie)}!S&&B&&ae.current&&Q.current&&X.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),m&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var le=Q.unref(),J=ae.unref(),ge=i?le||J:J||le;n.at==null&&ge&&X.select(t,ge)}}})},L0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=mo(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var c=D.above(t,{at:s,match:N=>de.isElement(N)&&D.isInline(t,N),mode:"highest",voids:i});if(c){var[,m]=c;if(D.isEnd(t,s,m)){var p=D.after(t,m);s=p}else if(D.isStart(t,s,m)){var h=D.before(t,m);s=h}}var g=D.above(t,{match:N=>de.isElement(N)&&D.isBlock(t,N),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),_=b&&v,F=!b||b&&v,x=!v,[,w]=ue.first({children:n},[]),[,B]=ue.last({children:n},[]),S=[],z=N=>{var[I,U]=N,ne=U.length===0;return ne?!1:_?!0:!(F&&P.isAncestor(U,w)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||x&&P.isAncestor(U,B)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var M of ue.nodes({children:n},{pass:z}))z(M)&&S.push(M);var $=[],R=[],k=[],A=!0,j=!1;for(var[L]of S)de.isElement(L)&&!t.isInline(L)?(A=!1,j=!0,R.push(L)):A?$.push(L):k.push(L);var[H]=D.nodes(t,{at:s,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i}),[,Z]=H,Q=D.isStart(t,s,Z),ae=D.isEnd(t,s,Z),C=D.pathRef(t,v&&!k.length?P.next(f):f),q=D.pathRef(t,ae?P.next(Z):Z);X.splitNodes(t,{at:s,match:N=>j?de.isElement(N)&&D.isBlock(t,N):fe.isText(N)||D.isInline(t,N),mode:j?"lowest":"highest",always:j&&(!b||$.length>0)&&(!v||k.length>0),voids:i});var Y=D.pathRef(t,!Q||Q&&ae?P.next(Z):Z);if(X.insertNodes(t,$,{at:Y.current,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i,batchDirty:o}),_&&!$.length&&R.length&&!k.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,R,{at:C.current,match:N=>de.isElement(N)&&D.isBlock(t,N),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,k,{at:q.current,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i,batchDirty:o}),!r.at){var E;if(k.length>0&&q.current?E=P.previous(q.current):R.length>0&&C.current?E=P.previous(C.current):Y.current&&(E=P.previous(Y.current)),E){var T=D.end(t,E);X.select(t,T)}}Y.unref(),C.unref(),q.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]=V.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);X.select(t,s)}}else return},q0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},W0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var p=s?D.before(t,l,c):D.after(t,l,c);p&&(m.anchor=p)}if(o==null||o==="focus"){var h=s?D.before(t,u,c):D.after(t,u,c);h&&(m.focus=h)}X.setSelection(t,m)}},U0=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){X.setSelection(e,t);return}if(!V.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var H0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:ol(ol({},l),n)})}},V0=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ee.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ee.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})}},K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=mo(t),c!==!1&&(c=!0)),c==null&&(c=!1),V.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,p]=V.edges(l),h=D.pointRef(t,p);X.delete(t,{at:l}),l=h.unref()}if(Ee.isPoint(l)){u==null&&(fe.isText(m)?u=$=>fe.isText($):t.isInline(m)?u=$=>fe.isText($)||D.isInline(t,$):u=$=>de.isElement($)&&D.isBlock(t,$));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var _=b.unref();l=v?P.next(_):_}else return}var F=P.parent(l),x=l[l.length-1];if(!(!i&&D.void(t,{at:F}))){if(o){var w=[],B=P.levels(F);Tv(t,()=>{var $=function(){var A=F.concat(x);x++;var j={type:"insert_node",path:A,node:R};t.apply(j),l=P.next(l),w.push(j),fe.isText?B.push(...Array.from(ue.nodes(R),L=>{var[,H]=L;return A.concat(H)})):B.push(A)};for(var R of n)$()},()=>{Yd(t,B,$=>{var R=$;for(var k of w)if(P.operationCanTransformPath(k)&&(R=P.transform(R,k),!R))return null;return R})})}else for(var S of n){var z=F.concat(x);x++,t.apply({type:"insert_node",path:z,node:S}),l=P.next(l)}if(l=P.previous(l),c){var M=D.end(t,l);M&&X.select(t,M)}}}})},Z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?ur(t,r):x=>de.isElement(x)&&D.isBlock(t,x)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,x=>{var[,w]=x;return D.pathRef(t,w)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var m=D.node(t,P.parent(c)),[p,h]=m,g=c[c.length-1],{length:f}=p.children;if(f===1){var b=P.next(h);X.moveNodes(t,{at:c,to:b,voids:i}),X.removeNodes(t,{at:h,voids:i})}else if(g===0)X.moveNodes(t,{at:c,to:h,voids:i});else if(g===f-1){var v=P.next(h);X.moveNodes(t,{at:c,to:v,voids:i})}else{var _=P.next(c),F=P.next(h);X.splitNodes(t,{at:_,voids:i}),X.moveNodes(t,{at:c,to:F,voids:i})}}}})},Y0=["text"],G0=["children"],Gd=(e,t)=>{if(de.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?Gd(e,n.children[0]):!1}else return!D.isEditor(t)},Q0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=D.parent(t,a);r=$=>l.children.includes($)}else r=$=>de.isElement($)&&D.isBlock(t,$);if(!i&&V.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),c=D.pointRef(t,u);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.select(t,a)}var[m]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!p)){var[h,g]=m,[f,b]=p;if(!(g.length===0||b.length===0)){var v=P.next(b),_=P.common(g,b),F=P.isSibling(g,b),x=Array.from(D.levels(t,{at:g}),$=>{var[R]=$;return R}).slice(_.length).slice(0,-1),w=D.above(t,{at:g,mode:"highest",match:$=>x.includes($)&&Gd(t,$)}),B=w&&D.pathRef(t,w[1]),S,z;if(fe.isText(h)&&fe.isText(f)){var M=Gt(h,Y0);z=f.text.length,S=M}else if(de.isElement(h)&&de.isElement(f)){var M=Gt(h,G0);z=f.children.length,S=M}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(et.stringify(h)," ").concat(et.stringify(f)));F||X.moveNodes(t,{at:g,to:v,voids:s}),B&&X.removeNodes(t,{at:B.current,voids:s}),de.isElement(f)&&D.isEmpty(t,f)||fe.isText(f)&&f.text===""&&b[b.length-1]!==0?X.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:S}),B&&B.unref()}}}})},J0=(e,t)=>{D.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?ur(e,r):h=>de.isElement(h)&&D.isBlock(e,h));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(e,g)});for(var c of u){var m=c.unref(),p=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:p}),o.current&&P.isSibling(p,m)&&P.isAfter(p,m)&&(o.current=P.next(o.current))}o.unref()}})},X0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?ur(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),!r&&V.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(t,g)});for(var c of u){var m=c.unref();if(m){var[p]=D.node(t,m);t.apply({type:"remove_node",path:m,node:p})}}}})},eb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:m=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?ur(t,i):z=>de.isElement(z)&&D.isBlock(t,z)),!l&&V.isRange(i)&&(i=D.unhangRange(t,i,{voids:m})),c&&V.isRange(i)){if(V.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[h,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=D.isStart(t,h,h.path);X.splitNodes(t,{at:h,match:a,mode:f,voids:m,always:!v}),i=p.unref(),r.at==null&&X.select(t,i)}s||(s=(z,M)=>z!==M);for(var[_,F]of D.nodes(t,{at:i,match:a,mode:u,voids:m})){var x={},w={};if(F.length!==0){var B=!1;for(var S in n)S==="children"||S==="text"||s(n[S],_[S])&&(B=!0,_.hasOwnProperty(S)&&(x[S]=_[S]),o?n[S]!=null&&(w[S]=o(_[S],n[S])):n[S]!=null&&(w[S]=n[S]));B&&t.apply({type:"set_node",path:F,properties:x,newProperties:w})}}}})},tb=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=D.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},nb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ae=>de.isElement(ae)&&D.isBlock(t,ae)),V.isRange(s)&&(s=tb(t,s)),P.isPath(s)){var u=s,c=D.point(t,u),[m]=D.parent(t,u);i=ae=>ae===m,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,_]=f;if(de.isElement(v)&&t.isInline(v)){var F=D.after(t,_);if(!F){var x={text:""},w=P.next(_);X.insertNodes(t,x,{at:w,voids:a}),F=D.point(t,w)}s=F,l=!0}var B=s.path.length-_.length;o=B+1,l=!0}h=D.pointRef(t,s);var S=s.path.length-o,[,z]=g,M=s.path.slice(0,S),$=o===0?s.offset:s.path[S]+b;for(var[R,k]of D.levels(t,{at:M,reverse:!0,voids:a})){var A=!1;if(k.length<z.length||k.length===0||!a&&de.isElement(R)&&D.isVoid(t,R))break;var j=p.current,L=D.isEnd(t,j,k);if(l||!p||!D.isEdge(t,j,k)){A=!0;var H=ue.extractProps(R);t.apply({type:"split_node",path:k,position:$,properties:H})}$=k[k.length-1]+(A||L?1:0)}if(n.at==null){var Z=h.current||D.end(t,[]);X.select(t,Z)}}finally{var Q;p.unref(),(Q=h)===null||Q===void 0||Q.unref()}}})},rb=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)},ab=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?ur(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),P.isPath(s)&&(s=D.range(t,s));var l=V.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,h=>{var[,g]=h;return D.pathRef(t,g)}).reverse(),m=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=V.intersection(l.current,b)),X.liftNodes(t,{at:b,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of c)m();l&&l.unref()}})};function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ll(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ul(Object(n),!0).forEach(function(r){lt(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 ib=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=ur(t,l):t.isInline(n)?o=b=>de.isElement(b)&&D.isInline(t,b)||fe.isText(b):o=b=>de.isElement(b)&&D.isBlock(t,b)),i&&V.isRange(l)){var[u,c]=V.edges(l),m=D.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:c,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&X.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=V.isRange(l)?V.intersection(l,D.range(t,f)):l;if(!v)return 0;var _=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(_.length>0){var[F]=_,x=_[_.length-1],[,w]=F,[,B]=x;if(w.length===0&&B.length===0)return 0;var S=P.equals(w,B)?P.parent(w):P.common(w,B),z=D.range(t,w,B),M=D.node(t,S),[$]=M,R=S.length+1,k=P.next(B.slice(0,R)),A=ll(ll({},n),{},{children:[]});X.insertNodes(t,A,{at:k,voids:s}),X.moveNodes(t,{at:z,match:j=>de.isAncestor($)&&$.children.includes(j),to:k.concat(0),voids:s})}},g;for(var[,f]of p)g=h()}})},sb=()=>{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 Sv(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iv(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ov(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(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 $0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return x0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rb(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ab(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ib(e,...r)}};return e},ob={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||on.isOperationList(e.redos[0].operations))&&(e.undos.length===0||on.isOperationList(e.undos[0].operations))}},Si=new WeakMap,ji=new WeakMap,Vn={isHistoryEditor(e){return ob.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return ji.get(e)},isSaving(e){return Si.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Vn.isMerging(e);ji.set(e,!1),t(),ji.set(e,n)},withoutSaving(e,t){var n=Vn.isSaving(e);Si.set(e,!1),t(),Si.set(e,n)}},ub=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),Vn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];Vn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(on.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=Vn.isSaving(t),c=Vn.isMerging(t);if(u==null&&(u=cb(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=lb(r,l)),o&&c)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},lb=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),cb=(e,t)=>e.type!=="set_selection",db=mb,Qd="֑-߿יִ-﷽ﹰ-ﻼ",Jd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",fb=new RegExp("^[^"+Jd+"]*["+Qd+"]"),hb=new RegExp("^[^"+Qd+"]*["+Jd+"]");function mb(e){return e=String(e||""),fb.test(e)?"rtl":hb.test(e)?"ltr":"neutral"}const Xd=jn(db);function pb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vo=pb,gb=typeof Zr=="object"&&Zr&&Zr.Object===Object&&Zr,vb=gb,bb=vb,yb=typeof self=="object"&&self&&self.Object===Object&&self,Db=bb||yb||Function("return this")(),ef=Db,Cb=ef,xb=function(){return Cb.Date.now()},wb=xb,Eb=/\s/;function _b(e){for(var t=e.length;t--&&Eb.test(e.charAt(t)););return t}var kb=_b,Fb=kb,Bb=/^\s+/;function Ab(e){return e&&e.slice(0,Fb(e)+1).replace(Bb,"")}var Tb=Ab,Sb=ef,jb=Sb.Symbol,tf=jb,cl=tf,nf=Object.prototype,Ob=nf.hasOwnProperty,Pb=nf.toString,vr=cl?cl.toStringTag:void 0;function Nb(e){var t=Ob.call(e,vr),n=e[vr];try{e[vr]=void 0;var r=!0}catch{}var a=Pb.call(e);return r&&(t?e[vr]=n:delete e[vr]),a}var Mb=Nb,Ib=Object.prototype,Rb=Ib.toString;function $b(e){return Rb.call(e)}var Lb=$b,dl=tf,zb=Mb,qb=Lb,Wb="[object Null]",Ub="[object Undefined]",fl=dl?dl.toStringTag:void 0;function Hb(e){return e==null?e===void 0?Ub:Wb:fl&&fl in Object(e)?zb(e):qb(e)}var Vb=Hb;function Kb(e){return e!=null&&typeof e=="object"}var Zb=Kb,Yb=Vb,Gb=Zb,Qb="[object Symbol]";function Jb(e){return typeof e=="symbol"||Gb(e)&&Yb(e)==Qb}var Xb=Jb,ey=Tb,hl=vo,ty=Xb,ml=0/0,ny=/^[-+]0x[0-9a-f]+$/i,ry=/^0b[01]+$/i,ay=/^0o[0-7]+$/i,iy=parseInt;function sy(e){if(typeof e=="number")return e;if(ty(e))return ml;if(hl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=hl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ey(e);var n=ry.test(e);return n||ay.test(e)?iy(e.slice(2),n?2:8):ny.test(e)?ml:+e}var oy=sy,uy=vo,Oi=wb,pl=oy,ly="Expected a function",cy=Math.max,dy=Math.min;function fy(e,t,n){var r,a,i,s,o,l,u=0,c=!1,m=!1,p=!0;if(typeof e!="function")throw new TypeError(ly);t=pl(t)||0,uy(n)&&(c=!!n.leading,m="maxWait"in n,i=m?cy(pl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var S=r,z=a;return r=a=void 0,u=B,s=e.apply(z,S),s}function g(B){return u=B,o=setTimeout(v,t),c?h(B):s}function f(B){var S=B-l,z=B-u,M=t-S;return m?dy(M,i-z):M}function b(B){var S=B-l,z=B-u;return l===void 0||S>=t||S<0||m&&z>=i}function v(){var B=Oi();if(b(B))return _(B);o=setTimeout(v,f(B))}function _(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function F(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function x(){return o===void 0?s:_(Oi())}function w(){var B=Oi(),S=b(B);if(r=arguments,a=this,l=B,S){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=F,w.flush=x,w}var rf=fy;const hy=jn(rf);var my=rf,py=vo,gy="Expected a function";function vy(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(gy);return py(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),my(e,t,{leading:r,maxWait:t,trailing:a})}var by=vy;const yy=jn(by),gl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,vl=(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 vl(n.overflowY,t)||vl(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},ia=(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,Dy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},bl=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,m=typeof u=="function"?u:H=>H!==u;if(!gl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;gl(g)&&m(g);){if(g=Dy(g),g===p){h.push(g);break}g!=null&&g===document.body&&Pi(g)&&!Pi(document.documentElement)||g!=null&&Pi(g,c)&&h.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:_}=window,{height:F,width:x,top:w,right:B,bottom:S,left:z}=e.getBoundingClientRect(),{top:M,right:$,bottom:R,left:k}=(H=>{const Z=window.getComputedStyle(H);return{top:parseFloat(Z.scrollMarginTop)||0,right:parseFloat(Z.scrollMarginRight)||0,bottom:parseFloat(Z.scrollMarginBottom)||0,left:parseFloat(Z.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?w-M:o==="end"?S+R:w+F/2-M+R,j=l==="center"?z+x/2-k+$:l==="end"?B+$:z-k;const L=[];for(let H=0;H<h.length;H++){const Z=h[H],{height:Q,width:ae,top:C,right:q,bottom:Y,left:E}=Z.getBoundingClientRect();if(s==="if-needed"&&w>=0&&z>=0&&S<=b&&B<=f&&w>=C&&S<=Y&&z>=E&&B<=q)return L;const T=getComputedStyle(Z),N=parseInt(T.borderLeftWidth,10),I=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),ne=parseInt(T.borderBottomWidth,10);let te=0,ie=0;const le="offsetWidth"in Z?Z.offsetWidth-Z.clientWidth-N-U:0,J="offsetHeight"in Z?Z.offsetHeight-Z.clientHeight-I-ne:0,ge="offsetWidth"in Z?Z.offsetWidth===0?0:ae/Z.offsetWidth:0,he="offsetHeight"in Z?Z.offsetHeight===0?0:Q/Z.offsetHeight:0;if(p===Z)te=o==="start"?A:o==="end"?A-b:o==="nearest"?ia(_,_+b,b,I,ne,_+A,_+A+F,F):A-b/2,ie=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:ia(v,v+f,f,N,U,v+j,v+j+x,x),te=Math.max(0,te+_),ie=Math.max(0,ie+v);else{te=o==="start"?A-C-I:o==="end"?A-Y+ne+J:o==="nearest"?ia(C,Y,Q,I,ne+J,A,A+F,F):A-(C+Q/2)+J/2,ie=l==="start"?j-E-N:l==="center"?j-(E+ae/2)+le/2:l==="end"?j-q+U+le:ia(E,q,ae,N,U+le,j,j+x,x);const{scrollLeft:pe,scrollTop:xe}=Z;te=he===0?0:Math.max(0,Math.min(xe+te/he,Z.scrollHeight-Q/he+J)),ie=ge===0?0:Math.max(0,Math.min(pe+ie/ge,Z.scrollWidth-ae/ge+le)),A+=xe-te,j+=pe-ie}L.push({el:Z,top:te,left:ie})}return L},Cy=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function xy(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(bl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of bl(e,Cy(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var wn=[],wy=function(){return wn.some(function(e){return e.activeTargets.length>0})},Ey=function(){return wn.some(function(e){return e.skippedTargets.length>0})},yl="ResizeObserver loop completed with undelivered notifications.",_y=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:yl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=yl),window.dispatchEvent(e)},Mr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Mr||(Mr={}));var En=function(e){return Object.freeze(e)},ky=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,En(this)}return e}(),af=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,En(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}(),bo=function(e){return e instanceof SVGElement&&"getBBox"in e},sf=function(e){if(bo(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)},Dl=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)},Fy=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},Er=typeof window<"u"?window:{},sa=new WeakMap,Cl=/auto|scroll/,By=/^tb|vertical/,Ay=/msie|trident/i.test(Er.navigator&&Er.navigator.userAgent),Pt=function(e){return parseFloat(e||"0")},Gn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new ky((n?t:e)||0,(n?e:t)||0)},xl=En({devicePixelContentBoxSize:Gn(),borderBoxSize:Gn(),contentBoxSize:Gn(),contentRect:new af(0,0,0,0)}),of=function(e,t){if(t===void 0&&(t=!1),sa.has(e)&&!t)return sa.get(e);if(sf(e))return sa.set(e,xl),xl;var n=getComputedStyle(e),r=bo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ay&&n.boxSizing==="border-box",i=By.test(n.writingMode||""),s=!r&&Cl.test(n.overflowY||""),o=!r&&Cl.test(n.overflowX||""),l=r?0:Pt(n.paddingTop),u=r?0:Pt(n.paddingRight),c=r?0:Pt(n.paddingBottom),m=r?0:Pt(n.paddingLeft),p=r?0:Pt(n.borderTopWidth),h=r?0:Pt(n.borderRightWidth),g=r?0:Pt(n.borderBottomWidth),f=r?0:Pt(n.borderLeftWidth),b=m+u,v=l+c,_=f+h,F=p+g,x=o?e.offsetHeight-F-e.clientHeight:0,w=s?e.offsetWidth-_-e.clientWidth:0,B=a?b+_:0,S=a?v+F:0,z=r?r.width:Pt(n.width)-B-w,M=r?r.height:Pt(n.height)-S-x,$=z+b+w+_,R=M+v+x+F,k=En({devicePixelContentBoxSize:Gn(Math.round(z*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:Gn($,R,i),contentBoxSize:Gn(z,M,i),contentRect:new af(m,l,z,M)});return sa.set(e,k),k},uf=function(e,t,n){var r=of(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Mr.DEVICE_PIXEL_CONTENT_BOX:return s;case Mr.BORDER_BOX:return a;default:return i}},Ty=function(){function e(t){var n=of(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=En([n.borderBoxSize]),this.contentBoxSize=En([n.contentBoxSize]),this.devicePixelContentBoxSize=En([n.devicePixelContentBoxSize])}return e}(),lf=function(e){if(sf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Sy=function(){var e=1/0,t=[];wn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new Ty(u.target),m=lf(u.target);o.push(c),u.lastReportedSize=uf(u.target,u.observedBox),m<e&&(e=m)}),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},wl=function(e){wn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(lf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},jy=function(){var e=0;for(wl(e);wy();)e=Sy(),wl(e);return Ey()&&_y(),e>0},Ni,cf=[],Oy=function(){return cf.splice(0).forEach(function(e){return e()})},Py=function(e){if(!Ni){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Oy()}).observe(n,r),Ni=function(){n.textContent="".concat(t?t--:t++)}}cf.push(e),Ni()},Ny=function(e){Py(function(){requestAnimationFrame(e)})},xa=0,My=function(){return!!xa},Iy=250,Ry={attributes:!0,characterData:!0,childList:!0,subtree:!0},El=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],_l=function(e){return e===void 0&&(e=0),Date.now()+e},Mi=!1,$y=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=Iy),!Mi){Mi=!0;var r=_l(t);Ny(function(){var a=!1;try{a=jy()}finally{if(Mi=!1,t=r-_l(),!My())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,Ry)};document.body?n():Er.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),El.forEach(function(n){return Er.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),El.forEach(function(n){return Er.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),As=new $y,kl=function(e){!xa&&e>0&&As.start(),xa+=e,!xa&&As.stop()},Ly=function(e){return!bo(e)&&!Fy(e)&&getComputedStyle(e).display==="inline"},zy=function(){function e(t,n){this.target=t,this.observedBox=n||Mr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=uf(this.target,this.observedBox,!0);return Ly(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),qy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),oa=new WeakMap,Fl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ua=function(){function e(){}return e.connect=function(t,n){var r=new qy(t,n);oa.set(t,r)},e.observe=function(t,n,r){var a=oa.get(t),i=a.observationTargets.length===0;Fl(a.observationTargets,n)<0&&(i&&wn.push(a),a.observationTargets.push(new zy(n,r&&r.box)),kl(1),As.schedule())},e.unobserve=function(t,n){var r=oa.get(t),a=Fl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&wn.splice(wn.indexOf(r),1),r.observationTargets.splice(a,1),kl(-1))},e.disconnect=function(t){var n=this,r=oa.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Wy=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.");ua.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(!Dl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ua.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(!Dl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ua.unobserve(this,t)},e.prototype.disconnect=function(){ua.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Xt={};Object.defineProperty(Xt,"__esModule",{value:!0});var Uy=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ii={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},df={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Uy?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},yo={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 la=1;la<20;la++)yo["f"+la]=111+la;function ii(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return ff(s,t)}),a=function(o){return r.some(function(l){return hf(l,o)})},i=n==null?a:a(n);return i}function Hy(e,t){return ii(e,t)}function Vy(e,t){return ii(e,{byKey:!0},t)}function ff(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Ii)r[Ii[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),m;!(o=(m=c.next()).done);o=!0){var p=m.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Do(p),f=Ii[g];if(p.length>1&&!f&&!df[p]&&!yo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=mf(p)),f&&(r[f]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function hf(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 mf(e){e=Do(e);var t=yo[e]||e.toUpperCase().charCodeAt(0);return t}function Do(e){return e=e.toLowerCase(),e=df[e]||e,e}var Ky=Xt.default=ii,Ri=Xt.isHotkey=ii;Xt.isCodeHotkey=Hy;Xt.isKeyHotkey=Vy;Xt.parseHotkey=ff;Xt.compareHotkey=hf;Xt.toKeyCode=mf;Xt.toKeyName=Do;function Zy(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 nr(e,t){if(e==null)return{};var n=Zy(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 Ir(e){"@babel/helpers - typeof";return Ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ir(e)}function Yy(e,t){if(Ir(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ir(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gy(e){var t=Yy(e,"string");return Ir(t)==="symbol"?t:String(t)}function kt(e,t,n){return t=Gy(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Co=y.createContext(null),pn=()=>{var e=y.useContext(Co);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},pf=parseInt(y.version.split(".")[0],10),Qy=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Bl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ut=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Kn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Jy=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),gf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Xy=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),e1=ut&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),t1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),n1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),r1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),wa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tn=(!Xy||!e1)&&!Jy&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",xo=new WeakMap,wo=new WeakMap,vf=new WeakMap,Ea=new WeakMap,Ts=new WeakMap,Rr=new WeakMap,_n=new WeakMap,La=new WeakMap,si=new WeakMap,Ss=new WeakMap,un=new WeakMap,Cn=new WeakMap,_r=new WeakMap,js=new WeakMap,Eo=new WeakMap,Tt=new WeakMap,Zt=new WeakMap,dt=new WeakMap,rn=new WeakMap,an=new WeakMap,bf=new WeakMap,rr=Symbol("placeholder"),yf=Symbol("mark-placeholder"),a1=globalThis.Text,_o=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,i1=e=>cn(e)&&e.nodeType===8,_t=e=>cn(e)&&e.nodeType===1,cn=e=>{var t=_o(e);return!!t&&e instanceof t.Node},Os=e=>{var t=e&&e.anchorNode&&_o(e.anchorNode);return!!t&&e instanceof t.Selection},Df=e=>cn(e)&&e.nodeType===3,s1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,o1=e=>{var[t,n]=e;if(_t(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Cf(t,a,r?"backward":"forward"),r=a<n;_t(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=l1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},u1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Cf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(i1(a)||_t(a)&&a.childNodes.length===0||_t(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]},l1=(e,t,n)=>{var[r]=Cf(e,t,n);return r},xf=e=>{var t="";if(Df(e)&&e.nodeValue)return e.nodeValue;if(_t(e)){for(var n of Array.from(e.childNodes))t+=xf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
130
- `)}return t},c1=/data-slate-fragment="(.+?)"/m,d1=e=>{var t=e.getData("text/html"),[,n]=t.match(c1)||[];return n},ko=(e,t,n)=>{var{target:r}=t;if(_t(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:ko(e,i,n)},f1=0;class h1{constructor(){kt(this,"id",void 0),this.id="".concat(f1++)}}var ee={androidPendingDiffs:e=>dt.get(e),androidScheduleFlush:e=>{var t;(t=Eo.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);un.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.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=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&D.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=D.point(e,s,{edge:l?"start":"end"}),c=l?D.before(e,u):D.after(e,u);if(c){var m=D.range(e,c);return m}}var p,{document:h}=ee.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=La.get(t);return n||(n=new h1,La.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=wo.get(r);if(a==null){if(D.isEditor(r))return n;break}var i=xo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(et.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!un.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(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,D.start(t,[])),t.onChange()),un.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=vf.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=ee.toDOMNode(t,t),s;try{s=_t(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)=>cn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return D.hasPath(e,n.path)&&D.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>cn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Cn.get(e),isFocused:e=>!!un.get(e),isReadOnly:e=>!!Ss.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ss.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&D.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=si.get(e),r=D.isEditor(t)?Ea.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(et.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=D.node(e,t.path),r=ee.toDOMNode(e,n),a;D.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:m}=c.textContent,p=u.getAttribute("data-slate-length"),h=p==null?m:parseInt(p,10),g=o+h,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof a1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var _=Math.min(m,Math.max(0,t.offset-o));a=[c,_];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(et.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=V.isBackward(t),i=ee.toDOMPoint(e,n),s=V.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[m,p]=a?i:s,h=_t(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),f=_t(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(m,b?1:p),l},toSlateNode:(e,t)=>{var n=_t(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Rr.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:o1(t),o=i.parentNode,l=null,u=0;if(o){var c,m,p=ee.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=ee.getWindow(e),_=v.document.createRange();_.setStart(l,0),_.setEnd(i,s);var F=_.cloneContents(),x=[...Array.prototype.slice.call(F.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(F.querySelectorAll("[contenteditable=false]"))];x.forEach(j=>{if(ut&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=F.textContent.length,b=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),B=0;B<w.length;B++){var S=w[B];if(ee.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&ut&&b.getAttribute("data-slate-zero-width")==="z"&&(c=b.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Kn&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
129
+ */function _u(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return _u(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(_u(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var zd=Symbol.for("immer-nothing"),ku=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state"),Tg=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 ft(e,...t){if(process.env.NODE_ENV!=="production"){const n=Tg[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 tr=Object.getPrototypeOf;function Bn(e){return!!e&&!!e[yt]}function An(e){var t;return e?qd(e)||Array.isArray(e)||!!e[ku]||!!((t=e.constructor)!=null&&t[ku])||ni(e)||ri(e):!1}var Sg=Object.prototype.constructor.toString();function qd(e){if(!e||typeof e!="object")return!1;const t=tr(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)===Sg}function Na(e,t){ti(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ti(e){const t=e[yt];return t?t.type_:Array.isArray(e)?1:ni(e)?2:ri(e)?3:0}function ws(e,t){return ti(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Wd(e,t,n){const r=ti(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function jg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ni(e){return e instanceof Map}function ri(e){return e instanceof Set}function yn(e){return e.copy_||e.base_}function Es(e,t){if(ni(e))return new Map(e);if(ri(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=qd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[yt];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(tr(e),r)}else{const r=tr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function co(e,t=!1){return ai(e)||Bn(e)||!An(e)||(ti(e)>1&&(e.set=e.add=e.clear=e.delete=Og),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>co(r,!0))),e}function Og(){ft(2)}function ai(e){return Object.isFrozen(e)}var Pg={};function Tn(e){const t=Pg[e];return t||ft(0,e),t}var Or;function Ud(){return Or}function Ng(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Fu(e,t){t&&(Tn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _s(e){ks(e),e.drafts_.forEach(Mg),e.drafts_=null}function ks(e){e===Or&&(Or=e.parent_)}function Bu(e){return Or=Ng(Or,e)}function Mg(e){const t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Au(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[yt].modified_&&(_s(t),ft(4)),An(e)&&(e=Ma(t,e),t.parent_||Ia(t,e)),t.patches_&&Tn("Patches").generateReplacementPatches_(n[yt].base_,e,t.patches_,t.inversePatches_)):e=Ma(t,n,[]),_s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==zd?e:void 0}function Ma(e,t,n){if(ai(t))return t;const r=t[yt];if(!r)return Na(t,(a,i)=>Tu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ia(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),Na(i,(o,l)=>Tu(e,r,a,o,l,n,s)),Ia(e,a,!1),n&&e.patches_&&Tn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Tu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&ft(5),Bn(a)){const o=i&&t&&t.type_!==3&&!ws(t.assigned_,r)?i.concat(r):void 0,l=Ma(e,a,o);if(Wd(n,r,l),Bn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(An(a)&&!ai(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ma(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ia(e,a)}}function Ia(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&co(t,n)}function Ig(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ud(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=fo;n&&(a=[r],i=Pr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var fo={get(e,t){if(t===yt)return e;const n=yn(e);if(!ws(n,t))return Rg(e,n,t);const r=n[t];return e.finalized_||!An(r)?r:r===Ai(e.base_,t)?(Ti(e),e.copy_[t]=Bs(r,e)):r},has(e,t){return t in yn(e)},ownKeys(e){return Reflect.ownKeys(yn(e))},set(e,t,n){const r=Hd(yn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Ai(yn(e),t),i=a==null?void 0:a[yt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(jg(n,a)&&(n!==void 0||ws(e.base_,t)))return!0;Ti(e),Fs(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 Ai(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ti(e),Fs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=yn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ft(11)},getPrototypeOf(e){return tr(e.base_)},setPrototypeOf(){ft(12)}},Pr={};Na(fo,(e,t)=>{Pr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Pr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ft(13),Pr.set.call(this,e,t,void 0)};Pr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ft(14),fo.set.call(this,e[0],t,n,e[0])};function Ai(e,t){const n=e[yt];return(n?yn(n):e)[t]}function Rg(e,t,n){var a;const r=Hd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Hd(e,t){if(!(t in e))return;let n=tr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=tr(n)}}function Fs(e){e.modified_||(e.modified_=!0,e.parent_&&Fs(e.parent_))}function Ti(e){e.copy_||(e.copy_=Es(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $g=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"&&ft(6),r!==void 0&&typeof r!="function"&&ft(7);let a;if(An(t)){const i=Bu(this),s=Bs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?_s(i):ks(i)}return Fu(i,r),Au(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===zd&&(a=void 0),this.autoFreeze_&&co(a,!0),r){const i=[],s=[];Tn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else ft(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){An(e)||ft(8),Bn(e)&&(e=Lg(e));const t=Bu(this),n=Bs(e,void 0);return n[yt].isManual_=!0,ks(t),n}finishDraft(e,t){const n=e&&e[yt];(!n||!n.isManual_)&&ft(9);const{scope_:r}=n;return Fu(r,t),Au(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=Tn("Patches").applyPatches_;return Bn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Bs(e,t){const n=ni(e)?Tn("MapSet").proxyMap_(e,t):ri(e)?Tn("MapSet").proxySet_(e,t):Ig(e,t);return(t?t.scope_:Ud()).drafts_.push(n),n}function Lg(e){return Bn(e)||ft(10,e),Vd(e)}function Vd(e){if(!An(e)||ai(e))return e;const t=e[yt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Es(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Es(e,!0);return Na(n,(r,a)=>{Wd(n,r,Vd(a))}),t&&(t.finalized_=!1),n}var Dt=new $g,ho=Dt.produce;Dt.produceWithPatches.bind(Dt);Dt.setAutoFreeze.bind(Dt);Dt.setUseStrictShallowCopy.bind(Dt);Dt.applyPatches.bind(Dt);var Su=Dt.createDraft.bind(Dt),ju=Dt.finishDraft.bind(Dt),zg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},qg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ee.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Wg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ra=new WeakMap,$a=new WeakMap,wr=new WeakMap,Kd=new WeakMap,Ou=new WeakMap,Pu=new WeakMap,Nu=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:m,newPath:p}=t;if(P.equals(m,p))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var h=p.slice();return P.endsBefore(m,p)&&m.length<p.length&&(h[m.length-1]-=1),h.concat(r.slice(m.length))}else P.isSibling(m,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[p.length-1]+=1):P.endsBefore(m,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Nr(e){"@babel/helpers - typeof";return Nr=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},Nr(e)}function Ug(e,t){if(Nr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Nr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hg(e){var t=Ug(e,"string");return Nr(t)==="symbol"?t:String(t)}function lt(e,t,n){return t=Hg(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vg=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of V.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var p=ue.leaf(e,u),h=p.text.slice(0,d),g=p.text.slice(d);if(p.text=h+m+g,t)for(var[f,b]of V.points(t))t[b]=Ee.transform(f,n);break}case"merge_node":{var{path:v}=n,_=ue.get(e,v),F=P.previous(v),x=ue.get(e,F),w=ue.parent(e,v),B=v[v.length-1];if(fe.isText(_)&&fe.isText(x))x.text+=_.text;else if(!fe.isText(_)&&!fe.isText(x))x.children.push(..._.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(_)," ").concat(et.stringify(x)));if(w.children.splice(B,1),t)for(var[S,z]of V.points(t))t[z]=Ee.transform(S,n);break}case"move_node":{var{path:M,newPath:$}=n;if(P.isAncestor(M,$))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat($,"] because the destination is inside itself."));var R=ue.get(e,M),k=ue.parent(e,M),A=M[M.length-1];k.children.splice(A,1);var j=P.transform(M,n),L=ue.get(e,P.parent(j)),H=j[j.length-1];if(L.children.splice(H,0,R),t)for(var[Z,Q]of V.points(t))t[Q]=Ee.transform(Z,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],q=ue.parent(e,ae);if(q.children.splice(C,1),t)for(var[Y,E]of V.points(t)){var T=Ee.transform(Y,n);if(t!=null&&T!=null)t[E]=T;else{var N=void 0,I=void 0;for(var[U,ne]of ue.texts(e))if(P.compare(ne,ae)===-1)N=[U,ne];else{I=[U,ne];break}var te=!1;N&&I&&(P.equals(I[1],ae)?te=!P.hasPrevious(I[1]):te=P.common(N[1],ae).length<P.common(I[1],ae).length),N&&!te?(Y.path=N[1],Y.offset=N[0].text.length):I?(Y.path=I[1],Y.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:le,text:J}=n;if(J.length===0)break;var ge=ue.leaf(e,ie),he=ge.text.slice(0,le),pe=ge.text.slice(le+J.length);if(ge.text=he+pe,t)for(var[xe,_e]of V.points(t))t[_e]=Ee.transform(xe,n);break}case"set_node":{var{path:Le,properties:Te,newProperties:Ae}=n;if(Le.length===0)throw new Error("Cannot set properties on the root node!");var Pe=ue.get(e,Le);for(var ke in Ae){if(ke==="children"||ke==="text")throw new Error('Cannot set the "'.concat(ke,'" property of nodes!'));var Ve=Ae[ke];Ve==null?delete Pe[ke]:Pe[ke]=Ve}for(var qe in Te)Ae.hasOwnProperty(qe)||delete Pe[qe];break}case"set_selection":{var{newProperties:W}=n;if(W==null)t=W;else{if(t==null){if(!V.isRange(W))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(W)," when there is no current selection."));t=gr({},W)}for(var re in W){var me=W[re];if(me==null){if(re==="anchor"||re==="focus")throw new Error('Cannot remove the "'.concat(re,'" selection property'));delete t[re]}else t[re]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ze}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Ye=ue.get(e,ve),gt=ue.parent(e,ve),Ut=ve[ve.length-1],Bt;if(fe.isText(Ye)){var tt=Ye.text.slice(0,we),Ot=Ye.text.slice(we);Ye.text=tt,Bt=gr(gr({},Ze),{},{text:Ot})}else{var vt=Ye.children.slice(0,we),di=Ye.children.slice(we);Ye.children=vt,Bt=gr(gr({},Ze),{},{children:di})}if(gt.children.splice(Ut+1,0,Bt),t)for(var[lr,Kr]of V.points(t))t[Kr]=Ee.transform(lr,n);break}}return t},Kg={transform(e,t){e.children=Su(e.children);var n=e.selection&&Su(e.selection);try{n=Vg(e,n,t)}finally{e.children=ju(e.children),n?e.selection=Bn(n)?ju(n):n:e.selection=null}}},Zg={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)}},Yg={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)}},Zd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!Zd(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 Gg(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 Gt(e,t){if(e==null)return{};var n=Gg(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 Qg=["anchor","focus"];function Iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Iu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Gt(e,Qg),[r,a]=V.edges(e),[i,s]=V.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:Jg({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ee.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ee.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return nt(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ho(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ee.transform(r.anchor,t,{affinity:i}),u=Ee.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Ru=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),de={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:Ru,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 Ru(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Xg=["children"],ev=["text"],$u=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(et.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Gt(e,Xg);return t}else{var t=Gt(e,ev);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(et.stringify(e)));var n=ho({children:e.children},r=>{var[a,i]=V.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!V.includes(t,h)}});for(var[,o]of s){if(!V.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=ue.leaf(r,o);m.text=m.text.slice(a.offset)}}D.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(et.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=$u.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return $u.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(et.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||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?P.isBefore(o,i):P.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;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=P.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=ue.get(e,o);continue}o=P.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ue.get(e,n);if(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 Lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var on={isNodeOperation(e){return on.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&nt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>on.isOperation(t))},isSelectionOperation(e){return on.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return on.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ue(Ue({},e),{},{type:"remove_node"});case"insert_text":return Ue(Ue({},e),{},{type:"remove_text"});case"merge_node":return Ue(Ue({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return Ue(Ue({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ue(Ue({},e),{},{path:r,newPath:a})}case"remove_node":return Ue(Ue({},e),{},{type:"insert_node"});case"remove_text":return Ue(Ue({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ue(Ue({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ue(Ue({},e),{},{properties:l,newProperties:null}):l==null?Ue(Ue({},e),{},{properties:null,newProperties:o}):Ue(Ue({},e),{},{properties:l,newProperties:o})}case"split_node":return Ue(Ue({},e),{},{type:"merge_node",path:P.next(e.path)})}}},zu=new WeakMap,tv=e=>{var t=zu.get(e);if(t!==void 0)return t;if(!nt(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||nt(e.marks))&&(e.selection===null||V.isRange(e.selection))&&ue.isNodeList(e.children)&&on.isOperationList(e.operations);return zu.set(e,n),n},D={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return tv(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)}},nv={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ee={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ee.compare(e,t)===1},isBefore(e,t){return Ee.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ho(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=P.transform(i,t,Wu(Wu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Uu=void 0,et={setScrubber(e){Uu=e},stringify(e){return JSON.stringify(e,Uu)}},rv=["text"],av=["anchor","focus"];function Hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Gt(i,rv);return s}return Zd(r?a(e):e,r?a(t):t)},isText(e){return nt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>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=[Vt({},e)];for(var r of t){var a=Gt(r,av),[i,s]=V.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:p}=m.text,h=l;if(l+=p,u<=h&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===h)||u>l||d<h||d===h&&h!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<l){var v=d-h;b=Vt(Vt({},g),{},{text:g.text.slice(v)}),g=Vt(Vt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var _=u-h;f=Vt(Vt({},g),{},{text:g.text.slice(0,_)}),g=Vt(Vt({},g),{},{text:g.text.slice(_)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},mo=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],ur=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},po=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?cv(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var p=xv(d,m);if([i,s]=r?[s,p]:[p,i],Hn(i,Ce.ZWJ)&&Hn(s,Ce.ExtPict)&&(r?l=Vu(t.substring(0,o)):l=Vu(t.substring(0,t.length-o)),!l)||Hn(i,Ce.RI)&&Hn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Fv(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Ev(i,s))break;o+=d.length}return o||1},iv=/\s/,sv=/[\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]/,ov=/['\u2018\u2019]/,uv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=po(t,n),[s,o]=go(t,i,n);if(lv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},go=(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)]},lv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(iv.test(t))return!1;if(ov.test(t)){var a=po(n,r),[i,s]=go(n,a,r);if(e(i,s,r))return!0}return!sv.test(t)},cv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(fv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(dv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},dv=e=>e>=55296&&e<=56319,fv=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 hv=/^(?:[\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])$/,mv=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,pv=/^(?:[\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])$/,gv=/^[\u1100-\u115F\uA960-\uA97C]$/,vv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,bv=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,yv=/^[\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]$/,Dv=/^[\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]$/,Cv=/^(?:[\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])$/,xv=(e,t)=>{var n=Ce.Any;return e.search(hv)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(mv)!==-1&&(n|=Ce.Prepend),e.search(pv)!==-1&&(n|=Ce.SpacingMark),e.search(gv)!==-1&&(n|=Ce.L),e.search(vv)!==-1&&(n|=Ce.V),e.search(bv)!==-1&&(n|=Ce.T),e.search(yv)!==-1&&(n|=Ce.LV),e.search(Dv)!==-1&&(n|=Ce.LVT),e.search(Cv)!==-1&&(n|=Ce.ExtPict),n};function Hn(e,t){return(e&t)!==0}var wv=[[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 Ev(e,t){return wv.findIndex(n=>Hn(e,n[0])&&Hn(t,n[1]))===-1}var _v=/(?:[\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$/,Vu=e=>e.search(_v)!==-1,kv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Fv=e=>{var t=e.match(kv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Bv={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=mo(e)}=n;if(P.isPath(a)&&(a=D.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&D.void(e,{at:i}))return;var s=V.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);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&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:m,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:p,text:t})}})}};function Ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function aa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ku(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=aa(aa(aa(aa({},Kg),Zg),Yg),Bv),Ca=new WeakMap,Av=e=>Ca.get(e)||!1,Tv=(e,t,n)=>{var r=Ca.get(e)||!1;Ca.set(e,!0);try{t(),n()}finally{Ca.set(e,r)}};function Yd(e,t,n){var r=Ra.get(e)||[],a=$a.get(e)||new Set,i,s,o=m=>{if(m){var p=m.join(",");s.has(p)||(s.add(p),i.push(m))}};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);Ra.set(e,i),$a.set(e,s)}var Sv=(e,t)=>{for(var n of D.pathRefs(e))zg.transform(n,t);for(var r of D.pointRefs(e))qg.transform(r,t);for(var a of D.rangeRefs(e))Wg.transform(a,t);if(!Av(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Yd(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),wr.get(e)||(wr.set(e,!0),Promise.resolve().then(()=>{wr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},jv=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(ue.nodes(r),$=>{var[,R]=$;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:m}=t;if(P.equals(d,m))return[];var p=[],h=[];for(var g of P.ancestors(d)){var f=P.transform(g,t);p.push(f)}for(var b of P.ancestors(m)){var v=P.transform(b,t);h.push(v)}var _=h[h.length-1],F=m[m.length-1],x=_.concat(F);return[...p,...h,x]}case"remove_node":{var{path:w}=t,B=P.ancestors(w);return[...B]}case"split_node":{var{path:S}=t,z=P.levels(S),M=P.next(S);return[...z,M]}default:return[]}},Ov=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Pv=(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=D.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],m=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==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 h={text:""};X.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(m){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--))}}}},Nv=(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},Mv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=D.path(t,i),l=a==="lowest";for(var[u,d]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(V.isRange(i)){if(P.isAncestor(d,i.anchor.path)&&P.isAncestor(d,i.focus.path))return[u,d]}else if(!P.equals(o,d))return[u,d]}}};function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Iv=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,p)=>{if(!fe.isText(m))return!1;var[h,g]=D.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=Yu(Yu({},D.marks(e)||{}),{},{[t]:n});e.marks=d,wr.get(e)||e.onChange()}}};function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Qu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,Qu(Qu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ju(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var $v=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,Xu(Xu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Lv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},zv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&X.delete(e,{unit:t})},qv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Wv=(e,t)=>[D.start(e,t),D.end(e,t)];function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){lt(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 Uv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,tl(tl({},n),{},{match:r=>de.isElement(r)&&D.isElementReadOnly(t,r)}))},Hv=(e,t)=>D.point(e,t,{edge:"end"}),Vv=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},Kv=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){lt(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 Zv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,rl(rl({},n),{},{match:r=>de.isElement(r)&&D.isVoid(t,r)}))},Yv=(e,t)=>t.children.some(n=>de.isElement(n)&&D.isBlock(e,n)),Gv=(e,t)=>t.children.some(n=>fe.isText(n)||D.isInline(e,n)),Qv=(e,t)=>ue.has(e,t),Jv=(e,t)=>t.children.every(n=>fe.isText(n)),Xv=e=>{X.splitNodes(e,{always:!0})},e0=(e,t,n)=>{X.insertNodes(e,t,n)},t0=e=>{X.splitNodes(e,{always:!0})};function al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function n0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var r0=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=n0({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},a0=(e,t)=>!e.isInline(t),i0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),s0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},o0=(e,t,n)=>{var r=D.end(e,n);return Ee.equals(t,r)},u0=e=>{var t=Kd.get(e);return t===void 0?!0:t},l0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return Ee.equals(t,r)},c0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},d0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function f0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var h0=["text"],m0=["text"],p0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Gt(u,h0);return d}else return{}}var{path:m}=a,[p]=D.leaf(t,m);if(a.offset===0){var h=D.previous(t,{at:m,match:fe.isText}),g=D.above(t,{match:x=>de.isElement(x)&&D.isVoid(t,x)&&t.markableVoid(x)});if(!g){var f=D.above(t,{match:x=>de.isElement(x)&&D.isBlock(t,x)});if(h&&f){var[b,v]=h,[,_]=f;P.isAncestor(_,v)&&(p=b)}}}var F=Gt(p,m0);return F},g0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=D.after(t,s,{voids:a});if(o){var[,l]=D.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},v0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function b0(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(nv.isSpan(n))u=n[0],d=n[1];else{var m=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:m,d=i?m:p}var h=ue.nodes(e,{reverse:i,from:u,to:d,pass:x=>{var[w]=x;return de.isElement(w)?!!(!s&&(D.isVoid(e,w)||D.isElementReadOnly(e,w))||o&&!D.isSelectable(e,w)):!1}}),g=[],f;for(var[b,v]of h)if(!(o&&de.isElement(b)&&!D.isSelectable(e,b))){var _=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&_)){if(!l(b,v)){if(a&&!_&&fe.isText(b))return;continue}if(r==="lowest"&&_){f=[b,v];continue}var F=r==="lowest"?f:[b,v];F&&(a?g.push(F):yield F),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var y0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Ra.get(d)||[],s=d=>$a.get(d)||new Set,o=d=>{var m=i(d).pop(),p=m.join(",");return s(d).delete(p),m};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));Ra.set(t,l),$a.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var m=D.node(t,d),[p,h]=m;de.isElement(p)&&p.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var _=D.node(t,v);t.normalizeNode(_,{operation:a})}b++,g=i(t)}})}},D0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=P.parent(a),s=D.node(t,i);return s},C0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},x0=e=>{var t=Ou.get(e);return t||(t=new Set,Ou.set(e,t)),t},w0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=P.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},E0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},_0=e=>{var t=Pu.get(e);return t||(t=new Set,Pu.set(e,t)),t},k0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!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(V.isRange(n)){var[u,d]=V.edges(n);return a==="start"?u:d}return n};function F0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=D.range(e,n),[l,u]=V.edges(o),d=a?u:l,m=!1,p="",h=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var _=P.isAncestor(v,u.path)?u:D.end(e,v),F=P.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:F,focus:_},{voids:i}),m=!0}}if(fe.isText(b)){var x=P.equals(v,d.path);for(x?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(x||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(h===0){if(p==="")break;h=w(p,r,a),p=go(p,h,a)[1]}if(f=a?f-h:f+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:f}}}}function w(B,S,z){return S==="character"?po(B,z):S==="word"?uv(B,z):S==="line"||S==="block"?B.length:1}}()}var B0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=D.before(t,s,{voids:a});if(o){var[,l]=D.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},T0=e=>{var t=Nu.get(e);return t||(t=new Set,Nu.set(e,t)),t},S0=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};function 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 j0(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){lt(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 O0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!fe.isText(d))return!1;var[p,h]=D.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=j0({},D.marks(e)||{});delete u[t],e.marks=u,wr.get(e)||e.onChange()}}},P0=(e,t)=>{Kd.set(e,t)},N0=(e,t)=>D.point(e,t,{edge:"start"}),M0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=V.edges(i),l="";for(var[u,d]of D.nodes(t,{at:i,match:fe.isText,voids:a})){var m=u.text;P.equals(d,o.path)&&(m=m.slice(0,o.offset)),P.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},I0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>de.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),d={anchor:u,focus:s},m=!0;for(var[p,h]of D.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(p.text!==""||P.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},R0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},$0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(m=!0,u=u.anchor),Ee.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},d=!0}}if(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!d){var[,b]=V.edges(u),v=D.end(t,[]);Ee.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[_,F]=V.edges(u),x=D.above(t,{match:he=>de.isElement(he)&&D.isBlock(t,he),at:_,voids:l}),w=D.above(t,{match:he=>de.isElement(he)&&D.isBlock(t,he),at:F,voids:l}),B=x&&w&&!P.equals(x[1],w[1]),S=P.equals(_.path,F.path),z=l?null:(r=D.void(t,{at:_,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:_,mode:"highest"}),M=l?null:(a=D.void(t,{at:F,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:F,mode:"highest"});if(z){var $=D.before(t,_);$&&x&&P.isAncestor(x[1],$.path)&&(_=$)}if(M){var R=D.after(t,F);R&&w&&P.isAncestor(w[1],R.path)&&(F=R)}var k=[],A;for(var j of D.nodes(t,{at:u,voids:l})){var[L,H]=j;A&&P.compare(H,A)===0||(!l&&de.isElement(L)&&(D.isVoid(t,L)||D.isElementReadOnly(t,L))||!P.isCommon(H,_.path)&&!P.isCommon(H,F.path))&&(k.push(j),A=H)}var Z=Array.from(k,he=>{var[,pe]=he;return D.pathRef(t,pe)}),Q=D.pointRef(t,_),ae=D.pointRef(t,F),C="";if(!S&&!z){var q=Q.current,[Y]=D.leaf(t,q),{path:E}=q,{offset:T}=_,N=Y.text.slice(T);N.length>0&&(t.apply({type:"remove_text",path:E,offset:T,text:N}),C=N)}if(Z.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>X.removeNodes(t,{at:he,voids:l})),!M){var I=ae.current,[U]=D.leaf(t,I),{path:ne}=I,te=S?_.offset:0,ie=U.text.slice(te,F.offset);ie.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:ie}),C=ie)}!S&&B&&ae.current&&Q.current&&X.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),m&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var le=Q.unref(),J=ae.unref(),ge=i?le||J:J||le;n.at==null&&ge&&X.select(t,ge)}}})},L0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=mo(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var d=D.above(t,{at:s,match:N=>de.isElement(N)&&D.isInline(t,N),mode:"highest",voids:i});if(d){var[,m]=d;if(D.isEnd(t,s,m)){var p=D.after(t,m);s=p}else if(D.isStart(t,s,m)){var h=D.before(t,m);s=h}}var g=D.above(t,{match:N=>de.isElement(N)&&D.isBlock(t,N),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),_=b&&v,F=!b||b&&v,x=!v,[,w]=ue.first({children:n},[]),[,B]=ue.last({children:n},[]),S=[],z=N=>{var[I,U]=N,ne=U.length===0;return ne?!1:_?!0:!(F&&P.isAncestor(U,w)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||x&&P.isAncestor(U,B)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var M of ue.nodes({children:n},{pass:z}))z(M)&&S.push(M);var $=[],R=[],k=[],A=!0,j=!1;for(var[L]of S)de.isElement(L)&&!t.isInline(L)?(A=!1,j=!0,R.push(L)):A?$.push(L):k.push(L);var[H]=D.nodes(t,{at:s,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i}),[,Z]=H,Q=D.isStart(t,s,Z),ae=D.isEnd(t,s,Z),C=D.pathRef(t,v&&!k.length?P.next(f):f),q=D.pathRef(t,ae?P.next(Z):Z);X.splitNodes(t,{at:s,match:N=>j?de.isElement(N)&&D.isBlock(t,N):fe.isText(N)||D.isInline(t,N),mode:j?"lowest":"highest",always:j&&(!b||$.length>0)&&(!v||k.length>0),voids:i});var Y=D.pathRef(t,!Q||Q&&ae?P.next(Z):Z);if(X.insertNodes(t,$,{at:Y.current,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i,batchDirty:o}),_&&!$.length&&R.length&&!k.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,R,{at:C.current,match:N=>de.isElement(N)&&D.isBlock(t,N),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,k,{at:q.current,match:N=>fe.isText(N)||D.isInline(t,N),mode:"highest",voids:i,batchDirty:o}),!r.at){var E;if(k.length>0&&q.current?E=P.previous(q.current):R.length>0&&C.current?E=P.previous(C.current):Y.current&&(E=P.previous(Y.current)),E){var T=D.end(t,E);X.select(t,T)}}Y.unref(),C.unref(),q.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]=V.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);X.select(t,s)}}else return},q0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},W0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var p=s?D.before(t,l,d):D.after(t,l,d);p&&(m.anchor=p)}if(o==null||o==="focus"){var h=s?D.before(t,u,d):D.after(t,u,d);h&&(m.focus=h)}X.setSelection(t,m)}},U0=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){X.setSelection(e,t);return}if(!V.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var H0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:ol(ol({},l),n)})}},V0=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ee.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ee.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})}},K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=mo(t),d!==!1&&(d=!0)),d==null&&(d=!1),V.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,p]=V.edges(l),h=D.pointRef(t,p);X.delete(t,{at:l}),l=h.unref()}if(Ee.isPoint(l)){u==null&&(fe.isText(m)?u=$=>fe.isText($):t.isInline(m)?u=$=>fe.isText($)||D.isInline(t,$):u=$=>de.isElement($)&&D.isBlock(t,$));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var _=b.unref();l=v?P.next(_):_}else return}var F=P.parent(l),x=l[l.length-1];if(!(!i&&D.void(t,{at:F}))){if(o){var w=[],B=P.levels(F);Tv(t,()=>{var $=function(){var A=F.concat(x);x++;var j={type:"insert_node",path:A,node:R};t.apply(j),l=P.next(l),w.push(j),fe.isText?B.push(...Array.from(ue.nodes(R),L=>{var[,H]=L;return A.concat(H)})):B.push(A)};for(var R of n)$()},()=>{Yd(t,B,$=>{var R=$;for(var k of w)if(P.operationCanTransformPath(k)&&(R=P.transform(R,k),!R))return null;return R})})}else for(var S of n){var z=F.concat(x);x++,t.apply({type:"insert_node",path:z,node:S}),l=P.next(l)}if(l=P.previous(l),d){var M=D.end(t,l);M&&X.select(t,M)}}}})},Z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?ur(t,r):x=>de.isElement(x)&&D.isBlock(t,x)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,x=>{var[,w]=x;return D.pathRef(t,w)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var m=D.node(t,P.parent(d)),[p,h]=m,g=d[d.length-1],{length:f}=p.children;if(f===1){var b=P.next(h);X.moveNodes(t,{at:d,to:b,voids:i}),X.removeNodes(t,{at:h,voids:i})}else if(g===0)X.moveNodes(t,{at:d,to:h,voids:i});else if(g===f-1){var v=P.next(h);X.moveNodes(t,{at:d,to:v,voids:i})}else{var _=P.next(d),F=P.next(h);X.splitNodes(t,{at:_,voids:i}),X.moveNodes(t,{at:d,to:F,voids:i})}}}})},Y0=["text"],G0=["children"],Gd=(e,t)=>{if(de.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?Gd(e,n.children[0]):!1}else return!D.isEditor(t)},Q0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=D.parent(t,a);r=$=>l.children.includes($)}else r=$=>de.isElement($)&&D.isBlock(t,$);if(!i&&V.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),d=D.pointRef(t,u);X.delete(t,{at:a}),a=d.unref(),n.at==null&&X.select(t,a)}var[m]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!p)){var[h,g]=m,[f,b]=p;if(!(g.length===0||b.length===0)){var v=P.next(b),_=P.common(g,b),F=P.isSibling(g,b),x=Array.from(D.levels(t,{at:g}),$=>{var[R]=$;return R}).slice(_.length).slice(0,-1),w=D.above(t,{at:g,mode:"highest",match:$=>x.includes($)&&Gd(t,$)}),B=w&&D.pathRef(t,w[1]),S,z;if(fe.isText(h)&&fe.isText(f)){var M=Gt(h,Y0);z=f.text.length,S=M}else if(de.isElement(h)&&de.isElement(f)){var M=Gt(h,G0);z=f.children.length,S=M}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(et.stringify(h)," ").concat(et.stringify(f)));F||X.moveNodes(t,{at:g,to:v,voids:s}),B&&X.removeNodes(t,{at:B.current,voids:s}),de.isElement(f)&&D.isEmpty(t,f)||fe.isText(f)&&f.text===""&&b[b.length-1]!==0?X.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:S}),B&&B.unref()}}}})},J0=(e,t)=>{D.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?ur(e,r):h=>de.isElement(h)&&D.isBlock(e,h));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(e,g)});for(var d of u){var m=d.unref(),p=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:p}),o.current&&P.isSibling(p,m)&&P.isAfter(p,m)&&(o.current=P.next(o.current))}o.unref()}})},X0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?ur(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),!r&&V.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(t,g)});for(var d of u){var m=d.unref();if(m){var[p]=D.node(t,m);t.apply({type:"remove_node",path:m,node:p})}}}})},eb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?ur(t,i):z=>de.isElement(z)&&D.isBlock(t,z)),!l&&V.isRange(i)&&(i=D.unhangRange(t,i,{voids:m})),d&&V.isRange(i)){if(V.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[h,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=D.isStart(t,h,h.path);X.splitNodes(t,{at:h,match:a,mode:f,voids:m,always:!v}),i=p.unref(),r.at==null&&X.select(t,i)}s||(s=(z,M)=>z!==M);for(var[_,F]of D.nodes(t,{at:i,match:a,mode:u,voids:m})){var x={},w={};if(F.length!==0){var B=!1;for(var S in n)S==="children"||S==="text"||s(n[S],_[S])&&(B=!0,_.hasOwnProperty(S)&&(x[S]=_[S]),o?n[S]!=null&&(w[S]=o(_[S],n[S])):n[S]!=null&&(w[S]=n[S]));B&&t.apply({type:"set_node",path:F,properties:x,newProperties:w})}}}})},tb=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=D.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},nb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ae=>de.isElement(ae)&&D.isBlock(t,ae)),V.isRange(s)&&(s=tb(t,s)),P.isPath(s)){var u=s,d=D.point(t,u),[m]=D.parent(t,u);i=ae=>ae===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,_]=f;if(de.isElement(v)&&t.isInline(v)){var F=D.after(t,_);if(!F){var x={text:""},w=P.next(_);X.insertNodes(t,x,{at:w,voids:a}),F=D.point(t,w)}s=F,l=!0}var B=s.path.length-_.length;o=B+1,l=!0}h=D.pointRef(t,s);var S=s.path.length-o,[,z]=g,M=s.path.slice(0,S),$=o===0?s.offset:s.path[S]+b;for(var[R,k]of D.levels(t,{at:M,reverse:!0,voids:a})){var A=!1;if(k.length<z.length||k.length===0||!a&&de.isElement(R)&&D.isVoid(t,R))break;var j=p.current,L=D.isEnd(t,j,k);if(l||!p||!D.isEdge(t,j,k)){A=!0;var H=ue.extractProps(R);t.apply({type:"split_node",path:k,position:$,properties:H})}$=k[k.length-1]+(A||L?1:0)}if(n.at==null){var Z=h.current||D.end(t,[]);X.select(t,Z)}}finally{var Q;p.unref(),(Q=h)===null||Q===void 0||Q.unref()}}})},rb=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)},ab=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?ur(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),P.isPath(s)&&(s=D.range(t,s));var l=V.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,h=>{var[,g]=h;return D.pathRef(t,g)}).reverse(),m=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=V.intersection(l.current,b)),X.liftNodes(t,{at:b,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of d)m();l&&l.unref()}})};function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ll(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ul(Object(n),!0).forEach(function(r){lt(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 ib=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=ur(t,l):t.isInline(n)?o=b=>de.isElement(b)&&D.isInline(t,b)||fe.isText(b):o=b=>de.isElement(b)&&D.isBlock(t,b)),i&&V.isRange(l)){var[u,d]=V.edges(l),m=D.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&X.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=V.isRange(l)?V.intersection(l,D.range(t,f)):l;if(!v)return 0;var _=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(_.length>0){var[F]=_,x=_[_.length-1],[,w]=F,[,B]=x;if(w.length===0&&B.length===0)return 0;var S=P.equals(w,B)?P.parent(w):P.common(w,B),z=D.range(t,w,B),M=D.node(t,S),[$]=M,R=S.length+1,k=P.next(B.slice(0,R)),A=ll(ll({},n),{},{children:[]});X.insertNodes(t,A,{at:k,voids:s}),X.moveNodes(t,{at:z,match:j=>de.isAncestor($)&&$.children.includes(j),to:k.concat(0),voids:s})}},g;for(var[,f]of p)g=h()}})},sb=()=>{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 Sv(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iv(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ov(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(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 $0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return x0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rb(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ab(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ib(e,...r)}};return e},ob={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||on.isOperationList(e.redos[0].operations))&&(e.undos.length===0||on.isOperationList(e.undos[0].operations))}},Si=new WeakMap,ji=new WeakMap,Vn={isHistoryEditor(e){return ob.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return ji.get(e)},isSaving(e){return Si.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Vn.isMerging(e);ji.set(e,!1),t(),ji.set(e,n)},withoutSaving(e,t){var n=Vn.isSaving(e);Si.set(e,!1),t(),Si.set(e,n)}},ub=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),Vn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];Vn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(on.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=Vn.isSaving(t),d=Vn.isMerging(t);if(u==null&&(u=cb(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=lb(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},lb=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),cb=(e,t)=>e.type!=="set_selection",db=mb,Qd="֑-߿יִ-﷽ﹰ-ﻼ",Jd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",fb=new RegExp("^[^"+Jd+"]*["+Qd+"]"),hb=new RegExp("^[^"+Qd+"]*["+Jd+"]");function mb(e){return e=String(e||""),fb.test(e)?"rtl":hb.test(e)?"ltr":"neutral"}const Xd=jn(db);function pb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vo=pb,gb=typeof Zr=="object"&&Zr&&Zr.Object===Object&&Zr,vb=gb,bb=vb,yb=typeof self=="object"&&self&&self.Object===Object&&self,Db=bb||yb||Function("return this")(),ef=Db,Cb=ef,xb=function(){return Cb.Date.now()},wb=xb,Eb=/\s/;function _b(e){for(var t=e.length;t--&&Eb.test(e.charAt(t)););return t}var kb=_b,Fb=kb,Bb=/^\s+/;function Ab(e){return e&&e.slice(0,Fb(e)+1).replace(Bb,"")}var Tb=Ab,Sb=ef,jb=Sb.Symbol,tf=jb,cl=tf,nf=Object.prototype,Ob=nf.hasOwnProperty,Pb=nf.toString,vr=cl?cl.toStringTag:void 0;function Nb(e){var t=Ob.call(e,vr),n=e[vr];try{e[vr]=void 0;var r=!0}catch{}var a=Pb.call(e);return r&&(t?e[vr]=n:delete e[vr]),a}var Mb=Nb,Ib=Object.prototype,Rb=Ib.toString;function $b(e){return Rb.call(e)}var Lb=$b,dl=tf,zb=Mb,qb=Lb,Wb="[object Null]",Ub="[object Undefined]",fl=dl?dl.toStringTag:void 0;function Hb(e){return e==null?e===void 0?Ub:Wb:fl&&fl in Object(e)?zb(e):qb(e)}var Vb=Hb;function Kb(e){return e!=null&&typeof e=="object"}var Zb=Kb,Yb=Vb,Gb=Zb,Qb="[object Symbol]";function Jb(e){return typeof e=="symbol"||Gb(e)&&Yb(e)==Qb}var Xb=Jb,ey=Tb,hl=vo,ty=Xb,ml=0/0,ny=/^[-+]0x[0-9a-f]+$/i,ry=/^0b[01]+$/i,ay=/^0o[0-7]+$/i,iy=parseInt;function sy(e){if(typeof e=="number")return e;if(ty(e))return ml;if(hl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=hl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ey(e);var n=ry.test(e);return n||ay.test(e)?iy(e.slice(2),n?2:8):ny.test(e)?ml:+e}var oy=sy,uy=vo,Oi=wb,pl=oy,ly="Expected a function",cy=Math.max,dy=Math.min;function fy(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,p=!0;if(typeof e!="function")throw new TypeError(ly);t=pl(t)||0,uy(n)&&(d=!!n.leading,m="maxWait"in n,i=m?cy(pl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var S=r,z=a;return r=a=void 0,u=B,s=e.apply(z,S),s}function g(B){return u=B,o=setTimeout(v,t),d?h(B):s}function f(B){var S=B-l,z=B-u,M=t-S;return m?dy(M,i-z):M}function b(B){var S=B-l,z=B-u;return l===void 0||S>=t||S<0||m&&z>=i}function v(){var B=Oi();if(b(B))return _(B);o=setTimeout(v,f(B))}function _(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function F(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function x(){return o===void 0?s:_(Oi())}function w(){var B=Oi(),S=b(B);if(r=arguments,a=this,l=B,S){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=F,w.flush=x,w}var rf=fy;const hy=jn(rf);var my=rf,py=vo,gy="Expected a function";function vy(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(gy);return py(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),my(e,t,{leading:r,maxWait:t,trailing:a})}var by=vy;const yy=jn(by),gl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,vl=(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 vl(n.overflowY,t)||vl(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},ia=(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,Dy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},bl=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:H=>H!==u;if(!gl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;gl(g)&&m(g);){if(g=Dy(g),g===p){h.push(g);break}g!=null&&g===document.body&&Pi(g)&&!Pi(document.documentElement)||g!=null&&Pi(g,d)&&h.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:_}=window,{height:F,width:x,top:w,right:B,bottom:S,left:z}=e.getBoundingClientRect(),{top:M,right:$,bottom:R,left:k}=(H=>{const Z=window.getComputedStyle(H);return{top:parseFloat(Z.scrollMarginTop)||0,right:parseFloat(Z.scrollMarginRight)||0,bottom:parseFloat(Z.scrollMarginBottom)||0,left:parseFloat(Z.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?w-M:o==="end"?S+R:w+F/2-M+R,j=l==="center"?z+x/2-k+$:l==="end"?B+$:z-k;const L=[];for(let H=0;H<h.length;H++){const Z=h[H],{height:Q,width:ae,top:C,right:q,bottom:Y,left:E}=Z.getBoundingClientRect();if(s==="if-needed"&&w>=0&&z>=0&&S<=b&&B<=f&&w>=C&&S<=Y&&z>=E&&B<=q)return L;const T=getComputedStyle(Z),N=parseInt(T.borderLeftWidth,10),I=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),ne=parseInt(T.borderBottomWidth,10);let te=0,ie=0;const le="offsetWidth"in Z?Z.offsetWidth-Z.clientWidth-N-U:0,J="offsetHeight"in Z?Z.offsetHeight-Z.clientHeight-I-ne:0,ge="offsetWidth"in Z?Z.offsetWidth===0?0:ae/Z.offsetWidth:0,he="offsetHeight"in Z?Z.offsetHeight===0?0:Q/Z.offsetHeight:0;if(p===Z)te=o==="start"?A:o==="end"?A-b:o==="nearest"?ia(_,_+b,b,I,ne,_+A,_+A+F,F):A-b/2,ie=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:ia(v,v+f,f,N,U,v+j,v+j+x,x),te=Math.max(0,te+_),ie=Math.max(0,ie+v);else{te=o==="start"?A-C-I:o==="end"?A-Y+ne+J:o==="nearest"?ia(C,Y,Q,I,ne+J,A,A+F,F):A-(C+Q/2)+J/2,ie=l==="start"?j-E-N:l==="center"?j-(E+ae/2)+le/2:l==="end"?j-q+U+le:ia(E,q,ae,N,U+le,j,j+x,x);const{scrollLeft:pe,scrollTop:xe}=Z;te=he===0?0:Math.max(0,Math.min(xe+te/he,Z.scrollHeight-Q/he+J)),ie=ge===0?0:Math.max(0,Math.min(pe+ie/ge,Z.scrollWidth-ae/ge+le)),A+=xe-te,j+=pe-ie}L.push({el:Z,top:te,left:ie})}return L},Cy=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function xy(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(bl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of bl(e,Cy(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var wn=[],wy=function(){return wn.some(function(e){return e.activeTargets.length>0})},Ey=function(){return wn.some(function(e){return e.skippedTargets.length>0})},yl="ResizeObserver loop completed with undelivered notifications.",_y=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:yl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=yl),window.dispatchEvent(e)},Mr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Mr||(Mr={}));var En=function(e){return Object.freeze(e)},ky=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,En(this)}return e}(),af=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,En(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}(),bo=function(e){return e instanceof SVGElement&&"getBBox"in e},sf=function(e){if(bo(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)},Dl=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)},Fy=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},Er=typeof window<"u"?window:{},sa=new WeakMap,Cl=/auto|scroll/,By=/^tb|vertical/,Ay=/msie|trident/i.test(Er.navigator&&Er.navigator.userAgent),Pt=function(e){return parseFloat(e||"0")},Gn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new ky((n?t:e)||0,(n?e:t)||0)},xl=En({devicePixelContentBoxSize:Gn(),borderBoxSize:Gn(),contentBoxSize:Gn(),contentRect:new af(0,0,0,0)}),of=function(e,t){if(t===void 0&&(t=!1),sa.has(e)&&!t)return sa.get(e);if(sf(e))return sa.set(e,xl),xl;var n=getComputedStyle(e),r=bo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ay&&n.boxSizing==="border-box",i=By.test(n.writingMode||""),s=!r&&Cl.test(n.overflowY||""),o=!r&&Cl.test(n.overflowX||""),l=r?0:Pt(n.paddingTop),u=r?0:Pt(n.paddingRight),d=r?0:Pt(n.paddingBottom),m=r?0:Pt(n.paddingLeft),p=r?0:Pt(n.borderTopWidth),h=r?0:Pt(n.borderRightWidth),g=r?0:Pt(n.borderBottomWidth),f=r?0:Pt(n.borderLeftWidth),b=m+u,v=l+d,_=f+h,F=p+g,x=o?e.offsetHeight-F-e.clientHeight:0,w=s?e.offsetWidth-_-e.clientWidth:0,B=a?b+_:0,S=a?v+F:0,z=r?r.width:Pt(n.width)-B-w,M=r?r.height:Pt(n.height)-S-x,$=z+b+w+_,R=M+v+x+F,k=En({devicePixelContentBoxSize:Gn(Math.round(z*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:Gn($,R,i),contentBoxSize:Gn(z,M,i),contentRect:new af(m,l,z,M)});return sa.set(e,k),k},uf=function(e,t,n){var r=of(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Mr.DEVICE_PIXEL_CONTENT_BOX:return s;case Mr.BORDER_BOX:return a;default:return i}},Ty=function(){function e(t){var n=of(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=En([n.borderBoxSize]),this.contentBoxSize=En([n.contentBoxSize]),this.devicePixelContentBoxSize=En([n.devicePixelContentBoxSize])}return e}(),lf=function(e){if(sf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Sy=function(){var e=1/0,t=[];wn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Ty(u.target),m=lf(u.target);o.push(d),u.lastReportedSize=uf(u.target,u.observedBox),m<e&&(e=m)}),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},wl=function(e){wn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(lf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},jy=function(){var e=0;for(wl(e);wy();)e=Sy(),wl(e);return Ey()&&_y(),e>0},Ni,cf=[],Oy=function(){return cf.splice(0).forEach(function(e){return e()})},Py=function(e){if(!Ni){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Oy()}).observe(n,r),Ni=function(){n.textContent="".concat(t?t--:t++)}}cf.push(e),Ni()},Ny=function(e){Py(function(){requestAnimationFrame(e)})},xa=0,My=function(){return!!xa},Iy=250,Ry={attributes:!0,characterData:!0,childList:!0,subtree:!0},El=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],_l=function(e){return e===void 0&&(e=0),Date.now()+e},Mi=!1,$y=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=Iy),!Mi){Mi=!0;var r=_l(t);Ny(function(){var a=!1;try{a=jy()}finally{if(Mi=!1,t=r-_l(),!My())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,Ry)};document.body?n():Er.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),El.forEach(function(n){return Er.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),El.forEach(function(n){return Er.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),As=new $y,kl=function(e){!xa&&e>0&&As.start(),xa+=e,!xa&&As.stop()},Ly=function(e){return!bo(e)&&!Fy(e)&&getComputedStyle(e).display==="inline"},zy=function(){function e(t,n){this.target=t,this.observedBox=n||Mr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=uf(this.target,this.observedBox,!0);return Ly(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),qy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),oa=new WeakMap,Fl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ua=function(){function e(){}return e.connect=function(t,n){var r=new qy(t,n);oa.set(t,r)},e.observe=function(t,n,r){var a=oa.get(t),i=a.observationTargets.length===0;Fl(a.observationTargets,n)<0&&(i&&wn.push(a),a.observationTargets.push(new zy(n,r&&r.box)),kl(1),As.schedule())},e.unobserve=function(t,n){var r=oa.get(t),a=Fl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&wn.splice(wn.indexOf(r),1),r.observationTargets.splice(a,1),kl(-1))},e.disconnect=function(t){var n=this,r=oa.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Wy=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.");ua.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(!Dl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ua.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(!Dl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ua.unobserve(this,t)},e.prototype.disconnect=function(){ua.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Xt={};Object.defineProperty(Xt,"__esModule",{value:!0});var Uy=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ii={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},df={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Uy?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},yo={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 la=1;la<20;la++)yo["f"+la]=111+la;function ii(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return ff(s,t)}),a=function(o){return r.some(function(l){return hf(l,o)})},i=n==null?a:a(n);return i}function Hy(e,t){return ii(e,t)}function Vy(e,t){return ii(e,{byKey:!0},t)}function ff(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Ii)r[Ii[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var p=m.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Do(p),f=Ii[g];if(p.length>1&&!f&&!df[p]&&!yo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=mf(p)),f&&(r[f]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function hf(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 mf(e){e=Do(e);var t=yo[e]||e.toUpperCase().charCodeAt(0);return t}function Do(e){return e=e.toLowerCase(),e=df[e]||e,e}var Ky=Xt.default=ii,Ri=Xt.isHotkey=ii;Xt.isCodeHotkey=Hy;Xt.isKeyHotkey=Vy;Xt.parseHotkey=ff;Xt.compareHotkey=hf;Xt.toKeyCode=mf;Xt.toKeyName=Do;function Zy(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 nr(e,t){if(e==null)return{};var n=Zy(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 Ir(e){"@babel/helpers - typeof";return Ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ir(e)}function Yy(e,t){if(Ir(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ir(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gy(e){var t=Yy(e,"string");return Ir(t)==="symbol"?t:String(t)}function kt(e,t,n){return t=Gy(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Co=y.createContext(null),pn=()=>{var e=y.useContext(Co);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},pf=parseInt(y.version.split(".")[0],10),Qy=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Bl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ut=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Kn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Jy=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),gf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Xy=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),e1=ut&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),t1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),n1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),r1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),wa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tn=(!Xy||!e1)&&!Jy&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",xo=new WeakMap,wo=new WeakMap,vf=new WeakMap,Ea=new WeakMap,Ts=new WeakMap,Rr=new WeakMap,_n=new WeakMap,La=new WeakMap,si=new WeakMap,Ss=new WeakMap,un=new WeakMap,Cn=new WeakMap,_r=new WeakMap,js=new WeakMap,Eo=new WeakMap,Tt=new WeakMap,Zt=new WeakMap,dt=new WeakMap,rn=new WeakMap,an=new WeakMap,bf=new WeakMap,rr=Symbol("placeholder"),yf=Symbol("mark-placeholder"),a1=globalThis.Text,_o=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,i1=e=>cn(e)&&e.nodeType===8,_t=e=>cn(e)&&e.nodeType===1,cn=e=>{var t=_o(e);return!!t&&e instanceof t.Node},Os=e=>{var t=e&&e.anchorNode&&_o(e.anchorNode);return!!t&&e instanceof t.Selection},Df=e=>cn(e)&&e.nodeType===3,s1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,o1=e=>{var[t,n]=e;if(_t(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Cf(t,a,r?"backward":"forward"),r=a<n;_t(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=l1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},u1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Cf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(i1(a)||_t(a)&&a.childNodes.length===0||_t(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]},l1=(e,t,n)=>{var[r]=Cf(e,t,n);return r},xf=e=>{var t="";if(Df(e)&&e.nodeValue)return e.nodeValue;if(_t(e)){for(var n of Array.from(e.childNodes))t+=xf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
130
+ `)}return t},c1=/data-slate-fragment="(.+?)"/m,d1=e=>{var t=e.getData("text/html"),[,n]=t.match(c1)||[];return n},ko=(e,t,n)=>{var{target:r}=t;if(_t(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.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:ko(e,i,n)},f1=0;class h1{constructor(){kt(this,"id",void 0),this.id="".concat(f1++)}}var ee={androidPendingDiffs:e=>dt.get(e),androidScheduleFlush:e=>{var t;(t=Eo.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);un.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.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=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&D.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=D.point(e,s,{edge:l?"start":"end"}),d=l?D.before(e,u):D.after(e,u);if(d){var m=D.range(e,d);return m}}var p,{document:h}=ee.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=La.get(t);return n||(n=new h1,La.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=wo.get(r);if(a==null){if(D.isEditor(r))return n;break}var i=xo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(et.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!un.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(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,D.start(t,[])),t.onChange()),un.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=vf.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=ee.toDOMNode(t,t),s;try{s=_t(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)=>cn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return D.hasPath(e,n.path)&&D.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>cn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Cn.get(e),isFocused:e=>!!un.get(e),isReadOnly:e=>!!Ss.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ss.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&D.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=si.get(e),r=D.isEditor(t)?Ea.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(et.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=D.node(e,t.path),r=ee.toDOMNode(e,n),a;D.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,p=u.getAttribute("data-slate-length"),h=p==null?m:parseInt(p,10),g=o+h,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof a1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var _=Math.min(m,Math.max(0,t.offset-o));a=[d,_];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(et.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=V.isBackward(t),i=ee.toDOMPoint(e,n),s=V.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,p]=a?i:s,h=_t(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),f=_t(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(m,b?1:p),l},toSlateNode:(e,t)=>{var n=_t(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Rr.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:o1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,p=ee.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=ee.getWindow(e),_=v.document.createRange();_.setStart(l,0),_.setEnd(i,s);var F=_.cloneContents(),x=[...Array.prototype.slice.call(F.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(F.querySelectorAll("[contenteditable=false]"))];x.forEach(j=>{if(ut&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=F.textContent.length,b=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),B=0;B<w.length;B++){var S=w[B];if(ee.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&ut&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Kn&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
131
131
 
132
- `))&&u--}if(ut&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&ee.hasDOMNode(e,z,{editable:!0})){var M=ee.toSlateNode(e,z),{path:$,offset:R}=D.start(e,ee.findPath(e,M));return z.querySelector("[data-slate-leaf]")||(R=s),{path:$,offset:R}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var k=ee.toSlateNode(e,l),A=ee.findPath(e,k);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Os(t)?t.anchorNode:t.startContainer,o,l,u,c,m;if(s)if(Os(t)){if(Kn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),h=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement){let B=function(S){return S.childElementCount>0?B(S.children[0]):S};var g=p.startContainer,f=h.startContainer,b=B(g.children[p.startOffset]),v=B(f.children[h.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=h.endContainer,l=h.endOffset,c=p.startOffset):(o=p.startContainer,l=p.endOffset,c=h.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;gf&&u1(o)||Kn?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Kn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
132
+ `))&&u--}if(ut&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&ee.hasDOMNode(e,z,{editable:!0})){var M=ee.toSlateNode(e,z),{path:$,offset:R}=D.start(e,ee.findPath(e,M));return z.querySelector("[data-slate-leaf]")||(R=s),{path:$,offset:R}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var k=ee.toSlateNode(e,l),A=ee.findPath(e,k);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Os(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Os(t)){if(Kn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),h=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement){let B=function(S){return S.childElementCount>0?B(S.children[0]):S};var g=p.startContainer,f=h.startContainer,b=B(g.children[p.startOffset]),v=B(f.children[h.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=h.endContainer,l=h.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=h.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;gf&&u1(o)||Kn?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=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(Kn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
133
133
 
134
- `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var _;u=o,c=((_=o.textContent)===null||_===void 0?void 0:_.length)||0}var F=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!F)return null;var x=m?F:ee.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!x)return null;var w={anchor:F,focus:x};return V.isExpanded(w)&&V.isForward(w)&&_t(u)&&D.void(e,{at:w.focus,mode:"highest"})&&(w=D.unhangRange(e,w,{voids:!0})),w}};function m1(e,t){var{path:n,diff:r}=t;if(!D.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=P.next(n);if(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function wf(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 p1(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 g1(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 Ef(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=p1(i,a),o=Math.min(i.length-s,a.length-s),l=g1(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 v1(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=wf(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 Ef(e,{start:r,end:l,text:o})}function b1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ps(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!fe.isText(a))return null;var i=D.above(e,{match:o=>de.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.next(e,{at:n,match:fe.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Al(e,t){var n=Ps(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Ps(e,t.focus);return r?{anchor:n,focus:r}:null}function Ns(e,t,n){var r=dt.get(e),a=r==null?void 0:r.find(c=>{var{path:m}=c;return P.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return Ee.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=Ee.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=Ee.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Tl(e,t,n){var r=Ns(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=Ns(e,t.focus,n);return a?{anchor:r,focus:a}:null}function y1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ca(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sl(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var D1=25,C1=200,x1=function(){},w1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function E1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var k=an.get(t);if(an.delete(t),k){var{selection:A}=t,j=Al(t,k);j&&(!A||!V.equals(j,A))&&X.select(t,j)}},m=()=>{var k=rn.get(t);if(rn.delete(t),!!k){if(k.at){var A=Ee.isPoint(k.at)?Ps(t,k.at):Al(t,k.at);if(!A)return;var j=D.range(t,A);(!t.selection||!V.equals(t.selection,j))&&X.select(t,A)}k.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!x()&&!F()){c();return}a||(a=!0,setTimeout(()=>a=!1)),F()&&(a="action");var k=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Zt.set(t,t.marks),x1("flush",rn.get(t),dt.get(t));for(var A=x(),j;j=(L=dt.get(t))===null||L===void 0?void 0:L[0];){var L,H,Z=Tt.get(t);Z!==void 0&&(Tt.delete(t),t.marks=Z),Z&&u===!1&&(u=null);var Q=b1(j);(!t.selection||!V.equals(t.selection,Q))&&X.select(t,Q),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),dt.set(t,(H=dt.get(t))===null||H===void 0?void 0:H.filter(q=>{var{id:Y}=q;return Y!==j.id})),m1(t,j)||(A=!1,rn.delete(t),Zt.delete(t),a="action",an.delete(t),n.cancel(),r.cancel(),k==null||k.unref())}var ae=k==null?void 0:k.unref();if(ae&&!an.get(t)&&(!t.selection||!V.equals(ae,t.selection))&&X.select(t,ae),F()){m();return}A&&n(),n.flush(),r.flush(),c();var C=Zt.get(t);Zt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},h=k=>{i&&clearTimeout(i),i=setTimeout(()=>{Cn.set(t,!1),p()},D1)},g=k=>{Cn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ts.get(t);if(j){if(x()||A){j.style.display="none";return}j.style.removeProperty("display")}},b=(k,A)=>{var j,L=(j=dt.get(t))!==null&&j!==void 0?j:[];dt.set(t,L);var H=ue.leaf(t,k),Z=L.findIndex(C=>P.equals(C.path,k));if(Z<0){var Q=Ef(H.text,A);Q&&L.push({path:k,diff:A,id:l++}),f();return}var ae=v1(H.text,L[Z].diff,A);if(!ae){L.splice(Z,1),f();return}L[Z]=ca(ca({},L[Z]),{},{diff:ae})},v=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,an.delete(t),n.cancel(),r.cancel(),F()&&p(),rn.set(t,{at:j,run:A}),o=setTimeout(p)},_=k=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=k,L=null,H=k.dataTransfer||k.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[Z]=k.getTargetRanges();Z&&(L=ee.toSlateRange(t,Z,{exactMatch:!1,suppressThrow:!0}));var Q=ee.getWindow(t),ae=Q.getSelection();if(!L&&ae&&(Z=ae,L=ee.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),L=(A=L)!==null&&A!==void 0?A:t.selection,!!L){var C=!0;if(j.startsWith("delete")){if(V.isExpanded(L)){var[q,Y]=V.edges(L),E=ue.leaf(t,q.path);if(E.text.length===q.offset&&Y.offset===0){var T=D.next(t,{at:q.path,match:fe.isText});T&&P.equals(T[1],Y.path)&&(L={anchor:Y,focus:Y})}}var N=j.endsWith("Backward")?"backward":"forward",[I,U]=V.edges(L),[ne,te]=D.leaf(t,I.path),ie={text:"",start:I.offset,end:U.offset},le=dt.get(t),J=le==null?void 0:le.find(ve=>P.equals(ve.path,te)),ge=J?[J.diff,ie]:[ie],he=wf(ne.text,...ge);if(he.length===0&&(C=!1),V.isExpanded(L)){if(C&&P.equals(L.anchor.path,L.focus.path)){var pe={path:L.anchor.path,offset:I.offset},xe=D.range(t,pe,pe);return S(xe),b(L.anchor.path,{text:"",end:U.offset,start:I.offset})}return v(()=>D.deleteFragment(t,{direction:N}),{at:L})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:L});case"deleteContent":case"deleteContentForward":{var{anchor:_e}=L;if(C&&V.isCollapsed(L)){var Le=ue.leaf(t,_e.path);if(_e.offset<Le.text.length)return b(_e.path,{text:"",start:_e.offset,end:_e.offset+1})}return v(()=>D.deleteForward(t),{at:L})}case"deleteContentBackward":{var Te,{anchor:Ae}=L,Pe=Os(Z)?Z.isCollapsed:!!((Te=Z)!==null&&Te!==void 0&&Te.collapsed);return C&&Pe&&V.isCollapsed(L)&&Ae.offset>0?b(Ae.path,{text:"",start:Ae.offset-1,end:Ae.offset}):v(()=>D.deleteBackward(t),{at:L})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:L});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:L});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:L});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:L});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:L});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:L});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:L});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:L});case"insertParagraph":return v(()=>D.insertBreak(t),{at:L});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(w1(H))return v(()=>ee.insertData(t,H),{at:L});var ke=H??"";if(Tt.get(t)&&(ke=ke.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(ke)&&(ke=ke.slice(0,-1)),ke.includes(`
134
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var _;u=o,d=((_=o.textContent)===null||_===void 0?void 0:_.length)||0}var F=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!F)return null;var x=m?F:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!x)return null;var w={anchor:F,focus:x};return V.isExpanded(w)&&V.isForward(w)&&_t(u)&&D.void(e,{at:w.focus,mode:"highest"})&&(w=D.unhangRange(e,w,{voids:!0})),w}};function m1(e,t){var{path:n,diff:r}=t;if(!D.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=P.next(n);if(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function wf(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 p1(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 g1(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 Ef(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=p1(i,a),o=Math.min(i.length-s,a.length-s),l=g1(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 v1(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=wf(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 Ef(e,{start:r,end:l,text:o})}function b1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ps(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!fe.isText(a))return null;var i=D.above(e,{match:o=>de.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.next(e,{at:n,match:fe.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Al(e,t){var n=Ps(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Ps(e,t.focus);return r?{anchor:n,focus:r}:null}function Ns(e,t,n){var r=dt.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return P.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return Ee.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=Ee.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=Ee.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Tl(e,t,n){var r=Ns(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=Ns(e,t.focus,n);return a?{anchor:r,focus:a}:null}function y1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ca(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sl(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var D1=25,C1=200,x1=function(){},w1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function E1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var k=an.get(t);if(an.delete(t),k){var{selection:A}=t,j=Al(t,k);j&&(!A||!V.equals(j,A))&&X.select(t,j)}},m=()=>{var k=rn.get(t);if(rn.delete(t),!!k){if(k.at){var A=Ee.isPoint(k.at)?Ps(t,k.at):Al(t,k.at);if(!A)return;var j=D.range(t,A);(!t.selection||!V.equals(t.selection,j))&&X.select(t,A)}k.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!x()&&!F()){d();return}a||(a=!0,setTimeout(()=>a=!1)),F()&&(a="action");var k=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Zt.set(t,t.marks),x1("flush",rn.get(t),dt.get(t));for(var A=x(),j;j=(L=dt.get(t))===null||L===void 0?void 0:L[0];){var L,H,Z=Tt.get(t);Z!==void 0&&(Tt.delete(t),t.marks=Z),Z&&u===!1&&(u=null);var Q=b1(j);(!t.selection||!V.equals(t.selection,Q))&&X.select(t,Q),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),dt.set(t,(H=dt.get(t))===null||H===void 0?void 0:H.filter(q=>{var{id:Y}=q;return Y!==j.id})),m1(t,j)||(A=!1,rn.delete(t),Zt.delete(t),a="action",an.delete(t),n.cancel(),r.cancel(),k==null||k.unref())}var ae=k==null?void 0:k.unref();if(ae&&!an.get(t)&&(!t.selection||!V.equals(ae,t.selection))&&X.select(t,ae),F()){m();return}A&&n(),n.flush(),r.flush(),d();var C=Zt.get(t);Zt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},h=k=>{i&&clearTimeout(i),i=setTimeout(()=>{Cn.set(t,!1),p()},D1)},g=k=>{Cn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ts.get(t);if(j){if(x()||A){j.style.display="none";return}j.style.removeProperty("display")}},b=(k,A)=>{var j,L=(j=dt.get(t))!==null&&j!==void 0?j:[];dt.set(t,L);var H=ue.leaf(t,k),Z=L.findIndex(C=>P.equals(C.path,k));if(Z<0){var Q=Ef(H.text,A);Q&&L.push({path:k,diff:A,id:l++}),f();return}var ae=v1(H.text,L[Z].diff,A);if(!ae){L.splice(Z,1),f();return}L[Z]=ca(ca({},L[Z]),{},{diff:ae})},v=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,an.delete(t),n.cancel(),r.cancel(),F()&&p(),rn.set(t,{at:j,run:A}),o=setTimeout(p)},_=k=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=k,L=null,H=k.dataTransfer||k.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[Z]=k.getTargetRanges();Z&&(L=ee.toSlateRange(t,Z,{exactMatch:!1,suppressThrow:!0}));var Q=ee.getWindow(t),ae=Q.getSelection();if(!L&&ae&&(Z=ae,L=ee.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),L=(A=L)!==null&&A!==void 0?A:t.selection,!!L){var C=!0;if(j.startsWith("delete")){if(V.isExpanded(L)){var[q,Y]=V.edges(L),E=ue.leaf(t,q.path);if(E.text.length===q.offset&&Y.offset===0){var T=D.next(t,{at:q.path,match:fe.isText});T&&P.equals(T[1],Y.path)&&(L={anchor:Y,focus:Y})}}var N=j.endsWith("Backward")?"backward":"forward",[I,U]=V.edges(L),[ne,te]=D.leaf(t,I.path),ie={text:"",start:I.offset,end:U.offset},le=dt.get(t),J=le==null?void 0:le.find(ve=>P.equals(ve.path,te)),ge=J?[J.diff,ie]:[ie],he=wf(ne.text,...ge);if(he.length===0&&(C=!1),V.isExpanded(L)){if(C&&P.equals(L.anchor.path,L.focus.path)){var pe={path:L.anchor.path,offset:I.offset},xe=D.range(t,pe,pe);return S(xe),b(L.anchor.path,{text:"",end:U.offset,start:I.offset})}return v(()=>D.deleteFragment(t,{direction:N}),{at:L})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:L});case"deleteContent":case"deleteContentForward":{var{anchor:_e}=L;if(C&&V.isCollapsed(L)){var Le=ue.leaf(t,_e.path);if(_e.offset<Le.text.length)return b(_e.path,{text:"",start:_e.offset,end:_e.offset+1})}return v(()=>D.deleteForward(t),{at:L})}case"deleteContentBackward":{var Te,{anchor:Ae}=L,Pe=Os(Z)?Z.isCollapsed:!!((Te=Z)!==null&&Te!==void 0&&Te.collapsed);return C&&Pe&&V.isCollapsed(L)&&Ae.offset>0?b(Ae.path,{text:"",start:Ae.offset-1,end:Ae.offset}):v(()=>D.deleteBackward(t),{at:L})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:L});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:L});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:L});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:L});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:L});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:L});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:L});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:L});case"insertParagraph":return v(()=>D.insertBreak(t),{at:L});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(w1(H))return v(()=>ee.insertData(t,H),{at:L});var ke=H??"";if(Tt.get(t)&&(ke=ke.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(ke)&&(ke=ke.slice(0,-1)),ke.includes(`
135
135
  `))return v(()=>{var ve=ke.split(`
136
136
  `);ve.forEach((we,Ze)=>{we&&D.insertText(t,we),Ze!==ve.length-1&&D.insertSoftBreak(t)})},{at:L});if(P.equals(L.anchor.path,L.focus.path)){var[Ve,qe]=V.edges(L),W={start:Ve.offset,end:qe.offset,text:ke};if(ke&&u&&j==="insertCompositionText"){var re=u.start+u.text.search(/\S|$/),me=W.start+W.text.search(/\S|$/);me===re+1&&W.end===u.start+u.text.length?(W.start-=1,u=null,$()):u=!1}else j==="insertText"?u===null?u=W:u&&V.isCollapsed(L)&&u.end+u.text.length===Ve.offset?u=ca(ca({},u),{},{text:u.text+ke}):u=!1:u=!1;if(C){b(Ve.path,W);return}}return v(()=>D.insertText(t,ke),{at:L})}}}},F=()=>!!rn.get(t),x=()=>{var k;return!!((k=dt.get(t))!==null&&k!==void 0&&k.length)},w=()=>F()||x(),B=()=>a,S=k=>{an.set(t,k),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(k){var j=!A||!P.equals(A.anchor.path,k.anchor.path),L=!A||!P.equals(A.anchor.path.slice(0,-1),k.anchor.path.slice(0,-1));(j&&u||L)&&(u=!1),(j||x())&&(s=setTimeout(p,C1))}},z=()=>{(F()||!x())&&p()},M=k=>{x()||(f(!0),setTimeout(f))},$=()=>{F()||(o=setTimeout(p))},R=k=>{if(!(x()||F())&&k.some(j=>ko(t,j,k))){var A;(A=bf.get(t))===null||A===void 0||A()}};return{flush:p,scheduleFlush:$,hasPendingDiffs:x,hasPendingAction:F,hasPendingChanges:w,isFlushing:B,handleUserSelect:S,handleCompositionEnd:h,handleCompositionStart:g,handleDOMBeforeInput:_,handleKeyDown:M,handleDomMutations:R,handleInput:z}}function _1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var $r=wa?y.useLayoutEffect:y.useEffect;function k1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));$r(()=>{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 F1=["node"];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 B1(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){kt(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 A1={subtree:!0,childList:!0,characterData:!0},T1=ut?e=>{var{node:t}=e,n=nr(e,F1);if(!ut)return null;var r=pn(),a=_1(),[i]=y.useState(()=>E1(B1({editor:r},n)));return k1(t,i.handleDomMutations,A1),Eo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,S1=["anchor","focus"],j1=["anchor","focus"],O1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),_f=(e,t)=>{var n=nr(e,S1),r=nr(t,j1);return e[rr]===t[rr]&&O1(n,r)},P1=(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(!V.equals(r,a)||!_f(r,a))return!1}return!0},N1=(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||!_f(r,a))return!1}return!0};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 M1(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){kt(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 I1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=pn(),s=ee.findPath(i,a),o=P.parent(s),l=!!n[yf];return i.isVoid(r)?y.createElement($i,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&D.string(i,o)===""?y.createElement($i,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement($i,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
137
137
  `?y.createElement(Pl,{isTrailing:!0,text:n.text}):y.createElement(Pl,{text:n.text})},Pl=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
138
- `:""),[i]=y.useState(a);return $r(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(R1,{ref:r},i)},R1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),$i=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",M1({},a),!ut||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kf(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){kt(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 $1=ut?300:0;function L1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ml(e){e.current&&(clearTimeout(e.current),e.current=null)}var z1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=_=>y.createElement(W1,kf({},_))}=e,o=pn(),l=y.useRef(null),u=y.useRef(null),[c,m]=y.useState(!1),p=y.useRef(null),h=y.useCallback(_=>{if(L1(l,_==null),_==null){var F;Ts.delete(o),(F=t.onPlaceholderResize)===null||F===void 0||F.call(t,null)}else{if(Ts.set(o,_),!l.current){var x=window.ResizeObserver||Wy;l.current=new x(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,_)})}l.current.observe(_),u.current=_}},[u,t,o]),g=y.createElement(I1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[rr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{m(!0),p.current=null},$1)):(Ml(p),m(!1)),()=>Ml(p)),[f,m]),f&&c){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Cr?"inherit":void 0},contentEditable:!1,ref:h}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},q1=y.memo(z1,(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[rr]===e.leaf[rr]),W1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",kf({},t),n)},U1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=pn(),l=y.useRef(null),u=fe.decorations(s,t),c=ee.findKey(o,s),m=[],p=0;p<u.length;p++){var h=u[p];m.push(y.createElement(q1,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=si.get(o);f?(b==null||b.set(c,f),_n.set(s,f),Rr.set(f,s)):(b==null||b.delete(c),_n.delete(s),l.current&&Rr.delete(l.current)),l.current=f},[l,o,c,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},Ff=y.memo(U1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&N1(t.decorations,e.decorations));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 Ms(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){kt(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 H1=e=>{var{decorations:t,element:n,renderElement:r=_=>y.createElement(K1,Ms({},_)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=pn(),l=G1(),u=o.isInline(n),c=ee.findKey(o,n),m=y.useCallback(_=>{var F=si.get(o);_?(F==null||F.set(c,_),_n.set(n,_),Rr.set(_,n)):(F==null||F.delete(c),_n.delete(n))},[o,c,n]),p=Af({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:m};if(u&&(h["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=Xd(g);f==="rtl"&&(h.dir=f)}if(D.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Ff,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),xo.set(v,0),wo.set(v,n)}return r({attributes:h,children:p,element:n})},V1=y.memo(H1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&P1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),K1=e=>{var{attributes:t,children:n,element:r}=e,a=pn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ms(Ms({},t),{},{style:{position:"relative"}}),n)},Bf=y.createContext(()=>[]),Z1=()=>y.useContext(Bf),Y1=y.createContext(!1),Af=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Z1(),l=pn(),u=ee.findPath(l,n),c=[],m=de.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],f=ee.findKey(l,g),b=D.range(l,h),v=s&&V.intersection(b,s),_=o([g,h]);for(var F of t){var x=V.intersection(F,b);x&&_.push(x)}de.isElement(g)?c.push(y.createElement(Y1.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(V1,{decorations:_,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(y.createElement(Ff,{decorations:_,key:f.id,isLast:m&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),xo.set(g,p),wo.set(g,n)}return c},Tf=y.createContext(!1),G1=()=>y.useContext(Tf),Sf=y.createContext(null),Nn=()=>{var e=y.useContext(Sf);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=pn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.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 J1=3,X1={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"},eD={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"},tD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=X1[e],n=eD[e],r=tD[e],a=t&&Ri(t),i=n&&Ri(n),s=r&&Ri(r);return o=>!!(a&&a(o)||Bl&&i&&i(o)||!Bl&&s&&s(o))},Ke={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},nD=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>ko(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}},rD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class jf extends y.Component{constructor(){super(...arguments),kt(this,"context",null),kt(this,"manager",null),kt(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,rD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=nD(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}}kt(jf,"contextType",Co);var aD=ut?jf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},iD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],sD=["text"];function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var oD=e=>y.createElement(y.Fragment,null,Af(e)),uD=e=>{var t=y.useCallback(T=>y.createElement(lD,Mt({},T)),[]),{autoFocus:n,decorate:r=cD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=dD,style:m={},as:p="div",disableDefaultStyles:h=!1}=e,g=nr(e,iD),f=Nn(),[b,v]=y.useState(!1),_=y.useRef(null),F=y.useRef([]),[x,w]=y.useState(),{onUserInput:B,receivedUserInput:S}=Q1(),[,z]=y.useReducer(T=>T+1,0);bf.set(f,z),Ss.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{_.current&&n&&_.current.focus()},[n]);var $=y.useRef(),R=y.useMemo(()=>yy(()=>{var T=$.current;if((ut||!ee.isComposing(f))&&(!M.isUpdatingSelection||T!=null&&T.isFlushing())&&!M.isDraggingInternally){var N=ee.findDocumentOrShadowRoot(f),{activeElement:I}=N,U=ee.toDOMNode(f,f),ne=N.getSelection();if(I===U?(M.latestElement=I,un.set(f,!0)):un.delete(f),!ne)return X.deselect(f);var{anchorNode:te,focusNode:ie}=ne,le=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te),J=ee.hasEditableTarget(f,ie)||ee.isTargetInsideNonReadonlyVoid(f,ie);if(le&&J){var ge=ee.toSlateRange(f,ne,{exactMatch:!1,suppressThrow:!0});ge&&(!ee.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?X.select(f,ge):T==null||T.handleUserSelect(ge))}s&&(!le||!J)&&X.deselect(f)}},100),[f,s,M]),k=y.useMemo(()=>hy(R,0),[R]);$.current=T1({node:_,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:k}),$r(()=>{var T,N,I;_.current&&(I=_o(_.current))?(vf.set(f,I),Ea.set(f,_.current),_n.set(f,_.current),Rr.set(_.current,f)):_n.delete(f);var{selection:U}=f,ne=ee.findDocumentOrShadowRoot(f),te=ne.getSelection();if(!(!te||!ee.isFocused(f)||(T=$.current)!==null&&T!==void 0&&T.hasPendingAction())){var ie=he=>{var pe=te.type!=="None";if(!(!U&&!pe)){var xe=te.focusNode,_e;if(Kn&&te.rangeCount>1){var Le=te.getRangeAt(0),Te=te.getRangeAt(te.rangeCount-1);Le.startContainer===xe?_e=Te.endContainer:_e=Le.startContainer}else _e=te.anchorNode;var Ae=Ea.get(f),Pe=!1;if(Ae.contains(_e)&&Ae.contains(xe)&&(Pe=!0),pe&&Pe&&U&&!he){var ke=ee.toSlateRange(f,te,{exactMatch:!0,suppressThrow:!0});if(ke&&V.equals(ke,U)){var Ve;if(!M.hasMarkPlaceholder||(Ve=_e)!==null&&Ve!==void 0&&(Ve=Ve.parentElement)!==null&&Ve!==void 0&&Ve.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!ee.hasRange(f,U)){f.selection=ee.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var qe=U&&ee.toDOMRange(f,U);return qe?(ee.isComposing(f)&&!ut?te.collapseToEnd():V.isBackward(U)?te.setBaseAndExtent(qe.endContainer,qe.endOffset,qe.startContainer,qe.startOffset):te.setBaseAndExtent(qe.startContainer,qe.startOffset,qe.endContainer,qe.endOffset),c(f,qe)):te.removeAllRanges(),qe}};te.rangeCount<=1&&ie();var le=((N=$.current)===null||N===void 0?void 0:N.isFlushing())==="action";if(!ut||!le){setTimeout(()=>{M.isUpdatingSelection=!1});return}var J=null,ge=requestAnimationFrame(()=>{if(le){var he=pe=>{try{var xe=ee.toDOMNode(f,f);xe.focus(),ie(pe)}catch{}};he(),J=setTimeout(()=>{he(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),J&&clearTimeout(J)}}});var A=y.useCallback(T=>{if(B(),!s&&ee.hasEditableTarget(f,T.target)&&!fD(T,a)){var N;if($.current)return $.current.handleDOMBeforeInput(T);k.flush(),R.flush();var{selection:I}=f,{inputType:U}=T,ne=T.dataTransfer||T.data||void 0,te=U==="insertCompositionText"||U==="deleteCompositionText";if(te&&ee.isComposing(f))return;var ie=!1;if(U==="insertText"&&I&&V.isCollapsed(I)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&I.anchor.offset!==0){var le,J;ie=!0,f.marks&&(ie=!1);var{anchor:ge}=I,[he,pe]=ee.toDOMPoint(f,ge),xe=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),_e=ee.getWindow(f);if(ie&&xe&&ee.hasDOMNode(f,xe)){var Le,Te=_e==null?void 0:_e.document.createTreeWalker(xe,NodeFilter.SHOW_TEXT).lastChild();Te===he&&((Le=Te.textContent)===null||Le===void 0?void 0:Le.length)===pe&&(ie=!1)}if(ie&&he.parentElement&&(_e==null||(J=_e.getComputedStyle(he.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ae=D.above(f,{at:ge.path,match:re=>de.isElement(re)&&D.isBlock(f,re)});Ae&&ue.string(Ae[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Pe]=T.getTargetRanges();if(Pe){var ke=ee.toSlateRange(f,Pe,{exactMatch:!1,suppressThrow:!1});if(!I||!V.equals(I,ke)){ie=!1;var Ve=!te&&f.selection&&D.rangeRef(f,f.selection);X.select(f,ke),Ve&&_r.set(f,Ve)}}}if(te)return;if(ie||T.preventDefault(),I&&V.isExpanded(I)&&U.startsWith("delete")){var qe=U.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:qe});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&ee.isComposing(f)&&(v(!1),Cn.set(f,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?ee.insertData(f,ne):typeof ne=="string"&&(ie?F.current.push(()=>D.insertText(f,ne)):D.insertText(f,ne));break}}var W=(N=_r.get(f))===null||N===void 0?void 0:N.unref();_r.delete(f),W&&(!f.selection||!V.equals(f.selection,W))&&X.select(f,W)}},[f,R,B,a,s,k]),j=y.useCallback(T=>{T==null?(R.cancel(),k.cancel(),Ea.delete(f),_n.delete(f),_.current&&tn&&_.current.removeEventListener("beforeinput",A)):tn&&T.addEventListener("beforeinput",A),_.current=T},[R,k,f,A]);$r(()=>{var T=ee.getWindow(f);return T.document.addEventListener("selectionchange",k),()=>{T.document.removeEventListener("selectionchange",k)}},[k]);var L=r([f,[]]),H=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,Z=y.useCallback(T=>{if(T&&H){var N;w((N=T.getBoundingClientRect())===null||N===void 0?void 0:N.height)}else w(void 0)},[H]);if(H){var Q=D.start(f,[]);L.push({[rr]:!0,placeholder:i,onPlaceholderResize:Z,anchor:Q,focus:Q})}var{marks:ae}=f;if(M.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&ae){var{anchor:C}=f.selection,q=ue.leaf(f,C.path),Y=nr(q,sD);if(!fe.equals(q,ae,{loose:!0})){M.hasMarkPlaceholder=!0;var E=Object.fromEntries(Object.keys(Y).map(T=>[T,null]));L.push(Mt(Mt(Mt({[yf]:!0},E),ae),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:N}=T,I=ue.leaf(f,N.path);if(ae&&!fe.equals(I,ae,{loose:!0})){Tt.set(f,ae);return}}Tt.delete(f)})}),y.createElement(Tf.Provider,{value:s},y.createElement(Bf.Provider,{value:r},y.createElement(aD,{node:_,receivedUserInput:S},y.createElement(p,Mt(Mt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:tn||!wa?g.spellCheck:!1,autoCorrect:tn||!wa?g.autoCorrect:"false",autoCapitalize:tn||!wa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Mt(Mt({},h?{}:Mt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},x?{minHeight:x}:{})),m),onBeforeInput:y.useCallback(T=>{if(!tn&&!s&&!st(T,g.onBeforeInput)&&ee.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!ee.isComposing(f))){var N=T.data;D.insertText(f,N)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(T=>{if(!st(T,g.onInput)){if($.current){$.current.handleInput();return}for(var N of F.current)N();F.current=[]}},[g.onInput]),onBlur:y.useCallback(T=>{if(!(s||M.isUpdatingSelection||!ee.hasSelectableTarget(f,T.target)||st(T,g.onBlur))){var N=ee.findDocumentOrShadowRoot(f);if(M.latestElement!==N.activeElement){var{relatedTarget:I}=T,U=ee.toDOMNode(f,f);if(I!==U&&!(_t(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&cn(I)&&ee.hasDOMNode(f,I)){var ne=ee.toSlateNode(f,I);if(de.isElement(ne)&&!f.isVoid(ne))return}if(Cr){var te=N.getSelection();te==null||te.removeAllRanges()}un.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,g.onBlur]),onClick:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!st(T,g.onClick)&&cn(T.target)){var N=ee.toSlateNode(f,T.target),I=ee.findPath(f,N);if(!D.hasPath(f,I)||ue.get(f,I)!==N)return;if(T.detail===J1&&I.length>=1){var U=I;if(!(de.isElement(N)&&D.isBlock(f,N))){var ne,te=D.above(f,{match:xe=>de.isElement(xe)&&D.isBlock(f,xe),at:I});U=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:I.slice(0,1)}var ie=D.range(f,U);X.select(f,ie);return}if(s)return;var le=D.start(f,I),J=D.end(f,I),ge=D.void(f,{at:le}),he=D.void(f,{at:J});if(ge&&he&&P.equals(ge[1],he[1])){var pe=D.range(f,le);X.select(f,pe)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var N;if(ee.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Cn.set(f,!1)}),(N=$.current)===null||N===void 0||N.handleCompositionEnd(T),st(T,g.onCompositionEnd)||ut)return;if(!Cr&&!t1&&!Qy&&!r1&&!n1&&T.data){var I=Tt.get(f);Tt.delete(f),I!==void 0&&(Zt.set(f,f.marks),f.marks=I),D.insertText(f,T.data);var U=Zt.get(f);Zt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCompositionUpdate)&&(ee.isComposing(f)||(v(!0),Cn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var N;if((N=$.current)===null||N===void 0||N.handleCompositionStart(T),st(T,g.onCompositionStart)||ut)return;v(!0);var{selection:I}=f;if(I&&V.isExpanded(I)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCopy)&&!$l(T)&&(T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(T=>{if(!s&&ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCut)&&!$l(T)){T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"cut");var{selection:N}=f;if(N)if(V.isExpanded(N))D.deleteFragment(f);else{var I=ue.parent(f,N.anchor.path);D.isVoid(f,I)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!st(T,g.onDragOver)){var N=ee.toSlateNode(f,T.target);de.isElement(N)&&D.isVoid(f,N)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!st(T,g.onDragStart)){var N=ee.toSlateNode(f,T.target),I=ee.findPath(f,N),U=de.isElement(N)&&D.isVoid(f,N)||D.void(f,{at:I,voids:!0});if(U){var ne=D.range(f,I);X.select(f,ne)}M.isDraggingInternally=!0,ee.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,M]),onDrop:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!st(T,g.onDrop)){T.preventDefault();var N=f.selection,I=ee.findEventRange(f,T),U=T.dataTransfer;X.select(f,I),M.isDraggingInternally&&N&&!V.equals(N,I)&&!D.void(f,{at:I,voids:!0})&&X.delete(f,{at:N}),ee.insertData(f,U),ee.isFocused(f)||ee.focus(f)}M.isDraggingInternally=!1},[s,f,g.onDrop,M]),onDragEnd:y.useCallback(T=>{!s&&M.isDraggingInternally&&g.onDragEnd&&ee.hasTarget(f,T.target)&&g.onDragEnd(T),M.isDraggingInternally=!1},[s,M,g,f]),onFocus:y.useCallback(T=>{if(!s&&!M.isUpdatingSelection&&ee.hasEditableTarget(f,T.target)&&!st(T,g.onFocus)){var N=ee.toDOMNode(f,f),I=ee.findDocumentOrShadowRoot(f);if(M.latestElement=I.activeElement,Kn&&T.target!==N){N.focus();return}un.set(f,!0)}},[s,M,f,g.onFocus]),onKeyDown:y.useCallback(T=>{if(!s&&ee.hasEditableTarget(f,T.target)){var N;(N=$.current)===null||N===void 0||N.handleKeyDown(T);var{nativeEvent:I}=T;if(ee.isComposing(f)&&I.isComposing===!1&&(Cn.set(f,!1),v(!1)),st(T,g.onKeyDown)||ee.isComposing(f))return;var{selection:U}=f,ne=f.children[U!==null?U.focus.path[0]:0],te=Xd(ue.string(ne))==="rtl";if(Ke.isRedo(I)){T.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(Ke.isUndo(I)){T.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ke.isMoveLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward(I)){T.preventDefault(),X.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward(I)){T.preventDefault(),U&&V.isCollapsed(U)?X.move(f,{reverse:!te}):X.collapse(f,{edge:te?"end":"start"});return}if(Ke.isMoveForward(I)){T.preventDefault(),U&&V.isCollapsed(U)?X.move(f,{reverse:te}):X.collapse(f,{edge:te?"start":"end"});return}if(Ke.isMoveWordBackward(I)){T.preventDefault(),U&&V.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!te});return}if(Ke.isMoveWordForward(I)){T.preventDefault(),U&&V.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:te});return}if(tn){if((gf||Cr)&&U&&(Ke.isDeleteBackward(I)||Ke.isDeleteForward(I))&&V.isCollapsed(U)){var J=ue.parent(f,U.anchor.path);if(de.isElement(J)&&D.isVoid(f,J)&&(D.isInline(f,J)||D.isBlock(f,J))){T.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold(I)||Ke.isItalic(I)||Ke.isTransposeCharacter(I)){T.preventDefault();return}if(Ke.isSoftBreak(I)){T.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock(I)){T.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(T=>{!s&&ee.hasEditableTarget(f,T.target)&&!st(T,g.onPaste)&&(!tn||s1(T.nativeEvent)||Cr)&&(T.preventDefault(),ee.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),y.createElement(oD,{decorations:L,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},lD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Mt({},t),n,ut&&y.createElement("br",null))},cD=()=>[],dD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),xy(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},st=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},$l=e=>cn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),fD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},hD=y.createContext(!1),mD=y.createContext({});function pD(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 gD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],vD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=nr(e,gD),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:m}=pD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(js.set(t,p),()=>{js.set(t,()=>{})}),[t,p]);var[h,g]=y.useState(ee.isFocused(t));return y.useEffect(()=>{g(ee.isFocused(t))},[t]),$r(()=>{var f=()=>g(ee.isFocused(t));return pf>=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(mD.Provider,{value:c},y.createElement(Sf.Provider,{value:l},y.createElement(Co.Provider,{value:l.editor},y.createElement(hD.Provider,{value:h},n))))},Ll=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},zl=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return Ll(r,a)&&Ll(a,r)},bD=(e,t)=>{var n=D.range(e,V.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(zl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)zl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.range(e,r[i],n)};function 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 Wl(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){kt(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 yD=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 si.set(r,new WeakMap),r.addMark=(u,c)=>{var m,p;(m=Eo.get(r))===null||m===void 0||m(),!Tt.get(r)&&(p=dt.get(r))!==null&&p!==void 0&&p.length&&Tt.set(r,null),Zt.delete(r),o(u,c)},r.removeMark=u=>{var c;!Tt.get(r)&&(c=dt.get(r))!==null&&c!==void 0&&c.length&&Tt.set(r,null),Zt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var c=D.above(r,{match:g=>de.isElement(g)&&D.isBlock(r,g),at:r.selection});if(c){var[,m]=c,p=D.range(r,m,r.selection.anchor),h=bD(r,p);V.isCollapsed(h)||X.delete(r,{at:h})}}},r.apply=u=>{var c=[],m=[],p=dt.get(r);if(p!=null&&p.length){var h=p.map(j=>y1(j,u)).filter(Boolean);dt.set(r,h)}var g=an.get(r);g&&an.set(r,Tl(r,g,u));var f=rn.get(r);if(f!=null&&f.at){var b=Ee.isPoint(f==null?void 0:f.at)?Ns(r,f.at,u):Tl(r,f.at,u);rn.set(r,b?Wl(Wl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Ln(r,u.path));break}case"set_selection":{var v;(v=_r.get(r))===null||v===void 0||v.unref(),_r.delete(r);break}case"insert_node":case"remove_node":{c.push(...Ln(r,P.parent(u.path)));break}case"merge_node":{var _=P.previous(u.path);c.push(...Ln(r,_));break}case"move_node":{var F=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...Ln(r,F));var x;P.isBefore(u.path,u.newPath)?(c.push(...Ln(r,P.parent(u.path))),x=u.newPath):(c.push(...Ln(r,P.parent(u.newPath))),x=u.path);var w=ue.get(t,P.parent(x)),B=ee.findKey(r,w),S=D.pathRef(r,P.parent(x));m.push([S,B]);break}}a(u);for(var[z,M]of c){var[$]=D.node(r,z);La.set($,M)}for(var[R,k]of m)if(R.current){var[A]=D.node(r,R.current);La.set(A,k)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[m,p]=V.edges(c),h=D.void(r,{at:m.path}),g=D.void(r,{at:p.path});if(!(V.isCollapsed(c)&&!h)){var f=ee.toDOMRange(r,c),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(v=$)}),g){var[_]=g,F=f.cloneRange(),x=ee.toDOMNode(r,_);F.setEndAfter(x),b=F.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var R=$.getAttribute("data-slate-zero-width")==="n";$.textContent=R?`
139
- `:""}),Df(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),b.appendChild(w),v=w}var B=r.getFragment(),S=JSON.stringify(B),z=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",xf(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||d1(u);if(c){var m=decodeURIComponent(window.atob(c)),p=JSON.parse(m);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var m=c.split(/\r\n|\r|\n/),p=!1;for(var h of m)p&&X.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var c=pf<18?Sc.unstable_batchedUpdates:m=>m();c(()=>{var m=js.get(r);m&&m(u),i(u)})},r},Ln=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const DD={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},en=y.createContext(DD);var K=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(K||{}),$t=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))($t||{});const CD=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case K.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case K.link:return d.jsx("a",{...e,children:t});case K.li:return d.jsx("li",{...e,children:t});case K.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case K.ol:return d.jsx("ol",{...e,children:t});case K.ul:return d.jsx("ul",{...e,children:t});case K.span:return d.jsx("span",{...e,children:t});case K.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},xD=({attributes:e,children:t,leaf:n})=>{const r=n;return r[K.bold]&&(t=d.jsx("strong",{children:t})),r[K.italic]&&(t=d.jsx("em",{children:t})),r[K.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Is="MENTION: ",Of={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Ul={"mention-popover":35,default:-52},Li=16,Pf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(en),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var h,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,c=0;if(t==="mention-popover"){const{position:f}=i,b=F=>{if(!D.hasPath(e,F.path))return!1;const x=ue.get(e,F.path);return D.isEditor(x)||de.isElement(x)?F.offset<=x.children.length:fe.isText(x)?F.offset<=x.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||Of).getBoundingClientRect();const _=(h=document.getElementById(n))==null?void 0:h.getBoundingClientRect();l.style.setProperty("--width",`${((_==null?void 0:_.width)||0)/Li}rem`),c=(_==null?void 0:_.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 m=Ul[t]||Ul.default,p=((u==null?void 0:u.top)||0)+window.scrollY+m;c===0&&(c=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Li}rem`,l.style.left=`${c/Li}rem`},o),r},wD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===K.link});if(a){const i=a[0],s=Yc(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 ot=(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))(ot||{});const Zn={[K.paragraph]:K.paragraph,[K.blockquote]:K.blockquote,[K.codeblock]:K.codeblock,[K.link]:K.link,[K.ul]:K.ul,[K.ol]:K.ol,[K.li]:K.li,[K.mention]:K.mention,[K.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[$t.emphasis]:K.italic,[$t.strong]:K.bold,[$t.delete]:K.strikethrough,[$t.code]:K.code,[K.hr]:K.hr,[K.image]:K.image};function Hl(e){if(e)throw e}var _a=Object.prototype.hasOwnProperty,Nf=Object.prototype.toString,Vl=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,Zl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Nf.call(t)==="[object Array]"},Yl=function(t){if(!t||Nf.call(t)!=="[object Object]")return!1;var n=_a.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&_a.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||_a.call(t,a)},Gl=function(t,n){Vl&&n.name==="__proto__"?Vl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Ql=function(t,n){if(n==="__proto__")if(_a.call(t,n)){if(Kl)return Kl(t,n).value}else return;return t[n]},ED=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Ql(o,n),a=Ql(t,n),o!==a&&(c&&a&&(Yl(a)||(i=Zl(a)))?(i?(i=!1,s=r&&Zl(r)?r:[]):s=r&&Yl(r)?r:{},Gl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&Gl(o,{name:n,newValue:a}));return o};const zi=jn(ED);function Rs(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 _D(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,c?kD(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function kD(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function kr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jl(e.position):"start"in e||"end"in e?Jl(e):"line"in e||"column"in e?$s(e):""}function $s(e){return Xl(e&&e.line)+":"+Xl(e&&e.column)}function Jl(e){return $s(e&&e.start)+"-"+$s(e&&e.end)}function Xl(e){return e&&typeof e=="number"?e:1}class pt 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=kr(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}}pt.prototype.file="";pt.prototype.name="";pt.prototype.reason="";pt.prototype.message="";pt.prototype.stack="";pt.prototype.column=void 0;pt.prototype.line=void 0;pt.prototype.ancestors=void 0;pt.prototype.cause=void 0;pt.prototype.fatal=void 0;pt.prototype.place=void 0;pt.prototype.ruleId=void 0;pt.prototype.source=void 0;const It={basename:FD,dirname:BD,extname:AD,join:TD,sep:"/"};function FD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ur(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 BD(e){if(Ur(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 AD(e){Ur(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 TD(...e){let t=-1,n;for(;++t<e.length;)Ur(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":SD(n)}function SD(e){Ur(e);const t=e.codePointAt(0)===47;let n=jD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jD(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 Ur(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OD={cwd:PD};function PD(){return"/"}function Ls(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ND(e){if(typeof e=="string")e=new URL(e);else if(!Ls(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 MD(e)}function MD(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 qi=["history","path","basename","stem","extname","dirname"];class ID{constructor(t){let n;t?Ls(t)?n={path:t}:typeof t=="string"||RD(t)?n={value:t}:n=t:n={},this.cwd=OD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qi.length;){const i=qi[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)qi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?It.basename(this.path):void 0}set basename(t){Ui(t,"basename"),Wi(t,"basename"),this.path=It.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?It.dirname(this.path):void 0}set dirname(t){ec(this.basename,"dirname"),this.path=It.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?It.extname(this.path):void 0}set extname(t){if(Wi(t,"extname"),ec(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=It.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ls(t)&&(t=ND(t)),Ui(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?It.basename(this.path,this.extname):void 0}set stem(t){Ui(t,"stem"),Wi(t,"stem"),this.path=It.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 pt(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 Wi(e,t){if(e&&e.includes(It.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+It.sep+"`")}function Ui(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ec(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function RD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $D=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},LD={}.hasOwnProperty;class Fo extends $D{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=_D()}copy(){const t=new Fo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(zi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ki("data",this.frozen),this.namespace[t]=n,this):LD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ki("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=da(t),r=this.parser||this.Parser;return Hi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Hi("process",this.parser||this.Parser),Vi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=da(t),l=r.parse(o);r.run(l,o,function(c,m,p){if(c||!m||!p)return u(c);const h=m,g=r.stringify(h,p);WD(g)?p.value=g:p.result=g,u(c,p)});function u(c,m){c||!m?s(c):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Hi("processSync",this.parser||this.Parser),Vi("processSync",this.compiler||this.Compiler),this.process(t,a),nc("processSync","process",n),r;function a(i,s){n=!0,Hl(i),r=s}}run(t,n,r){tc(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=da(n);a.run(t,l,u);function u(c,m,p){const h=m||t;c?o(c):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),nc("runSync","run",r),a;function i(s,o){Hl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=da(n),a=this.compiler||this.Compiler;return Vi("stringify",a),tc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ki("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...m]=u;l(c,m)}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=zi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const m=u[c];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[h,...g]=c;const f=r[p][1];Rs(f)&&Rs(h)&&(h=zi(!0,f,h)),r[p]=[u,h,...g]}}}}const zD=new Fo().freeze();function Hi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ki(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 tc(e){if(!Rs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function da(e){return qD(e)?e:new ID(e)}function qD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function WD(e){return typeof e=="string"||UD(e)}function UD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HD={};function VD(e,t){const n=t||HD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Mf(e,r,a)}function Mf(e,t,n){if(KD(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 rc(e.children,t,n)}return Array.isArray(e)?rc(e,t,n):""}function rc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Mf(e[a],t,n);return r.join("")}function KD(e){return!!(e&&typeof e=="object")}const ac=document.createElement("i");function Bo(e){const t="&"+e+";";ac.innerHTML=t;const n=ac.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qt(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 Et(e,t){return e.length>0?(Qt(e,e.length,0,t),e):t}const ic={}.hasOwnProperty;function ZD(e){const t={};let n=-1;for(;++n<e.length;)YD(t,e[n]);return t}function YD(e,t){let n;for(n in t){const a=(ic.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){ic.call(a,s)||(a[s]=[]);const o=i[s];GD(a[s],Array.isArray(o)?o:o?[o]:[])}}}function GD(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Qt(e,0,0,r)}function If(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 Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=gn(/[A-Za-z]/),St=gn(/[\dA-Za-z]/),QD=gn(/[#-'*+\--9=?A-Z^-~]/);function zs(e){return e!==null&&(e<32||e===127)}const qs=gn(/\d/),JD=gn(/[\dA-Fa-f]/),XD=gn(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const eC=gn(/\p{P}|\p{S}/u),tC=gn(/\s/);function gn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const nC={tokenize:rC};function rC(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"),ze(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 ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const aC={tokenize:iC},sc={tokenize:sC};function iC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(F){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,u)(F)}return u(F)}function l(F){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const x=t.events.length;let w=x,B;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){B=t.events[w][1].end;break}v(r);let S=x;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},B),S++;return Qt(t.events,w+1,0,t.events.slice(x)),t.events.length=S,u(F)}return o(F)}function u(F){if(r===n.length){if(!a)return p(F);if(a.currentConstruct&&a.currentConstruct.concrete)return g(F);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(sc,c,m)(F)}function c(F){return a&&_(),v(r),p(F)}function m(F){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(F)}function p(F){return t.containerState={},e.attempt(sc,h,g)(F)}function h(F){return r++,n.push([t.currentConstruct,t.containerState]),p(F)}function g(F){if(F===null){a&&_(),v(0),e.consume(F);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(F)}function f(F){if(F===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(F);return}return ye(F)?(e.consume(F),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(F),f)}function b(F,x){const w=t.sliceStream(F);if(x&&w.push(null),F.previous=i,i&&(i.next=F),i=F,a.defineSkip(F.start),a.write(w),t.parser.lazy[F.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const S=t.events.length;let z=S,M,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(M){$=t.events[z][1].end;break}M=!0}for(v(r),B=S;B<t.events.length;)t.events[B][1].end=Object.assign({},$),B++;Qt(t.events,z+1,0,t.events.slice(S)),t.events.length=B}}function v(F){let x=n.length;for(;x-- >F;){const w=n[x];t.containerState=w[1],w[0].exit.call(t,e)}n.length=F}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function sC(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oc(e){if(e===null||ht(e)||tC(e))return 1;if(eC(e))return 2}function Ao(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 Ws={name:"attention",tokenize:uC,resolveAll:oC};function oC(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);uc(m,-l),uc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Et(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Et(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Et(u,Ao(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Et(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Et(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Qt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=oc(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=oc(l),m=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?m:m&&(a||!p)),u._close=!!(i===42?p:p&&(c||!m)),t(l)}}function uc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lC={name:"autolink",tokenize:cC};function cC(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Rt(h)?(e.consume(h),s):h===64?n(h):u(h)}function s(h){return h===43||h===45||h===46||St(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||St(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||zs(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),c):QD(h)?(e.consume(h),u):n(h)}function c(h){return St(h)?m(h):n(h)}function m(h){return h===46?(e.consume(h),r=0,c):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||St(h))&&r++<63){const g=h===45?p:m;return e.consume(h),g}return n(h)}}const oi={tokenize:dC,partial:!0};function dC(e,t,n){return r;function r(i){return Oe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const Rf={name:"blockQuote",tokenize:fC,continuation:{tokenize:hC},exit:mC};function fC(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function hC(e,t,n){const r=this;return a;function a(s){return Oe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Rf,t,n)(s)}}function mC(e){e.exit("blockQuote")}const $f={name:"characterEscape",tokenize:pC};function pC(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 XD(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Lf={name:"characterReference",tokenize:gC};function gC(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=St,c(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=JD,c):(e.enter("characterReferenceValue"),i=7,s=qs,c(m))}function c(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return s===St&&!Bo(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),c):n(m)}}const lc={tokenize:bC,partial:!0},cc={name:"codeFenced",tokenize:vC,concrete:!0};function vC(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(B)}function c(B){return B===o?(s++,e.consume(B),c):s<3?n(B):(e.exit("codeFencedFenceSequence"),Oe(B)?ze(e,m,"whitespace")(B):m(B))}function m(B){return B===null||ye(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(lc,f,x)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ye(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(B)):Oe(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ye(B)?m(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ye(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(B)):B===96&&B===o?n(B):(e.consume(B),g)}function f(B){return e.attempt(a,x,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&Oe(B)?ze(e,_,"linePrefix",i+1)(B):_(B)}function _(B){return B===null||ye(B)?e.check(lc,f,x)(B):(e.enter("codeFlowValue"),F(B))}function F(B){return B===null||ye(B)?(e.exit("codeFlowValue"),_(B)):(e.consume(B),F)}function x(B){return e.exit("codeFenced"),t(B)}function w(B,S,z){let M=0;return $;function $(L){return B.enter("lineEnding"),B.consume(L),B.exit("lineEnding"),R}function R(L){return B.enter("codeFencedFence"),Oe(L)?ze(B,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):k(L)}function k(L){return L===o?(B.enter("codeFencedFenceSequence"),A(L)):z(L)}function A(L){return L===o?(M++,B.consume(L),A):M>=s?(B.exit("codeFencedFenceSequence"),Oe(L)?ze(B,j,"whitespace")(L):j(L)):z(L)}function j(L){return L===null||ye(L)?(B.exit("codeFencedFence"),S(L)):z(L)}}}function bC(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 Zi={name:"codeIndented",tokenize:DC},yC={tokenize:CC,partial:!0};function DC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(yC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function CC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(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):ye(s)?a(s):n(s)}}const xC={name:"codeText",tokenize:_C,resolve:wC,previous:EC};function wC(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 EC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _C(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,c(m)):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ye(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function c(m){return m===96?(e.consume(m),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class kC{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&&br(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),br(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),br(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);br(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);br(this.left,n.reverse())}}}function br(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zf(e){const t={};let n=-1,r,a,i,s,o,l,u;const c=new kC(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.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,FC(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=c.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(c.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},c.get(a)[1].start),o=c.slice(a,n),o.unshift(r),c.splice(a,n-a+1,o))}}return Qt(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function FC(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 c,m,p=-1,h=n,g=0,f=0;const b=[f];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),m&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),_=i.pop();l.push([_,_+v.length-1]),e.splice(_,2,v)}for(l.reverse(),p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const BC={tokenize:SC,resolve:TC},AC={tokenize:jC,partial:!0};function TC(e){return zf(e),e}function SC(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):ye(o)?e.check(AC,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 jC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||ye(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 qf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||zs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ye(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function f(v){return!c&&(v===null||v===41||ht(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,f):v===41?(e.consume(v),c--,f):v===null||v===32||v===40||zs(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Wf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),c}function c(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===null||h===91||h===93||ye(h)||o++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!Oe(h)),h===92?p:m)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,m):m(h)}}function Uf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ye(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:c)}function m(p){return p===s||p===92?(e.consume(p),c):c(p)}}function Fr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const OC={name:"definition",tokenize:NC},PC={tokenize:MC,partial:!0};function NC(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Wf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ht(h)?Fr(e,u)(h):u(h)}function u(h){return qf(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(PC,m,m)(h)}function m(h){return Oe(h)?ze(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ye(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function MC(e,t,n){return r;function r(o){return ht(o)?Fr(e,a)(o):n(o)}function a(o){return Uf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const IC={name:"hardBreakEscape",tokenize:RC};function RC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const $C={name:"headingAtx",tokenize:zC,resolve:LC};function LC(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"},Qt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function zC(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ht(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ye(c)?(e.exit("atxHeading"),t(c)):Oe(c)?ze(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ht(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const qC=["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"],WC={name:"htmlFlow",tokenize:KC,resolveTo:VC,concrete:!0},UC={tokenize:YC,partial:!0},HC={tokenize:ZC,partial:!0};function VC(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 KC(e,t,n){const r=this;let a,i,s,o,l;return u;function u(E){return c(E)}function c(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),i=!0,f):E===63?(e.consume(E),a=3,r.interrupt?t:C):Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function p(E){return E===45?(e.consume(E),a=2,h):E===91?(e.consume(E),a=5,o=0,g):Rt(E)?(e.consume(E),a=4,r.interrupt?t:C):n(E)}function h(E){return E===45?(e.consume(E),r.interrupt?t:C):n(E)}function g(E){const T="CDATA[";return E===T.charCodeAt(o++)?(e.consume(E),o===T.length?r.interrupt?t:k:g):n(E)}function f(E){return Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||ht(E)){const T=E===47,N=s.toLowerCase();return!T&&!i&&dc.includes(N)?(a=1,r.interrupt?t(E):k(E)):qC.includes(s.toLowerCase())?(a=6,T?(e.consume(E),v):r.interrupt?t(E):k(E)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?_(E):F(E))}return E===45||St(E)?(e.consume(E),s+=String.fromCharCode(E),b):n(E)}function v(E){return E===62?(e.consume(E),r.interrupt?t:k):n(E)}function _(E){return Oe(E)?(e.consume(E),_):$(E)}function F(E){return E===47?(e.consume(E),$):E===58||E===95||Rt(E)?(e.consume(E),x):Oe(E)?(e.consume(E),F):$(E)}function x(E){return E===45||E===46||E===58||E===95||St(E)?(e.consume(E),x):w(E)}function w(E){return E===61?(e.consume(E),B):Oe(E)?(e.consume(E),w):F(E)}function B(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,S):Oe(E)?(e.consume(E),B):z(E)}function S(E){return E===l?(e.consume(E),l=null,M):E===null||ye(E)?n(E):(e.consume(E),S)}function z(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||ht(E)?w(E):(e.consume(E),z)}function M(E){return E===47||E===62||Oe(E)?F(E):n(E)}function $(E){return E===62?(e.consume(E),R):n(E)}function R(E){return E===null||ye(E)?k(E):Oe(E)?(e.consume(E),R):n(E)}function k(E){return E===45&&a===2?(e.consume(E),H):E===60&&a===1?(e.consume(E),Z):E===62&&a===4?(e.consume(E),q):E===63&&a===3?(e.consume(E),C):E===93&&a===5?(e.consume(E),ae):ye(E)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(UC,Y,A)(E)):E===null||ye(E)?(e.exit("htmlFlowData"),A(E)):(e.consume(E),k)}function A(E){return e.check(HC,j,Y)(E)}function j(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),L}function L(E){return E===null||ye(E)?A(E):(e.enter("htmlFlowData"),k(E))}function H(E){return E===45?(e.consume(E),C):k(E)}function Z(E){return E===47?(e.consume(E),s="",Q):k(E)}function Q(E){if(E===62){const T=s.toLowerCase();return dc.includes(T)?(e.consume(E),q):k(E)}return Rt(E)&&s.length<8?(e.consume(E),s+=String.fromCharCode(E),Q):k(E)}function ae(E){return E===93?(e.consume(E),C):k(E)}function C(E){return E===62?(e.consume(E),q):E===45&&a===2?(e.consume(E),C):k(E)}function q(E){return E===null||ye(E)?(e.exit("htmlFlowData"),Y(E)):(e.consume(E),q)}function Y(E){return e.exit("htmlFlow"),t(E)}}function ZC(e,t,n){const r=this;return a;function a(s){return ye(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 YC(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(oi,t,n)}}const GC={name:"htmlText",tokenize:QC};function QC(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),w):C===63?(e.consume(C),F):Rt(C)?(e.consume(C),z):n(C)}function u(C){return C===45?(e.consume(C),c):C===91?(e.consume(C),i=0,g):Rt(C)?(e.consume(C),_):n(C)}function c(C){return C===45?(e.consume(C),h):n(C)}function m(C){return C===null?n(C):C===45?(e.consume(C),p):ye(C)?(s=m,Z(C)):(e.consume(C),m)}function p(C){return C===45?(e.consume(C),h):m(C)}function h(C){return C===62?H(C):C===45?p(C):m(C)}function g(C){const q="CDATA[";return C===q.charCodeAt(i++)?(e.consume(C),i===q.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):ye(C)?(s=f,Z(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?H(C):C===93?(e.consume(C),v):f(C)}function _(C){return C===null||C===62?H(C):ye(C)?(s=_,Z(C)):(e.consume(C),_)}function F(C){return C===null?n(C):C===63?(e.consume(C),x):ye(C)?(s=F,Z(C)):(e.consume(C),F)}function x(C){return C===62?H(C):F(C)}function w(C){return Rt(C)?(e.consume(C),B):n(C)}function B(C){return C===45||St(C)?(e.consume(C),B):S(C)}function S(C){return ye(C)?(s=S,Z(C)):Oe(C)?(e.consume(C),S):H(C)}function z(C){return C===45||St(C)?(e.consume(C),z):C===47||C===62||ht(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),H):C===58||C===95||Rt(C)?(e.consume(C),$):ye(C)?(s=M,Z(C)):Oe(C)?(e.consume(C),M):H(C)}function $(C){return C===45||C===46||C===58||C===95||St(C)?(e.consume(C),$):R(C)}function R(C){return C===61?(e.consume(C),k):ye(C)?(s=R,Z(C)):Oe(C)?(e.consume(C),R):M(C)}function k(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,A):ye(C)?(s=k,Z(C)):Oe(C)?(e.consume(C),k):(e.consume(C),j)}function A(C){return C===a?(e.consume(C),a=void 0,L):C===null?n(C):ye(C)?(s=A,Z(C)):(e.consume(C),A)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||ht(C)?M(C):(e.consume(C),j)}function L(C){return C===47||C===62||ht(C)?M(C):n(C)}function H(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function Z(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),Q}function Q(C){return Oe(C)?ze(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ae(C)}function ae(C){return e.enter("htmlTextData"),s(C)}}const To={name:"labelEnd",tokenize:rx,resolveTo:nx,resolveAll:tx},JC={tokenize:ax},XC={tokenize:ix},ex={tokenize:sx};function tx(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 nx(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Et(o,e.slice(i+1,i+r+3)),o=Et(o,[["enter",c,t]]),o=Et(o,Ao(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Et(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Et(o,e.slice(s+1)),o=Et(o,[["exit",l,t]]),Qt(e,i,e.length,o),e}function rx(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?m(p):(s=r.parser.defined.includes(Qn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(JC,c,s?c:m)(p):p===91?e.attempt(XC,c,s?u:m)(p):s?c(p):m(p)}function u(p){return e.attempt(ex,c,m)(p)}function c(p){return t(p)}function m(p){return i._balanced=!0,n(p)}}function ax(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return ht(m)?Fr(e,i)(m):i(m)}function i(m){return m===41?c(m):qf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ht(m)?Fr(e,l)(m):c(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Uf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):c(m)}function u(m){return ht(m)?Fr(e,c)(m):c(m)}function c(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function ix(e,t,n){const r=this;return a;function a(o){return Wf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function sx(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 ox={name:"labelStartImage",tokenize:ux,resolveAll:To.resolveAll};function ux(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 lx={name:"labelStartLink",tokenize:cx,resolveAll:To.resolveAll};function cx(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Yi={name:"lineEnding",tokenize:dx};function dx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const ka={name:"thematicBreak",tokenize:fx};function fx(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||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?ze(e,o,"whitespace")(u):o(u))}}const ct={name:"list",tokenize:px,continuation:{tokenize:gx},exit:bx},hx={tokenize:yx,partial:!0},mx={tokenize:vx,partial:!0};function px(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:qs(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(ka,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return qs(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(oi,r.interrupt?n:c,e.attempt(hx,p,m))}function c(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function m(h){return Oe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function gx(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(oi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mx,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(ct,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function vx(e,t,n){const r=this;return ze(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 bx(e){e.exit(this.containerState.type)}function yx(e,t,n){const r=this;return ze(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fc={name:"setextUnderline",tokenize:Cx,resolveTo:Dx};function Dx(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 Cx(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,m;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){m=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const xx={tokenize:wx};function wx(e){const t=this,n=e.attempt(oi,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(BC,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 Ex={resolveAll:Vf()},_x=Hf("string"),kx=Hf("text");function Hf(e){return{tokenize:t,resolveAll:Vf(e==="text"?Fx:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const m=a[c];let p=-1;if(m)for(;++p<m.length;){const h=m[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Vf(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 Fx(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 Bx(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:_,enter:F,exit:x,attempt:S(w),check:S(B),interrupt:S(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:f,write:m};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(R){return s=Et(s,R),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=Ao(i,u.events,u),u.events)}function p(R,k){return Tx(h(R),k)}function h(R){return Ax(s,R)}function g(){const{line:R,column:k,offset:A,_index:j,_bufferIndex:L}=r;return{line:R,column:k,offset:A,_index:j,_bufferIndex:L}}function f(R){a[R.line]=R.column,$()}function b(){let R;for(;r._index<s.length;){const k=s[r._index];if(typeof k=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<k.length;)v(k.charCodeAt(r._bufferIndex));else v(k)}}function v(R){c=c(R)}function _(R){ye(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,$()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=R}function F(R,k){const A=k||{};return A.type=R,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function x(R){const k=o.pop();return k.end=g(),u.events.push(["exit",k,u]),k}function w(R,k){z(R,k.from)}function B(R,k){k.restore()}function S(R,k){return A;function A(j,L,H){let Z,Q,ae,C;return Array.isArray(j)?Y(j):"tokenize"in j?Y([j]):q(j);function q(I){return U;function U(ne){const te=ne!==null&&I[ne],ie=ne!==null&&I.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return Y(le)(ne)}}function Y(I){return Z=I,Q=0,I.length===0?H:E(I[Q])}function E(I){return U;function U(ne){return C=M(),ae=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?N():I.tokenize.call(k?Object.assign(Object.create(u),k):u,l,T,N)(ne)}}function T(I){return R(ae,C),L}function N(I){return C.restore(),++Q<Z.length?E(Z[Q]):H}}}function z(R,k){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&Qt(u.events,k,u.events.length-k,R.resolve(u.events.slice(k),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function M(){const R=g(),k=u.previous,A=u.currentConstruct,j=u.events.length,L=Array.from(o);return{restore:H,from:j};function H(){r=R,u.previous=k,u.currentConstruct=A,u.events.length=j,o=L,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Ax(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 Tx(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=`
138
+ `:""),[i]=y.useState(a);return $r(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(R1,{ref:r},i)},R1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),$i=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",M1({},a),!ut||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kf(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){kt(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 $1=ut?300:0;function L1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ml(e){e.current&&(clearTimeout(e.current),e.current=null)}var z1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=_=>y.createElement(W1,kf({},_))}=e,o=pn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),p=y.useRef(null),h=y.useCallback(_=>{if(L1(l,_==null),_==null){var F;Ts.delete(o),(F=t.onPlaceholderResize)===null||F===void 0||F.call(t,null)}else{if(Ts.set(o,_),!l.current){var x=window.ResizeObserver||Wy;l.current=new x(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,_)})}l.current.observe(_),u.current=_}},[u,t,o]),g=y.createElement(I1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[rr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{m(!0),p.current=null},$1)):(Ml(p),m(!1)),()=>Ml(p)),[f,m]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Cr?"inherit":void 0},contentEditable:!1,ref:h}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},q1=y.memo(z1,(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[rr]===e.leaf[rr]),W1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",kf({},t),n)},U1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=pn(),l=y.useRef(null),u=fe.decorations(s,t),d=ee.findKey(o,s),m=[],p=0;p<u.length;p++){var h=u[p];m.push(y.createElement(q1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=si.get(o);f?(b==null||b.set(d,f),_n.set(s,f),Rr.set(f,s)):(b==null||b.delete(d),_n.delete(s),l.current&&Rr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},Ff=y.memo(U1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&N1(t.decorations,e.decorations));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 Ms(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){kt(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 H1=e=>{var{decorations:t,element:n,renderElement:r=_=>y.createElement(K1,Ms({},_)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=pn(),l=G1(),u=o.isInline(n),d=ee.findKey(o,n),m=y.useCallback(_=>{var F=si.get(o);_?(F==null||F.set(d,_),_n.set(n,_),Rr.set(_,n)):(F==null||F.delete(d),_n.delete(n))},[o,d,n]),p=Af({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:m};if(u&&(h["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=Xd(g);f==="rtl"&&(h.dir=f)}if(D.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Ff,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),xo.set(v,0),wo.set(v,n)}return r({attributes:h,children:p,element:n})},V1=y.memo(H1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&P1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),K1=e=>{var{attributes:t,children:n,element:r}=e,a=pn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ms(Ms({},t),{},{style:{position:"relative"}}),n)},Bf=y.createContext(()=>[]),Z1=()=>y.useContext(Bf),Y1=y.createContext(!1),Af=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Z1(),l=pn(),u=ee.findPath(l,n),d=[],m=de.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],f=ee.findKey(l,g),b=D.range(l,h),v=s&&V.intersection(b,s),_=o([g,h]);for(var F of t){var x=V.intersection(F,b);x&&_.push(x)}de.isElement(g)?d.push(y.createElement(Y1.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(V1,{decorations:_,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(Ff,{decorations:_,key:f.id,isLast:m&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),xo.set(g,p),wo.set(g,n)}return d},Tf=y.createContext(!1),G1=()=>y.useContext(Tf),Sf=y.createContext(null),Nn=()=>{var e=y.useContext(Sf);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=pn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.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 J1=3,X1={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"},eD={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"},tD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=X1[e],n=eD[e],r=tD[e],a=t&&Ri(t),i=n&&Ri(n),s=r&&Ri(r);return o=>!!(a&&a(o)||Bl&&i&&i(o)||!Bl&&s&&s(o))},Ke={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},nD=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>ko(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}},rD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class jf extends y.Component{constructor(){super(...arguments),kt(this,"context",null),kt(this,"manager",null),kt(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,rD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=nD(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}}kt(jf,"contextType",Co);var aD=ut?jf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},iD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],sD=["text"];function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var oD=e=>y.createElement(y.Fragment,null,Af(e)),uD=e=>{var t=y.useCallback(T=>y.createElement(lD,Mt({},T)),[]),{autoFocus:n,decorate:r=cD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=dD,style:m={},as:p="div",disableDefaultStyles:h=!1}=e,g=nr(e,iD),f=Nn(),[b,v]=y.useState(!1),_=y.useRef(null),F=y.useRef([]),[x,w]=y.useState(),{onUserInput:B,receivedUserInput:S}=Q1(),[,z]=y.useReducer(T=>T+1,0);bf.set(f,z),Ss.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{_.current&&n&&_.current.focus()},[n]);var $=y.useRef(),R=y.useMemo(()=>yy(()=>{var T=$.current;if((ut||!ee.isComposing(f))&&(!M.isUpdatingSelection||T!=null&&T.isFlushing())&&!M.isDraggingInternally){var N=ee.findDocumentOrShadowRoot(f),{activeElement:I}=N,U=ee.toDOMNode(f,f),ne=N.getSelection();if(I===U?(M.latestElement=I,un.set(f,!0)):un.delete(f),!ne)return X.deselect(f);var{anchorNode:te,focusNode:ie}=ne,le=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te),J=ee.hasEditableTarget(f,ie)||ee.isTargetInsideNonReadonlyVoid(f,ie);if(le&&J){var ge=ee.toSlateRange(f,ne,{exactMatch:!1,suppressThrow:!0});ge&&(!ee.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?X.select(f,ge):T==null||T.handleUserSelect(ge))}s&&(!le||!J)&&X.deselect(f)}},100),[f,s,M]),k=y.useMemo(()=>hy(R,0),[R]);$.current=T1({node:_,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:k}),$r(()=>{var T,N,I;_.current&&(I=_o(_.current))?(vf.set(f,I),Ea.set(f,_.current),_n.set(f,_.current),Rr.set(_.current,f)):_n.delete(f);var{selection:U}=f,ne=ee.findDocumentOrShadowRoot(f),te=ne.getSelection();if(!(!te||!ee.isFocused(f)||(T=$.current)!==null&&T!==void 0&&T.hasPendingAction())){var ie=he=>{var pe=te.type!=="None";if(!(!U&&!pe)){var xe=te.focusNode,_e;if(Kn&&te.rangeCount>1){var Le=te.getRangeAt(0),Te=te.getRangeAt(te.rangeCount-1);Le.startContainer===xe?_e=Te.endContainer:_e=Le.startContainer}else _e=te.anchorNode;var Ae=Ea.get(f),Pe=!1;if(Ae.contains(_e)&&Ae.contains(xe)&&(Pe=!0),pe&&Pe&&U&&!he){var ke=ee.toSlateRange(f,te,{exactMatch:!0,suppressThrow:!0});if(ke&&V.equals(ke,U)){var Ve;if(!M.hasMarkPlaceholder||(Ve=_e)!==null&&Ve!==void 0&&(Ve=Ve.parentElement)!==null&&Ve!==void 0&&Ve.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!ee.hasRange(f,U)){f.selection=ee.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var qe=U&&ee.toDOMRange(f,U);return qe?(ee.isComposing(f)&&!ut?te.collapseToEnd():V.isBackward(U)?te.setBaseAndExtent(qe.endContainer,qe.endOffset,qe.startContainer,qe.startOffset):te.setBaseAndExtent(qe.startContainer,qe.startOffset,qe.endContainer,qe.endOffset),d(f,qe)):te.removeAllRanges(),qe}};te.rangeCount<=1&&ie();var le=((N=$.current)===null||N===void 0?void 0:N.isFlushing())==="action";if(!ut||!le){setTimeout(()=>{M.isUpdatingSelection=!1});return}var J=null,ge=requestAnimationFrame(()=>{if(le){var he=pe=>{try{var xe=ee.toDOMNode(f,f);xe.focus(),ie(pe)}catch{}};he(),J=setTimeout(()=>{he(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),J&&clearTimeout(J)}}});var A=y.useCallback(T=>{if(B(),!s&&ee.hasEditableTarget(f,T.target)&&!fD(T,a)){var N;if($.current)return $.current.handleDOMBeforeInput(T);k.flush(),R.flush();var{selection:I}=f,{inputType:U}=T,ne=T.dataTransfer||T.data||void 0,te=U==="insertCompositionText"||U==="deleteCompositionText";if(te&&ee.isComposing(f))return;var ie=!1;if(U==="insertText"&&I&&V.isCollapsed(I)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&I.anchor.offset!==0){var le,J;ie=!0,f.marks&&(ie=!1);var{anchor:ge}=I,[he,pe]=ee.toDOMPoint(f,ge),xe=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),_e=ee.getWindow(f);if(ie&&xe&&ee.hasDOMNode(f,xe)){var Le,Te=_e==null?void 0:_e.document.createTreeWalker(xe,NodeFilter.SHOW_TEXT).lastChild();Te===he&&((Le=Te.textContent)===null||Le===void 0?void 0:Le.length)===pe&&(ie=!1)}if(ie&&he.parentElement&&(_e==null||(J=_e.getComputedStyle(he.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ae=D.above(f,{at:ge.path,match:re=>de.isElement(re)&&D.isBlock(f,re)});Ae&&ue.string(Ae[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Pe]=T.getTargetRanges();if(Pe){var ke=ee.toSlateRange(f,Pe,{exactMatch:!1,suppressThrow:!1});if(!I||!V.equals(I,ke)){ie=!1;var Ve=!te&&f.selection&&D.rangeRef(f,f.selection);X.select(f,ke),Ve&&_r.set(f,Ve)}}}if(te)return;if(ie||T.preventDefault(),I&&V.isExpanded(I)&&U.startsWith("delete")){var qe=U.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:qe});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&ee.isComposing(f)&&(v(!1),Cn.set(f,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?ee.insertData(f,ne):typeof ne=="string"&&(ie?F.current.push(()=>D.insertText(f,ne)):D.insertText(f,ne));break}}var W=(N=_r.get(f))===null||N===void 0?void 0:N.unref();_r.delete(f),W&&(!f.selection||!V.equals(f.selection,W))&&X.select(f,W)}},[f,R,B,a,s,k]),j=y.useCallback(T=>{T==null?(R.cancel(),k.cancel(),Ea.delete(f),_n.delete(f),_.current&&tn&&_.current.removeEventListener("beforeinput",A)):tn&&T.addEventListener("beforeinput",A),_.current=T},[R,k,f,A]);$r(()=>{var T=ee.getWindow(f);return T.document.addEventListener("selectionchange",k),()=>{T.document.removeEventListener("selectionchange",k)}},[k]);var L=r([f,[]]),H=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,Z=y.useCallback(T=>{if(T&&H){var N;w((N=T.getBoundingClientRect())===null||N===void 0?void 0:N.height)}else w(void 0)},[H]);if(H){var Q=D.start(f,[]);L.push({[rr]:!0,placeholder:i,onPlaceholderResize:Z,anchor:Q,focus:Q})}var{marks:ae}=f;if(M.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&ae){var{anchor:C}=f.selection,q=ue.leaf(f,C.path),Y=nr(q,sD);if(!fe.equals(q,ae,{loose:!0})){M.hasMarkPlaceholder=!0;var E=Object.fromEntries(Object.keys(Y).map(T=>[T,null]));L.push(Mt(Mt(Mt({[yf]:!0},E),ae),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:N}=T,I=ue.leaf(f,N.path);if(ae&&!fe.equals(I,ae,{loose:!0})){Tt.set(f,ae);return}}Tt.delete(f)})}),y.createElement(Tf.Provider,{value:s},y.createElement(Bf.Provider,{value:r},y.createElement(aD,{node:_,receivedUserInput:S},y.createElement(p,Mt(Mt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:tn||!wa?g.spellCheck:!1,autoCorrect:tn||!wa?g.autoCorrect:"false",autoCapitalize:tn||!wa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Mt(Mt({},h?{}:Mt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},x?{minHeight:x}:{})),m),onBeforeInput:y.useCallback(T=>{if(!tn&&!s&&!st(T,g.onBeforeInput)&&ee.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!ee.isComposing(f))){var N=T.data;D.insertText(f,N)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(T=>{if(!st(T,g.onInput)){if($.current){$.current.handleInput();return}for(var N of F.current)N();F.current=[]}},[g.onInput]),onBlur:y.useCallback(T=>{if(!(s||M.isUpdatingSelection||!ee.hasSelectableTarget(f,T.target)||st(T,g.onBlur))){var N=ee.findDocumentOrShadowRoot(f);if(M.latestElement!==N.activeElement){var{relatedTarget:I}=T,U=ee.toDOMNode(f,f);if(I!==U&&!(_t(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&cn(I)&&ee.hasDOMNode(f,I)){var ne=ee.toSlateNode(f,I);if(de.isElement(ne)&&!f.isVoid(ne))return}if(Cr){var te=N.getSelection();te==null||te.removeAllRanges()}un.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,g.onBlur]),onClick:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!st(T,g.onClick)&&cn(T.target)){var N=ee.toSlateNode(f,T.target),I=ee.findPath(f,N);if(!D.hasPath(f,I)||ue.get(f,I)!==N)return;if(T.detail===J1&&I.length>=1){var U=I;if(!(de.isElement(N)&&D.isBlock(f,N))){var ne,te=D.above(f,{match:xe=>de.isElement(xe)&&D.isBlock(f,xe),at:I});U=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:I.slice(0,1)}var ie=D.range(f,U);X.select(f,ie);return}if(s)return;var le=D.start(f,I),J=D.end(f,I),ge=D.void(f,{at:le}),he=D.void(f,{at:J});if(ge&&he&&P.equals(ge[1],he[1])){var pe=D.range(f,le);X.select(f,pe)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var N;if(ee.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Cn.set(f,!1)}),(N=$.current)===null||N===void 0||N.handleCompositionEnd(T),st(T,g.onCompositionEnd)||ut)return;if(!Cr&&!t1&&!Qy&&!r1&&!n1&&T.data){var I=Tt.get(f);Tt.delete(f),I!==void 0&&(Zt.set(f,f.marks),f.marks=I),D.insertText(f,T.data);var U=Zt.get(f);Zt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCompositionUpdate)&&(ee.isComposing(f)||(v(!0),Cn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var N;if((N=$.current)===null||N===void 0||N.handleCompositionStart(T),st(T,g.onCompositionStart)||ut)return;v(!0);var{selection:I}=f;if(I&&V.isExpanded(I)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCopy)&&!$l(T)&&(T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(T=>{if(!s&&ee.hasSelectableTarget(f,T.target)&&!st(T,g.onCut)&&!$l(T)){T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"cut");var{selection:N}=f;if(N)if(V.isExpanded(N))D.deleteFragment(f);else{var I=ue.parent(f,N.anchor.path);D.isVoid(f,I)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!st(T,g.onDragOver)){var N=ee.toSlateNode(f,T.target);de.isElement(N)&&D.isVoid(f,N)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!st(T,g.onDragStart)){var N=ee.toSlateNode(f,T.target),I=ee.findPath(f,N),U=de.isElement(N)&&D.isVoid(f,N)||D.void(f,{at:I,voids:!0});if(U){var ne=D.range(f,I);X.select(f,ne)}M.isDraggingInternally=!0,ee.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,M]),onDrop:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!st(T,g.onDrop)){T.preventDefault();var N=f.selection,I=ee.findEventRange(f,T),U=T.dataTransfer;X.select(f,I),M.isDraggingInternally&&N&&!V.equals(N,I)&&!D.void(f,{at:I,voids:!0})&&X.delete(f,{at:N}),ee.insertData(f,U),ee.isFocused(f)||ee.focus(f)}M.isDraggingInternally=!1},[s,f,g.onDrop,M]),onDragEnd:y.useCallback(T=>{!s&&M.isDraggingInternally&&g.onDragEnd&&ee.hasTarget(f,T.target)&&g.onDragEnd(T),M.isDraggingInternally=!1},[s,M,g,f]),onFocus:y.useCallback(T=>{if(!s&&!M.isUpdatingSelection&&ee.hasEditableTarget(f,T.target)&&!st(T,g.onFocus)){var N=ee.toDOMNode(f,f),I=ee.findDocumentOrShadowRoot(f);if(M.latestElement=I.activeElement,Kn&&T.target!==N){N.focus();return}un.set(f,!0)}},[s,M,f,g.onFocus]),onKeyDown:y.useCallback(T=>{if(!s&&ee.hasEditableTarget(f,T.target)){var N;(N=$.current)===null||N===void 0||N.handleKeyDown(T);var{nativeEvent:I}=T;if(ee.isComposing(f)&&I.isComposing===!1&&(Cn.set(f,!1),v(!1)),st(T,g.onKeyDown)||ee.isComposing(f))return;var{selection:U}=f,ne=f.children[U!==null?U.focus.path[0]:0],te=Xd(ue.string(ne))==="rtl";if(Ke.isRedo(I)){T.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(Ke.isUndo(I)){T.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ke.isMoveLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward(I)){T.preventDefault(),X.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward(I)){T.preventDefault(),U&&V.isCollapsed(U)?X.move(f,{reverse:!te}):X.collapse(f,{edge:te?"end":"start"});return}if(Ke.isMoveForward(I)){T.preventDefault(),U&&V.isCollapsed(U)?X.move(f,{reverse:te}):X.collapse(f,{edge:te?"start":"end"});return}if(Ke.isMoveWordBackward(I)){T.preventDefault(),U&&V.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!te});return}if(Ke.isMoveWordForward(I)){T.preventDefault(),U&&V.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:te});return}if(tn){if((gf||Cr)&&U&&(Ke.isDeleteBackward(I)||Ke.isDeleteForward(I))&&V.isCollapsed(U)){var J=ue.parent(f,U.anchor.path);if(de.isElement(J)&&D.isVoid(f,J)&&(D.isInline(f,J)||D.isBlock(f,J))){T.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold(I)||Ke.isItalic(I)||Ke.isTransposeCharacter(I)){T.preventDefault();return}if(Ke.isSoftBreak(I)){T.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock(I)){T.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward(I)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(T=>{!s&&ee.hasEditableTarget(f,T.target)&&!st(T,g.onPaste)&&(!tn||s1(T.nativeEvent)||Cr)&&(T.preventDefault(),ee.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),y.createElement(oD,{decorations:L,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},lD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Mt({},t),n,ut&&y.createElement("br",null))},cD=()=>[],dD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),xy(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},st=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},$l=e=>cn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),fD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},hD=y.createContext(!1),mD=y.createContext({});function pD(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 gD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],vD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=nr(e,gD),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=pD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(js.set(t,p),()=>{js.set(t,()=>{})}),[t,p]);var[h,g]=y.useState(ee.isFocused(t));return y.useEffect(()=>{g(ee.isFocused(t))},[t]),$r(()=>{var f=()=>g(ee.isFocused(t));return pf>=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(mD.Provider,{value:d},y.createElement(Sf.Provider,{value:l},y.createElement(Co.Provider,{value:l.editor},y.createElement(hD.Provider,{value:h},n))))},Ll=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},zl=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return Ll(r,a)&&Ll(a,r)},bD=(e,t)=>{var n=D.range(e,V.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(zl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)zl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.range(e,r[i],n)};function 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 Wl(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){kt(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 yD=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 si.set(r,new WeakMap),r.addMark=(u,d)=>{var m,p;(m=Eo.get(r))===null||m===void 0||m(),!Tt.get(r)&&(p=dt.get(r))!==null&&p!==void 0&&p.length&&Tt.set(r,null),Zt.delete(r),o(u,d)},r.removeMark=u=>{var d;!Tt.get(r)&&(d=dt.get(r))!==null&&d!==void 0&&d.length&&Tt.set(r,null),Zt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var d=D.above(r,{match:g=>de.isElement(g)&&D.isBlock(r,g),at:r.selection});if(d){var[,m]=d,p=D.range(r,m,r.selection.anchor),h=bD(r,p);V.isCollapsed(h)||X.delete(r,{at:h})}}},r.apply=u=>{var d=[],m=[],p=dt.get(r);if(p!=null&&p.length){var h=p.map(j=>y1(j,u)).filter(Boolean);dt.set(r,h)}var g=an.get(r);g&&an.set(r,Tl(r,g,u));var f=rn.get(r);if(f!=null&&f.at){var b=Ee.isPoint(f==null?void 0:f.at)?Ns(r,f.at,u):Tl(r,f.at,u);rn.set(r,b?Wl(Wl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Ln(r,u.path));break}case"set_selection":{var v;(v=_r.get(r))===null||v===void 0||v.unref(),_r.delete(r);break}case"insert_node":case"remove_node":{d.push(...Ln(r,P.parent(u.path)));break}case"merge_node":{var _=P.previous(u.path);d.push(...Ln(r,_));break}case"move_node":{var F=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...Ln(r,F));var x;P.isBefore(u.path,u.newPath)?(d.push(...Ln(r,P.parent(u.path))),x=u.newPath):(d.push(...Ln(r,P.parent(u.newPath))),x=u.path);var w=ue.get(t,P.parent(x)),B=ee.findKey(r,w),S=D.pathRef(r,P.parent(x));m.push([S,B]);break}}a(u);for(var[z,M]of d){var[$]=D.node(r,z);La.set($,M)}for(var[R,k]of m)if(R.current){var[A]=D.node(r,R.current);La.set(A,k)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,p]=V.edges(d),h=D.void(r,{at:m.path}),g=D.void(r,{at:p.path});if(!(V.isCollapsed(d)&&!h)){var f=ee.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(v=$)}),g){var[_]=g,F=f.cloneRange(),x=ee.toDOMNode(r,_);F.setEndAfter(x),b=F.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var R=$.getAttribute("data-slate-zero-width")==="n";$.textContent=R?`
139
+ `:""}),Df(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),b.appendChild(w),v=w}var B=r.getFragment(),S=JSON.stringify(B),z=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",xf(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||d1(u);if(d){var m=decodeURIComponent(window.atob(d)),p=JSON.parse(m);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var m=d.split(/\r\n|\r|\n/),p=!1;for(var h of m)p&&X.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var d=pf<18?Sc.unstable_batchedUpdates:m=>m();d(()=>{var m=js.get(r);m&&m(u),i(u)})},r},Ln=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const DD={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},en=y.createContext(DD);var K=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(K||{}),$t=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))($t||{});const CD=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case K.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case K.link:return c.jsx("a",{...e,children:t});case K.li:return c.jsx("li",{...e,children:t});case K.mention:const a=r;return c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case K.ol:return c.jsx("ol",{...e,children:t});case K.ul:return c.jsx("ul",{...e,children:t});case K.span:return c.jsx("span",{...e,children:t});case K.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},xD=({attributes:e,children:t,leaf:n})=>{const r=n;return r[K.bold]&&(t=c.jsx("strong",{children:t})),r[K.italic]&&(t=c.jsx("em",{children:t})),r[K.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},Is="MENTION: ",Of={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Ul={"mention-popover":35,default:-52},Li=16,Pf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(en),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var h,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=F=>{if(!D.hasPath(e,F.path))return!1;const x=ue.get(e,F.path);return D.isEditor(x)||de.isElement(x)?F.offset<=x.children.length:fe.isText(x)?F.offset<=x.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||Of).getBoundingClientRect();const _=(h=document.getElementById(n))==null?void 0:h.getBoundingClientRect();l.style.setProperty("--width",`${((_==null?void 0:_.width)||0)/Li}rem`),d=(_==null?void 0:_.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 m=Ul[t]||Ul.default,p=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Li}rem`,l.style.left=`${d/Li}rem`},o),r},wD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===K.link});if(a){const i=a[0],s=Yc(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 ot=(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))(ot||{});const Zn={[K.paragraph]:K.paragraph,[K.blockquote]:K.blockquote,[K.codeblock]:K.codeblock,[K.link]:K.link,[K.ul]:K.ul,[K.ol]:K.ol,[K.li]:K.li,[K.mention]:K.mention,[K.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[$t.emphasis]:K.italic,[$t.strong]:K.bold,[$t.delete]:K.strikethrough,[$t.code]:K.code,[K.hr]:K.hr,[K.image]:K.image};function Hl(e){if(e)throw e}var _a=Object.prototype.hasOwnProperty,Nf=Object.prototype.toString,Vl=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,Zl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Nf.call(t)==="[object Array]"},Yl=function(t){if(!t||Nf.call(t)!=="[object Object]")return!1;var n=_a.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&_a.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||_a.call(t,a)},Gl=function(t,n){Vl&&n.name==="__proto__"?Vl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Ql=function(t,n){if(n==="__proto__")if(_a.call(t,n)){if(Kl)return Kl(t,n).value}else return;return t[n]},ED=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=Ql(o,n),a=Ql(t,n),o!==a&&(d&&a&&(Yl(a)||(i=Zl(a)))?(i?(i=!1,s=r&&Zl(r)?r:[]):s=r&&Yl(r)?r:{},Gl(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Gl(o,{name:n,newValue:a}));return o};const zi=jn(ED);function Rs(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 _D(){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 m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?kD(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 kD(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 kr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jl(e.position):"start"in e||"end"in e?Jl(e):"line"in e||"column"in e?$s(e):""}function $s(e){return Xl(e&&e.line)+":"+Xl(e&&e.column)}function Jl(e){return $s(e&&e.start)+"-"+$s(e&&e.end)}function Xl(e){return e&&typeof e=="number"?e:1}class pt 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=kr(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}}pt.prototype.file="";pt.prototype.name="";pt.prototype.reason="";pt.prototype.message="";pt.prototype.stack="";pt.prototype.column=void 0;pt.prototype.line=void 0;pt.prototype.ancestors=void 0;pt.prototype.cause=void 0;pt.prototype.fatal=void 0;pt.prototype.place=void 0;pt.prototype.ruleId=void 0;pt.prototype.source=void 0;const It={basename:FD,dirname:BD,extname:AD,join:TD,sep:"/"};function FD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ur(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 BD(e){if(Ur(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 AD(e){Ur(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 TD(...e){let t=-1,n;for(;++t<e.length;)Ur(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":SD(n)}function SD(e){Ur(e);const t=e.codePointAt(0)===47;let n=jD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jD(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 Ur(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OD={cwd:PD};function PD(){return"/"}function Ls(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ND(e){if(typeof e=="string")e=new URL(e);else if(!Ls(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 MD(e)}function MD(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 qi=["history","path","basename","stem","extname","dirname"];class ID{constructor(t){let n;t?Ls(t)?n={path:t}:typeof t=="string"||RD(t)?n={value:t}:n=t:n={},this.cwd=OD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qi.length;){const i=qi[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)qi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?It.basename(this.path):void 0}set basename(t){Ui(t,"basename"),Wi(t,"basename"),this.path=It.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?It.dirname(this.path):void 0}set dirname(t){ec(this.basename,"dirname"),this.path=It.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?It.extname(this.path):void 0}set extname(t){if(Wi(t,"extname"),ec(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=It.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ls(t)&&(t=ND(t)),Ui(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?It.basename(this.path,this.extname):void 0}set stem(t){Ui(t,"stem"),Wi(t,"stem"),this.path=It.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 pt(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 Wi(e,t){if(e&&e.includes(It.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+It.sep+"`")}function Ui(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ec(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function RD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $D=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},LD={}.hasOwnProperty;class Fo extends $D{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=_D()}copy(){const t=new Fo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(zi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ki("data",this.frozen),this.namespace[t]=n,this):LD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ki("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=da(t),r=this.parser||this.Parser;return Hi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Hi("process",this.parser||this.Parser),Vi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=da(t),l=r.parse(o);r.run(l,o,function(d,m,p){if(d||!m||!p)return u(d);const h=m,g=r.stringify(h,p);WD(g)?p.value=g:p.result=g,u(d,p)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Hi("processSync",this.parser||this.Parser),Vi("processSync",this.compiler||this.Compiler),this.process(t,a),nc("processSync","process",n),r;function a(i,s){n=!0,Hl(i),r=s}}run(t,n,r){tc(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=da(n);a.run(t,l,u);function u(d,m,p){const h=m||t;d?o(d):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),nc("runSync","run",r),a;function i(s,o){Hl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=da(n),a=this.compiler||this.Compiler;return Vi("stringify",a),tc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ki("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,...m]=u;l(d,m)}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=zi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const f=r[p][1];Rs(f)&&Rs(h)&&(h=zi(!0,f,h)),r[p]=[u,h,...g]}}}}const zD=new Fo().freeze();function Hi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ki(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 tc(e){if(!Rs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function da(e){return qD(e)?e:new ID(e)}function qD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function WD(e){return typeof e=="string"||UD(e)}function UD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HD={};function VD(e,t){const n=t||HD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Mf(e,r,a)}function Mf(e,t,n){if(KD(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 rc(e.children,t,n)}return Array.isArray(e)?rc(e,t,n):""}function rc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Mf(e[a],t,n);return r.join("")}function KD(e){return!!(e&&typeof e=="object")}const ac=document.createElement("i");function Bo(e){const t="&"+e+";";ac.innerHTML=t;const n=ac.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qt(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 Et(e,t){return e.length>0?(Qt(e,e.length,0,t),e):t}const ic={}.hasOwnProperty;function ZD(e){const t={};let n=-1;for(;++n<e.length;)YD(t,e[n]);return t}function YD(e,t){let n;for(n in t){const a=(ic.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){ic.call(a,s)||(a[s]=[]);const o=i[s];GD(a[s],Array.isArray(o)?o:o?[o]:[])}}}function GD(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Qt(e,0,0,r)}function If(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 Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=gn(/[A-Za-z]/),St=gn(/[\dA-Za-z]/),QD=gn(/[#-'*+\--9=?A-Z^-~]/);function zs(e){return e!==null&&(e<32||e===127)}const qs=gn(/\d/),JD=gn(/[\dA-Fa-f]/),XD=gn(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const eC=gn(/\p{P}|\p{S}/u),tC=gn(/\s/);function gn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const nC={tokenize:rC};function rC(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"),ze(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 ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const aC={tokenize:iC},sc={tokenize:sC};function iC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(F){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,u)(F)}return u(F)}function l(F){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const x=t.events.length;let w=x,B;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){B=t.events[w][1].end;break}v(r);let S=x;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},B),S++;return Qt(t.events,w+1,0,t.events.slice(x)),t.events.length=S,u(F)}return o(F)}function u(F){if(r===n.length){if(!a)return p(F);if(a.currentConstruct&&a.currentConstruct.concrete)return g(F);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(sc,d,m)(F)}function d(F){return a&&_(),v(r),p(F)}function m(F){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(F)}function p(F){return t.containerState={},e.attempt(sc,h,g)(F)}function h(F){return r++,n.push([t.currentConstruct,t.containerState]),p(F)}function g(F){if(F===null){a&&_(),v(0),e.consume(F);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(F)}function f(F){if(F===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(F);return}return ye(F)?(e.consume(F),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(F),f)}function b(F,x){const w=t.sliceStream(F);if(x&&w.push(null),F.previous=i,i&&(i.next=F),i=F,a.defineSkip(F.start),a.write(w),t.parser.lazy[F.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const S=t.events.length;let z=S,M,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(M){$=t.events[z][1].end;break}M=!0}for(v(r),B=S;B<t.events.length;)t.events[B][1].end=Object.assign({},$),B++;Qt(t.events,z+1,0,t.events.slice(S)),t.events.length=B}}function v(F){let x=n.length;for(;x-- >F;){const w=n[x];t.containerState=w[1],w[0].exit.call(t,e)}n.length=F}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function sC(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oc(e){if(e===null||ht(e)||tC(e))return 1;if(eC(e))return 2}function Ao(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 Ws={name:"attention",tokenize:uC,resolveAll:oC};function oC(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 m=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);uc(m,-l),uc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Et(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Et(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Et(u,Ao(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Et(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=Et(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Qt(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 uC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=oc(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=oc(l),m=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!p)),u._close=!!(i===42?p:p&&(d||!m)),t(l)}}function uc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lC={name:"autolink",tokenize:cC};function cC(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Rt(h)?(e.consume(h),s):h===64?n(h):u(h)}function s(h){return h===43||h===45||h===46||St(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||St(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||zs(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):QD(h)?(e.consume(h),u):n(h)}function d(h){return St(h)?m(h):n(h)}function m(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||St(h))&&r++<63){const g=h===45?p:m;return e.consume(h),g}return n(h)}}const oi={tokenize:dC,partial:!0};function dC(e,t,n){return r;function r(i){return Oe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const Rf={name:"blockQuote",tokenize:fC,continuation:{tokenize:hC},exit:mC};function fC(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function hC(e,t,n){const r=this;return a;function a(s){return Oe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Rf,t,n)(s)}}function mC(e){e.exit("blockQuote")}const $f={name:"characterEscape",tokenize:pC};function pC(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 XD(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Lf={name:"characterReference",tokenize:gC};function gC(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=St,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=JD,d):(e.enter("characterReferenceValue"),i=7,s=qs,d(m))}function d(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return s===St&&!Bo(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const lc={tokenize:bC,partial:!0},cc={name:"codeFenced",tokenize:vC,concrete:!0};function vC(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(B)}function d(B){return B===o?(s++,e.consume(B),d):s<3?n(B):(e.exit("codeFencedFenceSequence"),Oe(B)?ze(e,m,"whitespace")(B):m(B))}function m(B){return B===null||ye(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(lc,f,x)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ye(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(B)):Oe(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ye(B)?m(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ye(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(B)):B===96&&B===o?n(B):(e.consume(B),g)}function f(B){return e.attempt(a,x,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&Oe(B)?ze(e,_,"linePrefix",i+1)(B):_(B)}function _(B){return B===null||ye(B)?e.check(lc,f,x)(B):(e.enter("codeFlowValue"),F(B))}function F(B){return B===null||ye(B)?(e.exit("codeFlowValue"),_(B)):(e.consume(B),F)}function x(B){return e.exit("codeFenced"),t(B)}function w(B,S,z){let M=0;return $;function $(L){return B.enter("lineEnding"),B.consume(L),B.exit("lineEnding"),R}function R(L){return B.enter("codeFencedFence"),Oe(L)?ze(B,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):k(L)}function k(L){return L===o?(B.enter("codeFencedFenceSequence"),A(L)):z(L)}function A(L){return L===o?(M++,B.consume(L),A):M>=s?(B.exit("codeFencedFenceSequence"),Oe(L)?ze(B,j,"whitespace")(L):j(L)):z(L)}function j(L){return L===null||ye(L)?(B.exit("codeFencedFence"),S(L)):z(L)}}}function bC(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 Zi={name:"codeIndented",tokenize:DC},yC={tokenize:CC,partial:!0};function DC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(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):ye(u)?e.attempt(yC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function CC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(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):ye(s)?a(s):n(s)}}const xC={name:"codeText",tokenize:_C,resolve:wC,previous:EC};function wC(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 EC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _C(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ye(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class kC{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&&br(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),br(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),br(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);br(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);br(this.left,n.reverse())}}}function br(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new kC(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,FC(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 Qt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function FC(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,m,p=-1,h=n,g=0,f=0;const b=[f];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),m&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),_=i.pop();l.push([_,_+v.length-1]),e.splice(_,2,v)}for(l.reverse(),p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const BC={tokenize:SC,resolve:TC},AC={tokenize:jC,partial:!0};function TC(e){return zf(e),e}function SC(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):ye(o)?e.check(AC,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 jC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||ye(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 qf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||zs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ye(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function f(v){return!d&&(v===null||v===41||ht(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||zs(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Wf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),d}function d(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===null||h===91||h===93||ye(h)||o++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!Oe(h)),h===92?p:m)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,m):m(h)}}function Uf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||ye(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:d)}function m(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Fr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const OC={name:"definition",tokenize:NC},PC={tokenize:MC,partial:!0};function NC(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Wf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ht(h)?Fr(e,u)(h):u(h)}function u(h){return qf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(PC,m,m)(h)}function m(h){return Oe(h)?ze(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ye(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function MC(e,t,n){return r;function r(o){return ht(o)?Fr(e,a)(o):n(o)}function a(o){return Uf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const IC={name:"hardBreakEscape",tokenize:RC};function RC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const $C={name:"headingAtx",tokenize:zC,resolve:LC};function LC(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"},Qt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function zC(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||ht(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ye(d)?(e.exit("atxHeading"),t(d)):Oe(d)?ze(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||ht(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const qC=["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"],WC={name:"htmlFlow",tokenize:KC,resolveTo:VC,concrete:!0},UC={tokenize:YC,partial:!0},HC={tokenize:ZC,partial:!0};function VC(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 KC(e,t,n){const r=this;let a,i,s,o,l;return u;function u(E){return d(E)}function d(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),i=!0,f):E===63?(e.consume(E),a=3,r.interrupt?t:C):Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function p(E){return E===45?(e.consume(E),a=2,h):E===91?(e.consume(E),a=5,o=0,g):Rt(E)?(e.consume(E),a=4,r.interrupt?t:C):n(E)}function h(E){return E===45?(e.consume(E),r.interrupt?t:C):n(E)}function g(E){const T="CDATA[";return E===T.charCodeAt(o++)?(e.consume(E),o===T.length?r.interrupt?t:k:g):n(E)}function f(E){return Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||ht(E)){const T=E===47,N=s.toLowerCase();return!T&&!i&&dc.includes(N)?(a=1,r.interrupt?t(E):k(E)):qC.includes(s.toLowerCase())?(a=6,T?(e.consume(E),v):r.interrupt?t(E):k(E)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?_(E):F(E))}return E===45||St(E)?(e.consume(E),s+=String.fromCharCode(E),b):n(E)}function v(E){return E===62?(e.consume(E),r.interrupt?t:k):n(E)}function _(E){return Oe(E)?(e.consume(E),_):$(E)}function F(E){return E===47?(e.consume(E),$):E===58||E===95||Rt(E)?(e.consume(E),x):Oe(E)?(e.consume(E),F):$(E)}function x(E){return E===45||E===46||E===58||E===95||St(E)?(e.consume(E),x):w(E)}function w(E){return E===61?(e.consume(E),B):Oe(E)?(e.consume(E),w):F(E)}function B(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,S):Oe(E)?(e.consume(E),B):z(E)}function S(E){return E===l?(e.consume(E),l=null,M):E===null||ye(E)?n(E):(e.consume(E),S)}function z(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||ht(E)?w(E):(e.consume(E),z)}function M(E){return E===47||E===62||Oe(E)?F(E):n(E)}function $(E){return E===62?(e.consume(E),R):n(E)}function R(E){return E===null||ye(E)?k(E):Oe(E)?(e.consume(E),R):n(E)}function k(E){return E===45&&a===2?(e.consume(E),H):E===60&&a===1?(e.consume(E),Z):E===62&&a===4?(e.consume(E),q):E===63&&a===3?(e.consume(E),C):E===93&&a===5?(e.consume(E),ae):ye(E)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(UC,Y,A)(E)):E===null||ye(E)?(e.exit("htmlFlowData"),A(E)):(e.consume(E),k)}function A(E){return e.check(HC,j,Y)(E)}function j(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),L}function L(E){return E===null||ye(E)?A(E):(e.enter("htmlFlowData"),k(E))}function H(E){return E===45?(e.consume(E),C):k(E)}function Z(E){return E===47?(e.consume(E),s="",Q):k(E)}function Q(E){if(E===62){const T=s.toLowerCase();return dc.includes(T)?(e.consume(E),q):k(E)}return Rt(E)&&s.length<8?(e.consume(E),s+=String.fromCharCode(E),Q):k(E)}function ae(E){return E===93?(e.consume(E),C):k(E)}function C(E){return E===62?(e.consume(E),q):E===45&&a===2?(e.consume(E),C):k(E)}function q(E){return E===null||ye(E)?(e.exit("htmlFlowData"),Y(E)):(e.consume(E),q)}function Y(E){return e.exit("htmlFlow"),t(E)}}function ZC(e,t,n){const r=this;return a;function a(s){return ye(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 YC(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(oi,t,n)}}const GC={name:"htmlText",tokenize:QC};function QC(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),w):C===63?(e.consume(C),F):Rt(C)?(e.consume(C),z):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):Rt(C)?(e.consume(C),_):n(C)}function d(C){return C===45?(e.consume(C),h):n(C)}function m(C){return C===null?n(C):C===45?(e.consume(C),p):ye(C)?(s=m,Z(C)):(e.consume(C),m)}function p(C){return C===45?(e.consume(C),h):m(C)}function h(C){return C===62?H(C):C===45?p(C):m(C)}function g(C){const q="CDATA[";return C===q.charCodeAt(i++)?(e.consume(C),i===q.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):ye(C)?(s=f,Z(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?H(C):C===93?(e.consume(C),v):f(C)}function _(C){return C===null||C===62?H(C):ye(C)?(s=_,Z(C)):(e.consume(C),_)}function F(C){return C===null?n(C):C===63?(e.consume(C),x):ye(C)?(s=F,Z(C)):(e.consume(C),F)}function x(C){return C===62?H(C):F(C)}function w(C){return Rt(C)?(e.consume(C),B):n(C)}function B(C){return C===45||St(C)?(e.consume(C),B):S(C)}function S(C){return ye(C)?(s=S,Z(C)):Oe(C)?(e.consume(C),S):H(C)}function z(C){return C===45||St(C)?(e.consume(C),z):C===47||C===62||ht(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),H):C===58||C===95||Rt(C)?(e.consume(C),$):ye(C)?(s=M,Z(C)):Oe(C)?(e.consume(C),M):H(C)}function $(C){return C===45||C===46||C===58||C===95||St(C)?(e.consume(C),$):R(C)}function R(C){return C===61?(e.consume(C),k):ye(C)?(s=R,Z(C)):Oe(C)?(e.consume(C),R):M(C)}function k(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,A):ye(C)?(s=k,Z(C)):Oe(C)?(e.consume(C),k):(e.consume(C),j)}function A(C){return C===a?(e.consume(C),a=void 0,L):C===null?n(C):ye(C)?(s=A,Z(C)):(e.consume(C),A)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||ht(C)?M(C):(e.consume(C),j)}function L(C){return C===47||C===62||ht(C)?M(C):n(C)}function H(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function Z(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),Q}function Q(C){return Oe(C)?ze(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ae(C)}function ae(C){return e.enter("htmlTextData"),s(C)}}const To={name:"labelEnd",tokenize:rx,resolveTo:nx,resolveAll:tx},JC={tokenize:ax},XC={tokenize:ix},ex={tokenize:sx};function tx(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 nx(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=Et(o,e.slice(i+1,i+r+3)),o=Et(o,[["enter",d,t]]),o=Et(o,Ao(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Et(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Et(o,e.slice(s+1)),o=Et(o,[["exit",l,t]]),Qt(e,i,e.length,o),e}function rx(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?m(p):(s=r.parser.defined.includes(Qn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(JC,d,s?d:m)(p):p===91?e.attempt(XC,d,s?u:m)(p):s?d(p):m(p)}function u(p){return e.attempt(ex,d,m)(p)}function d(p){return t(p)}function m(p){return i._balanced=!0,n(p)}}function ax(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return ht(m)?Fr(e,i)(m):i(m)}function i(m){return m===41?d(m):qf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ht(m)?Fr(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Uf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return ht(m)?Fr(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function ix(e,t,n){const r=this;return a;function a(o){return Wf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function sx(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 ox={name:"labelStartImage",tokenize:ux,resolveAll:To.resolveAll};function ux(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 lx={name:"labelStartLink",tokenize:cx,resolveAll:To.resolveAll};function cx(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Yi={name:"lineEnding",tokenize:dx};function dx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const ka={name:"thematicBreak",tokenize:fx};function fx(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||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?ze(e,o,"whitespace")(u):o(u))}}const ct={name:"list",tokenize:px,continuation:{tokenize:gx},exit:bx},hx={tokenize:yx,partial:!0},mx={tokenize:vx,partial:!0};function px(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:qs(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(ka,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return qs(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(oi,r.interrupt?n:d,e.attempt(hx,p,m))}function d(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function m(h){return Oe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function gx(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(oi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mx,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(ct,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function vx(e,t,n){const r=this;return ze(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 bx(e){e.exit(this.containerState.type)}function yx(e,t,n){const r=this;return ze(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fc={name:"setextUnderline",tokenize:Cx,resolveTo:Dx};function Dx(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 Cx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const xx={tokenize:wx};function wx(e){const t=this,n=e.attempt(oi,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(BC,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 Ex={resolveAll:Vf()},_x=Hf("string"),kx=Hf("text");function Hf(e){return{tokenize:t,resolveAll:Vf(e==="text"?Fx: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 m=a[d];let p=-1;if(m)for(;++p<m.length;){const h=m[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Vf(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 Fx(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 Bx(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:_,enter:F,exit:x,attempt:S(w),check:S(B),interrupt:S(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(R){return s=Et(s,R),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=Ao(i,u.events,u),u.events)}function p(R,k){return Tx(h(R),k)}function h(R){return Ax(s,R)}function g(){const{line:R,column:k,offset:A,_index:j,_bufferIndex:L}=r;return{line:R,column:k,offset:A,_index:j,_bufferIndex:L}}function f(R){a[R.line]=R.column,$()}function b(){let R;for(;r._index<s.length;){const k=s[r._index];if(typeof k=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<k.length;)v(k.charCodeAt(r._bufferIndex));else v(k)}}function v(R){d=d(R)}function _(R){ye(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,$()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=R}function F(R,k){const A=k||{};return A.type=R,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function x(R){const k=o.pop();return k.end=g(),u.events.push(["exit",k,u]),k}function w(R,k){z(R,k.from)}function B(R,k){k.restore()}function S(R,k){return A;function A(j,L,H){let Z,Q,ae,C;return Array.isArray(j)?Y(j):"tokenize"in j?Y([j]):q(j);function q(I){return U;function U(ne){const te=ne!==null&&I[ne],ie=ne!==null&&I.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return Y(le)(ne)}}function Y(I){return Z=I,Q=0,I.length===0?H:E(I[Q])}function E(I){return U;function U(ne){return C=M(),ae=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?N():I.tokenize.call(k?Object.assign(Object.create(u),k):u,l,T,N)(ne)}}function T(I){return R(ae,C),L}function N(I){return C.restore(),++Q<Z.length?E(Z[Q]):H}}}function z(R,k){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&Qt(u.events,k,u.events.length-k,R.resolve(u.events.slice(k),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function M(){const R=g(),k=u.previous,A=u.currentConstruct,j=u.events.length,L=Array.from(o);return{restore:H,from:j};function H(){r=R,u.previous=k,u.currentConstruct=A,u.events.length=j,o=L,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Ax(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 Tx(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
140
140
  `;break}case-3:{s=`\r
141
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const Sx={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Rf},jx={91:OC},Ox={[-2]:Zi,[-1]:Zi,32:Zi},Px={35:$C,42:ka,45:[fc,ka],60:WC,61:fc,95:ka,96:cc,126:cc},Nx={38:Lf,92:$f},Mx={[-5]:Yi,[-4]:Yi,[-3]:Yi,33:ox,38:Lf,42:Ws,60:[lC,GC],91:lx,92:[IC,$f],93:To,95:Ws,96:xC},Ix={null:[Ws,Ex]},Rx={null:[42,95]},$x={null:[]},Lx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Rx,contentInitial:jx,disable:$x,document:Sx,flow:Px,flowInitial:Ox,insideSpan:Ix,string:Nx,text:Mx},Symbol.toStringTag,{value:"Module"}));function zx(e){const n=ZD([Lx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(nC),document:a(aC),flow:a(xx),string:a(_x),text:a(kx)};return r;function a(i){return s;function s(o){return Bx(r,i,o)}}}function qx(e){for(;!zf(e););return e}const hc=/[\0\t\n\r]/g;function Wx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,m,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(hc.lastIndex=m,u=hc.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(m);break}if(h===10&&m===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<p&&(l.push(i.slice(m,p)),e+=p-m),h){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ux=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Hx(e){return e.replace(Ux,Vx)}function Vx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return If(n.slice(i?2:1),i?16:10)}return Bo(n)||e}const Kf={}.hasOwnProperty;function Kx(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Zx(n)(qx(zx(n).document().write(Wx()(e,t,!0))))}function Zx(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Le),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(he),blockQuote:i(te),characterEscape:M,characterReference:M,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(le,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(pe),hardBreakTrailing:i(pe),htmlFlow:i(xe,s),htmlFlowData:M,htmlText:i(xe,s),htmlTextData:M,image:i(_e),label:s,link:i(Le),listItem:i(Ae),listItemValue:p,listOrdered:i(Te,m),listUnordered:i(Te),paragraph:i(Pe),reference:E,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(ke),thematicBreak:i(qe)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:ne,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:N,characterReferenceMarkerNumeric:N,characterReferenceValue:I,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(v),codeText:l(L),codeTextData:$,data:$,definition:l(),definitionDestinationString:x,definitionLabelString:_,definitionTitleString:F,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:$,htmlText:l(j),htmlTextData:$,image:l(Z),label:ae,labelText:Q,lineEnding:R,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:C,resourceTitleString:q,resource:Y,setextHeading:l(z),setextHeadingLineSequence:S,setextHeadingText:B,strong:l(),thematicBreak:l()}};Zf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let re={type:"root",children:[]};const me={stack:[re],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let we=-1;for(;++we<W.length;)if(W[we][1].type==="listOrdered"||W[we][1].type==="listUnordered")if(W[we][0]==="enter")ve.push(we);else{const Ze=ve.pop();we=a(W,Ze,we)}for(we=-1;++we<W.length;){const Ze=t[W[we][0]];Kf.call(Ze,W[we][1].type)&&Ze[W[we][1].type].call(Object.assign({sliceSerialize:W[we][2].sliceSerialize},me),W[we][1])}if(me.tokenStack.length>0){const Ze=me.tokenStack[me.tokenStack.length-1];(Ze[1]||mc).call(me,void 0,Ze[0])}for(re.position={start:nn(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:nn(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)re=t.transforms[we](re)||re;return re}function a(W,re,me){let ve=re-1,we=-1,Ze=!1,Ye,gt,Ut,Bt;for(;++ve<=me;){const tt=W[ve];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?we++:we--,Bt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!Bt&&!we&&!Ut&&(Ut=ve),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!we&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||we===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Ot=ve;for(gt=void 0;Ot--;){const vt=W[Ot];if(vt[1].type==="lineEnding"||vt[1].type==="lineEndingBlank"){if(vt[0]==="exit")continue;gt&&(W[gt][1].type="lineEndingBlank",Ze=!0),vt[1].type="lineEnding",gt=Ot}else if(!(vt[1].type==="linePrefix"||vt[1].type==="blockQuotePrefix"||vt[1].type==="blockQuotePrefixWhitespace"||vt[1].type==="blockQuoteMarker"||vt[1].type==="listItemIndent"))break}Ut&&(!gt||Ut<gt)&&(Ye._spread=!0),Ye.end=Object.assign({},gt?W[gt][1].start:tt[1].end),W.splice(gt||ve,0,["exit",Ye,tt[2]]),ve++,me++}if(tt[1].type==="listItemPrefix"){const Ot={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Ot,W.splice(ve,0,["enter",Ot,tt[2]]),ve++,me++,Ut=void 0,Bt=!0}}}return W[re][1]._spread=Ze,me}function i(W,re){return me;function me(ve){o.call(this,W(ve),ve),re&&re.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(W,re,me){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([re,me]),W.position={start:nn(re.start),end:void 0}}function l(W){return re;function re(me){W&&W.call(this,me),u.call(this,me)}}function u(W,re){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==W.type&&(re?re.call(this,W,ve[0]):(ve[1]||mc).call(this,W,ve[0]));else throw new Error("Cannot close `"+W.type+"` ("+kr({start:W.start,end:W.end})+"): it’s not open");me.position.end=nn(W.end)}function c(){return VD(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(W){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function h(){const W=this.resume(),re=this.stack[this.stack.length-1];re.lang=W}function g(){const W=this.resume(),re=this.stack[this.stack.length-1];re.meta=W}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=Qn(this.sliceSerialize(W)).toLowerCase()}function F(){const W=this.resume(),re=this.stack[this.stack.length-1];re.title=W}function x(){const W=this.resume(),re=this.stack[this.stack.length-1];re.url=W}function w(W){const re=this.stack[this.stack.length-1];if(!re.depth){const me=this.sliceSerialize(W).length;re.depth=me}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function S(W){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function M(W){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Ve(),ve.position={start:nn(W.start),end:void 0},me.push(ve)),this.stack.push(ve)}function $(W){const re=this.stack.pop();re.value+=this.sliceSerialize(W),re.position.end=nn(W.end)}function R(W){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=re.children[re.children.length-1];me.position.end=nn(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(M.call(this,W),$.call(this,W))}function k(){this.data.atHardBreak=!0}function A(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function j(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function L(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function H(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=re,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=re,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Q(W){const re=this.sliceSerialize(W),me=this.stack[this.stack.length-2];me.label=Hx(re),me.identifier=Qn(re).toLowerCase()}function ae(){const W=this.stack[this.stack.length-1],re=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=W.children;me.children=ve}else me.alt=re}function C(){const W=this.resume(),re=this.stack[this.stack.length-1];re.url=W}function q(){const W=this.resume(),re=this.stack[this.stack.length-1];re.title=W}function Y(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function T(W){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=Qn(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function N(W){this.data.characterReferenceType=W.type}function I(W){const re=this.sliceSerialize(W),me=this.data.characterReferenceType;let ve;me?(ve=If(re,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Bo(re);const we=this.stack.pop();we.value+=ve,we.position.end=nn(W.end)}function U(W){$.call(this,W);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(W)}function ne(W){$.call(this,W);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(W)}function te(){return{type:"blockquote",children:[]}}function ie(){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 ge(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function xe(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Te(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Ae(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function ke(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function qe(){return{type:"thematicBreak"}}}function nn(e){return{line:e.line,column:e.column,offset:e.offset}}function Zf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Zf(e,r):Yx(e,r)}}function Yx(e,t){let n;for(n in t)if(Kf.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 mc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+kr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is still open")}function Gx(e){const t=this;t.parser=n;function n(r){return Kx(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Yf(e,t){var l,u,c;const n={...Zn,...t==null?void 0:t.nodeTypes,[K.heading]:{...Zn[K.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[K.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>Yf({...m,ordered:e.ordered||!1},t))),e.type){case ot.heading:return{type:n[K.heading][e.depth||1],children:s};case ot.list:return{type:e.ordered?n[K.ol]:n[K.ul],children:s};case ot.listItem:return{type:n[K.li],children:s};case ot.paragraph:return{type:n[K.paragraph],children:s};case ot.link:return{type:n[K.link],[r]:e.url,children:s};case ot.image:return{type:n[K.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ot.blockquote:return{type:n[K.blockquote],children:s};case ot.code:return{type:n[K.codeblock],language:e.lang,children:[{text:e.value}]};case ot.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[K.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:K.paragraph,children:[{text:e.value||""}]};case ot.emphasis:return{[n[$t.emphasis]]:!0,...Gi(s),...fa(s)};case ot.strong:return{[n[$t.strong]]:!0,...Gi(s),...fa(s)};case ot.delete:return{[n[$t.delete]]:!0,...Gi(s),...fa(s)};case ot.inlineCode:return{[n[$t.code]]:!0,text:e.value,...fa(s)};case ot.thematicBreak:return{type:n[K.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Gi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function fa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Qx=function(t){const n=r=>r.children.map(a=>Yf(a,t));this.Compiler=n},Jx=(e,t=n=>{})=>{zD().use(Gx).use(Qx).process(e).then(n=>{const r=xn(n.result),a=s=>{const o=s;[K.li,K.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===K.paragraph&&o.children.splice(u,1,...c.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===K.link){const c=u.children&&u.children[0];if(c&&"text"in c&&c.text.includes(Is)){const m=u,p=c.text.replace(Is,""),h="link"in m&&m.link?m.link:"";m.type=K.mention,m.id=h,m.name=p,m.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(c=>{const m=c.replace(/~~/g,""),p=o.text.indexOf(c),h=o.text.substring(0,p),g=o.text.substring(p+c.length),f=[{text:h},{text:m,[K.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},So=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Xx=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},ew=e=>{const{selection:t}=e;return t?D.string(e,t):null},pc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},gc={"mod+b":K.bold,"mod+i":K.italic,"mod+shift+x":K.strikethrough,"mod+k":K.link,"mod+shift+7":K.ol,"mod+shift+8":K.ul,"mod+shift+9":K.blockquote},tw=(e,t,n,r)=>{for(const a in gc)if(Ky(a,e)){e.stopPropagation(),e.preventDefault();const i=gc[a];if(i===K.link){n([{type:"showLinkEditor",value:!0}]);return}if(fw(i)){rh(t,i,r);return}eh(t,i,r)}},Gf=(e,t,n,r)=>{var c;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(c=s.user)==null?void 0:c.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:K.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||Of),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),So(r)},nw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&V.isCollapsed(i)){const[s]=V.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),c=D.string(e,l).match(Hc);if(c){const m=c.index||0,p={path:s.path,offset:m},h={path:s.path,offset:m+c[0].length},g=D.range(e,p,h),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const F=c[1];let x=[];r&&(x=await r({name:F})),a([{type:"mentionPopover",value:{show:x.length>0?!0:n!==null,selectedUser:0,possibleUsers:x,position:x.length>0?g:null,numberOfUsers:x.length>0?x.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Qf=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},zn=e=>typeof e.text=="string",rw=[K.hr,K.image,K.mention],vc="<br>";function Jf(e,t={nodeTypes:Zn}){const{nodeTypes:n=Zn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Zn,...n,heading:{...Zn[K.heading],...n[K.heading]}},l=[o[K.ul],o[K.ol]];let u=i;if(!zn(e)&&s!==K.mention&&(u=e.children.map(c=>{const m=zn(c)?!1:l.includes(c.type||""),p=l.includes(e.type||"");let h=!1;return!zn(e)&&Array.isArray(e.children)&&(h=e.children.some(g=>!zn(g)&&g.type===o.link)),Jf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||p||h)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[K.blockquote]||e.parentType===o[K.blockquote]})}).join("")),!r&&(i===""||i===`
142
- `)&&e.parentType===o[K.paragraph]&&s!==o[K.mention]&&(s=o[K.paragraph],u=vc),!(u===""&&!rw.find(c=>o[c]===s)))switch(u!==vc&&zn(e)&&(e[K.strikethrough]&&e[K.bold]&&e[K.italic]?u=qn(u,"~~***"):e[K.bold]&&e[K.italic]?u=qn(u,"***"):(e[K.bold]&&(u=qn(u,"**")),e[K.italic]&&(u=qn(u,"_")),e[K.strikethrough]&&(u=qn(u,"~~")),e[K.code]&&(u=qn(u,"`")))),s){case o[K.heading][1]:return`# ${u}
141
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const Sx={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Rf},jx={91:OC},Ox={[-2]:Zi,[-1]:Zi,32:Zi},Px={35:$C,42:ka,45:[fc,ka],60:WC,61:fc,95:ka,96:cc,126:cc},Nx={38:Lf,92:$f},Mx={[-5]:Yi,[-4]:Yi,[-3]:Yi,33:ox,38:Lf,42:Ws,60:[lC,GC],91:lx,92:[IC,$f],93:To,95:Ws,96:xC},Ix={null:[Ws,Ex]},Rx={null:[42,95]},$x={null:[]},Lx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Rx,contentInitial:jx,disable:$x,document:Sx,flow:Px,flowInitial:Ox,insideSpan:Ix,string:Nx,text:Mx},Symbol.toStringTag,{value:"Module"}));function zx(e){const n=ZD([Lx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(nC),document:a(aC),flow:a(xx),string:a(_x),text:a(kx)};return r;function a(i){return s;function s(o){return Bx(r,i,o)}}}function qx(e){for(;!zf(e););return e}const hc=/[\0\t\n\r]/g;function Wx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(hc.lastIndex=m,u=hc.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(m);break}if(h===10&&m===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<p&&(l.push(i.slice(m,p)),e+=p-m),h){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}m=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ux=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Hx(e){return e.replace(Ux,Vx)}function Vx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return If(n.slice(i?2:1),i?16:10)}return Bo(n)||e}const Kf={}.hasOwnProperty;function Kx(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Zx(n)(qx(zx(n).document().write(Wx()(e,t,!0))))}function Zx(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Le),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(he),blockQuote:i(te),characterEscape:M,characterReference:M,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(le,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(pe),hardBreakTrailing:i(pe),htmlFlow:i(xe,s),htmlFlowData:M,htmlText:i(xe,s),htmlTextData:M,image:i(_e),label:s,link:i(Le),listItem:i(Ae),listItemValue:p,listOrdered:i(Te,m),listUnordered:i(Te),paragraph:i(Pe),reference:E,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(ke),thematicBreak:i(qe)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:ne,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:N,characterReferenceMarkerNumeric:N,characterReferenceValue:I,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(v),codeText:l(L),codeTextData:$,data:$,definition:l(),definitionDestinationString:x,definitionLabelString:_,definitionTitleString:F,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:$,htmlText:l(j),htmlTextData:$,image:l(Z),label:ae,labelText:Q,lineEnding:R,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:C,resourceTitleString:q,resource:Y,setextHeading:l(z),setextHeadingLineSequence:S,setextHeadingText:B,strong:l(),thematicBreak:l()}};Zf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let re={type:"root",children:[]};const me={stack:[re],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ve=[];let we=-1;for(;++we<W.length;)if(W[we][1].type==="listOrdered"||W[we][1].type==="listUnordered")if(W[we][0]==="enter")ve.push(we);else{const Ze=ve.pop();we=a(W,Ze,we)}for(we=-1;++we<W.length;){const Ze=t[W[we][0]];Kf.call(Ze,W[we][1].type)&&Ze[W[we][1].type].call(Object.assign({sliceSerialize:W[we][2].sliceSerialize},me),W[we][1])}if(me.tokenStack.length>0){const Ze=me.tokenStack[me.tokenStack.length-1];(Ze[1]||mc).call(me,void 0,Ze[0])}for(re.position={start:nn(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:nn(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)re=t.transforms[we](re)||re;return re}function a(W,re,me){let ve=re-1,we=-1,Ze=!1,Ye,gt,Ut,Bt;for(;++ve<=me;){const tt=W[ve];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?we++:we--,Bt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!Bt&&!we&&!Ut&&(Ut=ve),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!we&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||we===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Ot=ve;for(gt=void 0;Ot--;){const vt=W[Ot];if(vt[1].type==="lineEnding"||vt[1].type==="lineEndingBlank"){if(vt[0]==="exit")continue;gt&&(W[gt][1].type="lineEndingBlank",Ze=!0),vt[1].type="lineEnding",gt=Ot}else if(!(vt[1].type==="linePrefix"||vt[1].type==="blockQuotePrefix"||vt[1].type==="blockQuotePrefixWhitespace"||vt[1].type==="blockQuoteMarker"||vt[1].type==="listItemIndent"))break}Ut&&(!gt||Ut<gt)&&(Ye._spread=!0),Ye.end=Object.assign({},gt?W[gt][1].start:tt[1].end),W.splice(gt||ve,0,["exit",Ye,tt[2]]),ve++,me++}if(tt[1].type==="listItemPrefix"){const Ot={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Ot,W.splice(ve,0,["enter",Ot,tt[2]]),ve++,me++,Ut=void 0,Bt=!0}}}return W[re][1]._spread=Ze,me}function i(W,re){return me;function me(ve){o.call(this,W(ve),ve),re&&re.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(W,re,me){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([re,me]),W.position={start:nn(re.start),end:void 0}}function l(W){return re;function re(me){W&&W.call(this,me),u.call(this,me)}}function u(W,re){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==W.type&&(re?re.call(this,W,ve[0]):(ve[1]||mc).call(this,W,ve[0]));else throw new Error("Cannot close `"+W.type+"` ("+kr({start:W.start,end:W.end})+"): it’s not open");me.position.end=nn(W.end)}function d(){return VD(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(W){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function h(){const W=this.resume(),re=this.stack[this.stack.length-1];re.lang=W}function g(){const W=this.resume(),re=this.stack[this.stack.length-1];re.meta=W}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=Qn(this.sliceSerialize(W)).toLowerCase()}function F(){const W=this.resume(),re=this.stack[this.stack.length-1];re.title=W}function x(){const W=this.resume(),re=this.stack[this.stack.length-1];re.url=W}function w(W){const re=this.stack[this.stack.length-1];if(!re.depth){const me=this.sliceSerialize(W).length;re.depth=me}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function S(W){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function M(W){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Ve(),ve.position={start:nn(W.start),end:void 0},me.push(ve)),this.stack.push(ve)}function $(W){const re=this.stack.pop();re.value+=this.sliceSerialize(W),re.position.end=nn(W.end)}function R(W){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=re.children[re.children.length-1];me.position.end=nn(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(M.call(this,W),$.call(this,W))}function k(){this.data.atHardBreak=!0}function A(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function j(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function L(){const W=this.resume(),re=this.stack[this.stack.length-1];re.value=W}function H(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=re,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=re,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Q(W){const re=this.sliceSerialize(W),me=this.stack[this.stack.length-2];me.label=Hx(re),me.identifier=Qn(re).toLowerCase()}function ae(){const W=this.stack[this.stack.length-1],re=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=W.children;me.children=ve}else me.alt=re}function C(){const W=this.resume(),re=this.stack[this.stack.length-1];re.url=W}function q(){const W=this.resume(),re=this.stack[this.stack.length-1];re.title=W}function Y(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function T(W){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=Qn(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function N(W){this.data.characterReferenceType=W.type}function I(W){const re=this.sliceSerialize(W),me=this.data.characterReferenceType;let ve;me?(ve=If(re,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Bo(re);const we=this.stack.pop();we.value+=ve,we.position.end=nn(W.end)}function U(W){$.call(this,W);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(W)}function ne(W){$.call(this,W);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(W)}function te(){return{type:"blockquote",children:[]}}function ie(){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 ge(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function xe(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Te(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Ae(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function ke(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function qe(){return{type:"thematicBreak"}}}function nn(e){return{line:e.line,column:e.column,offset:e.offset}}function Zf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Zf(e,r):Yx(e,r)}}function Yx(e,t){let n;for(n in t)if(Kf.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 mc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+kr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is still open")}function Gx(e){const t=this;t.parser=n;function n(r){return Kx(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Yf(e,t){var l,u,d;const n={...Zn,...t==null?void 0:t.nodeTypes,[K.heading]:{...Zn[K.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[K.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>Yf({...m,ordered:e.ordered||!1},t))),e.type){case ot.heading:return{type:n[K.heading][e.depth||1],children:s};case ot.list:return{type:e.ordered?n[K.ol]:n[K.ul],children:s};case ot.listItem:return{type:n[K.li],children:s};case ot.paragraph:return{type:n[K.paragraph],children:s};case ot.link:return{type:n[K.link],[r]:e.url,children:s};case ot.image:return{type:n[K.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ot.blockquote:return{type:n[K.blockquote],children:s};case ot.code:return{type:n[K.codeblock],language:e.lang,children:[{text:e.value}]};case ot.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[K.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:K.paragraph,children:[{text:e.value||""}]};case ot.emphasis:return{[n[$t.emphasis]]:!0,...Gi(s),...fa(s)};case ot.strong:return{[n[$t.strong]]:!0,...Gi(s),...fa(s)};case ot.delete:return{[n[$t.delete]]:!0,...Gi(s),...fa(s)};case ot.inlineCode:return{[n[$t.code]]:!0,text:e.value,...fa(s)};case ot.thematicBreak:return{type:n[K.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Gi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function fa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Qx=function(t){const n=r=>r.children.map(a=>Yf(a,t));this.Compiler=n},Jx=(e,t=n=>{})=>{zD().use(Gx).use(Qx).process(e).then(n=>{const r=xn(n.result),a=s=>{const o=s;[K.li,K.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===K.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===K.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Is)){const m=u,p=d.text.replace(Is,""),h="link"in m&&m.link?m.link:"";m.type=K.mention,m.id=h,m.name=p,m.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 m=d.replace(/~~/g,""),p=o.text.indexOf(d),h=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:h},{text:m,[K.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},So=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Xx=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},ew=e=>{const{selection:t}=e;return t?D.string(e,t):null},pc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},gc={"mod+b":K.bold,"mod+i":K.italic,"mod+shift+x":K.strikethrough,"mod+k":K.link,"mod+shift+7":K.ol,"mod+shift+8":K.ul,"mod+shift+9":K.blockquote},tw=(e,t,n,r)=>{for(const a in gc)if(Ky(a,e)){e.stopPropagation(),e.preventDefault();const i=gc[a];if(i===K.link){n([{type:"showLinkEditor",value:!0}]);return}if(fw(i)){rh(t,i,r);return}eh(t,i,r)}},Gf=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:K.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||Of),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),So(r)},nw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&V.isCollapsed(i)){const[s]=V.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),d=D.string(e,l).match(Hc);if(d){const m=d.index||0,p={path:s.path,offset:m},h={path:s.path,offset:m+d[0].length},g=D.range(e,p,h),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const F=d[1];let x=[];r&&(x=await r({name:F})),a([{type:"mentionPopover",value:{show:x.length>0?!0:n!==null,selectedUser:0,possibleUsers:x,position:x.length>0?g:null,numberOfUsers:x.length>0?x.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Qf=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},zn=e=>typeof e.text=="string",rw=[K.hr,K.image,K.mention],vc="<br>";function Jf(e,t={nodeTypes:Zn}){const{nodeTypes:n=Zn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Zn,...n,heading:{...Zn[K.heading],...n[K.heading]}},l=[o[K.ul],o[K.ol]];let u=i;if(!zn(e)&&s!==K.mention&&(u=e.children.map(d=>{const m=zn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let h=!1;return!zn(e)&&Array.isArray(e.children)&&(h=e.children.some(g=>!zn(g)&&g.type===o.link)),Jf({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||p||h)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[K.blockquote]||e.parentType===o[K.blockquote]})}).join("")),!r&&(i===""||i===`
142
+ `)&&e.parentType===o[K.paragraph]&&s!==o[K.mention]&&(s=o[K.paragraph],u=vc),!(u===""&&!rw.find(d=>o[d]===s)))switch(u!==vc&&zn(e)&&(e[K.strikethrough]&&e[K.bold]&&e[K.italic]?u=qn(u,"~~***"):e[K.bold]&&e[K.italic]?u=qn(u,"***"):(e[K.bold]&&(u=qn(u,"**")),e[K.italic]&&(u=qn(u,"_")),e[K.strikethrough]&&(u=qn(u,"~~")),e[K.code]&&(u=qn(u,"`")))),s){case o[K.heading][1]:return`# ${u}
143
143
  `;case o[K.heading][2]:return`## ${u}
144
144
  `;case o[K.heading][3]:return`### ${u}
145
145
  `;case o[K.heading][4]:return`#### ${u}
@@ -150,7 +150,7 @@ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
150
150
  `;case o[K.codeblock]:return`\`\`\`${e.language||""}
151
151
  ${u}
152
152
  \`\`\`
153
- `;case o[K.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[K.mention]:const{id:c}=e;return e?`@{{${c}}}`:u;case o[K.ul]:case o[K.ol]:return`
153
+ `;case o[K.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[K.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[K.ul]:case o[K.ol]:return`
154
154
  ${u}
155
155
 
156
156
  `;case o[K.li]:const m=e&&e.parentType===o[K.ol],p=e.children.length===1&&zn(e.children[0]);let h="";for(let g=0;a>g;g++)m?h+=" ":h+=" ";return t.inBlockquote&&(h="> "+h),`
@@ -158,8 +158,8 @@ ${h}${m?"1.":"-"} ${u}${p?`
158
158
  `:""}`;case o[K.paragraph]:return`${u}
159
159
 
160
160
  `;case o[K.hr]:return`---
161
- `;default:return u}}function qn(e,t){const n=e.trim(),r=n,a=`${t}${r}${bc(t)}`;if(r.length===e.length)return a;const i=t+r+bc(t);return e.replace(n,i)}const bc=e=>e.split("").reverse().join(""),aw=e=>e.map(t=>Jf(t)).join("").trim();const iw=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(en),{show:l,selectedUser:u,possibleUsers:c}=i,m=Pf(n,"mention-popover",`toolbar-${s}`);if(!l)return d.jsx(d.Fragment,{});const p=Qf(a);return d.jsx(qr,{parent:p,children:d.jsx(Qc,{ref:m,className:"mention-popover",onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:d.jsxs("ul",{children:[c.map(({userId:h,user:g},f)=>d.jsx(Yt,{element:"li",className:G({selected:f===u}),member:{id:h,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Gf(n,v,r,s),o&&o({id:h||"",name:g.name||""})}}},h)),d.jsx(Yt,{element:"li",className:G("fallback",{selected:c.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${zt}icons/invite-user.svg`},link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},jo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=se.useIntl(),l=Nn(),{id:u,tabbableOption:c,setFocus:m,openTooltip:p,dispatch:h}=y.useContext(en),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{h([{type:"openTooltip",value:e}])},onMouseLeave:()=>{h([{type:"openTooltip",value:null}])},onFocus:()=>{h([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const b=[{type:"openTooltip",value:null}];l.selection&&b.push({type:"lastAnchor",value:l.selection.anchor}),h(b)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var b,v,_,F;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const x=f.currentTarget.closest("li");let w=x==null?void 0:x.nextElementSibling;if(f.key==="ArrowLeft"){const z=x==null?void 0:x.previousElementSibling;z?w=z:w=(b=x==null?void 0:x.parentElement)==null?void 0:b.lastElementChild}else w||(w=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const B=w==null?void 0:w.className.split(" ")[0];B&&(m(B),(_=w==null?void 0:w.querySelector("button"))==null||_.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(F=S==null?void 0:S.previousElementSibling)==null||F.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Pn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},yc=[K.ol,K.ul],Xf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},sw=e=>{const[t]=D.nodes(e,{match:n=>n.type===K.blockquote});return!!t},eh=(e,t,n)=>{try{const r=sw(e),a=Xf(e,t),i=yc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&de.isElement(u)&&yc.includes(u.type)},split:!0});const o={type:a?K.paragraph:i?K.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:c,match:p=>{const h=p;return!D.isEditor(p)&&de.isElement(p)&&h.type===K.li}})).forEach(([p,h])=>{ue.string(p).trim()===""&&X.removeNodes(e,{at:h})})}else{if(r){const u={type:K.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}`)}},ow=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=Xf(a,e);return d.jsx(jo,{id:e,active:i,hasDivider:t,callback:()=>{eh(a,e,r),n(i?null:e)}})},Br=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&de.isElement(n)&&r.type===K.link}});return!!t},uw=(e,t,n,r)=>{e.selection&&Oo(e,t,n,r)},lw=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&de.isElement(o)&&l.type===K.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),So(n)}}else Oo(e,t,n,r)},Oo=(e,t,n,r=a=>{console.error(a)})=>{try{Br(e)&&th(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:K.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"})),So(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},th=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&de.isElement(t)&&n.type===K.link}})};let Qi=null;const cw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(en),o=Nn(),l=wD(o),u=(l==null?void 0:l.text)||ew(o),[c,m]=y.useState(Br(o)),p=Pf(o,"link-editor",`${n}-link`),h=y.useRef(null);y.useEffect(()=>{var _;!c&&r&&((_=h.current)==null||_.focus())},[c]),y.useEffect(()=>{Qi&&clearTimeout(Qi),Qi=setTimeout(()=>{m(Br(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(_=>{const F={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${_}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:_}),_){case"open":F.href=(l==null?void 0:l.full)||"",F.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},F.children=d.jsxs(d.Fragment,{children:[F.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${_}_text`})})]});break;case"edit":F.onClick=()=>{m(!1)};break;case"remove":F.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Br(o)&&(th(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return F}),b=[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&b.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=Qf(a);return d.jsx(qr,{parent:v,children:d.jsx(Pn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!c},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var _;return(_=h.current)==null?void 0:_.focus()})}},children:c?d.jsx(sr,{wrappers:g,buttons:f}):d.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async _=>{setTimeout(()=>{const F=[{type:"showLinkEditor",value:!1}];if(_.url){const{full:x}=Yc(_.url);l!=null&&l.full?lw(o,x,n,s):uw(o,x,n,s),F.push({type:"lastAnchor",value:null})}i(F)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},dw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(en),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Br(e))},[e.selection]),d.jsx(jo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},fw=e=>[K.bold,K.italic,K.strikethrough].includes(e),nh=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},rh=(e,t,n)=>{try{nh(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},hw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=nh(a,e);return d.jsx(jo,{id:e,active:i,hasDivider:t,callback:()=>{rh(a,e,r),n(i?null:e)}})},za=[K.bold,K.italic,K.strikethrough],mw=[K.ol,K.ul,K.blockquote];const pw=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(en);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[za.map((r,a)=>d.jsx(hw,{format:r,hasDivider:a===za.length-1},r)),d.jsx(dw,{}),mw.map((r,a)=>d.jsx(ow,{format:r,hasDivider:a===1},r))]})]}),d.jsx(cw,{})]})};var gw=Dw,vw=/^(?:\w+:)?\/\/(\S+)$/,bw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,yw=/^[^\s\.]+\.\S{2,}$/;function Dw(e){if(typeof e!="string")return!1;var t=e.match(vw);if(!t)return!1;var n=t[1];return n?!!(bw.test(n)||yw.test(n)):!1}const Cw=jn(gw),xw=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[K.link].includes(s.type)||a(i)},e.insertText=i=>{i&&Cw(i)?Oo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},ww=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===K.mention?!0:n(i),e.isVoid=i=>i.type===K.mention?!0:r(i),e.markableVoid=i=>i.type===K.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Ew=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===K.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 ah=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),c=em();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=a||{},{listMembers:p,clickMentionFallback:h,onChange:g=()=>{},onMention:f=()=>{},reportError:b=q=>{console.error(q)}}=i||{},v=[{type:K.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const _={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:za[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[F,x]=y.useReducer(zr,_),{editorKey:w,originalValue:B,initialValue:S,stringValue:z,lastAnchor:M,lastKey:$,hasInteracted:R,hasLoaded:k,mentionPopover:A}=F,j=q=>{const Y=q||za[0];q&&x([{type:"tabbableOption",value:Y}])},L=`rte-${e}`,H=y.useCallback(q=>d.jsx(CD,{...q}),[]),Z=y.useCallback(q=>d.jsx(xD,{...q}),[]),Q=y.useMemo(()=>xw(ww(Ew(ub(yD(sb())),b),b),L,b),[]);y.useEffect(()=>{if(!t)return;Tr.lastIndex=0;const q=t.match(Tr);!q||q.length>1||q[0].length!==t.length||R||x([{type:"originalValue",value:t}])},[t]);const ae=q=>{if(!Q||q!==L)return;const Y=D.end(Q,[]);X.select(Q,Y),ee.focus(Q)};y.useEffect(()=>{const q=Y=>{var N;const E=Y,T=((N=E==null?void 0:E.detail)==null?void 0:N.id)||null;T&&ae(T)};return window.addEventListener("focusEditor",q),()=>{window.removeEventListener("focusEditor",q)}},[]),y.useEffect(()=>{if(Q.children.length>0&&!k){if(x([{type:"hasLoaded",value:!0}]),!s)return;ae(L)}},[Q.children.length,S]),y.useEffect(()=>{B&&(async()=>{let Y=xn(B);if(Y.includes("<")){jr.prototype.escape=T=>T;const E=new jr;E.addRule("br",{filter:["br"],replacement:T=>T+`
161
+ `;default:return u}}function qn(e,t){const n=e.trim(),r=n,a=`${t}${r}${bc(t)}`;if(r.length===e.length)return a;const i=t+r+bc(t);return e.replace(n,i)}const bc=e=>e.split("").reverse().join(""),aw=e=>e.map(t=>Jf(t)).join("").trim();const iw=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(en),{show:l,selectedUser:u,possibleUsers:d}=i,m=Pf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Qf(a);return c.jsx(qr,{parent:p,children:c.jsx(Qc,{ref:m,className:"mention-popover",onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:h,user:g},f)=>c.jsx(Yt,{element:"li",className:G({selected:f===u}),member:{id:h,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Gf(n,v,r,s),o&&o({id:h||"",name:g.name||""})}}},h)),c.jsx(Yt,{element:"li",className:G("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${zt}icons/invite-user.svg`},link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},jo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=se.useIntl(),l=Nn(),{id:u,tabbableOption:d,setFocus:m,openTooltip:p,dispatch:h}=y.useContext(en),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{h([{type:"openTooltip",value:e}])},onMouseLeave:()=>{h([{type:"openTooltip",value:null}])},onFocus:()=>{h([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const b=[{type:"openTooltip",value:null}];l.selection&&b.push({type:"lastAnchor",value:l.selection.anchor}),h(b)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var b,v,_,F;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const x=f.currentTarget.closest("li");let w=x==null?void 0:x.nextElementSibling;if(f.key==="ArrowLeft"){const z=x==null?void 0:x.previousElementSibling;z?w=z:w=(b=x==null?void 0:x.parentElement)==null?void 0:b.lastElementChild}else w||(w=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const B=w==null?void 0:w.className.split(" ")[0];B&&(m(B),(_=w==null?void 0:w.querySelector("button"))==null||_.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(F=S==null?void 0:S.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Pn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},yc=[K.ol,K.ul],Xf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},sw=e=>{const[t]=D.nodes(e,{match:n=>n.type===K.blockquote});return!!t},eh=(e,t,n)=>{try{const r=sw(e),a=Xf(e,t),i=yc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&de.isElement(u)&&yc.includes(u.type)},split:!0});const o={type:a?K.paragraph:i?K.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const h=p;return!D.isEditor(p)&&de.isElement(p)&&h.type===K.li}})).forEach(([p,h])=>{ue.string(p).trim()===""&&X.removeNodes(e,{at:h})})}else{if(r){const u={type:K.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}`)}},ow=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=Xf(a,e);return c.jsx(jo,{id:e,active:i,hasDivider:t,callback:()=>{eh(a,e,r),n(i?null:e)}})},Br=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&de.isElement(n)&&r.type===K.link}});return!!t},uw=(e,t,n,r)=>{e.selection&&Oo(e,t,n,r)},lw=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&de.isElement(o)&&l.type===K.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),So(n)}}else Oo(e,t,n,r)},Oo=(e,t,n,r=a=>{console.error(a)})=>{try{Br(e)&&th(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:K.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"})),So(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},th=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&de.isElement(t)&&n.type===K.link}})};let Qi=null;const cw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(en),o=Nn(),l=wD(o),u=(l==null?void 0:l.text)||ew(o),[d,m]=y.useState(Br(o)),p=Pf(o,"link-editor",`${n}-link`),h=y.useRef(null);y.useEffect(()=>{var _;!d&&r&&((_=h.current)==null||_.focus())},[d]),y.useEffect(()=>{Qi&&clearTimeout(Qi),Qi=setTimeout(()=>{m(Br(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(_=>{const F={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${_}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:_}),_){case"open":F.href=(l==null?void 0:l.full)||"",F.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},F.children=c.jsxs(c.Fragment,{children:[F.children,c.jsx(Ie,{children:e.formatMessage({id:`${t}${_}_text`})})]});break;case"edit":F.onClick=()=>{m(!1)};break;case"remove":F.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Br(o)&&(th(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return F}),b=[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&b.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=Qf(a);return c.jsx(qr,{parent:v,children:c.jsx(Pn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var _;return(_=h.current)==null?void 0:_.focus()})}},children:d?c.jsx(sr,{wrappers:g,buttons:f}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async _=>{setTimeout(()=>{const F=[{type:"showLinkEditor",value:!1}];if(_.url){const{full:x}=Yc(_.url);l!=null&&l.full?lw(o,x,n,s):uw(o,x,n,s),F.push({type:"lastAnchor",value:null})}i(F)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},dw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(en),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Br(e))},[e.selection]),c.jsx(jo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},fw=e=>[K.bold,K.italic,K.strikethrough].includes(e),nh=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},rh=(e,t,n)=>{try{nh(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},hw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=nh(a,e);return c.jsx(jo,{id:e,active:i,hasDivider:t,callback:()=>{rh(a,e,r),n(i?null:e)}})},za=[K.bold,K.italic,K.strikethrough],mw=[K.ol,K.ul,K.blockquote];const pw=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(en);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[za.map((r,a)=>c.jsx(hw,{format:r,hasDivider:a===za.length-1},r)),c.jsx(dw,{}),mw.map((r,a)=>c.jsx(ow,{format:r,hasDivider:a===1},r))]})]}),c.jsx(cw,{})]})};var gw=Dw,vw=/^(?:\w+:)?\/\/(\S+)$/,bw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,yw=/^[^\s\.]+\.\S{2,}$/;function Dw(e){if(typeof e!="string")return!1;var t=e.match(vw);if(!t)return!1;var n=t[1];return n?!!(bw.test(n)||yw.test(n)):!1}const Cw=jn(gw),xw=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[K.link].includes(s.type)||a(i)},e.insertText=i=>{i&&Cw(i)?Oo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},ww=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===K.mention?!0:n(i),e.isVoid=i=>i.type===K.mention?!0:r(i),e.markableVoid=i=>i.type===K.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Ew=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===K.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 ah=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),d=em();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=a||{},{listMembers:p,clickMentionFallback:h,onChange:g=()=>{},onMention:f=()=>{},reportError:b=q=>{console.error(q)}}=i||{},v=[{type:K.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const _={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:za[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[F,x]=y.useReducer(zr,_),{editorKey:w,originalValue:B,initialValue:S,stringValue:z,lastAnchor:M,lastKey:$,hasInteracted:R,hasLoaded:k,mentionPopover:A}=F,j=q=>{const Y=q||za[0];q&&x([{type:"tabbableOption",value:Y}])},L=`rte-${e}`,H=y.useCallback(q=>c.jsx(CD,{...q}),[]),Z=y.useCallback(q=>c.jsx(xD,{...q}),[]),Q=y.useMemo(()=>xw(ww(Ew(ub(yD(sb())),b),b),L,b),[]);y.useEffect(()=>{if(!t)return;Tr.lastIndex=0;const q=t.match(Tr);!q||q.length>1||q[0].length!==t.length||R||x([{type:"originalValue",value:t}])},[t]);const ae=q=>{if(!Q||q!==L)return;const Y=D.end(Q,[]);X.select(Q,Y),ee.focus(Q)};y.useEffect(()=>{const q=Y=>{var N;const E=Y,T=((N=E==null?void 0:E.detail)==null?void 0:N.id)||null;T&&ae(T)};return window.addEventListener("focusEditor",q),()=>{window.removeEventListener("focusEditor",q)}},[]),y.useEffect(()=>{if(Q.children.length>0&&!k){if(x([{type:"hasLoaded",value:!0}]),!s)return;ae(L)}},[Q.children.length,S]),y.useEffect(()=>{B&&(async()=>{let Y=xn(B);if(Y.includes("<")){jr.prototype.escape=T=>T;const E=new jr;E.addRule("br",{filter:["br"],replacement:T=>T+`
162
162
 
163
- `}),Y=E.turndown(Y)}o&&o.mentions&&(Y=await Zc({text:Y,template:`[${Is}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),Jx(Y,E=>{x([{type:"initialValue",value:E},{type:"editorKey",value:B.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:pc(Q)}])},150)})})()},[B]),y.useEffect(()=>{t!==""||!Q||ds(B,t)&&!R||(D.withoutNormalizing(Q,()=>{X.delete(Q,{at:{anchor:D.start(Q,[]),focus:D.end(Q,[])}}),X.deselect(Q),Q.children.length!==0&&X.unwrapNodes(Q,{at:[0]}),X.insertNodes(Q,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Mc(()=>{nw({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:x})},100);return S?d.jsx("div",{id:L,className:"rich-text-editor",children:d.jsxs(en.Provider,{value:{...F,id:L,isInOverlay:m,setFocus:j,dispatch:x,onMention:f,reportError:b},children:[d.jsxs(vD,{editor:Q,initialValue:S,onChange:q=>{if(Q.operations.some(E=>E.type!=="set_selection")){const E=aw(q);g(E),x([{type:"stringValue",value:pc(Q)}]),R||x([{type:"hasInteracted",value:!0}]),C(),c&&console.log({serialized:E,json:q})}},...l,children:[d.jsx(uD,{className:"input",renderElement:H,renderLeaf:Z,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:q=>{if(q.key==="Enter"){A.show&&(q.preventDefault(),q.stopPropagation(),Gf(Q,A,x,L));const{selection:Y}=Q;if(Y){const E=V.isCollapsed(Y),[T,N]=D.node(Q,Y,{depth:1});let I=T,U=I.type;const ne=I.children[0];if(ne&&[K.ol,K.ul].includes(ne.type)&&(I=ne,U=ne.type),I&&de.isElement(I)&&U!==K.paragraph){if(U===K.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),X.insertNodes(Q,v);return}if(E){const[te,ie]=D.parent(Q,Y,{edge:"end"}),J=te.type;if([K.ul,K.ol].includes(U))if(q.stopPropagation(),q.preventDefault(),J===K.li&&$==="Enter"){te.children.length===1&&"text"in te.children[0]&&te.children[0].text===""&&X.removeNodes(Q,{at:ie}),X.insertNodes(Q,v,{at:P.next(N)}),X.select(Q,D.end(Q,P.next(N)));return}else{const[ge,he]=Xx(Q,K.li),pe={type:K.li,children:[{text:""}]};X.insertNodes(Q,pe,{at:P.next(he)}),X.select(Q,D.end(Q,P.next(he)))}}}}}else if(q.key==="Escape"){if(A.show){q.preventDefault(),q.stopPropagation(),x([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&A.show){q.preventDefault(),q.stopPropagation();const{selectedUser:Y,possibleUsers:E}=A;let T=q.key==="ArrowUp"?Y-1:Y+1;T<0&&(T=E.length-1),T>=E.length+1&&(T=0),x([{type:"mentionPopover",value:{...A,selectedUser:T}}])}x([{type:"lastKey",value:q.key}]),tw(q,Q,x,b)},onBlur:()=>{Q.selection&&x([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(M){if(!P.isPath(M.path)||!ue.has(Q,M.path))return;const q=ue.get(Q,M.path);let Y=0;if(fe.isText(q)?Y=q.text.length:q.children&&(Y=q.children.length),M.offset>Y)return;try{X.select(Q,{anchor:M,focus:M})}catch(E){const T=E.message;b(`Error focusing editor: ${T}`)}}}}),d.jsx(pw,{}),p?d.jsx(iw,{onFallbackClick:h}):null]},w),d.jsx(so,{id:`character-limit-${e}`,limit:r,valueLength:ei(z)})]})}):d.jsx(d.Fragment,{})};const _w=({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=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:G("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const m=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:m,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:m,children:c.label})]},m)})})]})};function ih({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,c]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async x=>{p(!0),g(!1);try{const w=x.target.files&&x.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const B=await a({fileObject:w,userId:t}),S={thumbnail:B.thumbnailURL,full:B.originalURL};c(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:_=o.formatMessage({id:`${l}cta_change`}),uploading:F=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return d.jsxs("div",{className:G("profile-image-change-figure",e),children:[d.jsx(hn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&d.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),d.jsx(Fe,{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:m,children:m?F:u?_:v})]})}const sh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const oh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async x=>{x.preventDefault();try{await l(c),m([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},_=x=>{x.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},F=x=>{x.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),d.jsx(qt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Fe,{variant:"secondary",onClick:_,children:b({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Fe,{onClick:F,children:b({id:"inviteForm_ctaDone"})})]}):d.jsx(Fe,{onClick:_,children:b({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Lh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:c,onChange:x=>{m(x),h(!x.length)},autoFocus:!1,getLabel:(x,w,B)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:x}),d.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(w),h(!c.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),d.jsx(qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Fe,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Fa=e=>e.map(t=>({condition:t})),xt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},kw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[xt.NEW_PASSWORD]!==h[xt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=h=>!ps(h[xt.NEW_PASSWORD]).isValid,m=[{"data-testid":xt.NEW_PASSWORD,id:xt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Fa(["required",c]),functions:{onChange:h=>l(ps(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":xt.CONFIRMED_PASSWORD,id:xt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Fa(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":xt.CURRENT_PASSWORD,id:xt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Fa(["required"])}),i&&m.push({component:Od,props:{matchingRules:o}});const p={id:xt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(xt.NEW_PASSWORD)||g.includes(xt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Jt,{...p}),r&&d.jsx(fn,{variant:"error",text:r})]})};const uh=({hooks:e,functions:t,meta:n={},gtm:r})=>{var x,w;const a=se.useIntl(),i="profileForm_",s=y.useContext(mt),[o,l]=y.useState(s.image),[u,c]=y.useState(!1),{uploadImage:m,onSuccess:p=async B=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:_="ProfileForm",event:F="profile-form-submit-click"}=r||{};return d.jsx(Jt,{id:"profile-details-form",fields:[{component:ih,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,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:((x=s.location)==null?void 0:x.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:B})=>B&&!u?!1:!b(B),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||c(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:qt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:_,event:F},functions:{onSuccess:async B=>{try{const S={...B,image:o||null,location:u?await f(B==null?void 0:B.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const lh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=se.useIntl(),u=y.useRef(null);Xn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&c(m)}}),d.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Dc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},Fw=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"]}},Bw=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=Fw(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}])},Aw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(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:()=>{Dc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Bd,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(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:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>d.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>d.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:h}),privacy:h=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Dc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const Tw=({className:e=""})=>d.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(se.FormattedMessage,{id:"signup_success_title"})}),d.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const Sw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},jw=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=se.useIntl(),{title:u=!0,expectation:c=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:c,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(zr,Sw),{validFields:v,emailDetails:_,shouldManuallyApprove:F,shouldDisableButton:x,showSuccessMessage:w,showError:B}=f,[S,z]=Hs.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(()=>{F===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[F]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const $=y.useMemo(()=>Aw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,g,f]),R=x?!0:F?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&w?d.jsx(Tw,{className:e}):d.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(se.FormattedMessage,{id:"signup_title"})}),B&&d.jsx(fn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Jt,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:R?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await Bw({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:k=>{r.handleError(k),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const vn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Ow=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(vn,{className:G("download-section",n),children:d.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(sr,{buttons:r})]})})};const Us="editSection_";function ch({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Pw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return d.jsxs(jt,{variant:"muted",icon:e,children:[d.jsx("p",{children:t||s({id:`${Us}placeholder_description`})}),a&&d.jsx("p",{children:d.jsx(Fe,{href:r,variant:"secondary",size:"small",onClick:()=>ch({href:r,setShowModal:i}),children:n||s({id:`${Us}placeholder_cta`})})})]})},Nw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:c}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),d.jsxs("section",{className:G("edit-section",t),children:[g&&d.jsx(mn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:b||(n?d.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var _,F;(_=n==null?void 0:n.functions)!=null&&_.onSuccess&&await((F=n==null?void 0:n.functions)==null?void 0:F.onSuccess(v)),p(!1)},onCancel:h}}):d.jsx(d.Fragment,{}))}),d.jsxs("div",{className:G("edit-section-header",{"no-title":!s}),children:[s&&d.jsx("h2",{className:"edit-section-header-title",children:i}),f&&d.jsx(Fe,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>ch({href:a,setShowModal:p}),children:c({id:`${Us}edit`})})]}),e||d.jsx(Pw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&d.jsx(qt,{})]})};const Mw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:G("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:m,link:p=!1,description:h=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:m});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&d.jsx("small",{children:h})]},window.btoa(`${c.url}_${g}`))})})]})};let Ji;const Xi="contactFooter_",Iw=({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(Ji),Ji=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ji),window.removeEventListener("resize",l)}),[]),d.jsx(vn,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(se.FormattedMessage,{id:`${Xi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(se.FormattedMessage,{id:`${Xi}text`})}),d.jsx(dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(se.FormattedMessage,{id:`${Xi}email`})})]}),d.jsx(sh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Rw=({activeLink:e,profile:t,...n})=>d.jsx(vn,{children:d.jsx(kd,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(_d,{activeLink:e,profile:t}),d.jsx(nd,{...n})]})})});const es="cookieBanner_",ts=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ns=new Date(Date.now()+12*30*24*60*60*1e3),dh=()=>{const e=se.useIntl(),[t,n,r]=Hs.useCookies(ts),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ts.forEach(c=>{n(c,!0,{path:"/",expires:ns,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ns}),ts.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:ns});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${es}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${es}title`})}),d.jsx("p",{children:e.formatMessage({id:`${es}text`})}),d.jsx(sr,{buttons:u})]})},Kt={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:Wn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Wn["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:Wn.support,gtmType:"concierge-email-click"},business:{email:Wn.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 Yn="footer_",qa="SiteFooter",Cc=({group:e})=>{const t=Kt[e].order||[];let n=!1;return"text"in Kt[e]&&(n=Kt[e].text),d.jsxs(y.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(se.FormattedMessage,{id:`${Yn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Kt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":qa,"data-gtm-event-type":i,...s,children:d.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(y.Fragment,{children:[d.jsx("dt",{children:d.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":qa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Po=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Ya,{element:"hr"}),d.jsx(io,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":qa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Cc,{group:e}),Object.keys(Kt[e]).includes("child")&&d.jsx(Cc,{group:Kt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(Kt.social.order)&&Kt.social.order.map(e=>{const t=Kt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":qa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(se.FormattedMessage,{id:`${Yn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(se.FormattedMessage,{id:`${Yn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={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===bt.ACCOUNT&&t===!1&&n[bt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.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 bt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case bt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case bt.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=jc(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?Re.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 bt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",bt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case bt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.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(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Lr={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:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Wa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=jc(Lr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let F=o.gtmType||`${e}-click`;if(F.includes(".")){const x=F.split("."),w=x[x.length-2];F=`${w==="topics"?`${w}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":F,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},_={};if(f&&(b={...b,"aria-current":"page"}),h){const F=o.menuId||e,x={onClick:w=>Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]}),onFocus:()=>Re.events.onFocus({id:F}),onBlur:()=>Re.events.onBlur({id:F,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:F,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:F,callback:a})};v={...x,id:F===bt.SITE?bt.SITE:bt.ACCOUNT},n&&(g&&(_={...x,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]})},"aria-haspopup":!0,"aria-expanded":r[F],"aria-controls":F}),v={...v,hidden:F in r?!r[F]:!0}),g||(v={...v})}return d.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(c?Fe:"a",p,s.formatMessage({id:m})):n&&o.order&&g?d.jsxs("button",{..._,children:[s.formatMessage({id:m}),d.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[bt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&d.jsx("ul",{...v,children:o.order.map(F=>{if(!o[F])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[F].order?d.jsxs("li",{className:G({[o[F].className]:o[F].className}),children:[s.formatMessage({id:`${m}_${F}`}),d.jsx("ul",{children:o[F].order.map(w=>d.jsx(Wa,{id:`${e}.${F}.${w}`,...x},w))})]},F):d.jsx(Wa,{id:`${e}.${F}`,...x},F)})})]},e)};const $w={height:67,height_desktop:83};var bt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(bt||{});const No=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(mt),r=On(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(zr,{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:c}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),Rc({scrollPosition:$w[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,_,F=!1)=>{Re.handleMenus({id:v,value:_,menus:m.current.menus,dispatch:o,forceHandle:F})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{m.current.menus[_]&&p(_,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Xn(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["site-navigation"]]),Xn(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["account-navigation"]]);const f=d.jsxs(d.Fragment,{children:[!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(lh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),d.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Lr.order.map(v=>d.jsx(Wa,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(io,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[i.navigation?d.jsxs(d.Fragment,{children:[b,f]}):d.jsxs(d.Fragment,{children:[f,b]}),a?d.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),d.jsx(hn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Lr.buttons.order.map(v=>d.jsx(Wa,{id:`buttons.${v}`},v))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Lw=()=>{const e=se.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(No,{}),d.jsx("div",{id:"content",children:d.jsx(fn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(Po,{})]})},fh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:m="default",circle:p="default",modal:h="default"}=i,g=Nc(),[f,b]=y.useState(""),v=B=>{const{detail:{message:S}}=B;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const _=ba(e,{locale:o}),F=ba(t,{locale:o}),x=ba(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),m!=="default"&&(w[m]=!0),p!=="default"&&(w[p]=!0),d.jsx(zh.ErrorBoundary,{onError:r,fallback:d.jsx(Lw,{}),children:d.jsxs(y.Suspense,{fallback:null,children:[d.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[d.jsx(No,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[F&&d.jsx("div",{className:G("additional-content prepended",{"large-modal":h==="large"}),children:F}),y.createElement(c==="bold"?to:"div",{id:"content",children:_,className:G({"large-modal":h==="large"})})]}),x&&d.jsx("div",{className:"additional-content appended",children:x}),u&&d.jsx(Po,{}),d.jsx(dh,{})]}),f&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},xc={default:"tags_",headerTopics:"header_topics_topics_"},rs={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"},zw={getTagDetails:e=>{if(e.includes("topic_")){if(e=rs.topic[e.replace("topic_","")],e){const t=Lr.topics.topics[e].href;return t?{id:e,href:t,text:`${xc.headerTopics}${e}`}:null}return null}return rs[e]?(e=rs[e],{id:e,text:`${xc.default}${e}`}):null}};const qw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=zw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const Ww=({members:{data:e=[],total:t=e.length},isMember:n=!1,hasNextPage:r=!1,loadNextPage:a=()=>{},profile:i,gtmContext:s="member",gtmType:o="member-click",className:l=""})=>{const u=se.useIntl(),c="membersList",m=y.useContext(mt),[p,h]=y.useState(!1);return e.length===0?null:d.jsxs("div",{className:G("members-list",l),children:[d.jsxs("h1",{children:[u.formatMessage({id:c}),d.jsx("span",{className:"count",children:t})]}),d.jsxs("ul",{children:[n?d.jsxs("li",{children:[d.jsx(Yt,{member:m,gtmContext:s,gtmType:o}),d.jsx(dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),h(!0)},children:u.formatMessage({id:`${c}_profile`})})]}):d.jsx(d.Fragment,{}),e.map((g,f)=>d.jsxs("li",{children:[d.jsx(Yt,{member:g,gtmContext:s,gtmType:o}),g.isAdmin&&d.jsx(ln,{children:u.formatMessage({id:`${c}_admin`})})]},f))]}),r&&d.jsx(Wr,{hasNextPage:r,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),i?d.jsx(li,{form:i,showModal:p,content:{title:u.formatMessage({id:`${c}_modal_title`})},functions:{onClose:()=>{h(!1)}}}):d.jsx(d.Fragment,{})]})},Uw={showForm:!1},ui=y.createContext(Uw),hh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return d.jsx(ui.Provider,{value:{...t,updateConversation:n},children:e})},wc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Hw=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?d.jsx("small",{children:At(a.formatMessage,`${e}explainer`,n,"action",{a:i=>d.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})})}):d.jsx(d.Fragment,{})},Vw=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.useIntl();return n?d.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:At(a.formatMessage,`${t}label_action`,r,"action")})};let ha=null;const Je="discussion_form_",Hr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:c={},gtmContext:m="DiscussionForm"})=>{var xe,_e,Le;const p=se.useIntl(),h=y.useContext(mt),[g,f]=y.useState(""),{isLoading:b=!1,isInWrapper:v=!1,isInOverlay:_=!1,isAutoFocused:F=!1,isEditing:x=!1,hasTitleField:w=!1,isPrepopulated:B=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:M=!1,showSuccessMessage:$=!0}=r||{},{onChange:R=()=>{},create:k=()=>{},handleSaveEdit:A=()=>{},handleCancel:j=()=>{},callback:L=()=>{},onMention:H=()=>{},listMembers:Z=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:ae={create:{projectNames:["questions-answers"]}}}=u,[C,q]=y.useState({title:w&&w.text||"",body:x&&x.text||B&&B.text||""}),[Y,E]=y.useState(o.error||!1),[T,N]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&B&&B!==C.body&&q({...C,body:B.text||""})},[B]),b)return d.jsx(Ft,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const I=Te=>{q({...C,body:Te}),R({body:Te});let Ae;!h||!h.id?Ae=At(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Te.length>=i&&(Ae=`${Je}error_tooLong`):Ae=At(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Ae?E(Ae):Y&&E(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Te=((xe=t.slugs)==null?void 0:xe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Le=t.slugs)==null?void 0:Le.question)||"";Te&&(U=`${U}-${Te.slice(-15)}`)}e&&(U=`${e}-${U}`);const ne=async()=>{if(!h||!h.id||!n||J)return;ha&&clearTimeout(ha),N("submitting");const Te=window.location.pathname;try{let Ae;switch(t.type){case"post":Ae=await k({title:C.title,content:C.body});break;case"question":Ae=await k({title:C.body,authorId:h&&h.id,...ae==null?void 0:ae.create});break;case"response":Ae=await k({questionSlug:t.slugs.question},{body:C.body,authorId:h&&h.id,contentPath:Te});break;case"reply":Ae=await k({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:h&&h.id,contentPath:Te});break;default:break}await Xh(1e3),L&&await L(Ae),ha=setTimeout(()=>{q({title:"",body:""}),N("submitted"),f(At(p.formatMessage,`${Je}success`,t.type,"action"));const Pe=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Pe),te()},500)}catch(Ae){const Pe=Ae;let ke=`${Je}error`;Pe!=null&&Pe.message.includes("entry already exists")&&(ke=At(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Pe!=null&&Pe.message.includes("429")?ke=At(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Pe!=null&&Pe.message.includes("400")&&(ke=`${Je}error`),E(ke),te()}},te=()=>{ha=setTimeout(()=>{E(!1),N(!1),f("")},5e3)},ie=!C.title||!Jo(C.title),le=!C.body||!Jo(C.body);let J=le;w&&(J=ie&&le);const ge=T==="submitting",he=[{component:Vw,props:{formID:U,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:ah,props:{id:`${U}-input`,value:T==="submitting"&&!Y?"":C.body,placeholder:a||At(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:I,onMention:H,listMembers:Z,clickMentionFallback:Q},data:c,autoFocus:x!==!1||F&&!w,"aria-invalid":!!Y,"aria-errormessage":"error-message"}},{component:Hw,props:{intlPath:Je,showGuidelines:z,type:t.type,gtmContext:m}}];M&&he.push({component:qt}),w&&he.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:F,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Te=>{q({...C,title:Te}),R({title:Te})}},validation:[{condition:()=>J,error:p.formatMessage({id:`${Je}titleField_error`})}]});let pe=!h||!h.id||!n||J||ge;return x&&(w?pe=pe||C.body===x.text&&C.title===w.text:pe=pe||C.body===x.text),d.jsxs(d.Fragment,{children:[d.jsxs(Jt,{id:U,className:G("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!ge||o.cancel},functions:{onSuccess:async()=>{if(x){N("submitting"),A(C);return}await ne()},onCancel:j},fields:he,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:pe,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:p.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!h||!h.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:m,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&d.jsx("h2",{children:At(p.formatMessage,`${Je}title`,t.type,"action")}),d.jsx(Yt,{member:h?{...h,link:!1}:"community",gtmContext:m,gtmType:"profile-click"})]}),T==="submitted"&&$&&d.jsx(Sr,{className:"success","data-testid":"success",children:At(p.formatMessage,`${Je}success`,t.type,"action")}),Y&&d.jsx(Sr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof Y=="string"?Y.includes(" ")?Y:p.formatMessage({id:Y},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):Y}),g&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Hr},Symbol.toStringTag,{value:"Module"})),Zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Yw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ua=({icon:e,className:t="",...n})=>d.jsx(Fe,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Ar=!1;const as=()=>{Ar!==!1&&(clearTimeout(Ar),Ar=!1)},is=5;let ss=null;const mh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=se.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(zr,c),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=y.useMemo(()=>Yw(n,is),[n]),F=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Ar)return as(),!1;if(as(),f||!s)return!1;Ar=setTimeout(x,350)},x=async()=>{if(as(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=Zw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{ss=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},B=()=>{ss&&clearTimeout(ss)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},d.jsxs(d.Fragment,{children:[d.jsx(Ua,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:F,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:h})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>w,onClick:S=>{var M;S.preventDefault(),S.stopPropagation(),B(),p([{type:"showLikers",value:!0}]);const z=(M=S.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Pn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string"||!S.name)return null;const M={};return v!==z&&(M.tabIndex=-1),d.jsx("li",{"data-index":z,children:d.jsx(dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>B(),onKeyDown:$=>{var L,H,Z,Q;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const R=$.key==="ArrowUp"?"up":"down",k=(L=$.currentTarget)==null?void 0:L.parentElement;let A=k==null?void 0:k.nextElementSibling;if(R==="up"){const ae=k==null?void 0:k.previousElementSibling;ae?A=ae:(A=(H=k==null?void 0:k.parentElement)==null?void 0:H.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=(Z=k==null?void 0:k.parentElement)==null?void 0:Z.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...M,children:S.name})},S.id||window.btoa(S.name))}),t>is&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-is})})]})})]})]}))},os=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Gw=280,Mo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Jn(e,typeof t=="number"?t:Gw):e;a=a.trim();const i=`<br>
163
+ `}),Y=E.turndown(Y)}o&&o.mentions&&(Y=await Zc({text:Y,template:`[${Is}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),Jx(Y,E=>{x([{type:"initialValue",value:E},{type:"editorKey",value:B.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:pc(Q)}])},150)})})()},[B]),y.useEffect(()=>{t!==""||!Q||ds(B,t)&&!R||(D.withoutNormalizing(Q,()=>{X.delete(Q,{at:{anchor:D.start(Q,[]),focus:D.end(Q,[])}}),X.deselect(Q),Q.children.length!==0&&X.unwrapNodes(Q,{at:[0]}),X.insertNodes(Q,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Mc(()=>{nw({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:x})},100);return S?c.jsx("div",{id:L,className:"rich-text-editor",children:c.jsxs(en.Provider,{value:{...F,id:L,isInOverlay:m,setFocus:j,dispatch:x,onMention:f,reportError:b},children:[c.jsxs(vD,{editor:Q,initialValue:S,onChange:q=>{if(Q.operations.some(E=>E.type!=="set_selection")){const E=aw(q);g(E),x([{type:"stringValue",value:pc(Q)}]),R||x([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:E,json:q})}},...l,children:[c.jsx(uD,{className:"input",renderElement:H,renderLeaf:Z,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:q=>{if(q.key==="Enter"){A.show&&(q.preventDefault(),q.stopPropagation(),Gf(Q,A,x,L));const{selection:Y}=Q;if(Y){const E=V.isCollapsed(Y),[T,N]=D.node(Q,Y,{depth:1});let I=T,U=I.type;const ne=I.children[0];if(ne&&[K.ol,K.ul].includes(ne.type)&&(I=ne,U=ne.type),I&&de.isElement(I)&&U!==K.paragraph){if(U===K.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),X.insertNodes(Q,v);return}if(E){const[te,ie]=D.parent(Q,Y,{edge:"end"}),J=te.type;if([K.ul,K.ol].includes(U))if(q.stopPropagation(),q.preventDefault(),J===K.li&&$==="Enter"){te.children.length===1&&"text"in te.children[0]&&te.children[0].text===""&&X.removeNodes(Q,{at:ie}),X.insertNodes(Q,v,{at:P.next(N)}),X.select(Q,D.end(Q,P.next(N)));return}else{const[ge,he]=Xx(Q,K.li),pe={type:K.li,children:[{text:""}]};X.insertNodes(Q,pe,{at:P.next(he)}),X.select(Q,D.end(Q,P.next(he)))}}}}}else if(q.key==="Escape"){if(A.show){q.preventDefault(),q.stopPropagation(),x([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&A.show){q.preventDefault(),q.stopPropagation();const{selectedUser:Y,possibleUsers:E}=A;let T=q.key==="ArrowUp"?Y-1:Y+1;T<0&&(T=E.length-1),T>=E.length+1&&(T=0),x([{type:"mentionPopover",value:{...A,selectedUser:T}}])}x([{type:"lastKey",value:q.key}]),tw(q,Q,x,b)},onBlur:()=>{Q.selection&&x([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(M){if(!P.isPath(M.path)||!ue.has(Q,M.path))return;const q=ue.get(Q,M.path);let Y=0;if(fe.isText(q)?Y=q.text.length:q.children&&(Y=q.children.length),M.offset>Y)return;try{X.select(Q,{anchor:M,focus:M})}catch(E){const T=E.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(pw,{}),p?c.jsx(iw,{onFallbackClick:h}):null]},w),c.jsx(so,{id:`character-limit-${e}`,limit:r,valueLength:ei(z)})]})}):c.jsx(c.Fragment,{})};const _w=({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:G("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:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function ih({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async x=>{p(!0),g(!1);try{const w=x.target.files&&x.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const B=await a({fileObject:w,userId:t}),S={thumbnail:B.thumbnailURL,full:B.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:_=o.formatMessage({id:`${l}cta_change`}),uploading:F=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(hn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Fe,{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:m,children:m?F:u?_:v})]})}const sh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const oh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async x=>{x.preventDefault();try{await l(d),m([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},_=x=>{x.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},F=x=>{x.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"secondary",onClick:_,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Fe,{onClick:F,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(Fe,{onClick:_,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Lh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:x=>{m(x),h(!x.length)},autoFocus:!1,getLabel:(x,w,B)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:x}),c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(w),h(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(qt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Fe,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Fa=e=>e.map(t=>({condition:t})),xt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},kw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[xt.NEW_PASSWORD]!==h[xt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=h=>!ps(h[xt.NEW_PASSWORD]).isValid,m=[{"data-testid":xt.NEW_PASSWORD,id:xt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Fa(["required",d]),functions:{onChange:h=>l(ps(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":xt.CONFIRMED_PASSWORD,id:xt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Fa(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":xt.CURRENT_PASSWORD,id:xt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Fa(["required"])}),i&&m.push({component:Od,props:{matchingRules:o}});const p={id:xt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(xt.NEW_PASSWORD)||g.includes(xt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...p}),r&&c.jsx(fn,{variant:"error",text:r})]})};const uh=({hooks:e,functions:t,meta:n={},gtm:r})=>{var x,w;const a=se.useIntl(),i="profileForm_",s=y.useContext(mt),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:m,onSuccess:p=async B=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:_="ProfileForm",event:F="profile-form-submit-click"}=r||{};return c.jsx(Jt,{id:"profile-details-form",fields:[{component:ih,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,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:((x=s.location)==null?void 0:x.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:B})=>B&&!u?!1:!b(B),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:qt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:_,event:F},functions:{onSuccess:async B=>{try{const S={...B,image:o||null,location:u?await f(B==null?void 0:B.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const lh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=se.useIntl(),u=y.useRef(null);Xn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.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:G("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(Ie,{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:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Dc=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}])},Fw=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"]}},Bw=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=Fw(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}])},Aw=({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,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(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:()=>{Dc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Bd,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(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:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>c.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>c.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>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:h}),privacy:h=>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:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)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"&&Dc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const Tw=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const Sw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},jw=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=se.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:d,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(zr,Sw),{validFields:v,emailDetails:_,shouldManuallyApprove:F,shouldDisableButton:x,showSuccessMessage:w,showError:B}=f,[S,z]=Hs.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(()=>{F===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[F]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const $=y.useMemo(()=>Aw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,g,f]),R=x?!0:F?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&w?c.jsx(Tw,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(se.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(fn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:R?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await Bw({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:k=>{r.handleError(k),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const vn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Ow=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(vn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(sr,{buttons:r})]})})};const Us="editSection_";function ch({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Pw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(jt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Us}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Fe,{href:r,variant:"secondary",size:"small",onClick:()=>ch({href:r,setShowModal:i}),children:n||s({id:`${Us}placeholder_cta`})})})]})},Nw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),c.jsxs("section",{className:G("edit-section",t),children:[g&&c.jsx(mn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var _,F;(_=n==null?void 0:n.functions)!=null&&_.onSuccess&&await((F=n==null?void 0:n.functions)==null?void 0:F.onSuccess(v)),p(!1)},onCancel:h}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:G("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Fe,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>ch({href:a,setShowModal:p}),children:d({id:`${Us}edit`})})]}),e||c.jsx(Pw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(qt,{})]})};const Mw=({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:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:p=!1,description:h=!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:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&c.jsx("small",{children:h})]},window.btoa(`${d.url}_${g}`))})})]})};let Ji;const Xi="contactFooter_",Iw=({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(Ji),Ji=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ji),window.removeEventListener("resize",l)}),[]),c.jsx(vn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${Xi}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(se.FormattedMessage,{id:`${Xi}text`})}),c.jsx(dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${Xi}email`})})]}),c.jsx(sh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Rw=({activeLink:e,profile:t,...n})=>c.jsx(vn,{children:c.jsx(kd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(_d,{activeLink:e,profile:t}),c.jsx(nd,{...n})]})})});const es="cookieBanner_",ts=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ns=new Date(Date.now()+12*30*24*60*60*1e3),dh=()=>{const e=se.useIntl(),[t,n,r]=Hs.useCookies(ts),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ts.forEach(d=>{n(d,!0,{path:"/",expires:ns,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ns}),ts.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:ns});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:`${es}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${es}title`})}),c.jsx("p",{children:e.formatMessage({id:`${es}text`})}),c.jsx(sr,{buttons:u})]})},Kt={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:Wn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Wn["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:Wn.support,gtmType:"concierge-email-click"},business:{email:Wn.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 Yn="footer_",qa="SiteFooter",Cc=({group:e})=>{const t=Kt[e].order||[];let n=!1;return"text"in Kt[e]&&(n=Kt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Yn}${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}=Kt[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":qa,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${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":qa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Po=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ya,{element:"hr"}),c.jsx(io,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":qa,"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(Cc,{group:e}),Object.keys(Kt[e]).includes("child")&&c.jsx(Cc,{group:Kt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Kt.social.order)&&Kt.social.order.map(e=>{const t=Kt.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":qa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Yn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Yn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={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===bt.ACCOUNT&&t===!1&&n[bt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.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 bt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case bt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case bt.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=jc(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?Re.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 bt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",bt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case bt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.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(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Lr={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:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Wa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=jc(Lr,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 m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let F=o.gtmType||`${e}-click`;if(F.includes(".")){const x=F.split("."),w=x[x.length-2];F=`${w==="topics"?`${w}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":F,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},_={};if(f&&(b={...b,"aria-current":"page"}),h){const F=o.menuId||e,x={onClick:w=>Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]}),onFocus:()=>Re.events.onFocus({id:F}),onBlur:()=>Re.events.onBlur({id:F,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:F,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:F,callback:a})};v={...x,id:F===bt.SITE?bt.SITE:bt.ACCOUNT},n&&(g&&(_={...x,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]})},"aria-haspopup":!0,"aria-expanded":r[F],"aria-controls":F}),v={...v,hidden:F in r?!r[F]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(d?Fe:"a",p,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{..._,children:[s.formatMessage({id:m}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[bt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(F=>{if(!o[F])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[F].order?c.jsxs("li",{className:G({[o[F].className]:o[F].className}),children:[s.formatMessage({id:`${m}_${F}`}),c.jsx("ul",{children:o[F].order.map(w=>c.jsx(Wa,{id:`${e}.${F}.${w}`,...x},w))})]},F):c.jsx(Wa,{id:`${e}.${F}`,...x},F)})})]},e)};const $w={height:67,height_desktop:83};var bt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(bt||{});const No=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(mt),r=On(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(zr,{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,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),Rc({scrollPosition:$w[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,_,F=!1)=>{Re.handleMenus({id:v,value:_,menus:m.current.menus,dispatch:o,forceHandle:F})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{m.current.menus[_]&&p(_,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Xn(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Xn(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(lh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Lr.order.map(v=>c.jsx(Wa,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(io,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(hn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Lr.buttons.order.map(v=>c.jsx(Wa,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Lw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(No,{}),c.jsx("div",{id:"content",children:c.jsx(fn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Po,{})]})},fh=({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:m="default",circle:p="default",modal:h="default"}=i,g=Nc(),[f,b]=y.useState(""),v=B=>{const{detail:{message:S}}=B;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const _=ba(e,{locale:o}),F=ba(t,{locale:o}),x=ba(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),m!=="default"&&(w[m]=!0),p!=="default"&&(w[p]=!0),c.jsx(zh.ErrorBoundary,{onError:r,fallback:c.jsx(Lw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[c.jsx(No,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[F&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":h==="large"}),children:F}),y.createElement(d==="bold"?to:"div",{id:"content",children:_,className:G({"large-modal":h==="large"})})]}),x&&c.jsx("div",{className:"additional-content appended",children:x}),u&&c.jsx(Po,{}),c.jsx(dh,{})]}),f&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},xc={default:"tags_",headerTopics:"header_topics_topics_"},rs={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"},zw={getTagDetails:e=>{if(e.includes("topic_")){if(e=rs.topic[e.replace("topic_","")],e){const t=Lr.topics.topics[e].href;return t?{id:e,href:t,text:`${xc.headerTopics}${e}`}:null}return null}return rs[e]?(e=rs[e],{id:e,text:`${xc.default}${e}`}):null}};const qw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=zw.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("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 Ww=({members:{data:e=[],total:t=e.length},isMember:n=!1,hasNextPage:r=!1,loadNextPage:a=()=>{},profile:i,gtmContext:s="member",gtmType:o="member-click",className:l=""})=>{const u=se.useIntl(),d="membersList",m=y.useContext(mt),[p,h]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:G("members-list",l),children:[c.jsxs("h1",{children:[u.formatMessage({id:d}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[n?c.jsxs("li",{children:[c.jsx(Yt,{member:m,gtmContext:s,gtmType:o}),c.jsx(dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),h(!0)},children:u.formatMessage({id:`${d}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,f)=>c.jsxs("li",{children:[c.jsx(Yt,{member:g,gtmContext:s,gtmType:o}),g.isAdmin&&c.jsx(ln,{children:u.formatMessage({id:`${d}_admin`})})]},f))]}),r&&c.jsx(Wr,{hasNextPage:r,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),i?c.jsx(li,{form:i,showModal:p,content:{title:u.formatMessage({id:`${d}_modal_title`})},functions:{onClose:()=>{h(!1)}}}):c.jsx(c.Fragment,{})]})},Uw={showForm:!1},ui=y.createContext(Uw),hh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(ui.Provider,{value:{...t,updateConversation:n},children:e})},wc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Hw=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:At(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,{})},Vw=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:At(a.formatMessage,`${t}label_action`,r,"action")})};let ha=null;const Je="discussion_form_",Hr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var xe,_e,Le;const p=se.useIntl(),h=y.useContext(mt),[g,f]=y.useState(""),{isLoading:b=!1,isInWrapper:v=!1,isInOverlay:_=!1,isAutoFocused:F=!1,isEditing:x=!1,hasTitleField:w=!1,isPrepopulated:B=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:M=!1,showSuccessMessage:$=!0}=r||{},{onChange:R=()=>{},create:k=()=>{},handleSaveEdit:A=()=>{},handleCancel:j=()=>{},callback:L=()=>{},onMention:H=()=>{},listMembers:Z=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:ae={create:{projectNames:["questions-answers"]}}}=u,[C,q]=y.useState({title:w&&w.text||"",body:x&&x.text||B&&B.text||""}),[Y,E]=y.useState(o.error||!1),[T,N]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&B&&B!==C.body&&q({...C,body:B.text||""})},[B]),b)return c.jsx(Ft,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const I=Te=>{q({...C,body:Te}),R({body:Te});let Ae;!h||!h.id?Ae=At(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Te.length>=i&&(Ae=`${Je}error_tooLong`):Ae=At(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Ae?E(Ae):Y&&E(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Te=((xe=t.slugs)==null?void 0:xe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Le=t.slugs)==null?void 0:Le.question)||"";Te&&(U=`${U}-${Te.slice(-15)}`)}e&&(U=`${e}-${U}`);const ne=async()=>{if(!h||!h.id||!n||J)return;ha&&clearTimeout(ha),N("submitting");const Te=window.location.pathname;try{let Ae;switch(t.type){case"post":Ae=await k({title:C.title,content:C.body});break;case"question":Ae=await k({title:C.body,authorId:h&&h.id,...ae==null?void 0:ae.create});break;case"response":Ae=await k({questionSlug:t.slugs.question},{body:C.body,authorId:h&&h.id,contentPath:Te});break;case"reply":Ae=await k({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:h&&h.id,contentPath:Te});break;default:break}await Xh(1e3),L&&await L(Ae),ha=setTimeout(()=>{q({title:"",body:""}),N("submitted"),f(At(p.formatMessage,`${Je}success`,t.type,"action"));const Pe=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Pe),te()},500)}catch(Ae){const Pe=Ae;let ke=`${Je}error`;Pe!=null&&Pe.message.includes("entry already exists")&&(ke=At(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Pe!=null&&Pe.message.includes("429")?ke=At(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Pe!=null&&Pe.message.includes("400")&&(ke=`${Je}error`),E(ke),te()}},te=()=>{ha=setTimeout(()=>{E(!1),N(!1),f("")},5e3)},ie=!C.title||!Jo(C.title),le=!C.body||!Jo(C.body);let J=le;w&&(J=ie&&le);const ge=T==="submitting",he=[{component:Vw,props:{formID:U,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:ah,props:{id:`${U}-input`,value:T==="submitting"&&!Y?"":C.body,placeholder:a||At(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:I,onMention:H,listMembers:Z,clickMentionFallback:Q},data:d,autoFocus:x!==!1||F&&!w,"aria-invalid":!!Y,"aria-errormessage":"error-message"}},{component:Hw,props:{intlPath:Je,showGuidelines:z,type:t.type,gtmContext:m}}];M&&he.push({component:qt}),w&&he.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:F,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Te=>{q({...C,title:Te}),R({title:Te})}},validation:[{condition:()=>J,error:p.formatMessage({id:`${Je}titleField_error`})}]});let pe=!h||!h.id||!n||J||ge;return x&&(w?pe=pe||C.body===x.text&&C.title===w.text:pe=pe||C.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:U,className:G("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!ge||o.cancel},functions:{onSuccess:async()=>{if(x){N("submitting"),A(C);return}await ne()},onCancel:j},fields:he,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:pe,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:p.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!h||!h.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:m,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&c.jsx("h2",{children:At(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(Yt,{member:h?{...h,link:!1}:"community",gtmContext:m,gtmType:"profile-click"})]}),T==="submitted"&&$&&c.jsx(Sr,{className:"success","data-testid":"success",children:At(p.formatMessage,`${Je}success`,t.type,"action")}),Y&&c.jsx(Sr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof Y=="string"?Y.includes(" ")?Y:p.formatMessage({id:Y},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):Y}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Hr},Symbol.toStringTag,{value:"Module"})),Zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Yw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ua=({icon:e,className:t="",...n})=>c.jsx(Fe,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Ar=!1;const as=()=>{Ar!==!1&&(clearTimeout(Ar),Ar=!1)},is=5;let ss=null;const mh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=se.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(zr,d),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=y.useMemo(()=>Yw(n,is),[n]),F=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Ar)return as(),!1;if(as(),f||!s)return!1;Ar=setTimeout(x,350)},x=async()=>{if(as(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=Zw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{ss=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},B=()=>{ss&&clearTimeout(ss)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ua,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:F,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:h})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>w,onClick:S=>{var M;S.preventDefault(),S.stopPropagation(),B(),p([{type:"showLikers",value:!0}]);const z=(M=S.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Pn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string"||!S.name)return null;const M={};return v!==z&&(M.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>B(),onKeyDown:$=>{var L,H,Z,Q;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const R=$.key==="ArrowUp"?"up":"down",k=(L=$.currentTarget)==null?void 0:L.parentElement;let A=k==null?void 0:k.nextElementSibling;if(R==="up"){const ae=k==null?void 0:k.previousElementSibling;ae?A=ae:(A=(H=k==null?void 0:k.parentElement)==null?void 0:H.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=(Z=k==null?void 0:k.parentElement)==null?void 0:Z.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...M,children:S.name})},S.id||window.btoa(S.name))}),t>is&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-is})})]})})]})]}))},os=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Gw=280,Mo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Jn(e,typeof t=="number"?t:Gw):e;a=a.trim();const i=`<br>
164
164
 
165
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Zc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Qw=3e3,Jw=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(Pn,{className:G("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Ua,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Qw)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Nt="discussion_",Xw=195;let ma=null;const Vr=({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:c="DiscussionAnswer",children:m,isTruncated:p=!1,styling:{showShareLinkButton:h=!1}={},setFocus:g=!1,isCommunity:f=!1})=>{var _e,Le,Te,Ae,Pe,ke,Ve,qe;const b=se.useIntl(),v=y.useContext(mt),_=y.useContext(ui),{createContent:F=async()=>{},deleteContent:x=async()=>{},updateContent:w=async()=>{}}=o.content||{},{createLike:B=()=>{},deleteLike:S=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:M=()=>Promise.resolve([]),clickMentionFallback:$=()=>{}}=o.mentions||{},{author:R,canLike:k,createdAt:A,id:j,likes:L=0,userLiked:H,comments:Z=0,mentions:Q}=t,ae=v&&v.id&&typeof R!="string"&&R.id&&R.id===v.id||!1,C=typeof k=="boolean"?k:!0,q=ae&&(!t.createdAt||Qh(t.createdAt,10,"seconds")),Y=y.useRef(null),[E,T]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[N,I]=y.useState(!1),[U,ne]=y.useState(q?"highlighted":"default"),[te,ie]=y.useState("");y.useEffect(()=>{const W=Y.current;if(!(!W||U==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),W.addEventListener("transitionend",J),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),W.removeEventListener("transitionend",J)}},[]),y.useEffect(()=>{T({...E,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const re=await Mo(E.body,p,Q,M);T({...E,postBody:re})})()},[E.body,Q]);const le=()=>{setTimeout(()=>{ne("fading")},1e3)},J=({propertyName:W})=>{W==="background-color"&&ne(re=>(re==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),Y.current&&Y.current.removeEventListener("transitionend",J)),re==="fading"?"default":re))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||E.postBody===""&&t.title==="")return d.jsx(Ft,{className:"discussion-card"});const ge=async({title:W,body:re})=>{W||(W=""),re||(re=""),ie("");try{if(!ds(W,E.title)||!ds(re,E.body)){const me=t.type==="question"?{title:re}:{title:W,body:re};await w(wc(t.slugs),me)}T({...E,title:W,body:re,isEditing:!1,didEdit:!0})}catch{ie(`${Nt}form_error`)}},he=()=>{if(_&&_.updateConversation){const W={showForm:!0},re=t.author;re&&re.id&&(f&&(W.prepopulateForm=`@{{${re.id}}}`),W.mentionData={id:re.id,name:re.name}),_.updateConversation(W)}setTimeout(()=>{var we,Ze,Ye;const re=`reply-form-${(t.type==="answer"?t.slug:((we=t.slugs)==null?void 0:we.reply)||((Ze=t.slugs)==null?void 0:Ze.answer)||((Ye=t.slugs)==null?void 0:Ye.question)||"").toLowerCase().slice(-15)}`,me=document.getElementById(re),ve=document.getElementById(`${re}-input`);ve&&ve.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},pe=async()=>{I(!1);try{await x(wc(t.slugs))}catch{ie("delete-error")}},xe=[{text:b.formatMessage({id:`${Nt}moreMenu_report`}),onClick:W=>{W.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${Nt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&ae&&xe.push({text:b.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>T({...E,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:W=>{W.preventDefault(),W.stopPropagation(),I(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...wd(`delete-${t.slug}-modal`,N)}),r&&o.pins&&xe.push({text:b.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((_e=Y==null?void 0:Y.current)==null||_e.focus(),(Le=Y==null?void 0:Y.current)==null||Le.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:G("discussion-post",u,{[U]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!E.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Y,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:W=>{if(!l.post||E.isEditing)return;W.preventDefault(),W.stopPropagation(),ma&&clearTimeout(ma),ma=setTimeout(()=>{window.location.href=l.post},150);const re=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ma}});document.dispatchEvent(re)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:j||t.slug,className:G("discussion-card",t.type,{editing:E.isEditing,"has-link":l.post&&!E.isEditing}),children:[!E.isEditing&&d.jsxs("div",{className:"author-section",children:[d.jsx(Yt,{member:R,additionalContent:{createdAt:A,didEdit:E.didEdit},className:typeof R!="string"&&R.id===i?"highlighted":"",gtmContext:c,gtmType:"profile-click"}),t.pinned&&d.jsx(ln,{variant:"naked",size:"xlarge",icon:"pin",children:d.jsx(Ie,{children:"Pinned Post"})})]}),E.isEditing?d.jsx(Hr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:E.title!==""?{text:E.title}:!1,isEditing:{text:E.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:te!==""&&te!=="delete-error"?b.formatMessage({id:te},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:F,handleSaveEdit:ge,handleCancel:()=>{ie(""),T({...E,isEditing:!1})},listMembers:M,clickMentionFallback:$},gtmContext:`${c}Form`,data:{mentions:t.mentions}}):l.post?d.jsxs("a",{href:l.post,children:[(E==null?void 0:E.title)&&d.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),E.postBody.length>Xw?d.jsx(td,{text:E.postBody,markdownOptions:{overrides:{a:vs,blockquote:{component:os}}}}):d.jsx(kn,{options:{overrides:{a:vs,blockquote:{component:os}}},children:E.postBody})]}):d.jsxs(d.Fragment,{children:[(E==null?void 0:E.title)&&d.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),d.jsx(kn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:os}}},children:E.postBody})]}),!E.isEditing&&!(s!=null&&s.actionBar)&&d.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&d.jsx(mh,{element:"li",likes:L,isShort:!1,userLiked:H,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:C,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:B,deleteLike:S}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&d.jsx("li",{children:d.jsx(Ua,{onClick:W=>{W.preventDefault(),W.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":c,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${Nt}comments_screenReader`},{count:Z}),children:b.formatMessage({id:`${Nt}comments`},{count:Z})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Ua,{styling:{muted:!0},onClick:he,icon:{icon:"speech-bubble_square"},children:b.formatMessage({id:`${Nt}reply`})})}),h&&d.jsx(Jw,{url:(Te=t.slugs)!=null&&Te.reply?`${window.location.origin}${(Ae=t.slugs)==null?void 0:Ae.question}/${(Pe=t.slugs)==null?void 0:Pe.answer}#${(ke=t.slugs)==null?void 0:ke.reply}`:`${window.location.origin}${(Ve=t.slugs)==null?void 0:Ve.question}/${(qe=t.slugs)==null?void 0:qe.answer}`,gtm:{context:c,event:`copy-link-${t.type}-click`}}),d.jsx(Ed,{element:"li",id:`more-${t.slug}`,options:xe})]})]}),m,d.jsx(mn,{id:`delete-${t.slug}-modal`,isOpen:N,functions:{onOpen:()=>{},onClose:()=>I(!1)},forceShow:{error:te==="delete-error"?b.formatMessage({id:"discussion_delete_error"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:b.formatMessage({id:"discussion_delete_title"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>I(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:pe,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:W=>d.jsx("p",{children:W}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const eE=y.lazy(()=>Promise.resolve().then(()=>VE)),tE=65,ph=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(mt)||"community",l=Xa(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[c,m]=y.useState({form:u||Gc("showPost")==="true"||!1,warning:!1}),[p,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await Mo(p.title||p.body||"",tE,p.mentions);h(_=>({..._,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof c.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const _=b;_.preventDefault(),_.stopPropagation();const x=_.target.closest("a");v=x&&x.getAttribute("href")}m(_=>({..._,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||c.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,c.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:G("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[d.jsx(hn,{name:l.name,src:l.image,alt:""}),d.jsx(kn,{className:G("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:wt,blockquote:wt,br:wt,em:wt,li:wt,ol:wt,p:wt,s:wt,span:wt,strong:wt,ul:wt}},children:f})]}),d.jsxs(qr,{children:[d.jsx(eE,{showModal:c.form,functions:{cacheText:h,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),d.jsx(mn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:c.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof c.warning=="string"&&(window.location.href=c.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:d.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},nE=y.lazy(()=>Promise.resolve().then(()=>Kw)),Io=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return d.jsx(fn,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(ao,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...c}=t,m={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...c,id:`add-post-${c.id||""}`};return e?d.jsx(ph,{form:m}):d.jsx(nE,{...m})},Ro=({form:e})=>{const t=y.useContext(mt),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{sm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),d.jsx(li,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const us="discussion_responses_",gh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:r.formatMessage({id:`${us}title`},{action:r.formatMessage({id:`${us}${e}`}),count:t})}),!n&&t===0&&d.jsx("p",{children:At(r.formatMessage,`${us}empty`,e,e)})]})};const vh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(ui),o=ba(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 d.jsxs("div",{className:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Wr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Hr,{...r})]})},rE="post",aE="reply",bh="00000000-0000-0000-0000-000000000000";function $o({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Lo({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 iE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function sE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function yh(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 oE({title:e,content:t}){return{title:e,content:t,id:bh,time:new Date().toISOString(),verb:rE}}function Ec({activity:e,user:t}){return{...e,actor:yh(t),...iE()}}function Ha({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 Dh({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 Va({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 Ch({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 uE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:bh,kind:aE,parent:t||""}}function _c({reply:e,user:t}){const n=yh(t);return{...e,user_id:n.id,user:n,...sE()}}function kc({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 lE({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const xh=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Fc,ls=0;const wh=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Fc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ls=0;return}ls++,!(ls>10)&&(Fc=setTimeout(()=>{e(t)},50))}},ar=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}),Wt=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}),zo=Object.freeze({actor:`SU:${ar.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),cE=Object.freeze({actor:`SU:${Wt.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"}),dE=Object.freeze({actor:`SU:${ar.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"}),fE=Object.freeze({actor:`SU:${Wt.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:zo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.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:zo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.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:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:zo.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:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:cE.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:dE.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:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:fE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function hE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ec({activity:oE(o),user:i});return Bc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Ec({activity:o,user:i});r.setQueryData(a,Bc(c,u,!0)),setTimeout(()=>{xh(c.id,"activity")},0)}});return s}function mE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sn(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,rankingMethod:u}){const c=We.useQueryClient(),m=Ja(),p={queryClient:c,queryKey:l},h={mutationHandlers:{error:$o(p),mutate:Lo(p)},user:m,...p},g=hE({...h,mutationFn:e}),f=mE({...h,mutationFn:t}),b=gE({...h,mutationFn:n}),v=yE({...h,mutationFn:a}),_=DE({...h,mutationFn:i}),F=bE({...h,mutationFn:s}),x=CE({...h,mutationFn:o}),{activities:w,...B}=vE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:_,pin:F,unpin:x},user:m,...B}}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function vE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:wE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>xE(a,i)),onError:n});return r}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&Dh({activity:o,user:r}),s}),onError:n});return a}function CE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&Ch({activity:o,user:r}),s}),onError:n});return a}function Bc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Sn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function xE(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 wE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const EE=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=jm(Qs.COMMUNITY_RANKING),c=se.useIntl(),[m,p]=y.useState("community_feed_live"),[h,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:_,isLoading:F,mutations:{create:x,edit:w,remove:B,like:S,unlike:z,pin:M,unpin:$}}=pE({queryKey:[e,t,"activities",m],queryFns:a,rankingMethod:m});y.useEffect(()=>{u&&g(h.concat(u))},[u]);const[R,k]=y.useState(null),A=()=>{k(f.length),v()};return wh(),b?d.jsx(fn,{variant:"error",text:b.message}):d.jsxs("section",{children:[d.jsx(Io,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:x,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),d.jsx(Jt,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:c.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:j,label:L})=>({id:j,label:c.formatMessage({id:`activitiesFeed_rankingMethod_${L}`})})),initialValue:m,functions:{onChange:j=>p(j)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,L)=>{var I,U,ne,te,ie,le,J,ge;const{id:H,own_reactions:Z,latest_reactions:Q,reaction_counts:ae,mentioned_users:C}=j,q=(((I=Q==null?void 0:Q.like)==null?void 0:I.length)||0)>0,Y=(((U=Z==null?void 0:Z.like)==null?void 0:U.length)||0)>0,E=Y?Z==null?void 0:Z.like[0].id:"",T=q?(ne=Q==null?void 0:Q.like)==null?void 0:ne.map(he=>{var pe,xe,_e;return{id:(pe=he==null?void 0:he.user)==null?void 0:pe.id,name:(_e=(xe=he==null?void 0:he.user)==null?void 0:xe.data)==null?void 0:_e.name}}):!1,N=j==null?void 0:j.actor;return d.jsx(y.Fragment,{children:d.jsx(Vr,{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:H},slug:H,author:{id:N==null?void 0:N.id,name:(te=N==null?void 0:N.data)==null?void 0:te.name,organization:(ie=N==null?void 0:N.data)==null?void 0:ie.organization,jobTitle:(le=N==null?void 0:N.data)==null?void 0:le.jobTitle,location:(J=N==null?void 0:N.data)==null?void 0:J.location,image:{thumbnail:((ge=N==null?void 0:N.data)==null?void 0:ge.thumbnail)||void 0}},userLiked:Y,likes:(ae==null?void 0:ae.like)||0,comments:(ae==null?void 0:ae.reply)||0,peopleWhoLiked:T,mentions:C,pinned:(ae==null?void 0:ae.pin)&&(ae==null?void 0:ae.pin)>0||!1},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>B({activityId:H}),updateContent:(he,{body:pe})=>w({activityId:H,content:pe})},likes:{createLike:()=>S({activityId:H}),deleteLike:()=>z({activityId:H,reactionId:E})},comments:{openComments:()=>null},pins:{createPin:()=>M({activityId:H}),deletePin:()=>$({activityId:H,reactionId:Q==null?void 0:Q.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:L===R,userHasOwnerPermissions:r})},H)}),!F&&d.jsx(Wr,{hasNextPage:_,loadNextPage:A,icon:{icon:"arrow-down",position:"right"},messages:{button:c.formatMessage({id:"loadMore_button"}),error:c.formatMessage({id:"loadMore_error"})}}),d.jsx(Ro,{form:l})]})},_E={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function kE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=_c({reply:uE(o),user:i});return Ac(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=_c({reply:o,user:i});r.setQueryData(a,Ac(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{xh(c.id,"reply")},0)}});return s}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ka(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Eh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ja(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:$o(u),mutate:Lo(u)},user:l,...u},m=kE({...c,mutationFn:e}),p=FE({...c,mutationFn:t}),h=BE({...c,mutationFn:n}),g=TE({...c,mutationFn:a}),f=SE({...c,mutationFn:i}),{replies:b,...v}=AE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:m,edit:p,remove:g,like:h,unlike:f},user:l,...v}}function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ka(s,o);return l&&kc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ka(o,l);u&&kc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function AE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=ME(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>NE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ka(i,s);return o&&lE({reply:o,user:r}),s}),onError:n});return a}function jE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function OE(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 PE(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 Ac(e,t,n){return t?n!=null&&n.append?OE(e,t,n):PE(e,t,n):jE(e)}function Ka(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function NE(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 ME(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 IE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:m,mutations:{create:p,edit:h,like:g,remove:f,unlike:b},user:v}=Eh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});Vs([m]);const[_,F]=y.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Fe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!_),children:s.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:l==null?void 0:l.length})}),_&&d.jsx(vh,{loadMore:{isLoading:m,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(x=>{var Q,ae,C,q,Y,E,T,N,I,U,ne,te;const{id:w,own_children:B,latest_children:S,children_counts:z,data:{mentioned_users:M}}=x,R=(((Q=B==null?void 0:B.like)==null?void 0:Q.length)||0)>0?(ae=B==null?void 0:B.like)==null?void 0:ae.find(ie=>{var le;return((le=ie==null?void 0:ie.user)==null?void 0:le.id)===(v==null?void 0:v.id)}):!1,k=R?R==null?void 0:R.id:"",A=!!R,L=(((C=S==null?void 0:S.like)==null?void 0:C.length)||0)>0?(q=S==null?void 0:S.like)==null?void 0:q.map(ie=>{var le,J,ge;return{id:(le=ie==null?void 0:ie.user)==null?void 0:le.id,name:(ge=(J=ie==null?void 0:ie.user)==null?void 0:J.data)==null?void 0:ge.name}}):!1,H=x==null?void 0:x.user,Z=typeof x.data.content=="string"?(Y=x==null?void 0:x.data)==null?void 0:Y.content:((T=(E=x==null?void 0:x.data)==null?void 0:E.content)==null?void 0:T.text)||"";return d.jsx(Vr,{isCommunity:!0,content:{id:w,type:"reply",body:Z,canLike:a,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:H==null?void 0:H.id,name:(N=H.data)==null?void 0:N.name,organization:(I=H.data)==null?void 0:I.organization,jobTitle:(U=H.data)==null?void 0:U.jobTitle,location:(ne=H.data)==null?void 0:ne.location,image:{thumbnail:((te=H.data)==null?void 0:te.thumbnail)||void 0}},userLiked:A,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:L,mentions:M},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(ie,{body:le})=>h({replyId:w,content:le})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:k})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},w)}):null})]})};const _h=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o},profile:l})=>{const u=se.useIntl(),{replies:c,repliesCount:m,fetchNextPage:p,hasNextPage:h,isLoading:g,mutations:{create:f,edit:b,like:v,remove:_,unlike:F},user:x}=Eh({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{S(c.length),p()},[B,S]=y.useState(null);return Vs([g]),wh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(gh,{type:"comment",responses:m,isLoading:g}),d.jsx(Io,{form:{content:{type:"reply",slugs:{}},functions:{create:(z,{body:M})=>f({activityId:n,content:M}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:u.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map((z,M)=>{var E,T,N,I,U,ne,te,ie,le,J,ge,he;const{id:$,own_children:R,latest_children:k,children_counts:A,data:{mentioned_users:j}}=z,H=(((E=R==null?void 0:R.like)==null?void 0:E.length)||0)>0?(T=R==null?void 0:R.like)==null?void 0:T.find(pe=>{var xe;return((xe=pe==null?void 0:pe.user)==null?void 0:xe.id)===(x==null?void 0:x.id)}):!1,Z=H?H==null?void 0:H.id:"",Q=!!H,C=(((N=k==null?void 0:k.like)==null?void 0:N.length)||0)>0?(I=k==null?void 0:k.like)==null?void 0:I.map(pe=>{var xe,_e,Le;return{id:(xe=pe==null?void 0:pe.user)==null?void 0:xe.id,name:(Le=(_e=pe==null?void 0:pe.user)==null?void 0:_e.data)==null?void 0:Le.name}}):!1,q=z==null?void 0:z.user,Y=typeof z.data.content=="string"?(U=z==null?void 0:z.data)==null?void 0:U.content:((te=(ne=z==null?void 0:z.data)==null?void 0:ne.content)==null?void 0:te.text)||"";return d.jsx(hh,{children:d.jsx(Vr,{isCommunity:!0,content:{id:$,type:"reply",body:Y,canLike:r,createdAt:z==null?void 0:z.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:$},slug:$,author:{id:q==null?void 0:q.id,name:(ie=q.data)==null?void 0:ie.name,organization:(le=q.data)==null?void 0:le.organization,jobTitle:(J=q.data)==null?void 0:J.jobTitle,location:(ge=q.data)==null?void 0:ge.location,image:{thumbnail:((he=q.data)==null?void 0:he.thumbnail)||void 0}},userLiked:Q,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:$}),updateContent:(pe,{body:xe})=>b({replyId:$,content:xe})},likes:{createLike:()=>v({replyId:$}),deleteLike:()=>F({replyId:$,reactionId:Z})},comments:{},mentions:i},children:d.jsx(IE,{basePath:e,parentId:t,activityId:n,replyId:$,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:M===B},$)},$)}),!g&&d.jsx(Wr,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:u.formatMessage({id:"loadMore_button"}),error:u.formatMessage({id:"loadMore_error"})}}),d.jsx(Ro,{form:l})]})};function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.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 $E({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=We.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function LE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=We.useQueryClient(),l=Ja(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:$o(u),mutate:Lo(u)},user:l,...u},m=RE({...c,mutationFn:t}),p=zE({...c,mutationFn:n}),h=qE({...c,mutationFn:r}),g=WE({...c,mutationFn:a}),f=UE({...c,mutationFn:i}),{activity:b,...v}=$E({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:p,unlike:h,pin:g,unpin:f},user:l,...v}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Dh({activity:s,user:r}),s)),onError:n});return a}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Ch({activity:s,user:r}),s))),onError:n});return a}const HE=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:c},profile:m})=>{var A,j,L,H,Z,Q,ae,C,q,Y,E,T;const p=se.useIntl(),{activity:h,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:_,pin:F,unpin:x}}=LE({queryFns:s,queryKey:[e,t,n]});if(f)return d.jsx(Ft,{style:{height:"400px"}});if(g||!h)return d.jsx(fn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:B,mentioned_users:S}=h,z=(((A=B==null?void 0:B.like)==null?void 0:A.length)||0)>0,M=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,$=M?w==null?void 0:w.like[0].id:"",R=z?(L=B==null?void 0:B.like)==null?void 0:L.map(N=>{var I,U,ne;return{id:(I=N==null?void 0:N.user)==null?void 0:I.id,name:(ne=(U=N==null?void 0:N.user)==null?void 0:U.data)==null?void 0:ne.name}}):!1,k=h==null?void 0:h.actor;return d.jsxs("section",{className:"activity-section",children:[d.jsx(Vr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:k.id,name:(H=k.data)==null?void 0:H.name,organization:(Z=k.data)==null?void 0:Z.organization,jobTitle:(Q=k.data)==null?void 0:Q.jobTitle,location:(ae=k.data)==null?void 0:ae.location,image:{thumbnail:((C=k.data)==null?void 0:C.thumbnail)||void 0}},userLiked:M,likes:((q=h==null?void 0:h.reaction_counts)==null?void 0:q.like)||0,comments:((Y=h==null?void 0:h.reaction_counts)==null?void 0:Y.reply)||0,peopleWhoLiked:R,mentions:S,pinned:((E=h==null?void 0:h.reaction_counts)==null?void 0:E.pin)&&((T=h==null?void 0:h.reaction_counts)==null?void 0:T.pin)>0||!1},originalAuthorId:k==null?void 0:k.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(N,{title:I,body:U})=>b({title:I,content:U})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>_({activityId:n,reactionId:$})},comments:{openComments:()=>{}},pins:{createPin:()=>F({activityId:n}),deletePin:()=>{var N;return x({activityId:n,reactionId:(N=B==null?void 0:B.pin)==null?void 0:N[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a},n),d.jsx(_h,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:c},profile:m})]})};const kh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:m}=n,{title:p="",body:h="",mentions:g}=r||{},f="discussion-form-modal";return d.jsx(mn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||h!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:G("discussion-form-modal",a),children:d.jsx(Hr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:h||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const _=g||{};_[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(F=>({...F,mentions:_}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},VE=Object.freeze(Object.defineProperty({__proto__:null,default:kh},Symbol.toStringTag,{value:"Module"}));const KE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=se.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(mn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:d.jsx(oh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const li=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(Gc("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=a;return d.jsx(mn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:G("profile-modal",s,{success:!!t}),maxWidth:700,children:d.jsxs(d.Fragment,{children:[t&&n||r?d.jsxs("div",{className:"intro",children:[t&&n?d.jsx("h3",{children:n}):"",r?d.jsx("p",{children:r}):""]}):null,d.jsx(uh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(m)}finally{c()}}}})]})})},ZE=Object.freeze(Object.defineProperty({__proto__:null,default:li},Symbol.toStringTag,{value:"Module"}));const YE=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(hn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(mn,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(kn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const GE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:G("testimonial-block",a),children:[d.jsx(Lt,{className:"testimonial",children:n}),r?d.jsx(Yt,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:G("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:G("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),QE=y.memo(GE);const JE=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(jt,{variant:"subtle",className:G("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const ci=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const m=c/60,p=Math.floor(m),h=(m-p)*60,g=Math.round(h),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:G("time-to-complete",a),"aria-label":u,children:l})};const XE=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(or,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const e_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],t_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},p={};c.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:_}=t[b];if(_&&e_.includes(_.toLowerCase()))return;p[b]={text:v,element:m[b]};return}p[b]={text:t[b],element:m[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(vn,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:_=""}=p[b];return b==="text"?d.jsx(kn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(_,{key:b,className:b},v)}return null}),l,h&&d.jsx(Fe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:G({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&d.jsx(or,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},n_=y.memo(t_);const r_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(vn,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const a_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(kn,{children:n}):n;return d.jsxs(vn,{className:G("highlight-section",t),children:[r&&d.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(or,{image:{...r,description:""}})}),d.jsx("div",{className:G("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:G("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},i_=y.memo(a_);const s_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:G("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(Fe,{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})]}),o_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const m=a&&ms(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Zs(c)});if(o)return d.jsx(ln,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&ms(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},u_={title:66,text:3e3,secondaryText:1e3,partner:34},Za={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"}},l_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:m}=e,p=e.contentType;let h="";if((f=Za[p])!=null&&f.gtmEvent&&(h=Za[p].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(Fe,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),_=async F=>{if(F.preventDefault(),F.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return d.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Fe,{onClick:_,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${m}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function c_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),[r,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t).then(i=>{if(!i)return;const{membersCount:s,role:o=""}=i;a({count:s==null?void 0:s.toString(),isMember:!!o,memberType:o})})},[t,e]),d.jsxs("span",{className:"member-information",children:[r.isMember&&d.jsx(ln,{size:"small",variant:"registered",icon:(r==null?void 0:r.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${r.memberType}`})}),d.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:r.count})})]})}const qo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var R,k;const u=se.useIntl(),c=y.useContext(mt),m=!!(c!=null&&c.id),p=y.useRef(null),[h,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(A=>{g({data:A,isLoading:!1})}).catch(()=>g(A=>({...A,isLoading:!1})))},[a,m,n]);const{data:f,isLoading:b}=h;if(b||!f)return d.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Za[v])return d.jsx(Ft,{element:"li",className:"card-wrapper"});const{basePath:_="",className:F,length:x,gtmEvent:w}=Za[v];let B=f.slug?`${_}${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")&&(B=f.slug);const S=A=>{B&&(A.preventDefault(),A.stopPropagation(),window.location.href=B)},z={...u_,...x};let M={className:"card"},$={};return B&&($={href:B,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&($.target="_blank"),M={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(M={...M,tabIndex:"0"},(R=p==null?void 0:p.current)==null||R.focus(),(k=p==null?void 0:p.current)==null||k.scrollIntoView({behavior:"smooth"})),d.jsx("li",{className:G("card-wrapper text-medium",F,t,{"has-link":B,"no-link":!B,"has-image":f.banner}),"data-testid":`${v}-card`,children:d.jsxs("div",{...M,ref:p,children:[d.jsx(Jc,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&Jh(f==null?void 0:f.createdAt,60)&&d.jsx(ln,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&d.jsx(ln,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Vc(f.startDate)}),f.banner?d.jsxs("p",{className:"img",children:[f.registered&&d.jsx(ln,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),d.jsx(or,{image:{...f.banner,description:""}})]}):F==="people"?d.jsx(hn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&d.jsx(eo,{contributors:{data:f.contributors},styling:{size:"small",showGap:F!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&d.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}):Jn(f.partner[0],z.partner)}),["title","text","secondaryText"].map(A=>{const j=f[A];if(!j)return null;const L=zc(A),H={key:A,className:L,"data-testid":L},Z={wrapper:"p",forceWrapper:!0,forceInline:!0},Q=Jn(j,z[A]);return["title","text"].includes(A)&&B?(Z.wrapper="a",d.jsx("p",{...H,children:d.jsx(Lt,{options:Z,...$,children:Q})})):d.jsx(Lt,{options:Z,...H,children:Q})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&d.jsx(c_,{communitySlug:a.slug||f.slug,buildMemberData:r}),d.jsx(o_,{type:F||"",data:f}),d.jsx(l_,{data:f,cta:i,link:B||"",gtmContext:s})]})})};const Fh=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:G("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(qo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),d_=(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},f_=({id:e,title:t})=>{const n=se.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:G("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const cs={fourCards:1024,threeCards:769,twoCards:480};let pa=null;const h_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,c]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=u,[h,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:b}=h,[v,_]=y.useState(""),F=t.length,x=Math.ceil(F/m),w=y.useRef(null),B=On(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let k=1;B&&(B>=cs.fourCards?k=4:B>=cs.threeCards?k=3:B>=cs.twoCards&&(k=2),k>F&&(k=F)),c(A=>({...A,cardsPerPage:k,isLoading:!1}))},[B,F]);const S=(k="next")=>{let A=f;if(typeof k=="string")if(k==="next")if(f<x-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=k;g(L=>({...L,currentPage:A,loadedPages:[...new Set([...b,A])]}));const j=()=>{const L=A*u.cardsPerPage,H=L+u.cardsPerPage;return t.slice(L,H).length};_(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:k,count:j()}))},z=k=>{pa=k.touches[0].clientX},M=k=>{if(pa===null)return;const A=k.touches[0].clientX,j=pa-A;j>5?S("next"):j<-5&&S("previous"),pa=null},$={"--width":`${B||0}px`,"--total-cards":F,"--cards-per-page":m,"--page":f};if(p)return d.jsx(Gs,{layout:`carousel${a?"-with-title":""}`});const R=(k,A)=>{var L;let j=null;return(L=k==null?void 0:k.sys)!=null&&L.id?j=`card-${k.sys.id}`:k!=null&&k.slug?j=`card-${k.slug}`:[n[A],k.contentType].includes("customCard")&&(j=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${A}`),j};return d.jsxs("section",{ref:w,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(f_,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:M,style:$,"data-testid":"carousel-list",children:t.map((k,A)=>{let j=R(k,A);return j&&d_(A,m,f,b)?d.jsx(qo,{id:j,card:{...k,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,d.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),x<=1?null:d.jsxs(d.Fragment,{children:[d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(x)].map((k,A)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:G("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:x})})})},`page-indicator-${A}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=x-1})})]}),d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},m_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?d.jsxs(y.Fragment,{children:[d.jsx(Gs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:d.jsx(qt,{})]},`placeholder-${c}`):d.jsxs(y.Fragment,{children:[d.jsx(h_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:d.jsx(qt,{})]},`carousel-${c}`)});const p_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return y.createElement(e,{className:G("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>d.jsx("strong",{children:m}),number:u})}),u<100&&a&&d.jsx(ci,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Ys,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Bh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Ah=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Ga(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Wc(a||"");return d.jsxs("small",{className:G("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:G("type",n),children:o})," ",t>0&&!r&&d.jsx(ci,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const g_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const m=se.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return d.jsxs(Qa,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[m.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${p}time_completed`}):d.jsx(ci,{time:s,appendedText:a?m.formatMessage({id:`${p}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:_,isIntroduction:F,optional:x,slug:w,subsectionId:B,title:S,type:z})=>{const M=a&&t||F,$={};return _&&($.style={"--image":`url(${_})`}),d.jsx("li",{className:G({article:b===yr.ARTICLE,discussion:b===yr.DISCUSSION,quiz:b===yr.QUIZ,completed:g&&b===yr.ARTICLE,locked:!M}),...$,children:d.jsx(dn,{href:M?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${qc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Bh,{sectionId:i,subsectionId:B,title:S,className:"course-title"})," ",d.jsx(Ah,{completionTime:f,icon:v,optional:x,type:z,children:c&&c[w]&&d.jsx("span",{className:"quiz-score",children:`${c[w]}%`})})]})})},w)})})]})};const v_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Fe,{...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:G("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},b_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Tc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ga="notFoundError_",y_=()=>{const e=se.useIntl(),t=[];return Tc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ga}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(fh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(vn,{children:[d.jsx(Fh,{cards:Tc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Fe,{href:"/solution-articles/",children:e.formatMessage({id:`${ga}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ga}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ga}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=EE;exports.ActivitySection=HE;exports.AddPost=Io;exports.Banner=XE;exports.BannerSection=n_;exports.Breadcrumbs=Mp;exports.Buckets=mm;exports.Button=Fe;exports.ButtonWrapper=sr;exports.COURSE_CONTENT_TYPES=yr;exports.CacheProvider=id;exports.Card=qo;exports.CardBlock=Fh;exports.Carousel=m_;exports.CharacterLimit=so;exports.CollapsibleSection=Qa;exports.Columns=kd;exports.CommunityDetails=Np;exports.ContactFooter=Iw;exports.ContactForm=sh;exports.ContentTypeLabel=Jc;exports.Contributors=eo;exports.ConversationContext=ui;exports.CookieBanner=dh;exports.CourseProgression=p_;exports.CourseStructure=g_;exports.CustomContentBanner=r_;exports.CustomEvents=Xe;exports.Directory=YE;exports.DiscussionConversation=hh;exports.DiscussionForm=Hr;exports.DiscussionFormCard=ph;exports.DiscussionFormModal=kh;exports.DiscussionLikes=mh;exports.DiscussionPost=Vr;exports.DiscussionThread=vh;exports.Divider=qt;exports.DownloadSection=Ow;exports.EMAILS=Wn;exports.EditSection=Nw;exports.EmailHelperTextBox=Bd;exports.EmptyStateBox=fn;exports.FeatureFlags=Qs;exports.Filters=Ip;exports.FlagsProvider=od;exports.Footer=Po;exports.Form=Jt;exports.Formatting=K;exports.Fragment=wt;exports.FullWidthSection=vn;exports.GET_STREAM_USER_PREFIX=hs;exports.GlobalProviders=Om;exports.Header=No;exports.HelperTextBox=ed;exports.HiddenFromScreenReaders=Ya;exports.HideShowTextBox=td;exports.HighlightSection=i_;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=Uc;exports.IconBulletedList=vm;exports.ImageContainer=cm;exports.IntlProvider=ud;exports.InviteForm=oh;exports.InviteModal=KE;exports.JoinButton=ao;exports.LanguageContext=Js;exports.LanguageSwitcher=$p;exports.LessonName=Bh;exports.LessonType=Ah;exports.Link=dn;exports.LoadMore=Wr;exports.LoadingBlock=Bm;exports.LoadingPlaceholder=Ft;exports.LoadingState=Gs;exports.Logo=io;exports.LogoSection=Mw;exports.MENTION_REGEX=Hc;exports.MarkCompleteButton=v_;exports.MarkdownText=kn;exports.MarketingBlock=s_;exports.Marks=$t;exports.Member=Yt;exports.MembersList=Ww;exports.Modal=to;exports.MoreMenu=Ed;exports.NUMBER_OF_COUNTRIES=Yh;exports.NUMBER_OF_USERS=Zh;exports.NavigationMenu=_d;exports.NotFoundError=y_;exports.Overlay=mn;exports.OverlayContext=Xs;exports.OverlayProvider=dd;exports.PageHeading=nd;exports.PageLayout=fh;exports.PasswordForm=kw;exports.PasswordRules=Od;exports.Pill=ln;exports.Popover=Qc;exports.Portal=qr;exports.ProfileForm=uh;exports.ProfileImageChange=ih;exports.ProfileModal=li;exports.ProfileModalLauncher=Ro;exports.ProfilePicture=hn;exports.ProgressBar=Ys;exports.ProgressTracker=fm;exports.Rating=ag;exports.RepliesFeed=_h;exports.ResponsesHeading=gh;exports.ResponsiveImage=or;exports.ReturnToNavButton=hm;exports.RichTextEditor=ah;exports.SearchForm=lh;exports.ShareLinks=Hp;exports.SignupForm=jw;exports.Span=vs;exports.StatusBanner=Sr;exports.TableOfContents=JE;exports.Tabs=Vp;exports.Tags=qw;exports.TestimonialBlock=QE;exports.TimeToComplete=ci;exports.Toggle=_w;exports.Tooltip=Pn;exports.TopLevelPage=Rw;exports.UUID_V4_REGEX=Tr;exports.UserContext=mt;exports.UserProvider=ld;exports.VisuallyHidden=Ie;exports.addAriaProps=wd;exports.basicReducer=zr;exports.camelCaseToDashCase=zc;exports.checkIntlPathExists=Ga;exports.generateConditions=Fa;exports.generateCssIcon=Gh;exports.getCharacterLimitProps=Fd;exports.getLongDate=Zs;exports.getMember=Xa;exports.getPostBody=Mo;exports.getShortDate=Vc;exports.getValueLength=ei;exports.headerData=Lr;exports.mapGetStreamData=b_;exports.pageReady=Kc;exports.passwordValidator=ps;exports.repliesFeedMock=_E;exports.supportedLanguages=ya;exports.toCamelCase=qc;exports.toCapitalisedCase=Kh;exports.toSentenceCase=Wc;exports.useCurrentPath=Nc;exports.useEffectAfterMount=Xn;exports.useElementWidth=On;exports.useOverlay=cd;exports.useScrollListener=Rc;exports.useScrollToHash=Vs;exports.useTooltips=Ks;exports.useUser=Ja;
165
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Zc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Qw=3e3,Jw=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(Pn,{className:G("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),c.jsx(Ua,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Qw)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Nt="discussion_",Xw=195;let ma=null;const Vr=({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:m,isTruncated:p=!1,styling:{showShareLinkButton:h=!1}={},setFocus:g=!1,isCommunity:f=!1})=>{var _e,Le,Te,Ae,Pe,ke,Ve,qe;const b=se.useIntl(),v=y.useContext(mt),_=y.useContext(ui),{createContent:F=async()=>{},deleteContent:x=async()=>{},updateContent:w=async()=>{}}=o.content||{},{createLike:B=()=>{},deleteLike:S=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:M=()=>Promise.resolve([]),clickMentionFallback:$=()=>{}}=o.mentions||{},{author:R,canLike:k,createdAt:A,id:j,likes:L=0,userLiked:H,comments:Z=0,mentions:Q}=t,ae=v&&v.id&&typeof R!="string"&&R.id&&R.id===v.id||!1,C=typeof k=="boolean"?k:!0,q=ae&&(!t.createdAt||Qh(t.createdAt,10,"seconds")),Y=y.useRef(null),[E,T]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[N,I]=y.useState(!1),[U,ne]=y.useState(q?"highlighted":"default"),[te,ie]=y.useState("");y.useEffect(()=>{const W=Y.current;if(!(!W||U==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),W.addEventListener("transitionend",J),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),W.removeEventListener("transitionend",J)}},[]),y.useEffect(()=>{T({...E,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const re=await Mo(E.body,p,Q,M);T({...E,postBody:re})})()},[E.body,Q]);const le=()=>{setTimeout(()=>{ne("fading")},1e3)},J=({propertyName:W})=>{W==="background-color"&&ne(re=>(re==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,le),Y.current&&Y.current.removeEventListener("transitionend",J)),re==="fading"?"default":re))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||E.postBody===""&&t.title==="")return c.jsx(Ft,{className:"discussion-card"});const ge=async({title:W,body:re})=>{W||(W=""),re||(re=""),ie("");try{if(!ds(W,E.title)||!ds(re,E.body)){const me=t.type==="question"?{title:re}:{title:W,body:re};await w(wc(t.slugs),me)}T({...E,title:W,body:re,isEditing:!1,didEdit:!0})}catch{ie(`${Nt}form_error`)}},he=()=>{if(_&&_.updateConversation){const W={showForm:!0},re=t.author;re&&re.id&&(f&&(W.prepopulateForm=`@{{${re.id}}}`),W.mentionData={id:re.id,name:re.name}),_.updateConversation(W)}setTimeout(()=>{var we,Ze,Ye;const re=`reply-form-${(t.type==="answer"?t.slug:((we=t.slugs)==null?void 0:we.reply)||((Ze=t.slugs)==null?void 0:Ze.answer)||((Ye=t.slugs)==null?void 0:Ye.question)||"").toLowerCase().slice(-15)}`,me=document.getElementById(re),ve=document.getElementById(`${re}-input`);ve&&ve.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},pe=async()=>{I(!1);try{await x(wc(t.slugs))}catch{ie("delete-error")}},xe=[{text:b.formatMessage({id:`${Nt}moreMenu_report`}),onClick:W=>{W.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${Nt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&ae&&xe.push({text:b.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>T({...E,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:W=>{W.preventDefault(),W.stopPropagation(),I(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...wd(`delete-${t.slug}-modal`,N)}),r&&o.pins&&xe.push({text:b.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((_e=Y==null?void 0:Y.current)==null||_e.focus(),(Le=Y==null?void 0:Y.current)==null||Le.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:G("discussion-post",u,{[U]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!E.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Y,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:W=>{if(!l.post||E.isEditing)return;W.preventDefault(),W.stopPropagation(),ma&&clearTimeout(ma),ma=setTimeout(()=>{window.location.href=l.post},150);const re=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ma}});document.dispatchEvent(re)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:j||t.slug,className:G("discussion-card",t.type,{editing:E.isEditing,"has-link":l.post&&!E.isEditing}),children:[!E.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Yt,{member:R,additionalContent:{createdAt:A,didEdit:E.didEdit},className:typeof R!="string"&&R.id===i?"highlighted":"",gtmContext:d,gtmType:"profile-click"}),t.pinned&&c.jsx(ln,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ie,{children:"Pinned Post"})})]}),E.isEditing?c.jsx(Hr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:E.title!==""?{text:E.title}:!1,isEditing:{text:E.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:te!==""&&te!=="delete-error"?b.formatMessage({id:te},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:F,handleSaveEdit:ge,handleCancel:()=>{ie(""),T({...E,isEditing:!1})},listMembers:M,clickMentionFallback:$},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),E.postBody.length>Xw?c.jsx(td,{text:E.postBody,markdownOptions:{overrides:{a:vs,blockquote:{component:os}}}}):c.jsx(kn,{options:{overrides:{a:vs,blockquote:{component:os}}},children:E.postBody})]}):c.jsxs(c.Fragment,{children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),c.jsx(kn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:os}}},children:E.postBody})]}),!E.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(mh,{element:"li",likes:L,isShort:!1,userLiked:H,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:C,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:B,deleteLike:S}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ua,{onClick:W=>{W.preventDefault(),W.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${Nt}comments_screenReader`},{count:Z}),children:b.formatMessage({id:`${Nt}comments`},{count:Z})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ua,{styling:{muted:!0},onClick:he,icon:{icon:"speech-bubble_square"},children:b.formatMessage({id:`${Nt}reply`})})}),h&&c.jsx(Jw,{url:(Te=t.slugs)!=null&&Te.reply?`${window.location.origin}${(Ae=t.slugs)==null?void 0:Ae.question}/${(Pe=t.slugs)==null?void 0:Pe.answer}#${(ke=t.slugs)==null?void 0:ke.reply}`:`${window.location.origin}${(Ve=t.slugs)==null?void 0:Ve.question}/${(qe=t.slugs)==null?void 0:qe.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),c.jsx(Ed,{element:"li",id:`more-${t.slug}`,options:xe})]})]}),m,c.jsx(mn,{id:`delete-${t.slug}-modal`,isOpen:N,functions:{onOpen:()=>{},onClose:()=>I(!1)},forceShow:{error:te==="delete-error"?b.formatMessage({id:"discussion_delete_error"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:b.formatMessage({id:"discussion_delete_title"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>I(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:pe,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:W=>c.jsx("p",{children:W}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const eE=y.lazy(()=>Promise.resolve().then(()=>VE)),tE=65,ph=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(mt)||"community",l=Xa(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||Gc("showPost")==="true"||!1,warning:!1}),[p,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await Mo(p.title||p.body||"",tE,p.mentions);h(_=>({..._,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const _=b;_.preventDefault(),_.stopPropagation();const x=_.target.closest("a");v=x&&x.getAttribute("href")}m(_=>({..._,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(hn,{name:l.name,src:l.image,alt:""}),c.jsx(kn,{className:G("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:wt,blockquote:wt,br:wt,em:wt,li:wt,ol:wt,p:wt,s:wt,span:wt,strong:wt,ul:wt}},children:f})]}),c.jsxs(qr,{children:[c.jsx(eE,{showModal:d.form,functions:{cacheText:h,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(mn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({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`})})})]})]})},nE=y.lazy(()=>Promise.resolve().then(()=>Kw)),Io=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(fn,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(ao,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,m={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx(ph,{form:m}):c.jsx(nE,{...m})},Ro=({form:e})=>{const t=y.useContext(mt),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{sm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(li,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const us="discussion_responses_",gh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${us}title`},{action:r.formatMessage({id:`${us}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:At(r.formatMessage,`${us}empty`,e,e)})]})};const vh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(ui),o=ba(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:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Wr,{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(Hr,{...r})]})},rE="post",aE="reply",bh="00000000-0000-0000-0000-000000000000";function $o({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Lo({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 iE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function sE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function yh(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 oE({title:e,content:t}){return{title:e,content:t,id:bh,time:new Date().toISOString(),verb:rE}}function Ec({activity:e,user:t}){return{...e,actor:yh(t),...iE()}}function Ha({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 Dh({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 Va({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 Ch({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 uE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:bh,kind:aE,parent:t||""}}function _c({reply:e,user:t}){const n=yh(t);return{...e,user_id:n.id,user:n,...sE()}}function kc({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 lE({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const xh=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Fc,ls=0;const wh=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Fc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ls=0;return}ls++,!(ls>10)&&(Fc=setTimeout(()=>{e(t)},50))}},ar=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}),Wt=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}),zo=Object.freeze({actor:`SU:${ar.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),cE=Object.freeze({actor:`SU:${Wt.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"}),dE=Object.freeze({actor:`SU:${ar.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"}),fE=Object.freeze({actor:`SU:${Wt.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:zo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.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:zo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.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:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:zo.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:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:cE.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:dE.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:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:fE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function hE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ec({activity:oE(o),user:i});return Bc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ec({activity:o,user:i});r.setQueryData(a,Bc(d,u,!0)),setTimeout(()=>{xh(d.id,"activity")},0)}});return s}function mE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sn(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,rankingMethod:u}){const d=We.useQueryClient(),m=Ja(),p={queryClient:d,queryKey:l},h={mutationHandlers:{error:$o(p),mutate:Lo(p)},user:m,...p},g=hE({...h,mutationFn:e}),f=mE({...h,mutationFn:t}),b=gE({...h,mutationFn:n}),v=yE({...h,mutationFn:a}),_=DE({...h,mutationFn:i}),F=bE({...h,mutationFn:s}),x=CE({...h,mutationFn:o}),{activities:w,...B}=vE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:_,pin:F,unpin:x},user:m,...B}}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function vE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:wE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>xE(a,i)),onError:n});return r}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&Dh({activity:o,user:r}),s}),onError:n});return a}function CE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&Ch({activity:o,user:r}),s}),onError:n});return a}function Bc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Sn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function xE(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 wE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const EE=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=jm(Qs.COMMUNITY_RANKING),d=se.useIntl(),[m,p]=y.useState("community_feed_live"),[h,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:_,isLoading:F,mutations:{create:x,edit:w,remove:B,like:S,unlike:z,pin:M,unpin:$}}=pE({queryKey:[e,t,"activities",m],queryFns:a,rankingMethod:m});y.useEffect(()=>{u&&g(h.concat(u))},[u]);const[R,k]=y.useState(null),A=()=>{k(f.length),v()};return wh(),b?c.jsx(fn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Io,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:x,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(Jt,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:j,label:L})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${L}`})})),initialValue:m,functions:{onChange:j=>p(j)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,L)=>{var I,U,ne,te,ie,le,J,ge;const{id:H,own_reactions:Z,latest_reactions:Q,reaction_counts:ae,mentioned_users:C}=j,q=(((I=Q==null?void 0:Q.like)==null?void 0:I.length)||0)>0,Y=(((U=Z==null?void 0:Z.like)==null?void 0:U.length)||0)>0,E=Y?Z==null?void 0:Z.like[0].id:"",T=q?(ne=Q==null?void 0:Q.like)==null?void 0:ne.map(he=>{var pe,xe,_e;return{id:(pe=he==null?void 0:he.user)==null?void 0:pe.id,name:(_e=(xe=he==null?void 0:he.user)==null?void 0:xe.data)==null?void 0:_e.name}}):!1,N=j==null?void 0:j.actor;return c.jsx(y.Fragment,{children:c.jsx(Vr,{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:H},slug:H,author:{id:N==null?void 0:N.id,name:(te=N==null?void 0:N.data)==null?void 0:te.name,organization:(ie=N==null?void 0:N.data)==null?void 0:ie.organization,jobTitle:(le=N==null?void 0:N.data)==null?void 0:le.jobTitle,location:(J=N==null?void 0:N.data)==null?void 0:J.location,image:{thumbnail:((ge=N==null?void 0:N.data)==null?void 0:ge.thumbnail)||void 0}},userLiked:Y,likes:(ae==null?void 0:ae.like)||0,comments:(ae==null?void 0:ae.reply)||0,peopleWhoLiked:T,mentions:C,pinned:(ae==null?void 0:ae.pin)&&(ae==null?void 0:ae.pin)>0||!1},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>B({activityId:H}),updateContent:(he,{body:pe})=>w({activityId:H,content:pe})},likes:{createLike:()=>S({activityId:H}),deleteLike:()=>z({activityId:H,reactionId:E})},comments:{openComments:()=>null},pins:{createPin:()=>M({activityId:H}),deletePin:()=>$({activityId:H,reactionId:Q==null?void 0:Q.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:L===R,userHasOwnerPermissions:r})},H)}),!F&&c.jsx(Wr,{hasNextPage:_,loadNextPage:A,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Ro,{form:l})]})},_E={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function kE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=_c({reply:uE(o),user:i});return Ac(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=_c({reply:o,user:i});r.setQueryData(a,Ac(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{xh(d.id,"reply")},0)}});return s}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ka(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Eh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ja(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:$o(u),mutate:Lo(u)},user:l,...u},m=kE({...d,mutationFn:e}),p=FE({...d,mutationFn:t}),h=BE({...d,mutationFn:n}),g=TE({...d,mutationFn:a}),f=SE({...d,mutationFn:i}),{replies:b,...v}=AE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:m,edit:p,remove:g,like:h,unlike:f},user:l,...v}}function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ka(s,o);return l&&kc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ka(o,l);u&&kc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function AE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=ME(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>NE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ka(i,s);return o&&lE({reply:o,user:r}),s}),onError:n});return a}function jE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function OE(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 PE(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 Ac(e,t,n){return t?n!=null&&n.append?OE(e,t,n):PE(e,t,n):jE(e)}function Ka(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function NE(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 ME(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 IE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:m,mutations:{create:p,edit:h,like:g,remove:f,unlike:b},user:v}=Eh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});Vs([m]);const[_,F]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Fe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!_),children:s.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:l==null?void 0:l.length})}),_&&c.jsx(vh,{loadMore:{isLoading:m,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(x=>{var Q,ae,C,q,Y,E,T,N,I,U,ne,te;const{id:w,own_children:B,latest_children:S,children_counts:z,data:{mentioned_users:M}}=x,R=(((Q=B==null?void 0:B.like)==null?void 0:Q.length)||0)>0?(ae=B==null?void 0:B.like)==null?void 0:ae.find(ie=>{var le;return((le=ie==null?void 0:ie.user)==null?void 0:le.id)===(v==null?void 0:v.id)}):!1,k=R?R==null?void 0:R.id:"",A=!!R,L=(((C=S==null?void 0:S.like)==null?void 0:C.length)||0)>0?(q=S==null?void 0:S.like)==null?void 0:q.map(ie=>{var le,J,ge;return{id:(le=ie==null?void 0:ie.user)==null?void 0:le.id,name:(ge=(J=ie==null?void 0:ie.user)==null?void 0:J.data)==null?void 0:ge.name}}):!1,H=x==null?void 0:x.user,Z=typeof x.data.content=="string"?(Y=x==null?void 0:x.data)==null?void 0:Y.content:((T=(E=x==null?void 0:x.data)==null?void 0:E.content)==null?void 0:T.text)||"";return c.jsx(Vr,{isCommunity:!0,content:{id:w,type:"reply",body:Z,canLike:a,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:H==null?void 0:H.id,name:(N=H.data)==null?void 0:N.name,organization:(I=H.data)==null?void 0:I.organization,jobTitle:(U=H.data)==null?void 0:U.jobTitle,location:(ne=H.data)==null?void 0:ne.location,image:{thumbnail:((te=H.data)==null?void 0:te.thumbnail)||void 0}},userLiked:A,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:L,mentions:M},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(ie,{body:le})=>h({replyId:w,content:le})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:k})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},w)}):null})]})};const _h=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o},profile:l})=>{const u=se.useIntl(),{replies:d,repliesCount:m,fetchNextPage:p,hasNextPage:h,isLoading:g,mutations:{create:f,edit:b,like:v,remove:_,unlike:F},user:x}=Eh({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{S(d.length),p()},[B,S]=y.useState(null);return Vs([g]),wh(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(gh,{type:"comment",responses:m,isLoading:g}),c.jsx(Io,{form:{content:{type:"reply",slugs:{}},functions:{create:(z,{body:M})=>f({activityId:n,content:M}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:u.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),d==null?void 0:d.map((z,M)=>{var E,T,N,I,U,ne,te,ie,le,J,ge,he;const{id:$,own_children:R,latest_children:k,children_counts:A,data:{mentioned_users:j}}=z,H=(((E=R==null?void 0:R.like)==null?void 0:E.length)||0)>0?(T=R==null?void 0:R.like)==null?void 0:T.find(pe=>{var xe;return((xe=pe==null?void 0:pe.user)==null?void 0:xe.id)===(x==null?void 0:x.id)}):!1,Z=H?H==null?void 0:H.id:"",Q=!!H,C=(((N=k==null?void 0:k.like)==null?void 0:N.length)||0)>0?(I=k==null?void 0:k.like)==null?void 0:I.map(pe=>{var xe,_e,Le;return{id:(xe=pe==null?void 0:pe.user)==null?void 0:xe.id,name:(Le=(_e=pe==null?void 0:pe.user)==null?void 0:_e.data)==null?void 0:Le.name}}):!1,q=z==null?void 0:z.user,Y=typeof z.data.content=="string"?(U=z==null?void 0:z.data)==null?void 0:U.content:((te=(ne=z==null?void 0:z.data)==null?void 0:ne.content)==null?void 0:te.text)||"";return c.jsx(hh,{children:c.jsx(Vr,{isCommunity:!0,content:{id:$,type:"reply",body:Y,canLike:r,createdAt:z==null?void 0:z.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:$},slug:$,author:{id:q==null?void 0:q.id,name:(ie=q.data)==null?void 0:ie.name,organization:(le=q.data)==null?void 0:le.organization,jobTitle:(J=q.data)==null?void 0:J.jobTitle,location:(ge=q.data)==null?void 0:ge.location,image:{thumbnail:((he=q.data)==null?void 0:he.thumbnail)||void 0}},userLiked:Q,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:$}),updateContent:(pe,{body:xe})=>b({replyId:$,content:xe})},likes:{createLike:()=>v({replyId:$}),deleteLike:()=>F({replyId:$,reactionId:Z})},comments:{},mentions:i},children:c.jsx(IE,{basePath:e,parentId:t,activityId:n,replyId:$,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:M===B},$)},$)}),!g&&c.jsx(Wr,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:u.formatMessage({id:"loadMore_button"}),error:u.formatMessage({id:"loadMore_error"})}}),c.jsx(Ro,{form:l})]})};function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.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 $E({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=We.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function LE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=We.useQueryClient(),l=Ja(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:$o(u),mutate:Lo(u)},user:l,...u},m=RE({...d,mutationFn:t}),p=zE({...d,mutationFn:n}),h=qE({...d,mutationFn:r}),g=WE({...d,mutationFn:a}),f=UE({...d,mutationFn:i}),{activity:b,...v}=$E({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:p,unlike:h,pin:g,unpin:f},user:l,...v}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Dh({activity:s,user:r}),s)),onError:n});return a}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Ch({activity:s,user:r}),s))),onError:n});return a}const HE=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:m})=>{var A,j,L,H,Z,Q,ae,C,q,Y,E,T;const p=se.useIntl(),{activity:h,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:_,pin:F,unpin:x}}=LE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(Ft,{style:{height:"400px"}});if(g||!h)return c.jsx(fn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:B,mentioned_users:S}=h,z=(((A=B==null?void 0:B.like)==null?void 0:A.length)||0)>0,M=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,$=M?w==null?void 0:w.like[0].id:"",R=z?(L=B==null?void 0:B.like)==null?void 0:L.map(N=>{var I,U,ne;return{id:(I=N==null?void 0:N.user)==null?void 0:I.id,name:(ne=(U=N==null?void 0:N.user)==null?void 0:U.data)==null?void 0:ne.name}}):!1,k=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Vr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:k.id,name:(H=k.data)==null?void 0:H.name,organization:(Z=k.data)==null?void 0:Z.organization,jobTitle:(Q=k.data)==null?void 0:Q.jobTitle,location:(ae=k.data)==null?void 0:ae.location,image:{thumbnail:((C=k.data)==null?void 0:C.thumbnail)||void 0}},userLiked:M,likes:((q=h==null?void 0:h.reaction_counts)==null?void 0:q.like)||0,comments:((Y=h==null?void 0:h.reaction_counts)==null?void 0:Y.reply)||0,peopleWhoLiked:R,mentions:S,pinned:((E=h==null?void 0:h.reaction_counts)==null?void 0:E.pin)&&((T=h==null?void 0:h.reaction_counts)==null?void 0:T.pin)>0||!1},originalAuthorId:k==null?void 0:k.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(N,{title:I,body:U})=>b({title:I,content:U})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>_({activityId:n,reactionId:$})},comments:{openComments:()=>{}},pins:{createPin:()=>F({activityId:n}),deletePin:()=>{var N;return x({activityId:n,reactionId:(N=B==null?void 0:B.pin)==null?void 0:N[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a},n),c.jsx(_h,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:m})]})};const kh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:p="",body:h="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(mn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||h!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:G("discussion-form-modal",a),children:c.jsx(Hr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:h||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const _=g||{};_[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(F=>({...F,mentions:_}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},VE=Object.freeze(Object.defineProperty({__proto__:null,default:kh},Symbol.toStringTag,{value:"Module"}));const KE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=se.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(mn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:c.jsx(oh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const li=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(Gc("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(mn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:G("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(uh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},ZE=Object.freeze(Object.defineProperty({__proto__:null,default:li},Symbol.toStringTag,{value:"Module"}));const YE=({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(hn,{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(mn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(kn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const GE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:G("testimonial-block",a),children:[c.jsx(Lt,{className:"testimonial",children:n}),r?c.jsx(Yt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:G("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:G("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),QE=y.memo(GE);const JE=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(jt,{variant:"subtle",className:G("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 ci=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,p=Math.floor(m),h=(m-p)*60,g=Math.round(h),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:G("time-to-complete",a),"aria-label":u,children:l})};const XE=({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(or,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const e_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],t_=({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"],m={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:_}=t[b];if(_&&e_.includes(_.toLowerCase()))return;p[b]={text:v,element:m[b]};return}p[b]={text:t[b],element:m[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(vn,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:_=""}=p[b];return b==="text"?c.jsx(kn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(_,{key:b,className:b},v)}return null}),l,h&&c.jsx(Fe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:G({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(or,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},n_=y.memo(t_);const r_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(vn,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const a_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(kn,{children:n}):n;return c.jsxs(vn,{className:G("highlight-section",t),children:[r&&c.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(or,{image:{...r,description:""}})}),c.jsx("div",{className:G("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:G("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},i_=y.memo(a_);const s_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:G("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Fe,{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})]}),o_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&ms(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Zs(d)});if(o)return c.jsx(ln,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&ms(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},u_={title:66,text:3e3,secondaryText:1e3,partner:34},Za={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"}},l_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,p=e.contentType;let h="";if((f=Za[p])!=null&&f.gtmEvent&&(h=Za[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Fe,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),_=async F=>{if(F.preventDefault(),F.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Fe,{onClick:_,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${m}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function c_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),[r,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t).then(i=>{if(!i)return;const{membersCount:s,role:o=""}=i;a({count:s==null?void 0:s.toString(),isMember:!!o,memberType:o})})},[t,e]),c.jsxs("span",{className:"member-information",children:[r.isMember&&c.jsx(ln,{size:"small",variant:"registered",icon:(r==null?void 0:r.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${r.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:r.count})})]})}const qo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var R,k;const u=se.useIntl(),d=y.useContext(mt),m=!!(d!=null&&d.id),p=y.useRef(null),[h,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(A=>{g({data:A,isLoading:!1})}).catch(()=>g(A=>({...A,isLoading:!1})))},[a,m,n]);const{data:f,isLoading:b}=h;if(b||!f)return c.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Za[v])return c.jsx(Ft,{element:"li",className:"card-wrapper"});const{basePath:_="",className:F,length:x,gtmEvent:w}=Za[v];let B=f.slug?`${_}${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")&&(B=f.slug);const S=A=>{B&&(A.preventDefault(),A.stopPropagation(),window.location.href=B)},z={...u_,...x};let M={className:"card"},$={};return B&&($={href:B,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&($.target="_blank"),M={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(M={...M,tabIndex:"0"},(R=p==null?void 0:p.current)==null||R.focus(),(k=p==null?void 0:p.current)==null||k.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:G("card-wrapper text-medium",F,t,{"has-link":B,"no-link":!B,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...M,ref:p,children:[c.jsx(Jc,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&Jh(f==null?void 0:f.createdAt,60)&&c.jsx(ln,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(ln,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Vc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(ln,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(or,{image:{...f.banner,description:""}})]}):F==="people"?c.jsx(hn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(eo,{contributors:{data:f.contributors},styling:{size:"small",showGap:F!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Jn(f.partner[0],z.partner)}),["title","text","secondaryText"].map(A=>{const j=f[A];if(!j)return null;const L=zc(A),H={key:A,className:L,"data-testid":L},Z={wrapper:"p",forceWrapper:!0,forceInline:!0},Q=Jn(j,z[A]);return["title","text"].includes(A)&&B?(Z.wrapper="a",c.jsx("p",{...H,children:c.jsx(Lt,{options:Z,...$,children:Q})})):c.jsx(Lt,{options:Z,...H,children:Q})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(c_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(o_,{type:F||"",data:f}),c.jsx(l_,{data:f,cta:i,link:B||"",gtmContext:s})]})})};const Fh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:G("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(qo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),d_=(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},f_=({id:e,title:t})=>{const n=se.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:G("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 cs={fourCards:1024,threeCards:769,twoCards:480};let pa=null;const h_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,d]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=u,[h,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:b}=h,[v,_]=y.useState(""),F=t.length,x=Math.ceil(F/m),w=y.useRef(null),B=On(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let k=1;B&&(B>=cs.fourCards?k=4:B>=cs.threeCards?k=3:B>=cs.twoCards&&(k=2),k>F&&(k=F)),d(A=>({...A,cardsPerPage:k,isLoading:!1}))},[B,F]);const S=(k="next")=>{let A=f;if(typeof k=="string")if(k==="next")if(f<x-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=k;g(L=>({...L,currentPage:A,loadedPages:[...new Set([...b,A])]}));const j=()=>{const L=A*u.cardsPerPage,H=L+u.cardsPerPage;return t.slice(L,H).length};_(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:k,count:j()}))},z=k=>{pa=k.touches[0].clientX},M=k=>{if(pa===null)return;const A=k.touches[0].clientX,j=pa-A;j>5?S("next"):j<-5&&S("previous"),pa=null},$={"--width":`${B||0}px`,"--total-cards":F,"--cards-per-page":m,"--page":f};if(p)return c.jsx(Gs,{layout:`carousel${a?"-with-title":""}`});const R=(k,A)=>{var L;let j=null;return(L=k==null?void 0:k.sys)!=null&&L.id?j=`card-${k.sys.id}`:k!=null&&k.slug?j=`card-${k.slug}`:[n[A],k.contentType].includes("customCard")&&(j=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${A}`),j};return c.jsxs("section",{ref:w,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(f_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:M,style:$,"data-testid":"carousel-list",children:t.map((k,A)=>{let j=R(k,A);return j&&d_(A,m,f,b)?c.jsx(qo,{id:j,card:{...k,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,c.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),x<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(x)].map((k,A)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:G("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:x})})})},`page-indicator-${A}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=x-1})})]}),c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},m_=({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}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(Gs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(h_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const p_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:G("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:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(ci,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Ys,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Bh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Ah=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Ga(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Wc(a||"");return c.jsxs("small",{className:G("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:G("type",n),children:o})," ",t>0&&!r&&c.jsx(ci,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const g_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=se.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return c.jsxs(Qa,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${p}time_completed`}):c.jsx(ci,{time:s,appendedText:a?m.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:_,isIntroduction:F,optional:x,slug:w,subsectionId:B,title:S,type:z})=>{const M=a&&t||F,$={};return _&&($.style={"--image":`url(${_})`}),c.jsx("li",{className:G({article:b===yr.ARTICLE,discussion:b===yr.DISCUSSION,quiz:b===yr.QUIZ,completed:g&&b===yr.ARTICLE,locked:!M}),...$,children:c.jsx(dn,{href:M?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${qc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Bh,{sectionId:i,subsectionId:B,title:S,className:"course-title"})," ",c.jsx(Ah,{completionTime:f,icon:v,optional:x,type:z,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const v_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Fe,{...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:G("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},b_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Tc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ga="notFoundError_",y_=()=>{const e=se.useIntl(),t=[];return Tc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ga}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(fh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(vn,{children:[c.jsx(Fh,{cards:Tc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Fe,{href:"/solution-articles/",children:e.formatMessage({id:`${ga}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ga}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ga}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=EE;exports.ActivitySection=HE;exports.AddPost=Io;exports.Banner=XE;exports.BannerSection=n_;exports.Breadcrumbs=Mp;exports.Buckets=mm;exports.Button=Fe;exports.ButtonWrapper=sr;exports.COURSE_CONTENT_TYPES=yr;exports.CacheProvider=id;exports.Card=qo;exports.CardBlock=Fh;exports.Carousel=m_;exports.CharacterLimit=so;exports.CollapsibleSection=Qa;exports.Columns=kd;exports.CommunityDetails=Np;exports.ContactFooter=Iw;exports.ContactForm=sh;exports.ContentTypeLabel=Jc;exports.Contributors=eo;exports.ConversationContext=ui;exports.CookieBanner=dh;exports.CourseProgression=p_;exports.CourseStructure=g_;exports.CustomContentBanner=r_;exports.CustomEvents=Xe;exports.Directory=YE;exports.DiscussionConversation=hh;exports.DiscussionForm=Hr;exports.DiscussionFormCard=ph;exports.DiscussionFormModal=kh;exports.DiscussionLikes=mh;exports.DiscussionPost=Vr;exports.DiscussionThread=vh;exports.Divider=qt;exports.DownloadSection=Ow;exports.EMAILS=Wn;exports.EditSection=Nw;exports.EmailHelperTextBox=Bd;exports.EmptyStateBox=fn;exports.FeatureFlags=Qs;exports.Filters=Ip;exports.FlagsProvider=od;exports.Footer=Po;exports.Form=Jt;exports.Formatting=K;exports.Fragment=wt;exports.FullWidthSection=vn;exports.GET_STREAM_USER_PREFIX=hs;exports.GlobalProviders=Om;exports.Header=No;exports.HelperTextBox=ed;exports.HiddenFromScreenReaders=Ya;exports.HideShowTextBox=td;exports.HighlightSection=i_;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=Uc;exports.IconBulletedList=vm;exports.ImageContainer=cm;exports.IntlProvider=ud;exports.InviteForm=oh;exports.InviteModal=KE;exports.JoinButton=ao;exports.LanguageContext=Js;exports.LanguageSwitcher=$p;exports.LessonName=Bh;exports.LessonType=Ah;exports.Link=dn;exports.LoadMore=Wr;exports.LoadingBlock=Bm;exports.LoadingPlaceholder=Ft;exports.LoadingState=Gs;exports.Logo=io;exports.LogoSection=Mw;exports.MENTION_REGEX=Hc;exports.MarkCompleteButton=v_;exports.MarkdownText=kn;exports.MarketingBlock=s_;exports.Marks=$t;exports.Member=Yt;exports.MembersList=Ww;exports.Modal=to;exports.MoreMenu=Ed;exports.NUMBER_OF_COUNTRIES=Yh;exports.NUMBER_OF_USERS=Zh;exports.NavigationMenu=_d;exports.NotFoundError=y_;exports.Overlay=mn;exports.OverlayContext=Xs;exports.OverlayProvider=dd;exports.PageHeading=nd;exports.PageLayout=fh;exports.PasswordForm=kw;exports.PasswordRules=Od;exports.Pill=ln;exports.Popover=Qc;exports.Portal=qr;exports.ProfileForm=uh;exports.ProfileImageChange=ih;exports.ProfileModal=li;exports.ProfileModalLauncher=Ro;exports.ProfilePicture=hn;exports.ProgressBar=Ys;exports.ProgressTracker=fm;exports.Rating=ag;exports.RepliesFeed=_h;exports.ResponsesHeading=gh;exports.ResponsiveImage=or;exports.ReturnToNavButton=hm;exports.RichTextEditor=ah;exports.SearchForm=lh;exports.ShareLinks=Hp;exports.SignupForm=jw;exports.Span=vs;exports.StatusBanner=Sr;exports.TableOfContents=JE;exports.Tabs=Vp;exports.Tags=qw;exports.TestimonialBlock=QE;exports.TimeToComplete=ci;exports.Toggle=_w;exports.Tooltip=Pn;exports.TopLevelPage=Rw;exports.UUID_V4_REGEX=Tr;exports.UserContext=mt;exports.UserProvider=ld;exports.VisuallyHidden=Ie;exports.addAriaProps=wd;exports.basicReducer=zr;exports.camelCaseToDashCase=zc;exports.checkIntlPathExists=Ga;exports.generateConditions=Fa;exports.generateCssIcon=Gh;exports.getCharacterLimitProps=Fd;exports.getLongDate=Zs;exports.getMember=Xa;exports.getPostBody=Mo;exports.getShortDate=Vc;exports.getValueLength=ei;exports.headerData=Lr;exports.mapGetStreamData=b_;exports.pageReady=Kc;exports.passwordValidator=ps;exports.repliesFeedMock=_E;exports.supportedLanguages=ya;exports.toCamelCase=qc;exports.toCapitalisedCase=Kh;exports.toSentenceCase=Wc;exports.useCurrentPath=Nc;exports.useEffectAfterMount=Xn;exports.useElementWidth=On;exports.useOverlay=cd;exports.useScrollListener=Rc;exports.useScrollToHash=Vs;exports.useTooltips=Ks;exports.useUser=Ja;