@apolitical/component-library 4.1.12-beta.3 → 4.1.12-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +24 -24
  2. package/index.mjs +1329 -1321
  3. package/package.json +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 Ro;function kh(){if(Ro)return ir;Ro=1;var e=x,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={},f=null,p=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(p=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:f,ref:p,props:m,_owner:a.current}}return ir.Fragment=n,ir.jsx=s,ir.jsxs=s,ir}var sr={};/**
13
+ */var Ro;function kh(){if(Ro)return ir;Ro=1;var e=x,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={},h=null,p=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=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:h,ref:p,props:m,_owner:a.current}}return ir.Fragment=n,ir.jsx=s,ir.jsxs=s,ir}var sr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,23 +18,23 @@
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 No;function _h(){return No||(No=1,process.env.NODE_ENV!=="production"&&function(){var e=x,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"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,h="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var re=g&&O[g]||O[h];return typeof re=="function"?re:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var re=arguments.length,ce=new Array(re>1?re-1:0),ye=1;ye<re;ye++)ce[ye-1]=arguments[ye];A("error",O,ce)}}function A(O,re,ce){{var ye=b.ReactDebugCurrentFrame,Be=ye.getStackAddendum();Be!==""&&(re+="%s",ce=ce.concat([Be]));var Re=ce.map(function(_e){return String(_e)});Re.unshift("Warning: "+re),Function.prototype.apply.call(console[O],console,Re)}}var k=!1,E=!1,T=!1,j=!1,z=!1,N;N=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||j||O===p||k||E||T||typeof O=="object"&&O!==null&&(O.$$typeof===f||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===N||O.getModuleId!==void 0))}function M(O,re,ce){var ye=O.displayName;if(ye)return ye;var Be=re.displayName||re.name||"";return Be!==""?ce+"("+Be+")":ce}function C(O){return O.displayName||"Context"}function B(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var re=O;return C(re)+".Consumer";case s:var ce=O;return C(ce._context)+".Provider";case l:return M(O,O.render,"ForwardRef");case m:var ye=O.displayName||null;return ye!==null?ye:B(O.type)||"Memo";case f:{var Be=O,Re=Be._payload,_e=Be._init;try{return B(_e(Re))}catch{return null}}}return null}var F=Object.assign,R=0,L,q,oe,ne,D,H,X;function _(){}_.__reactDisabledLog=!0;function S(){{if(R===0){L=console.log,q=console.info,oe=console.warn,ne=console.error,D=console.group,H=console.groupCollapsed,X=console.groupEnd;var O={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}R++}}function W(){{if(R--,R===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},O,{value:L}),info:F({},O,{value:q}),warn:F({},O,{value:oe}),error:F({},O,{value:ne}),group:F({},O,{value:D}),groupCollapsed:F({},O,{value:H}),groupEnd:F({},O,{value:X})})}R<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=b.ReactCurrentDispatcher,K;function te(O,re,ce){{if(K===void 0)try{throw Error()}catch(Be){var ye=Be.stack.trim().match(/\n( *(at )?)/);K=ye&&ye[1]||""}return`
21
+ */var No;function _h(){return No||(No=1,process.env.NODE_ENV!=="production"&&function(){var e=x,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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var re=g&&O[g]||O[f];return typeof re=="function"?re:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var re=arguments.length,ce=new Array(re>1?re-1:0),ye=1;ye<re;ye++)ce[ye-1]=arguments[ye];A("error",O,ce)}}function A(O,re,ce){{var ye=b.ReactDebugCurrentFrame,Be=ye.getStackAddendum();Be!==""&&(re+="%s",ce=ce.concat([Be]));var Re=ce.map(function(_e){return String(_e)});Re.unshift("Warning: "+re),Function.prototype.apply.call(console[O],console,Re)}}var k=!1,E=!1,F=!1,j=!1,z=!1,N;N=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||j||O===p||k||E||F||typeof O=="object"&&O!==null&&(O.$$typeof===h||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===N||O.getModuleId!==void 0))}function M(O,re,ce){var ye=O.displayName;if(ye)return ye;var Be=re.displayName||re.name||"";return Be!==""?ce+"("+Be+")":ce}function C(O){return O.displayName||"Context"}function B(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var re=O;return C(re)+".Consumer";case s:var ce=O;return C(ce._context)+".Provider";case l:return M(O,O.render,"ForwardRef");case m:var ye=O.displayName||null;return ye!==null?ye:B(O.type)||"Memo";case h:{var Be=O,Re=Be._payload,_e=Be._init;try{return B(_e(Re))}catch{return null}}}return null}var T=Object.assign,R=0,L,q,oe,ne,D,H,X;function _(){}_.__reactDisabledLog=!0;function S(){{if(R===0){L=console.log,q=console.info,oe=console.warn,ne=console.error,D=console.group,H=console.groupCollapsed,X=console.groupEnd;var O={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}R++}}function W(){{if(R--,R===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:T({},O,{value:L}),info:T({},O,{value:q}),warn:T({},O,{value:oe}),error:T({},O,{value:ne}),group:T({},O,{value:D}),groupCollapsed:T({},O,{value:H}),groupEnd:T({},O,{value:X})})}R<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=b.ReactCurrentDispatcher,K;function te(O,re,ce){{if(K===void 0)try{throw Error()}catch(Be){var ye=Be.stack.trim().match(/\n( *(at )?)/);K=ye&&ye[1]||""}return`
22
22
  `+K+O}}var ee=!1,ae;{var le=typeof WeakMap=="function"?WeakMap:Map;ae=new le}function V(O,re){if(!O||ee)return"";{var ce=ae.get(O);if(ce!==void 0)return ce}var ye;ee=!0;var Be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Re;Re=I.current,I.current=null,S();try{if(re){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch($t){ye=$t}Reflect.construct(O,[],_e)}else{try{_e.call()}catch($t){ye=$t}O.call(_e.prototype)}}else{try{throw Error()}catch($t){ye=$t}O()}}catch($t){if($t&&ye&&typeof $t.stack=="string"){for(var ke=$t.stack.split(`
23
23
  `),rt=ye.stack.split(`
24
24
  `),qe=ke.length-1,Ue=rt.length-1;qe>=1&&Ue>=0&&ke[qe]!==rt[Ue];)Ue--;for(;qe>=1&&Ue>=0;qe--,Ue--)if(ke[qe]!==rt[Ue]){if(qe!==1||Ue!==1)do if(qe--,Ue--,Ue<0||ke[qe]!==rt[Ue]){var bt=`
25
- `+ke[qe].replace(" at new "," at ");return O.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ae.set(O,bt),bt}while(qe>=1&&Ue>=0);break}}}finally{ee=!1,I.current=Re,W(),Error.prepareStackTrace=Be}var An=O?O.displayName||O.name:"",Po=An?te(An):"";return typeof O=="function"&&ae.set(O,Po),Po}function he(O,re,ce){return V(O,!1)}function pe(O){var re=O.prototype;return!!(re&&re.isReactComponent)}function we(O,re,ce){if(O==null)return"";if(typeof O=="function")return V(O,pe(O));if(typeof O=="string")return te(O);switch(O){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return he(O.render);case m:return we(O.type,re,ce);case f:{var ye=O,Be=ye._payload,Re=ye._init;try{return we(Re(Be),re,ce)}catch{}}}return""}var je=Object.prototype.hasOwnProperty,Oe={},Qe=b.ReactDebugCurrentFrame;function Ze(O){if(O){var re=O._owner,ce=we(O.type,O._source,re?re.type:null);Qe.setExtraStackFrame(ce)}else Qe.setExtraStackFrame(null)}function Ye(O,re,ce,ye,Be){{var Re=Function.call.bind(je);for(var _e in O)if(Re(O,_e)){var ke=void 0;try{if(typeof O[_e]!="function"){var rt=Error((ye||"React class")+": "+ce+" type `"+_e+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[_e]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}ke=O[_e](re,_e,ye,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(qe){ke=qe}ke&&!(ke instanceof Error)&&(Ze(Be),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ye||"React class",ce,_e,typeof ke),Ze(null)),ke instanceof Error&&!(ke.message in Oe)&&(Oe[ke.message]=!0,Ze(Be),w("Failed %s type: %s",ce,ke.message),Ze(null))}}}var nt=Array.isArray;function Fe(O){return nt(O)}function He(O){{var re=typeof Symbol=="function"&&Symbol.toStringTag,ce=re&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function ze(O){try{return Y(O),!1}catch{return!0}}function Y(O){return""+O}function ie(O){if(ze(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",He(O)),Y(O)}var me=b.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},Ce,Ve,Ke;Ke={};function mt(O){if(je.call(O,"ref")){var re=Object.getOwnPropertyDescriptor(O,"ref").get;if(re&&re.isReactWarning)return!1}return O.ref!==void 0}function It(O){if(je.call(O,"key")){var re=Object.getOwnPropertyDescriptor(O,"key").get;if(re&&re.isReactWarning)return!1}return O.key!==void 0}function Et(O,re){if(typeof O.ref=="string"&&me.current&&re&&me.current.stateNode!==re){var ce=B(me.current.type);Ke[ce]||(w('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',B(me.current.type),O.ref),Ke[ce]=!0)}}function Je(O,re){{var ce=function(){Ce||(Ce=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(O,"key",{get:ce,configurable:!0})}}function Bt(O,re){{var ce=function(){Ve||(Ve=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(O,"ref",{get:ce,configurable:!0})}}var pt=function(O,re,ce,ye,Be,Re,_e){var ke={$$typeof:t,type:O,key:re,ref:ce,props:_e,_owner:Re};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Be}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function ei(O,re,ce,ye,Be){{var Re,_e={},ke=null,rt=null;ce!==void 0&&(ie(ce),ke=""+ce),It(re)&&(ie(re.key),ke=""+re.key),mt(re)&&(rt=re.ref,Et(re,Be));for(Re in re)je.call(re,Re)&&!ve.hasOwnProperty(Re)&&(_e[Re]=re[Re]);if(O&&O.defaultProps){var qe=O.defaultProps;for(Re in qe)_e[Re]===void 0&&(_e[Re]=qe[Re])}if(ke||rt){var Ue=typeof O=="function"?O.displayName||O.name||"Unknown":O;ke&&Je(_e,Ue),rt&&Bt(_e,Ue)}return pt(O,ke,rt,Be,ye,me.current,_e)}}var ar=b.ReactCurrentOwner,Mr=b.ReactDebugCurrentFrame;function Bn(O){if(O){var re=O._owner,ce=we(O.type,O._source,re?re.type:null);Mr.setExtraStackFrame(ce)}else Mr.setExtraStackFrame(null)}var ti;ti=!1;function ni(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Fo(){{if(ar.current){var O=B(ar.current.type);if(O)return`
25
+ `+ke[qe].replace(" at new "," at ");return O.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ae.set(O,bt),bt}while(qe>=1&&Ue>=0);break}}}finally{ee=!1,I.current=Re,W(),Error.prepareStackTrace=Be}var An=O?O.displayName||O.name:"",Po=An?te(An):"";return typeof O=="function"&&ae.set(O,Po),Po}function he(O,re,ce){return V(O,!1)}function pe(O){var re=O.prototype;return!!(re&&re.isReactComponent)}function we(O,re,ce){if(O==null)return"";if(typeof O=="function")return V(O,pe(O));if(typeof O=="string")return te(O);switch(O){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return he(O.render);case m:return we(O.type,re,ce);case h:{var ye=O,Be=ye._payload,Re=ye._init;try{return we(Re(Be),re,ce)}catch{}}}return""}var je=Object.prototype.hasOwnProperty,Oe={},Qe=b.ReactDebugCurrentFrame;function Ze(O){if(O){var re=O._owner,ce=we(O.type,O._source,re?re.type:null);Qe.setExtraStackFrame(ce)}else Qe.setExtraStackFrame(null)}function Ye(O,re,ce,ye,Be){{var Re=Function.call.bind(je);for(var _e in O)if(Re(O,_e)){var ke=void 0;try{if(typeof O[_e]!="function"){var rt=Error((ye||"React class")+": "+ce+" type `"+_e+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[_e]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}ke=O[_e](re,_e,ye,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(qe){ke=qe}ke&&!(ke instanceof Error)&&(Ze(Be),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ye||"React class",ce,_e,typeof ke),Ze(null)),ke instanceof Error&&!(ke.message in Oe)&&(Oe[ke.message]=!0,Ze(Be),w("Failed %s type: %s",ce,ke.message),Ze(null))}}}var nt=Array.isArray;function Fe(O){return nt(O)}function He(O){{var re=typeof Symbol=="function"&&Symbol.toStringTag,ce=re&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function ze(O){try{return Y(O),!1}catch{return!0}}function Y(O){return""+O}function ie(O){if(ze(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",He(O)),Y(O)}var me=b.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},Ce,Ve,Ke;Ke={};function mt(O){if(je.call(O,"ref")){var re=Object.getOwnPropertyDescriptor(O,"ref").get;if(re&&re.isReactWarning)return!1}return O.ref!==void 0}function It(O){if(je.call(O,"key")){var re=Object.getOwnPropertyDescriptor(O,"key").get;if(re&&re.isReactWarning)return!1}return O.key!==void 0}function Et(O,re){if(typeof O.ref=="string"&&me.current&&re&&me.current.stateNode!==re){var ce=B(me.current.type);Ke[ce]||(w('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',B(me.current.type),O.ref),Ke[ce]=!0)}}function Je(O,re){{var ce=function(){Ce||(Ce=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(O,"key",{get:ce,configurable:!0})}}function Bt(O,re){{var ce=function(){Ve||(Ve=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(O,"ref",{get:ce,configurable:!0})}}var pt=function(O,re,ce,ye,Be,Re,_e){var ke={$$typeof:t,type:O,key:re,ref:ce,props:_e,_owner:Re};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Be}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function ei(O,re,ce,ye,Be){{var Re,_e={},ke=null,rt=null;ce!==void 0&&(ie(ce),ke=""+ce),It(re)&&(ie(re.key),ke=""+re.key),mt(re)&&(rt=re.ref,Et(re,Be));for(Re in re)je.call(re,Re)&&!ve.hasOwnProperty(Re)&&(_e[Re]=re[Re]);if(O&&O.defaultProps){var qe=O.defaultProps;for(Re in qe)_e[Re]===void 0&&(_e[Re]=qe[Re])}if(ke||rt){var Ue=typeof O=="function"?O.displayName||O.name||"Unknown":O;ke&&Je(_e,Ue),rt&&Bt(_e,Ue)}return pt(O,ke,rt,Be,ye,me.current,_e)}}var ar=b.ReactCurrentOwner,Mr=b.ReactDebugCurrentFrame;function Bn(O){if(O){var re=O._owner,ce=we(O.type,O._source,re?re.type:null);Mr.setExtraStackFrame(ce)}else Mr.setExtraStackFrame(null)}var ti;ti=!1;function ni(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Fo(){{if(ar.current){var O=B(ar.current.type);if(O)return`
26
26
 
27
27
  Check the render method of \``+O+"`."}return""}}function ch(O){{if(O!==void 0){var re=O.fileName.replace(/^.*[\\\/]/,""),ce=O.lineNumber;return`
28
28
 
29
29
  Check your code at `+re+":"+ce+"."}return""}}var To={};function dh(O){{var re=Fo();if(!re){var ce=typeof O=="string"?O:O.displayName||O.name;ce&&(re=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return re}}function So(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=dh(re);if(To[ce])return;To[ce]=!0;var ye="";O&&O._owner&&O._owner!==ar.current&&(ye=" It was passed a child from "+B(O._owner.type)+"."),Bn(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,ye),Bn(null)}}function jo(O,re){{if(typeof O!="object")return;if(Fe(O))for(var ce=0;ce<O.length;ce++){var ye=O[ce];ni(ye)&&So(ye,re)}else if(ni(O))O._store&&(O._store.validated=!0);else if(O){var Be=y(O);if(typeof Be=="function"&&Be!==O.entries)for(var Re=Be.call(O),_e;!(_e=Re.next()).done;)ni(_e.value)&&So(_e.value,re)}}}function fh(O){{var re=O.type;if(re==null||typeof re=="string")return;var ce;if(typeof re=="function")ce=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===m))ce=re.propTypes;else return;if(ce){var ye=B(re);Ye(ce,O.props,"prop",ye,O)}else if(re.PropTypes!==void 0&&!ti){ti=!0;var Be=B(re);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hh(O){{for(var re=Object.keys(O.props),ce=0;ce<re.length;ce++){var ye=re[ce];if(ye!=="children"&&ye!=="key"){Bn(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),Bn(null);break}}O.ref!==null&&(Bn(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),Bn(null))}}function Oo(O,re,ce,ye,Be,Re){{var _e=$(O);if(!_e){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=ch(Be);rt?ke+=rt:ke+=Fo();var qe;O===null?qe="null":Fe(O)?qe="array":O!==void 0&&O.$$typeof===t?(qe="<"+(B(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):qe=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",qe,ke)}var Ue=ei(O,re,ce,Be,Re);if(Ue==null)return Ue;if(_e){var bt=re.children;if(bt!==void 0)if(ye)if(Fe(bt)){for(var An=0;An<bt.length;An++)jo(bt[An],O);Object.freeze&&Object.freeze(bt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else jo(bt,O)}return O===r?hh(Ue):fh(Ue),Ue}}function mh(O,re,ce){return Oo(O,re,ce,!0)}function ph(O,re,ce){return Oo(O,re,ce,!1)}var gh=ph,vh=mh;sr.Fragment=r,sr.jsx=gh,sr.jsxs=vh}()),sr}process.env.NODE_ENV==="production"?es.exports=kh():es.exports=_h();var d=es.exports;const Cc=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Hn=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function xc(e,t,n){var r=this,a=x.useRef(null),i=x.useRef(0),s=x.useRef(null),o=x.useRef([]),l=x.useRef(),u=x.useRef(),c=x.useRef(e),m=x.useRef(!0);c.current=e;var f=typeof window<"u",p=!t&&t!==0&&f;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,w=y?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var A=x.useMemo(function(){var k=function($){var M=o.current,C=l.current;return o.current=l.current=null,i.current=$,u.current=c.current.apply(C,M)},E=function($,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame($):setTimeout($,M)},T=function($){if(!m.current)return!1;var M=$-a.current;return!a.current||M>=t||M<0||y&&$-i.current>=w},j=function($){return s.current=null,h&&o.current?k($):(o.current=l.current=null,u.current)},z=function $(){var M=Date.now();if(T(M))return j(M);if(m.current){var C=t-(M-a.current),B=y?Math.min(C,w-(M-i.current)):C;E($,B)}},N=function(){if(f||b){var $=Date.now(),M=T($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,M){if(!s.current&&m.current)return i.current=a.current,E(z,t),g?k(a.current):u.current;if(y)return E(z,t),k(a.current)}return s.current||E(z,t),u.current}};return N.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?j(Date.now()):u.current},N},[g,y,t,w,h,p,f,b]);return A}function wc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return xc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ri;const Qn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=x.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ri),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=wc(()=>{s()!==r&&(t&&(clearTimeout(ri),document.body.classList.add("is-resizing"),ri=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Ec=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=x.useState({current:0,past:0})||[!1,()=>{}],[s,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,m=a.current,f=c-m,p=f>0?"down":"up";if(i({current:c,past:m}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||f>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(f)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=wc(()=>{l()},250);return a},Rs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);Hn(()=>{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)},Ns=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=x.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Mo={},Jn=x.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),m=x.useRef(null),f=u||m,[p,g]=x.useState(n?"open":"hidden"),{extraPadding:h=!0,hasPointer:y=!1,hasForm:b=!1}=t,{onOpen:w=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const k=Mo[e];x.useEffect(()=>{const z=f==null?void 0:f.current;if(z)return z.addEventListener("transitionend",E),z.addEventListener("keydown",T),()=>{z.removeEventListener("transitionend",E),z.removeEventListener("keydown",T)}},[]);const E=({propertyName:z})=>{z==="opacity"&&(k!==!1&&clearTimeout(k),g(N=>(N==="open"?w():N==="closed"&&A(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},T=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Hn(()=>{k!==!1&&clearTimeout(k);let z="open";n?g("opening"):(g("closing"),z="hidden"),Mo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const j={...l};return s&&s.onBlur&&(j.onBlur=s.onBlur),d.jsx("aside",{ref:f,className:G("tooltip text-medium",p,i,{loading:r,"extra-padding":h,"has-pointer":y,bottom:y==="bottom","has-form":b}),...j,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=pn(e);return t.forEach(({type:r,value:a})=>{bh(n,r,a)}),n},kc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_c=(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},Bc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ac=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Fc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Bh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Ht="https://storage.googleapis.com/apolitical-assets/",Pn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},fr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ts="SU:",Tc="Invalid token error: Logging user out...",ns=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Ah="200,000+",Fh="160+";function Sc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},jc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ms=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),rs=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/fn.milliseconds.inHour,i=Math.floor(t/fn.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<=fn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/fn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Th=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/fn.milliseconds.inSecond<=t;case"minutes":return r/fn.milliseconds.inMinute<=t;case"hours":return r/fn.milliseconds.inHour<=t}return!1},Sh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},jh=e=>new Promise(t=>setTimeout(t,e)),Oh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Oc=async({text:e,template:t,mentions:n,getUsers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(ns);if(!a)return e;for(const s of a){const o=s.replace(ns,(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(ts))try{const m=c.replace(ts,"");u.id=m,await r({id:m}).then(f=>{const{name:p}=f;u.name=p||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Oh(e,u,t):s)}return e},Ph=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Xn={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",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.",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+ce+">.")}return re}}function So(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=dh(re);if(To[ce])return;To[ce]=!0;var ye="";O&&O._owner&&O._owner!==ar.current&&(ye=" It was passed a child from "+B(O._owner.type)+"."),Bn(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,ye),Bn(null)}}function jo(O,re){{if(typeof O!="object")return;if(Fe(O))for(var ce=0;ce<O.length;ce++){var ye=O[ce];ni(ye)&&So(ye,re)}else if(ni(O))O._store&&(O._store.validated=!0);else if(O){var Be=y(O);if(typeof Be=="function"&&Be!==O.entries)for(var Re=Be.call(O),_e;!(_e=Re.next()).done;)ni(_e.value)&&So(_e.value,re)}}}function fh(O){{var re=O.type;if(re==null||typeof re=="string")return;var ce;if(typeof re=="function")ce=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===m))ce=re.propTypes;else return;if(ce){var ye=B(re);Ye(ce,O.props,"prop",ye,O)}else if(re.PropTypes!==void 0&&!ti){ti=!0;var Be=B(re);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hh(O){{for(var re=Object.keys(O.props),ce=0;ce<re.length;ce++){var ye=re[ce];if(ye!=="children"&&ye!=="key"){Bn(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),Bn(null);break}}O.ref!==null&&(Bn(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),Bn(null))}}function Oo(O,re,ce,ye,Be,Re){{var _e=$(O);if(!_e){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=ch(Be);rt?ke+=rt:ke+=Fo();var qe;O===null?qe="null":Fe(O)?qe="array":O!==void 0&&O.$$typeof===t?(qe="<"+(B(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):qe=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",qe,ke)}var Ue=ei(O,re,ce,Be,Re);if(Ue==null)return Ue;if(_e){var bt=re.children;if(bt!==void 0)if(ye)if(Fe(bt)){for(var An=0;An<bt.length;An++)jo(bt[An],O);Object.freeze&&Object.freeze(bt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else jo(bt,O)}return O===r?hh(Ue):fh(Ue),Ue}}function mh(O,re,ce){return Oo(O,re,ce,!0)}function ph(O,re,ce){return Oo(O,re,ce,!1)}var gh=ph,vh=mh;sr.Fragment=r,sr.jsx=gh,sr.jsxs=vh}()),sr}process.env.NODE_ENV==="production"?es.exports=kh():es.exports=_h();var d=es.exports;const Cc=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Hn=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function xc(e,t,n){var r=this,a=x.useRef(null),i=x.useRef(0),s=x.useRef(null),o=x.useRef([]),l=x.useRef(),u=x.useRef(),c=x.useRef(e),m=x.useRef(!0);c.current=e;var h=typeof window<"u",p=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,y="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,w=y?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var A=x.useMemo(function(){var k=function($){var M=o.current,C=l.current;return o.current=l.current=null,i.current=$,u.current=c.current.apply(C,M)},E=function($,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame($):setTimeout($,M)},F=function($){if(!m.current)return!1;var M=$-a.current;return!a.current||M>=t||M<0||y&&$-i.current>=w},j=function($){return s.current=null,f&&o.current?k($):(o.current=l.current=null,u.current)},z=function $(){var M=Date.now();if(F(M))return j(M);if(m.current){var C=t-(M-a.current),B=y?Math.min(C,w-(M-i.current)):C;E($,B)}},N=function(){if(h||b){var $=Date.now(),M=F($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,M){if(!s.current&&m.current)return i.current=a.current,E(z,t),g?k(a.current):u.current;if(y)return E(z,t),k(a.current)}return s.current||E(z,t),u.current}};return N.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?j(Date.now()):u.current},N},[g,y,t,w,f,p,h,b]);return A}function wc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return xc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ri;const Qn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=x.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ri),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=wc(()=>{s()!==r&&(t&&(clearTimeout(ri),document.body.classList.add("is-resizing"),ri=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Ec=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=x.useState({current:0,past:0})||[!1,()=>{}],[s,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,m=a.current,h=c-m,p=h>0?"down":"up";if(i({current:c,past:m}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=wc(()=>{l()},250);return a},Rs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);Hn(()=>{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)},Ns=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=x.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Mo={},Jn=x.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),m=x.useRef(null),h=u||m,[p,g]=x.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:y=!1,hasForm:b=!1}=t,{onOpen:w=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const k=Mo[e];x.useEffect(()=>{const z=h==null?void 0:h.current;if(z)return z.addEventListener("transitionend",E),z.addEventListener("keydown",F),()=>{z.removeEventListener("transitionend",E),z.removeEventListener("keydown",F)}},[]);const E=({propertyName:z})=>{z==="opacity"&&(k!==!1&&clearTimeout(k),g(N=>(N==="open"?w():N==="closed"&&A(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},F=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Hn(()=>{k!==!1&&clearTimeout(k);let z="open";n?g("opening"):(g("closing"),z="hidden"),Mo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const j={...l};return s&&s.onBlur&&(j.onBlur=s.onBlur),d.jsx("aside",{ref:h,className:G("tooltip text-medium",p,i,{loading:r,"extra-padding":f,"has-pointer":y,bottom:y==="bottom","has-form":b}),...j,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=pn(e);return t.forEach(({type:r,value:a})=>{bh(n,r,a)}),n},kc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_c=(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},Bc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ac=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Fc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Bh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Ht="https://storage.googleapis.com/apolitical-assets/",Pn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},fr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ts="SU:",Tc="Invalid token error: Logging user out...",ns=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Ah="200,000+",Fh="160+";function Sc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},jc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ms=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),rs=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/fn.milliseconds.inHour,i=Math.floor(t/fn.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<=fn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/fn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Th=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/fn.milliseconds.inSecond<=t;case"minutes":return r/fn.milliseconds.inMinute<=t;case"hours":return r/fn.milliseconds.inHour<=t}return!1},Sh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},jh=e=>new Promise(t=>setTimeout(t,e)),Oh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Oc=async({text:e,template:t,mentions:n,getUsers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(ns);if(!a)return e;for(const s of a){const o=s.replace(ns,(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(ts))try{const m=c.replace(ts,"");u.id=m,await r({id:m}).then(h=>{const{name:p}=h;u.name=p||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Oh(e,u,t):s)}return e},Ph=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Xn={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",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.",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_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_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_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",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Rh={...Xn,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>"},Nh={...Xn,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"},Mh={...Xn,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>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:Xn,es:Rh,fr:Nh,pt:Mh},Symbol.toStringTag,{value:"Module"})),$a=(e,t=Xn)=>e in t,Ft=(e,t,n,r,a={})=>{let i="";return $a(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(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},oa=(e,t)=>x.Children.map(e,n=>Object.is(n,null)?n:x.cloneElement(n,{...t})),Pc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Rc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Lh=(e="")=>e.replace(/\s+/g,"").length>0,as=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:m=!1,...f})=>{const g=Qn(typeof t=="object"),{showTooltip:h,tooltipProps:y}=Ns(!!u);if(typeof t=="object"&&typeof g=="number"){const k=Object.assign({},t),E=kc(Object.keys(k));t=_c(g,E,k)}!l&&u&&(u="");const b=[];typeof t=="string"&&b.push(t),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const w={...f,className:G(e,o,b,{"no-text":!m,disabled:l,button:a}),onClick:k=>{(!a||a[0]==="#")&&s&&(k.preventDefault(),k.stopPropagation()),s&&s(k)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=x.createElement(i,w,m||(c?d.jsx(Me,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(Jn,{isOpen:h,children:u}),A]}):A},En=({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(Ee,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Ee,{...s})},o)});return x.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const tn=({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})},Io={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"}},zh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Io[e]:Io.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},qh=({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},ai=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${qh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const er=({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:f,sizes:p}=zh(e),g=ai({format:"avif",query:s,range:f,url:o}),h=ai({format:"webp",query:s,range:f,url:o}),y=ai({format:"",query:s,range:f,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:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:h,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Wh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(er,{image:{...e},className:"image"})}),kn=({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?x.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Nc=x.forwardRef(({className:e="",children:t},n)=>{const r=x.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?gc.createPortal(e,document.body):null;const Hh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Me,{children:d.jsx(ue.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 Uh=({elementId:e,offset:t=20})=>{const n=ue.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(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Vh=({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))}),$o=300,Lo="ease-in-out";class Kh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:$o,easing:Lo}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:$o,easing:Lo}),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 La=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=x.useRef(null);return x.useEffect(()=>{let s;return r&&(s=new Kh(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})]})},zo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Zh=e=>{let t=e;return Object.keys(zo).includes(e)&&(t=zo[e]),`url(${Ht}icons/${t}.svg)`};const qo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Mc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Zh(t)}:{},s=$a(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:G("content-type-label text-small",e in qo?qo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Rt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}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 an=({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=Qn(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),f=kc(Object.keys(m));a=_c(s,f,m)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Rt,{variant:"subtle",className:G("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Pt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Ee,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const is=({children:e,...t})=>d.jsx("p",{...t,children:e}),Ic={q:is,blockquote:is};for(let e=1;e<=6;e++)Ic[`h${e}`]={component:is,props:{className:"title"}};const $c=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:G("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Pt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Ic},children:r}):d.jsx("p",{children:r})]});const Lc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=x.useRef(null);e||(e=Date.now().toString());const[u,c]=x.useState(""),[m,f]=x.useState("closed");x.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),x.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
36
- `);c(h.length<3?`${a.substring(0,400)}...`:h.slice(0,3).join(`
37
- `))},[a]),x.useEffect(()=>{m==="ready-to-close"&&f("closing")},[m]);const p=({propertyName:h})=>{h==="max-height"&&f(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(m);return d.jsxs(Rt,{variant:"subtle",className:G("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:G("content",m),children:[d.jsx(Pt,{options:{forceBlock:!0,...i},children:m==="closed"?u:a}),m!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":g}),onClick:()=>{f(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 Yh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return x.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:x.Fragment,forceInline:!0},m={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(x.Fragment,{children:[d.jsx("dt",{style:m,children:d.jsx(Pt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:m,children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},u)})})},et=()=>x.Fragment,Gh=({children:e})=>d.jsx(Rt,{variant:"secondary",children:e}),Qh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Jh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Xh=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(x.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of x.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&x.isValidElement(s)){const o=s.type;if(Jh.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(La,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},em=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Rt,{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})},tm=e=>{const t=ue.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(Me,{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}`})]})},Wo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},nm=({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 x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&x.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"||Wo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!x.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Wo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Ee,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},ss=({children:e,...t})=>d.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const rm={default:{a:nm,CollapsibleSection:La,TextBox:Rt,CaseStudy:Gh,style:et,details:Xh,div:em,iframe:tm,center:Qh},"text-only":{h1:et,h2:et,h3:et,h4:et,h5:et,h6:et,style:et,details:et,div:et,TextBox:et,CollapsibleSection:et,CaseStudy:et,blockquote:et,iframe:et,button:et}},Un=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:x.Fragment,forceBlock:!0};let o=rm[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:G("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Pt,{options:{...s,...t,overrides:o},children:n})})};const zc=({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&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const hn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ns(!!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(Jn,{isOpen:l,children:a}),c]}):c};const wr=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const am=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.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:x.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=x.memo(am);const ii="loadingBlock_",im=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${ii}loading`})},75:{text:r.formatMessage({id:`${ii}almostDone`})},100:{text:r.formatMessage({id:`${ii}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(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Rt,{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($s,{progress:e})]})},sm=x.memo(im);const wt=({element:e="div",className:t="",...n})=>d.jsx(Ia,{element:e,className:G("loading-placeholder",t),...n});const os={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"]},qc=(e,t)=>e in os?d.jsx("div",{className:e,children:os[e].map((n,r)=>qc(n,r))},t):d.jsx(wt,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:G("loading-state",e),...t,children:os[e].map((n,r)=>qc(n,r))}),Wc=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):""},$r=["#5AB6A3","#A2D7AF","#806056","#3962B3"],om=e=>{const t=Math.ceil(26/$r.length),n=Wc(e).toLowerCase();if(n==="")return $r[0];const r=n.charCodeAt(0)-96;for(let a=0;a<$r.length;a++)if(r<=t*(a+1))return $r[a]};const Ho=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Ho,height:i=Ho,...s})=>{const[o,l]=x.useState(!1),u=x.useRef(null);x.useEffect(()=>{const m=u.current;if(!m)return;const f=m.getContext("2d");if(!f)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=p*window.devicePixelRatio,m.height=g*window.devicePixelRatio,f.scale(window.devicePixelRatio,window.devicePixelRatio)),f.fillStyle=om(n),f.fillRect(0,0,p,g),f.font=`${p/3}px Arial`,f.textAlign="center",f.fillStyle="white",f.fillText(Wc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:G("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},um=({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=Wn(l,r)),l};const tr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const l=ue.useIntl(),{size:u="medium"}=r,c=zs(t);c.name||(c.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:m,image:f}=c;let{url:p}=c;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const g=um(c),h=n&&n.createdAt?rs(n.createdAt):!1,y=n&&n.createdAt?Ms(n.createdAt):"";return x.createElement(e,{className:G("member text-medium",u,o),...a,children:d.jsxs(kn,{href:p,gtmType:s,gtmContext:i,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(sn,{name:m,src:f}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[m,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&d.jsx("span",{className:"date",title:y,"aria-label":y,children:l.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&d.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]})]}),g&&d.jsx("small",{className:G({"text-medium":u==="large"}),children:g})]})]})})};const Uo={small:24,medium:48},qs=({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=ue.useIntl();return!n||n.length===0?null:x.createElement(e,{...c,className:G("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((f,p)=>{let g,h="";if(p<o){const{name:y="",image:b=""}=zs(f);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(sn,{name:y,src:b,width:Uo[a||"medium"],height:Uo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:G({"large-number":y>99}),children:["+",$h(y,0)]}),h="number-left"}return g?d.jsx("li",{className:G("contributor",h),children:g},p):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]}`}):Wn(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:G("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},za=e=>(e==null?void 0:e.toString().length)||0,Hc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{za(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Lr="emailHelperTextBox_",Uc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=x.useState({path:`${Lr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=x.useState(!1),u=x.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Lr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Lr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);x.useEffect(()=>{let p=Lr,g="default",h={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:h,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx($c,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Rn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=x.useRef(),m=r||c;return x.createElement(t,{ref:m,...u,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,...a,onChange:f=>{const p=f.target;a.onChange(p.value)}})};const Fn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},lm=500,cm=({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]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:f,activePredictionIndex:p,isPredictionSelected:g},h]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{g||m(E=>({...E,debouncedInput:l}))},lm);return()=>{clearTimeout(k)}},[l,g]),x.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];h(T=>({...T,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),h(T=>({...T,predictions:[]}))}})():h(k=>({...k,predictions:[]}))},[c,g]),x.useEffect(()=>{p>=0&&f[p]&&m(k=>({...k,displayInput:f[p].description}))},[p,f]);const b=k=>{[Fn.DOWN,Fn.UP,Fn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Fn.DOWN&&p<f.length-1?h(E=>({...E,activePredictionIndex:p+1})):k.key===Fn.UP&&p>0?h(E=>({...E,activePredictionIndex:p-1})):k.key===Fn.ENTER&&p>-1&&(s(f[p].description),m(E=>({...E,input:f[p].description})),h(E=>({...E,predictions:[],isPredictionSelected:!0}))))},w=k=>{s(k.target.value),m(E=>({...E,input:k.target.value,displayInput:k.target.value})),h(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),m(E=>({...E,input:k.description,displayInput:k.description})),h(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:b,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:f.map((k,E)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>h(T=>({...T,activePredictionIndex:E})),className:G("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Vc=({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 f=ue.useIntl(),{onChange:p,...g}=r,h=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||f.formatMessage({id:s?`${s}_${a}`:a})})]});return x.createElement(n,{onClick:b=>{const w=b.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),h())},className:G("checkbox-wrapper",e),...m,...g},y)};const dm=x.memo(function({direction:t="down"}){return d.jsx(Ia,{className:G("rotating-chevron",`direction-${t}`)})});const fm=({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=ue.useIntl(),[m,f]=x.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=x.useState(g);let b;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?b=t&&h?t.find(j=>j.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?b=h[0]:b={id:"",label:""},x.useEffect(()=>{y(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,...k}=a,E=j=>{if(o){let z=[];h!=null&&h.includes(j.id)?z=h.filter(N=>N!==j.id):z=[...h,j.id],y([...z]),w&&w([...z])}else y([j]),w&&w(j.id),f(!1)},T=j=>{if(j==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];y(z),w&&w(z)}else y([]),w&&w([])};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:j=>{j.preventDefault(),j.stopPropagation(),f(!m)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${h.length}`:b.label,d.jsx(dm,{direction:m?"up":"down"})]}),d.jsx("select",{defaultValue:b.id,onChange:j=>{j.preventDefault(),j.stopPropagation();const z=t&&t.find(N=>N.id===j.target.value);E(z)},hidden:!m,...k,children:t==null?void 0:t.map(j=>d.jsx("option",{value:j.id,children:j.label},j.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:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(j=>{const z=j.id===b.id||(h==null?void 0:h.includes(j))||(h==null?void 0:h.includes(j.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":`${j}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),E(j)},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:j.label})]})},j.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Ee,{variant:"secondary",onClick:()=>{A&&A(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),f(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const hm=({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 f=ue.useIntl(),p=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:h,label:y=!1,value:b=h,disabled:w=!1})=>{const A=`${r}_${h}`,k=()=>{if(w)return;let E;if(i){const T=p==null?void 0:p.indexOf(b);Array.isArray(p)&&T>=0?(E=p,E.splice(T,1)):(!p||p.length===0?E=[]:E=p,E.push(b))}else E=g===b?void 0:b;t.onChange(E)};return d.jsx(Vc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):g===b,functions:{...t,onChange:k},intlPath:n,label:y||f.formatMessage({id:n?`${n}_${h}`:h}),disabled:w},A)})})};const mm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=x.useRef(),s=e||i,[o,l]=x.useState(!1),[u,c]=x.useState(t),m=()=>{var f;l(!o),c(o?"password":"text"),(f=s.current)==null||f.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:m,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Rn,{inputRef:s,type:u,...r})]})};const Tn={text:{component:Rn},email:{component:Rn},url:{component:Rn},textarea:{component:Rn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Vc},checkboxes:{component:hm,props:{multiSelect:!0}},select:{component:fm},password:{component:mm},autocomplete:{component:cm}},pm=({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 f=ue.useIntl(),p=l&&l.some(({condition:E})=>E==="required"),g=za(u),h=o&&Tn[o]&&Tn[o].component?Tn[o].component:Rn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let b={...m,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:pn(a),value:u};if(i>0){const E=Hc(i,a.onChange);b={...b,...E},E.functions&&typeof E.functions=="object"&&(b.functions={...b.functions,...E.functions})}o&&Tn[o]&&Tn[o].props&&(b={...b,...Tn[o].props}),o&&["checkboxes"].includes(o)&&(b.intlPath=`${t}_${e}`),r&&(b["aria-invalid"]=!0,b["aria-describedby"]=`error-${e}`);const w=m.label||f.formatMessage({id:t?`${t}_${e}`:e}),A=({...E})=>r?x.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...b,label:w,className:G("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=E=>x.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:G("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...y,children:[w,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",f.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...b}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},gm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?pn(e.errors):{},i=e.values?pn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,m=pn(Object.keys(a));for(const f of s)if(f.validation)for(let p=0;p<f.validation.length;p++){const{condition:g="required",error:h=!1}=f.validation[p];let y=!1;if(typeof g=="function"){const b=g(i);b&&(y=h||b)}else{const b=i[f.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:f.id,value:y}}),m.push(f.id);break}}return m.length===0?l(i):u(i,m),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let si=null;const nr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:m=()=>{},onCatch:f=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:y,...b}=s,w=40,{shouldShowCancelButton:A=!1,shouldReset:k=!0,showRequiredLabels:E=!0,showSuccessMessage:T=!1}=l||{},j=ue.useIntl(),z={};t.length&&t.forEach(D=>{const H=D.id||D.name;H&&(z[H]=D.value||"")});const[N,$]=x.useReducer(gm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:M,isSubmitting:C,formSubmitted:B,values:F}=N;x.useEffect(()=>{k&&B&&(si=setTimeout(()=>{$({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[B]),x.useEffect(()=>()=>{si&&clearTimeout(si)},[]),x.useEffect(()=>{const D=H=>{$({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const R=x.useRef(null),L=a||R;if(!t.length)return null;s.text||(s.text=j.formatMessage({id:"form_submit"}));const q=()=>{if(!C){if($({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&$({type:"submitForm",payload:{fields:t,dispatch:$,intl:j}});return}$({type:"submitForm",payload:{fields:t,dispatch:$,onSuccess:async D=>{try{await c(D),$({type:k?"formSubmittedAndReset":"formSubmitted"})}catch(H){f(H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,H)=>{p(D,H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:j}})}},ne=[{...b,icon:B?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var _;if(D.preventDefault(),D.stopPropagation(),C)return;let H=0;if((_=L==null?void 0:L.current)!=null&&_.id){const S=document.getElementById(L.current.id);S&&(H=S.getBoundingClientRect().top+window.scrollY)}const X=document.getElementById("header");X&&(H=H-X.offsetHeight-w),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),q()},disabled:C||B||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:C||B?j.formatMessage({id:`form_${C?"submitting":"submitted"}`}):s.text}];return A&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:C||B,onClick:m,children:o.text||j.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[x.createElement(e,{...g,id:r,className:G("form",n),ref:L},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(an,{variant:"error",text:j.formatMessage({id:"form_error_generalError"})}):null,(!k||!C&&!B||h)&&t.map((D,H)=>{const{id:X=D.name||H,component:_,functions:S={onChange:()=>{}},submitOnEnter:W=!1}=D;if(_)return d.jsx(_,{...D.props||{}},`component-${X}-${H}`);const I=F?F[X]:"",K={...S,onChange:te=>{$({type:"updateValue",payload:{key:X,value:te}}),S.onChange(te&&te.toString(),$)}};return W&&(K.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),q()),S.onKeyDown&&S.onKeyDown(te)}),d.jsx(pm,{intlPath:i,...D,showRequiredLabels:E,value:I,error:M==null?void 0:M[X],functions:K},X)}),y?null:(C||B)&&h?h:d.jsx(En,{className:G("cta",{center:C||B,submitted:B}),buttons:ne})]})),T&&B&&d.jsx(wr,{className:"success",children:typeof T=="string"?T:j.formatMessage({id:"form_success"})})]})};const zr="passwordRules_",Kc="isMoreThanEightCharacters",Zc="includesNumberAndSymbol",Yc="includesLowerAndUppercase",vm={[Kc]:"8Characters",[Zc]:"numberSymbol",[Yc]:"lowercaseUppercase"},bm=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:G("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${zr}intro`})}),d.jsx("ul",{children:[Kc,Zc,Yc].map(r=>d.jsxs("li",{className:G({matches:e[r]}),children:[d.jsxs(Me,{children:[n.formatMessage({id:`${zr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${zr}rule_${vm[r]}`})}),!e[r]&&d.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${zr}notMet`})]})]},`rule-${r}`))})]})},Gc=x.memo(bm);const ym=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const b=await n();u(w=>({...w,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(w=>({...w,setUp:!0,disabled:!0})),a(b)}};if(x.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:m,rating:f,disabled:p}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async b=>{if(!(!m||p))try{u(w=>({...w,rating:b,disabled:!0})),await r({id:m,value:b})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return d.jsxs("div",{className:G("rating",i),children:[d.jsx("span",{className:"label",children:h[f?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const w=b+1;return d.jsx("li",{className:G({selected:f&&w<=f}),children:d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!f||w>f?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${h[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),y(w)},disabled:p})},`rating-${w}`)})})]})};function Dm(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 us(e,t){return Array(t+1).join(e)}function Cm(e){return e.replace(/^\n*/,"")}function xm(e){for(var t=e.length;t>0&&e[t-1]===`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_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_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_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",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Rh={...Xn,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>"},Nh={...Xn,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"},Mh={...Xn,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>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:Xn,es:Rh,fr:Nh,pt:Mh},Symbol.toStringTag,{value:"Module"})),$a=(e,t=Xn)=>e in t,Ft=(e,t,n,r,a={})=>{let i="";return $a(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(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},oa=(e,t)=>x.Children.map(e,n=>Object.is(n,null)?n:x.cloneElement(n,{...t})),Pc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Rc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Lh=(e="")=>e.replace(/\s+/g,"").length>0,as=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:m=!1,...h})=>{const g=Qn(typeof t=="object"),{showTooltip:f,tooltipProps:y}=Ns(!!u);if(typeof t=="object"&&typeof g=="number"){const k=Object.assign({},t),E=kc(Object.keys(k));t=_c(g,E,k)}!l&&u&&(u="");const b=[];typeof t=="string"&&b.push(t),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const w={...h,className:G(e,o,b,{"no-text":!m,disabled:l,button:a}),onClick:k=>{(!a||a[0]==="#")&&s&&(k.preventDefault(),k.stopPropagation()),s&&s(k)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=x.createElement(i,w,m||(c?d.jsx(Me,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(Jn,{isOpen:f,children:u}),A]}):A},En=({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(Ee,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Ee,{...s})},o)});return x.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const tn=({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})},Io={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"}},zh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Io[e]:Io.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},qh=({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},ai=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${qh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const er=({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:h,sizes:p}=zh(e),g=ai({format:"avif",query:s,range:h,url:o}),f=ai({format:"webp",query:s,range:h,url:o}),y=ai({format:"",query:s,range:h,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:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Wh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(er,{image:{...e},className:"image"})}),kn=({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?x.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Nc=x.forwardRef(({className:e="",children:t},n)=>{const r=x.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?gc.createPortal(e,document.body):null;const Hh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Me,{children:d.jsx(ue.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 Uh=({elementId:e,offset:t=20})=>{const n=ue.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(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Vh=({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))}),$o=300,Lo="ease-in-out";class Kh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:$o,easing:Lo}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:$o,easing:Lo}),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 La=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=x.useRef(null);return x.useEffect(()=>{let s;return r&&(s=new Kh(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})]})},zo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Zh=e=>{let t=e;return Object.keys(zo).includes(e)&&(t=zo[e]),`url(${Ht}icons/${t}.svg)`};const qo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Mc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Zh(t)}:{},s=$a(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:G("content-type-label text-small",e in qo?qo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Rt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}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 an=({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=Qn(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=kc(Object.keys(m));a=_c(s,h,m)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Rt,{variant:"subtle",className:G("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Pt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Ee,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const is=({children:e,...t})=>d.jsx("p",{...t,children:e}),Ic={q:is,blockquote:is};for(let e=1;e<=6;e++)Ic[`h${e}`]={component:is,props:{className:"title"}};const $c=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:G("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Pt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Ic},children:r}):d.jsx("p",{children:r})]});const Lc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=x.useRef(null);e||(e=Date.now().toString());const[u,c]=x.useState(""),[m,h]=x.useState("closed");x.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",p),()=>{f.removeEventListener("transitionend",p)}},[]),x.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]),x.useEffect(()=>{m==="ready-to-close"&&h("closing")},[m]);const p=({propertyName:f})=>{f==="max-height"&&h(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(m);return d.jsxs(Rt,{variant:"subtle",className:G("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:G("content",m),children:[d.jsx(Pt,{options:{forceBlock:!0,...i},children:m==="closed"?u:a}),m!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":g}),onClick:()=>{h(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 Yh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return x.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:x.Fragment,forceInline:!0},m={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(x.Fragment,{children:[d.jsx("dt",{style:m,children:d.jsx(Pt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:m,children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},u)})})},et=()=>x.Fragment,Gh=({children:e})=>d.jsx(Rt,{variant:"secondary",children:e}),Qh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Jh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Xh=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(x.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of x.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&x.isValidElement(s)){const o=s.type;if(Jh.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(La,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},em=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Rt,{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})},tm=e=>{const t=ue.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(Me,{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}`})]})},Wo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},nm=({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 x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&x.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"||Wo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!x.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Wo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Ee,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},ss=({children:e,...t})=>d.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const rm={default:{a:nm,CollapsibleSection:La,TextBox:Rt,CaseStudy:Gh,style:et,details:Xh,div:em,iframe:tm,center:Qh},"text-only":{h1:et,h2:et,h3:et,h4:et,h5:et,h6:et,style:et,details:et,div:et,TextBox:et,CollapsibleSection:et,CaseStudy:et,blockquote:et,iframe:et,button:et}},Un=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:x.Fragment,forceBlock:!0};let o=rm[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:G("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Pt,{options:{...s,...t,overrides:o},children:n})})};const zc=({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&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const hn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ns(!!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(Jn,{isOpen:l,children:a}),c]}):c};const wr=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const am=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.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:x.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=x.memo(am);const ii="loadingBlock_",im=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${ii}loading`})},75:{text:r.formatMessage({id:`${ii}almostDone`})},100:{text:r.formatMessage({id:`${ii}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(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Rt,{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($s,{progress:e})]})},sm=x.memo(im);const wt=({element:e="div",className:t="",...n})=>d.jsx(Ia,{element:e,className:G("loading-placeholder",t),...n});const os={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"]},qc=(e,t)=>e in os?d.jsx("div",{className:e,children:os[e].map((n,r)=>qc(n,r))},t):d.jsx(wt,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:G("loading-state",e),...t,children:os[e].map((n,r)=>qc(n,r))}),Wc=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):""},$r=["#5AB6A3","#A2D7AF","#806056","#3962B3"],om=e=>{const t=Math.ceil(26/$r.length),n=Wc(e).toLowerCase();if(n==="")return $r[0];const r=n.charCodeAt(0)-96;for(let a=0;a<$r.length;a++)if(r<=t*(a+1))return $r[a]};const Ho=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Ho,height:i=Ho,...s})=>{const[o,l]=x.useState(!1),u=x.useRef(null);x.useEffect(()=>{const m=u.current;if(!m)return;const h=m.getContext("2d");if(!h)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=p*window.devicePixelRatio,m.height=g*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=om(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Wc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:G("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},um=({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=Wn(l,r)),l};const tr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const l=ue.useIntl(),{size:u="medium"}=r,c=zs(t);c.name||(c.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:m,image:h}=c;let{url:p}=c;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const g=um(c),f=n&&n.createdAt?rs(n.createdAt):!1,y=n&&n.createdAt?Ms(n.createdAt):"";return x.createElement(e,{className:G("member text-medium",u,o),...a,children:d.jsxs(kn,{href:p,gtmType:s,gtmContext:i,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(sn,{name:m,src:h}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[m,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&f&&d.jsx("span",{className:"date",title:y,"aria-label":y,children:l.formatMessage({id:`dates_${f.path}`},{number:f.number})}),n.didEdit&&d.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]})]}),g&&d.jsx("small",{className:G({"text-medium":u==="large"}),children:g})]})]})})};const Uo={small:24,medium:48},qs=({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=ue.useIntl();return!n||n.length===0?null:x.createElement(e,{...c,className:G("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((h,p)=>{let g,f="";if(p<o){const{name:y="",image:b=""}=zs(h);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(sn,{name:y,src:b,width:Uo[a||"medium"],height:Uo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:G({"large-number":y>99}),children:["+",$h(y,0)]}),f="number-left"}return g?d.jsx("li",{className:G("contributor",f),children:g},p):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]}`}):Wn(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:G("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},za=e=>(e==null?void 0:e.toString().length)||0,Hc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{za(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Lr="emailHelperTextBox_",Uc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=x.useState({path:`${Lr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=x.useState(!1),u=x.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=f=>{s({path:`${Lr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:f})};if(typeof r!="function"){g(a.formatMessage({id:`${Lr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(f=>{g(f.message)}).finally(()=>{l(!1)})},[t,n,r]);x.useEffect(()=>{let p=Lr,g="default",f={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",f={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",f={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:f,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx($c,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Rn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=x.useRef(),m=r||c;return x.createElement(t,{ref:m,...u,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,...a,onChange:h=>{const p=h.target;a.onChange(p.value)}})};const Fn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},lm=500,cm=({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]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:g},f]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{g||m(E=>({...E,debouncedInput:l}))},lm);return()=>{clearTimeout(k)}},[l,g]),x.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];f(F=>({...F,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(F=>({...F,predictions:[]}))}})():f(k=>({...k,predictions:[]}))},[c,g]),x.useEffect(()=>{p>=0&&h[p]&&m(k=>({...k,displayInput:h[p].description}))},[p,h]);const b=k=>{[Fn.DOWN,Fn.UP,Fn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Fn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):k.key===Fn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):k.key===Fn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},w=k=>{s(k.target.value),m(E=>({...E,input:k.target.value,displayInput:k.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),m(E=>({...E,input:k.description,displayInput:k.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:b,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:h.map((k,E)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>f(F=>({...F,activePredictionIndex:E})),className:G("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Vc=({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 h=ue.useIntl(),{onChange:p,...g}=r,f=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||h.formatMessage({id:s?`${s}_${a}`:a})})]});return x.createElement(n,{onClick:b=>{const w=b.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},y)};const dm=x.memo(function({direction:t="down"}){return d.jsx(Ia,{className:G("rotating-chevron",`direction-${t}`)})});const fm=({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=ue.useIntl(),[m,h]=x.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,y]=x.useState(g);let b;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?b=t&&f?t.find(j=>j.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?b=f[0]:b={id:"",label:""},x.useEffect(()=>{y(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,...k}=a,E=j=>{if(o){let z=[];f!=null&&f.includes(j.id)?z=f.filter(N=>N!==j.id):z=[...f,j.id],y([...z]),w&&w([...z])}else y([j]),w&&w(j.id),h(!1)},F=j=>{if(j==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];y(z),w&&w(z)}else y([]),w&&w([])};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:j=>{j.preventDefault(),j.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${f.length}`:b.label,d.jsx(dm,{direction:m?"up":"down"})]}),d.jsx("select",{defaultValue:b.id,onChange:j=>{j.preventDefault(),j.stopPropagation();const z=t&&t.find(N=>N.id===j.target.value);E(z)},hidden:!m,...k,children:t==null?void 0:t.map(j=>d.jsx("option",{value:j.id,children:j.label},j.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(Ee,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(j=>{const z=j.id===b.id||(f==null?void 0:f.includes(j))||(f==null?void 0:f.includes(j.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":`${j}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),E(j)},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:j.label})]})},j.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Ee,{variant:"secondary",onClick:()=>{A&&A(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const hm=({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 h=ue.useIntl(),p=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:y=!1,value:b=f,disabled:w=!1})=>{const A=`${r}_${f}`,k=()=>{if(w)return;let E;if(i){const F=p==null?void 0:p.indexOf(b);Array.isArray(p)&&F>=0?(E=p,E.splice(F,1)):(!p||p.length===0?E=[]:E=p,E.push(b))}else E=g===b?void 0:b;t.onChange(E)};return d.jsx(Vc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):g===b,functions:{...t,onChange:k},intlPath:n,label:y||h.formatMessage({id:n?`${n}_${f}`:f}),disabled:w},A)})})};const mm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=x.useRef(),s=e||i,[o,l]=x.useState(!1),[u,c]=x.useState(t),m=()=>{var h;l(!o),c(o?"password":"text"),(h=s.current)==null||h.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:m,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Rn,{inputRef:s,type:u,...r})]})};const Tn={text:{component:Rn},email:{component:Rn},url:{component:Rn},textarea:{component:Rn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Vc},checkboxes:{component:hm,props:{multiSelect:!0}},select:{component:fm},password:{component:mm},autocomplete:{component:cm}},pm=({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 h=ue.useIntl(),p=l&&l.some(({condition:E})=>E==="required"),g=za(u),f=o&&Tn[o]&&Tn[o].component?Tn[o].component:Rn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let b={...m,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:pn(a),value:u};if(i>0){const E=Hc(i,a.onChange);b={...b,...E},E.functions&&typeof E.functions=="object"&&(b.functions={...b.functions,...E.functions})}o&&Tn[o]&&Tn[o].props&&(b={...b,...Tn[o].props}),o&&["checkboxes"].includes(o)&&(b.intlPath=`${t}_${e}`),r&&(b["aria-invalid"]=!0,b["aria-describedby"]=`error-${e}`);const w=m.label||h.formatMessage({id:t?`${t}_${e}`:e}),A=({...E})=>r?x.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...b,label:w,className:G("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=E=>x.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:G("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...y,children:[w,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",h.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(f,{...b}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},gm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?pn(e.errors):{},i=e.values?pn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,m=pn(Object.keys(a));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:g="required",error:f=!1}=h.validation[p];let y=!1;if(typeof g=="function"){const b=g(i);b&&(y=f||b)}else{const b=i[h.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(b)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:h.id,value:y}}),m.push(h.id);break}}return m.length===0?l(i):u(i,m),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let si=null;const nr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:m=()=>{},onCatch:h=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:f,hideButton:y,...b}=s,w=40,{shouldShowCancelButton:A=!1,shouldReset:k=!0,showRequiredLabels:E=!0,showSuccessMessage:F=!1}=l||{},j=ue.useIntl(),z={};t.length&&t.forEach(D=>{const H=D.id||D.name;H&&(z[H]=D.value||"")});const[N,$]=x.useReducer(gm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:M,isSubmitting:C,formSubmitted:B,values:T}=N;x.useEffect(()=>{k&&B&&(si=setTimeout(()=>{$({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[B]),x.useEffect(()=>()=>{si&&clearTimeout(si)},[]),x.useEffect(()=>{const D=H=>{$({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const R=x.useRef(null),L=a||R;if(!t.length)return null;s.text||(s.text=j.formatMessage({id:"form_submit"}));const q=()=>{if(!C){if($({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&$({type:"submitForm",payload:{fields:t,dispatch:$,intl:j}});return}$({type:"submitForm",payload:{fields:t,dispatch:$,onSuccess:async D=>{try{await c(D),$({type:k?"formSubmittedAndReset":"formSubmitted"})}catch(H){h(H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,H)=>{p(D,H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:j}})}},ne=[{...b,icon:B?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var _;if(D.preventDefault(),D.stopPropagation(),C)return;let H=0;if((_=L==null?void 0:L.current)!=null&&_.id){const S=document.getElementById(L.current.id);S&&(H=S.getBoundingClientRect().top+window.scrollY)}const X=document.getElementById("header");X&&(H=H-X.offsetHeight-w),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),q()},disabled:C||B||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:C||B?j.formatMessage({id:`form_${C?"submitting":"submitted"}`}):s.text}];return A&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:C||B,onClick:m,children:o.text||j.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[x.createElement(e,{...g,id:r,className:G("form",n),ref:L},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(an,{variant:"error",text:j.formatMessage({id:"form_error_generalError"})}):null,(!k||!C&&!B||f)&&t.map((D,H)=>{const{id:X=D.name||H,component:_,functions:S={onChange:()=>{}},submitOnEnter:W=!1}=D;if(_)return d.jsx(_,{...D.props||{}},`component-${X}-${H}`);const I=T?T[X]:"",K={...S,onChange:te=>{$({type:"updateValue",payload:{key:X,value:te}}),S.onChange(te&&te.toString(),$)}};return W&&(K.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),q()),S.onKeyDown&&S.onKeyDown(te)}),d.jsx(pm,{intlPath:i,...D,showRequiredLabels:E,value:I,error:M==null?void 0:M[X],functions:K},X)}),y?null:(C||B)&&f?f:d.jsx(En,{className:G("cta",{center:C||B,submitted:B}),buttons:ne})]})),F&&B&&d.jsx(wr,{className:"success",children:typeof F=="string"?F:j.formatMessage({id:"form_success"})})]})};const zr="passwordRules_",Kc="isMoreThanEightCharacters",Zc="includesNumberAndSymbol",Yc="includesLowerAndUppercase",vm={[Kc]:"8Characters",[Zc]:"numberSymbol",[Yc]:"lowercaseUppercase"},bm=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:G("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${zr}intro`})}),d.jsx("ul",{children:[Kc,Zc,Yc].map(r=>d.jsxs("li",{className:G({matches:e[r]}),children:[d.jsxs(Me,{children:[n.formatMessage({id:`${zr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${zr}rule_${vm[r]}`})}),!e[r]&&d.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${zr}notMet`})]})]},`rule-${r}`))})]})},Gc=x.memo(bm);const ym=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const b=await n();u(w=>({...w,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(w=>({...w,setUp:!0,disabled:!0})),a(b)}};if(x.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async b=>{if(!(!m||p))try{u(w=>({...w,rating:b,disabled:!0})),await r({id:m,value:b})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return d.jsxs("div",{className:G("rating",i),children:[d.jsx("span",{className:"label",children:f[h?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const w=b+1;return d.jsx("li",{className:G({selected:h&&w<=h}),children:d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!h||w>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),y(w)},disabled:p})},`rating-${w}`)})})]})};function Dm(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 us(e,t){return Array(t+1).join(e)}function Cm(e){return e.replace(/^\n*/,"")}function xm(e){for(var t=e.length;t>0&&e[t-1]===`
38
38
  `;)t--;return e.substring(0,t)}var wm=["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 Hs(e){return Us(e,wm)}var Qc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Jc(e){return Us(e,Qc)}function Em(e){return ed(e,Qc)}var Xc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function km(e){return Us(e,Xc)}function _m(e){return ed(e,Xc)}function Us(e,t){return t.indexOf(e.nodeName)>=0}function ed(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var tt={};tt.paragraph={filter:"p",replacement:function(e){return`
39
39
 
40
40
  `+e+`
@@ -99,19 +99,19 @@ Thank you for helping to protect the Apolitical community from abusive content.`
99
99
  *
100
100
  * Copyright (c) 2014-2017, Jon Schlinkert.
101
101
  * Released under the MIT License.
102
- */function Zo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xe(e){var t,n;return Zo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Zo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var ad=Symbol.for("immer-nothing"),Yo=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Um=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 dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Um[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 Vn=Object.getPrototypeOf;function yn(e){return!!e&&!!e[gt]}function Dn(e){var t;return e?id(e)||Array.isArray(e)||!!e[Yo]||!!((t=e.constructor)!=null&&t[Yo])||Wa(e)||Ha(e):!1}var Vm=Object.prototype.constructor.toString();function id(e){if(!e||typeof e!="object")return!1;const t=Vn(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)===Vm}function Da(e,t){qa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Wa(e)?2:Ha(e)?3:0}function ls(e,t){return qa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function sd(e,t,n){const r=qa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Km(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wa(e){return e instanceof Map}function Ha(e){return e instanceof Set}function cn(e){return e.copy_||e.base_}function cs(e,t){if(Wa(e))return new Map(e);if(Ha(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&id(e))return Vn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Vn(e),n)}function Ks(e,t=!1){return Ua(e)||yn(e)||!Dn(e)||(qa(e)>1&&(e.set=e.add=e.clear=e.delete=Zm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ks(r,!0))),e}function Zm(){dt(2)}function Ua(e){return Object.isFrozen(e)}var Ym={};function Cn(e){const t=Ym[e];return t||dt(0,e),t}var Er;function od(){return Er}function Gm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Go(e,t){t&&(Cn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ds(e){fs(e),e.drafts_.forEach(Qm),e.drafts_=null}function fs(e){e===Er&&(Er=e.parent_)}function Qo(e){return Er=Gm(Er,e)}function Qm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(ds(t),dt(4)),Dn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Cn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ad?e:void 0}function Ca(e,t,n){if(Ua(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>Xo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(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),Da(i,(o,l)=>Xo(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Cn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Xo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),yn(a)){const o=i&&t&&t.type_!==3&&!ls(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(sd(n,r,l),yn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Dn(a)&&!Ua(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ks(t,n)}function Jm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:od(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Zs;n&&(a=[r],i=kr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Zs={get(e,t){if(t===gt)return e;const n=cn(e);if(!ls(n,t))return Xm(e,n,t);const r=n[t];return e.finalized_||!Dn(r)?r:r===ci(e.base_,t)?(di(e),e.copy_[t]=ms(r,e)):r},has(e,t){return t in cn(e)},ownKeys(e){return Reflect.ownKeys(cn(e))},set(e,t,n){const r=ud(cn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ci(cn(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Km(n,a)&&(n!==void 0||ls(e.base_,t)))return!0;di(e),hs(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 ci(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,di(e),hs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Vn(e.base_)},setPrototypeOf(){dt(12)}},kr={};Da(Zs,(e,t)=>{kr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});kr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),kr.set.call(this,e,t,void 0)};kr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Zs.set.call(this,e[0],t,n,e[0])};function ci(e,t){const n=e[gt];return(n?cn(n):e)[t]}function Xm(e,t,n){var a;const r=ud(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function ud(e,t){if(!(t in e))return;let n=Vn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Vn(n)}}function hs(e){e.modified_||(e.modified_=!0,e.parent_&&hs(e.parent_))}function di(e){e.copy_||(e.copy_=cs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ep=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"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(Dn(t)){const i=Qo(this),s=ms(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?ds(i):fs(i)}return Go(i,r),Jo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===ad&&(a=void 0),this.autoFreeze_&&Ks(a,!0),r){const i=[],s=[];Cn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(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){Dn(e)||dt(8),yn(e)&&(e=tp(e));const t=Qo(this),n=ms(e,void 0);return n[gt].isManual_=!0,fs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Go(r,t),Jo(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=Cn("Patches").applyPatches_;return yn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ms(e,t){const n=Wa(e)?Cn("MapSet").proxyMap_(e,t):Ha(e)?Cn("MapSet").proxySet_(e,t):Jm(e,t);return(t?t.scope_:od()).drafts_.push(n),n}function tp(e){return yn(e)||dt(10,e),ld(e)}function ld(e){if(!Dn(e)||Ua(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=cs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=cs(e,!0);return Da(n,(r,a)=>{sd(n,r,ld(a))}),t&&(t.finalized_=!1),n}var vt=new ep,Ys=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var eu=vt.createDraft.bind(vt),tu=vt.finishDraft.bind(vt),np={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()}}},rp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=xe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=U.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,pr=new WeakMap,cd=new WeakMap,nu=new WeakMap,ru=new WeakMap,au=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:f}=t;if(P.equals(m,f))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var p=f.slice();return P.endsBefore(m,f)&&m.length<f.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else P.isSibling(m,f)&&(P.isAncestor(f,r)||P.equals(f,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(f,r)||P.equals(f,r)||P.isAncestor(f,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[f.length-1]+=1):P.endsBefore(m,r)&&(P.equals(f,r)&&(r[f.length-1]+=1),r[m.length-1]-=1);break}}return r}};function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function ip(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sp(e){var t=ip(e,"string");return _r(t)==="symbol"?t:String(t)}function ot(e,t,n){return t=sp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 or(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){ot(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 op=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of U.points(t))t[l]=xe.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:m}=n;if(m.length===0)break;var f=se.leaf(e,u),p=f.text.slice(0,c),g=f.text.slice(c);if(f.text=p+m+g,t)for(var[h,y]of U.points(t))t[y]=xe.transform(h,n);break}case"merge_node":{var{path:b}=n,w=se.get(e,b),A=P.previous(b),k=se.get(e,A),E=se.parent(e,b),T=b[b.length-1];if(fe.isText(w)&&fe.isText(k))k.text+=w.text;else if(!fe.isText(w)&&!fe.isText(k))k.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Ge.stringify(w)," ").concat(Ge.stringify(k)));if(E.children.splice(T,1),t)for(var[j,z]of U.points(t))t[z]=xe.transform(j,n);break}case"move_node":{var{path:N,newPath:$}=n;if(P.isAncestor(N,$))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat($,"] because the destination is inside itself."));var M=se.get(e,N),C=se.parent(e,N),B=N[N.length-1];C.children.splice(B,1);var F=P.transform(N,n),R=se.get(e,P.parent(F)),L=F[F.length-1];if(R.children.splice(L,0,M),t)for(var[q,oe]of U.points(t))t[oe]=xe.transform(q,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],H=se.parent(e,ne);if(H.children.splice(D,1),t)for(var[X,_]of U.points(t)){var S=xe.transform(X,n);if(t!=null&&S!=null)t[_]=S;else{var W=void 0,I=void 0;for(var[K,te]of se.texts(e))if(P.compare(te,ne)===-1)W=[K,te];else{I=[K,te];break}var ee=!1;W&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(W[1],ne).length<P.common(I[1],ne).length),W&&!ee?(X.path=W[1],X.offset=W[0].text.length):I?(X.path=I[1],X.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:le,text:V}=n;if(V.length===0)break;var he=se.leaf(e,ae),pe=he.text.slice(0,le),we=he.text.slice(le+V.length);if(he.text=pe+we,t)for(var[je,Oe]of U.points(t))t[Oe]=xe.transform(je,n);break}case"set_node":{var{path:Qe,properties:Ze,newProperties:Ye}=n;if(Qe.length===0)throw new Error("Cannot set properties on the root node!");var nt=se.get(e,Qe);for(var Fe in Ye){if(Fe==="children"||Fe==="text")throw new Error('Cannot set the "'.concat(Fe,'" property of nodes!'));var He=Ye[Fe];He==null?delete nt[Fe]:nt[Fe]=He}for(var ze in Ze)Ye.hasOwnProperty(ze)||delete nt[ze];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!U.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ge.stringify(Y)," when there is no current selection."));t=or({},Y)}for(var ie in Y){var me=Y[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:Ce,properties:Ve}=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 Ke=se.get(e,ve),mt=se.parent(e,ve),It=ve[ve.length-1],Et;if(fe.isText(Ke)){var Je=Ke.text.slice(0,Ce),Bt=Ke.text.slice(Ce);Ke.text=Je,Et=or(or({},Ve),{},{text:Bt})}else{var pt=Ke.children.slice(0,Ce),ei=Ke.children.slice(Ce);Ke.children=pt,Et=or(or({},Ve),{},{children:ei})}if(mt.children.splice(It+1,0,Et),t)for(var[ar,Mr]of U.points(t))t[Mr]=xe.transform(ar,n);break}}return t},up={transform(e,t){e.children=eu(e.children);var n=e.selection&&eu(e.selection);try{n=op(e,n,t)}finally{e.children=tu(e.children),n?e.selection=yn(n)?tu(n):n:e.selection=null}}},lp={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)}},cp={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)}},dd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Xe(r)&&Xe(a)){if(!dd(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 dp(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 Ut(e,t){if(e==null)return{};var n=dp(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 fp=["anchor","focus"];function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?su(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var U={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return U.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=U.edges(e);return t},equals(e,t){return xe.equals(e.anchor,t.anchor)&&xe.equals(e.focus,t.focus)},includes(e,t){if(U.isRange(t)){if(U.includes(e,t.anchor)||U.includes(e,t.focus))return!0;var[n,r]=U.edges(e),[a,i]=U.edges(t);return xe.isBefore(n,a)&&xe.isAfter(r,i)}var[s,o]=U.edges(e),l=!1,u=!1;return xe.isPoint(t)?(l=xe.compare(t,s)>=0,u=xe.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=Ut(e,fp),[r,a]=U.edges(e),[i,s]=U.edges(t),o=xe.isBefore(r,i)?i:r,l=xe.isBefore(a,s)?a:s;return xe.isBefore(l,o)?null:hp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return xe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return xe.equals(t,n)},isExpanded(e){return!U.isCollapsed(e)},isForward(e){return!U.isBackward(e)},isRange(e){return Xe(e)&&xe.isPoint(e.anchor)&&xe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=U.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=U.isCollapsed(r);U.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?U.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=xe.transform(r.anchor,t,{affinity:i}),u=xe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ou=e=>Xe(e)&&se.isNodeList(e.children)&&!v.isEditor(e),de={isAncestor(e){return Xe(e)&&se.isNodeList(e.children)},isElement:ou,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 ou(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},mp=["children"],pp=["text"],uu=new WeakMap,se={ancestor(e,t){var n=se.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(Ge.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=se.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(Ge.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ge.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(v.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ge.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Ut(e,mp);return t}else{var t=Ut(e,pp);return t}},first(e,t){for(var n=t.slice(),r=se.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(Ge.stringify(e)));var n=Ys({children:e.children},r=>{var[a,i]=U.edges(t),s=se.nodes(r,{reverse:!0,pass:f=>{var[,p]=f;return!U.includes(t,p)}});for(var[,o]of s){if(!U.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=se.leaf(r,o);m.text=m.text.slice(a.offset)}}v.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(Ge.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)||v.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=uu.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return uu.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.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=se.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(Ge.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=se.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=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=se.get(e,o);continue}o=P.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=se.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(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))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 Ie(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){ot(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 Xt={isNodeOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Xe(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&se.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)&&Xe(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&se.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)&&Xe(e.properties)&&Xe(e.newProperties);case"set_selection":return e.properties===null&&U.isRange(e.newProperties)||e.newProperties===null&&U.isRange(e.properties)||Xe(e.properties)&&Xe(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&Xe(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Xt.isOperation(t))},isSelectionOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ie(Ie({},e),{},{type:"remove_node"});case"insert_text":return Ie(Ie({},e),{},{type:"remove_text"});case"merge_node":return Ie(Ie({},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 Ie(Ie({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ie(Ie({},e),{},{path:r,newPath:a})}case"remove_node":return Ie(Ie({},e),{},{type:"insert_node"});case"remove_text":return Ie(Ie({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ie(Ie({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ie(Ie({},e),{},{properties:l,newProperties:null}):l==null?Ie(Ie({},e),{},{properties:null,newProperties:o}):Ie(Ie({},e),{},{properties:l,newProperties:o})}case"split_node":return Ie(Ie({},e),{},{type:"merge_node",path:P.next(e.path)})}}},cu=new WeakMap,gp=e=>{var t=cu.get(e);if(t!==void 0)return t;if(!Xe(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||Xe(e.marks))&&(e.selection===null||U.isRange(e.selection))&&se.isNodeList(e.children)&&Xt.isOperationList(e.operations);return cu.set(e,n),n},v={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 gp(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)}},vp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var xe={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 xe.compare(e,t)===1},isBefore(e,t){return xe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return Xe(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(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,fu(fu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},hu=void 0,Ge={setScrubber(e){hu=e},stringify(e){return JSON.stringify(e,hu)}},bp=["text"],yp=["anchor","focus"];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 Lt(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){ot(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,bp);return s}return dd(r?a(e):e,r?a(t):t)},isText(e){return Xe(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=[Lt({},e)];for(var r of t){var a=Ut(r,yp),[i,s]=U.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var m of n){var{length:f}=m.text,p=l;if(l+=f,u<=p&&l<=c){Object.assign(m,a),o.push(m);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(m);continue}var g=m,h=void 0,y=void 0;if(c<l){var b=c-p;y=Lt(Lt({},g),{},{text:g.text.slice(b)}),g=Lt(Lt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var w=u-p;h=Lt(Lt({},g),{},{text:g.text.slice(0,w)}),g=Lt(Lt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),h&&o.push(h),o.push(g),y&&o.push(y)}n=o}return n}},Gs=e=>e.selection?e.selection:e.children.length>0?v.end(e,[]):[0],rr=(e,t)=>{var[n]=v.node(e,t);return r=>r===n},Qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?kp(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var c of a){var m=c.codePointAt(0);if(!m)break;var f=Mp(c,m);if([i,s]=r?[s,f]:[f,i],Nn(i,De.ZWJ)&&Nn(s,De.ExtPict)&&(r?l=pu(t.substring(0,o)):l=pu(t.substring(0,t.length-o)),!l)||Nn(i,De.RI)&&Nn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=qp(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&$p(i,s))break;o+=c.length}return o||1},Dp=/\s/,Cp=/[\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]/,xp=/['\u2018\u2019]/,wp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Qs(t,n),[s,o]=Js(t,i,n);if(Ep(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Js=(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)]},Ep=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Dp.test(t))return!1;if(xp.test(t)){var a=Qs(n,r),[i,s]=Js(n,a,r);if(e(i,s,r))return!0}return!Cp.test(t)},kp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Bp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(_p(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},_p=e=>e>=55296&&e<=56319,Bp=e=>e>=56320&&e<=57343,De;(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"})(De||(De={}));var Ap=/^(?:[\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])$/,Fp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Tp=/^(?:[\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])$/,Sp=/^[\u1100-\u115F\uA960-\uA97C]$/,jp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Op=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Pp=/^[\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]$/,Rp=/^[\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]$/,Np=/^(?:[\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])$/,Mp=(e,t)=>{var n=De.Any;return e.search(Ap)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(Fp)!==-1&&(n|=De.Prepend),e.search(Tp)!==-1&&(n|=De.SpacingMark),e.search(Sp)!==-1&&(n|=De.L),e.search(jp)!==-1&&(n|=De.V),e.search(Op)!==-1&&(n|=De.T),e.search(Pp)!==-1&&(n|=De.LV),e.search(Rp)!==-1&&(n|=De.LVT),e.search(Np)!==-1&&(n|=De.ExtPict),n};function Nn(e,t){return(e&t)!==0}var Ip=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function $p(e,t){return Ip.findIndex(n=>Nn(e,n[0])&&Nn(t,n[1]))===-1}var Lp=/(?:[\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$/,pu=e=>e.search(Lp)!==-1,zp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,qp=e=>{var t=e.match(zp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Wp={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Gs(e)}=n;if(P.isPath(a)&&(a=v.range(e,a)),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var i=U.end(a);if(!r&&v.void(e,{at:i}))return;var s=U.start(a),o=v.pointRef(e,s),l=v.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&v.void(e,{at:a})||v.elementReadOnly(e,{at:a}))){var{path:m,offset:f}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:f,text:t})}})}};function gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qr(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){ot(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 Q=qr(qr(qr(qr({},up),lp),cp),Wp),ua=new WeakMap,Hp=e=>ua.get(e)||!1,Up=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function fd(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=m=>{if(m){var f=m.join(",");s.has(f)||(s.add(f),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);wa.set(e,i),Ea.set(e,s)}var Vp=(e,t)=>{for(var n of v.pathRefs(e))np.transform(n,t);for(var r of v.pointRefs(e))rp.transform(r,t);for(var a of v.rangeRefs(e))ap.transform(a,t);if(!Hp(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;fd(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),v.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),pr.get(e)||(pr.set(e,!0),Promise.resolve().then(()=>{pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Kp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(se.nodes(r),$=>{var[,M]=$;return a.concat(M)});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 f=[],p=[];for(var g of P.ancestors(c)){var h=P.transform(g,t);f.push(h)}for(var y of P.ancestors(m)){var b=P.transform(y,t);p.push(b)}var w=p[p.length-1],A=m[m.length-1],k=w.concat(A);return[...f,...p,k]}case"remove_node":{var{path:E}=t,T=P.ancestors(E);return[...T]}case"split_node":{var{path:j}=t,z=P.levels(j),N=P.next(j);return[...z,N]}default:return[]}},Zp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Yp=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=v.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=se.get(e,r);if(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],m=o===n.children.length-1,f=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(f!==i)Q.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 p={text:""};Q.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Gp=(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},Qp=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=v.path(t,i),l=a==="lowest";for(var[u,c]of v.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(U.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 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){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,f)=>{if(!fe.isText(m))return!1;var[p,g]=v.parent(e,f);return!e.isVoid(p)||e.markableVoid(p)},i=U.isExpanded(r),s=!1;if(!i){var[o,l]=v.node(e,r);if(o&&a(o,l)){var[u]=v.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=bu(bu({},v.marks(e)||{}),{},{[t]:n});e.marks=c,pr.get(e)||e.onChange()}}};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.point(t,n,{edge:"end"}),i=v.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,Du(Du({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.start(t,[]),i=v.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,xu(xu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},tg=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},ng=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t})},rg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&U.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},ag=(e,t)=>[v.start(e,t),v.end(e,t)];function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,Eu(Eu({},n),{},{match:r=>de.isElement(r)&&v.isElementReadOnly(t,r)}))},sg=(e,t)=>v.point(e,t,{edge:"end"}),og=(e,t)=>{var n=v.path(e,t,{edge:"start"});return v.node(e,n)},ug=(e,t)=>{var n=v.range(e,t);return se.fragment(e,n)};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 _u(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){ot(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 lg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,_u(_u({},n),{},{match:r=>de.isElement(r)&&v.isVoid(t,r)}))},cg=(e,t)=>t.children.some(n=>de.isElement(n)&&v.isBlock(e,n)),dg=(e,t)=>t.children.some(n=>fe.isText(n)||v.isInline(e,n)),fg=(e,t)=>se.has(e,t),hg=(e,t)=>t.children.every(n=>fe.isText(n)),mg=e=>{Q.splitNodes(e,{always:!0})},pg=(e,t,n)=>{Q.insertNodes(e,t,n)},gg=e=>{Q.splitNodes(e,{always:!0})};function Bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function vg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bg=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=vg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},yg=(e,t)=>!e.isInline(t),Dg=(e,t,n)=>v.isStart(e,t,n)||v.isEnd(e,t,n),Cg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},xg=(e,t,n)=>{var r=v.end(e,n);return xe.equals(t,r)},wg=e=>{var t=cd.get(e);return t===void 0?!0:t},Eg=(e,t,n)=>{if(t.offset!==0)return!1;var r=v.start(e,n);return xe.equals(t,r)},kg=(e,t)=>{var n=v.path(e,t,{edge:"end"});return v.node(e,n)},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=se.leaf(t,a);return[i,a]};function Bg(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=v.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&v.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Ag=["text"],Fg=["text"],Tg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(U.isExpanded(r)){var s=v.isEnd(t,a,a.path);if(s){var o=v.after(t,a);o&&(a=o)}var[l]=v.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,Ag);return c}else return{}}var{path:m}=a,[f]=v.leaf(t,m);if(a.offset===0){var p=v.previous(t,{at:m,match:fe.isText}),g=v.above(t,{match:k=>de.isElement(k)&&v.isVoid(t,k)&&t.markableVoid(k)});if(!g){var h=v.above(t,{match:k=>de.isElement(k)&&v.isBlock(t,k)});if(p&&h){var[y,b]=p,[,w]=h;P.isAncestor(w,b)&&(f=y)}}}var A=Ut(f,Fg);return A},Sg=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=v.after(t,s,{voids:a});if(o){var[,l]=v.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]=v.parent(t,s);i=f=>c.children.includes(f)}else i=()=>!0;var[m]=v.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=se.get(t,a);return[i,a]};function Og(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,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(vp.isSpan(n))u=n[0],c=n[1];else{var m=v.path(e,n,{edge:"start"}),f=v.path(e,n,{edge:"end"});u=i?f:m,c=i?m:f}var p=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return de.isElement(E)?!!(!s&&(v.isVoid(e,E)||v.isElementReadOnly(e,E))||o&&!v.isSelectable(e,E)):!1}}),g=[],h;for(var[y,b]of p)if(!(o&&de.isElement(y)&&!v.isSelectable(e,y))){var w=h&&P.compare(b,h[1])===0;if(!(r==="highest"&&w)){if(!l(y,b)){if(a&&!w&&fe.isText(y))return;continue}if(r==="lowest"&&w){h=[y,b];continue}var A=r==="lowest"?h:[y,b];A&&(a?g.push(A):yield A),h=[y,b]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var Pg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var m=i(c).pop(),f=m.join(",");return s(c).delete(f),m};if(v.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,m]=c;return m}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&v.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var m=v.node(t,c),[f,p]=m;de.isElement(f)&&f.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,operation:a}))return;var b=o(t);if(se.has(t,b)){var w=v.node(t,b);t.normalizeNode(w,{operation:a})}y++,g=i(t)}})}},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=P.parent(a),s=v.node(t,i);return s},Ng=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=v.pathRefs(t);return l.delete(i),i.current=null,o}},s=v.pathRefs(t);return s.add(i),i},Mg=e=>{var t=nu.get(e);return t||(t=new Set,nu.set(e,t)),t},Ig=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]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return U.isRange(n)&&(i==="start"?n=U.start(n):i==="end"?n=U.end(n):n=P.common(n.anchor.path,n.focus.path)),xe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},$g=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=v.pointRefs(t);return l.delete(i),i.current=null,o}},s=v.pointRefs(t);return s.add(i),i},Lg=e=>{var t=ru.get(e);return t||(t=new Set,ru.set(e,t)),t},zg=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]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.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(U.isRange(n)){var[u,c]=U.edges(n);return a==="start"?u:c}return n};function qg(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=v.range(e,n),[l,u]=U.edges(o),c=a?u:l,m=!1,f="",p=0,g=0,h=0;for(var[y,b]of v.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield v.start(e,b);continue}if(e.isInline(y))continue;if(v.hasInlines(e,y)){var w=P.isAncestor(b,u.path)?u:v.end(e,b),A=P.isAncestor(b,l.path)?l:v.start(e,b);f=v.string(e,{anchor:A,focus:w},{voids:i}),m=!0}}if(fe.isText(y)){var k=P.equals(b,c.path);for(k?(g=a?c.offset:y.text.length-c.offset,h=c.offset):(g=y.text.length,h=a?g:0),(k||m||r==="offset")&&(yield{path:b,offset:h},m=!1);;){if(p===0){if(f==="")break;p=E(f,r,a),f=Js(f,p,a)[1]}if(h=a?h-p:h+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:h}}}}function E(T,j,z){return j==="character"?Qs(T,z):j==="word"?wp(T,z):j==="line"||j==="block"?T.length:1}}()}var Wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=v.before(t,s,{voids:a});if(o){var[,l]=v.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]=v.parent(t,s);i=f=>c.children.includes(f)}else i=()=>!0;var[m]=v.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},Hg=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=v.rangeRefs(t);return l.delete(i),i.current=null,o}},s=v.rangeRefs(t);return s.add(i),i},Ug=e=>{var t=au.get(e);return t||(t=new Set,au.set(e,t)),t},Vg=(e,t,n)=>{if(U.isRange(t)&&!n)return t;var r=v.start(e,t),a=v.end(e,n||t);return{anchor:r,focus:a}};function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Kg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,m)=>{if(!fe.isText(c))return!1;var[f,p]=v.parent(e,m);return!e.isVoid(f)||e.markableVoid(f)},a=U.isExpanded(n),i=!1;if(!a){var[s,o]=v.node(e,n);if(s&&r(s,o)){var[l]=v.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Kg({},v.marks(e)||{});delete u[t],e.marks=u,pr.get(e)||e.onChange()}}},Yg=(e,t)=>{cd.set(e,t)},Gg=(e,t)=>v.point(e,t,{edge:"start"}),Qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=v.range(t,n),[s,o]=U.edges(i),l="";for(var[u,c]of v.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},Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=U.edges(n);if(i.offset!==0||s.offset!==0||U.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=v.above(t,{at:s,match:g=>de.isElement(g)&&v.isBlock(t,g),voids:a}),l=o?o[1]:[],u=v.start(t,i),c={anchor:u,focus:s},m=!0;for(var[f,p]of v.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(f.text!==""||P.isBefore(p,l)){s={path:p,offset:f.text.length};break}}return{anchor:i,focus:s}},Xg=(e,t)=>{var n=v.isNormalizing(e);v.setNormalizing(e,!1);try{t()}finally{v.setNormalizing(e,n)}v.normalize(e)},ev=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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(U.isRange(u)&&U.isCollapsed(u)&&(m=!0,u=u.anchor),xe.isPoint(u)){var f=v.void(t,{at:u,mode:"highest"});if(!l&&f){var[,p]=f;u=p}else{var g={unit:s,distance:o},h=i?v.before(t,u,g)||v.start(t,[]):v.after(t,u,g)||v.end(t,[]);u={anchor:u,focus:h},c=!0}}if(P.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!U.isCollapsed(u)){if(!c){var[,y]=U.edges(u),b=v.end(t,[]);xe.equals(y,b)||(u=v.unhangRange(t,u,{voids:l}))}var[w,A]=U.edges(u),k=v.above(t,{match:pe=>de.isElement(pe)&&v.isBlock(t,pe),at:w,voids:l}),E=v.above(t,{match:pe=>de.isElement(pe)&&v.isBlock(t,pe),at:A,voids:l}),T=k&&E&&!P.equals(k[1],E[1]),j=P.equals(w.path,A.path),z=l?null:(r=v.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:v.elementReadOnly(t,{at:w,mode:"highest"}),N=l?null:(a=v.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:v.elementReadOnly(t,{at:A,mode:"highest"});if(z){var $=v.before(t,w);$&&k&&P.isAncestor(k[1],$.path)&&(w=$)}if(N){var M=v.after(t,A);M&&E&&P.isAncestor(E[1],M.path)&&(A=M)}var C=[],B;for(var F of v.nodes(t,{at:u,voids:l})){var[R,L]=F;B&&P.compare(L,B)===0||(!l&&de.isElement(R)&&(v.isVoid(t,R)||v.isElementReadOnly(t,R))||!P.isCommon(L,w.path)&&!P.isCommon(L,A.path))&&(C.push(F),B=L)}var q=Array.from(C,pe=>{var[,we]=pe;return v.pathRef(t,we)}),oe=v.pointRef(t,w),ne=v.pointRef(t,A),D="";if(!j&&!z){var H=oe.current,[X]=v.leaf(t,H),{path:_}=H,{offset:S}=w,W=X.text.slice(S);W.length>0&&(t.apply({type:"remove_text",path:_,offset:S,text:W}),D=W)}if(q.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>Q.removeNodes(t,{at:pe,voids:l})),!N){var I=ne.current,[K]=v.leaf(t,I),{path:te}=I,ee=j?w.offset:0,ae=K.text.slice(ee,A.offset);ae.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:ae}),D=ae)}!j&&T&&ne.current&&oe.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),m&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,D.slice(0,D.length-o));var le=oe.unref(),V=ne.unref(),he=i?le||V:V||le;n.at==null&&he&&Q.select(t,he)}}})},tv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Gs(t),batchDirty:o=!0}=r;if(n.length){if(U.isRange(s))if(a||(s=v.unhangRange(t,s,{voids:i})),U.isCollapsed(s))s=s.anchor;else{var[,l]=U.edges(s);if(!i&&v.void(t,{at:l}))return;var u=v.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=v.start(t,s));if(!(!i&&v.void(t,{at:s}))){var c=v.above(t,{at:s,match:W=>de.isElement(W)&&v.isInline(t,W),mode:"highest",voids:i});if(c){var[,m]=c;if(v.isEnd(t,s,m)){var f=v.after(t,m);s=f}else if(v.isStart(t,s,m)){var p=v.before(t,m);s=p}}var g=v.above(t,{match:W=>de.isElement(W)&&v.isBlock(t,W),at:s,voids:i}),[,h]=g,y=v.isStart(t,s,h),b=v.isEnd(t,s,h),w=y&&b,A=!y||y&&b,k=!b,[,E]=se.first({children:n},[]),[,T]=se.last({children:n},[]),j=[],z=W=>{var[I,K]=W,te=K.length===0;return te?!1:w?!0:!(A&&P.isAncestor(K,E)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||k&&P.isAncestor(K,T)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var N of se.nodes({children:n},{pass:z}))z(N)&&j.push(N);var $=[],M=[],C=[],B=!0,F=!1;for(var[R]of j)de.isElement(R)&&!t.isInline(R)?(B=!1,F=!0,M.push(R)):B?$.push(R):C.push(R);var[L]=v.nodes(t,{at:s,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i}),[,q]=L,oe=v.isStart(t,s,q),ne=v.isEnd(t,s,q),D=v.pathRef(t,b&&!C.length?P.next(h):h),H=v.pathRef(t,ne?P.next(q):q);Q.splitNodes(t,{at:s,match:W=>F?de.isElement(W)&&v.isBlock(t,W):fe.isText(W)||v.isInline(t,W),mode:F?"lowest":"highest",always:F&&(!y||$.length>0)&&(!b||C.length>0),voids:i});var X=v.pathRef(t,!oe||oe&&ne?P.next(q):q);if(Q.insertNodes(t,$,{at:X.current,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),w&&!$.length&&M.length&&!C.length&&Q.delete(t,{at:h,voids:i}),Q.insertNodes(t,M,{at:D.current,match:W=>de.isElement(W)&&v.isBlock(t,W),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,C,{at:H.current,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(C.length>0&&H.current?_=P.previous(H.current):M.length>0&&D.current?_=P.previous(D.current):X.current&&(_=P.previous(X.current)),_){var S=v.end(t,_);Q.select(t,S)}}X.unref(),D.unref(),H.unref()}}})},nv=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")Q.select(t,a.anchor);else if(r==="focus")Q.select(t,a.focus);else if(r==="start"){var[i]=U.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=U.edges(a);Q.select(t,s)}}else return},rv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},av=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=U.isBackward(r)?"focus":"anchor"),o==="end"&&(o=U.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var f=s?v.before(t,l,c):v.after(t,l,c);f&&(m.anchor=f)}if(o==null||o==="focus"){var p=s?v.before(t,u,c):v.after(t,u,c);p&&(m.focus=p)}Q.setSelection(t,m)}},iv=(e,t)=>{var{selection:n}=e;if(t=v.range(e,t),n){Q.setSelection(e,t);return}if(!U.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(Ge.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sv=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=U.isBackward(a)?"focus":"anchor"),i==="end"&&(i=U.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Tu(Tu({},l),n)})}},ov=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!xe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!xe.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})}},uv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=Gs(t),c!==!1&&(c=!0)),c==null&&(c=!1),U.isRange(l))if(a||(l=v.unhangRange(t,l,{voids:i})),U.isCollapsed(l))l=l.anchor;else{var[,f]=U.edges(l),p=v.pointRef(t,f);Q.delete(t,{at:l}),l=p.unref()}if(xe.isPoint(l)){u==null&&(fe.isText(m)?u=$=>fe.isText($):t.isInline(m)?u=$=>fe.isText($)||v.isInline(t,$):u=$=>de.isElement($)&&v.isBlock(t,$));var[g]=v.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,y=v.pathRef(t,h),b=v.isEnd(t,l,h);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=y.unref();l=b?P.next(w):w}else return}var A=P.parent(l),k=l[l.length-1];if(!(!i&&v.void(t,{at:A}))){if(o){var E=[],T=P.levels(A);Up(t,()=>{var $=function(){var B=A.concat(k);k++;var F={type:"insert_node",path:B,node:M};t.apply(F),l=P.next(l),E.push(F),fe.isText?T.push(...Array.from(se.nodes(M),R=>{var[,L]=R;return B.concat(L)})):T.push(B)};for(var M of n)$()},()=>{fd(t,T,$=>{var M=$;for(var C of E)if(P.operationCanTransformPath(C)&&(M=P.transform(M,C),!M))return null;return M})})}else for(var j of n){var z=A.concat(k);k++,t.apply({type:"insert_node",path:z,node:j}),l=P.next(l)}if(l=P.previous(l),c){var N=v.end(t,l);N&&Q.select(t,N)}}}})},lv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?rr(t,r):k=>de.isElement(k)&&v.isBlock(t,k)),!!r){var o=v.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return v.pathRef(t,E)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var m=v.node(t,P.parent(c)),[f,p]=m,g=c[c.length-1],{length:h}=f.children;if(h===1){var y=P.next(p);Q.moveNodes(t,{at:c,to:y,voids:i}),Q.removeNodes(t,{at:p,voids:i})}else if(g===0)Q.moveNodes(t,{at:c,to:p,voids:i});else if(g===h-1){var b=P.next(p);Q.moveNodes(t,{at:c,to:b,voids:i})}else{var w=P.next(c),A=P.next(p);Q.splitNodes(t,{at:w,voids:i}),Q.moveNodes(t,{at:c,to:A,voids:i})}}}})},cv=["text"],dv=["children"],hd=(e,t)=>{if(de.isElement(t)){var n=t;return v.isVoid(e,t)?!0:n.children.length===1?hd(e,n.children[0]):!1}else return!v.isEditor(t)},fv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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]=v.parent(t,a);r=$=>l.children.includes($)}else r=$=>de.isElement($)&&v.isBlock(t,$);if(!i&&U.isRange(a)&&(a=v.unhangRange(t,a,{voids:s})),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var[,u]=U.edges(a),c=v.pointRef(t,u);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.select(t,a)}var[m]=v.nodes(t,{at:a,match:r,voids:s,mode:o}),f=v.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!f)){var[p,g]=m,[h,y]=f;if(!(g.length===0||y.length===0)){var b=P.next(y),w=P.common(g,y),A=P.isSibling(g,y),k=Array.from(v.levels(t,{at:g}),$=>{var[M]=$;return M}).slice(w.length).slice(0,-1),E=v.above(t,{at:g,mode:"highest",match:$=>k.includes($)&&hd(t,$)}),T=E&&v.pathRef(t,E[1]),j,z;if(fe.isText(p)&&fe.isText(h)){var N=Ut(p,cv);z=h.text.length,j=N}else if(de.isElement(p)&&de.isElement(h)){var N=Ut(p,dv);z=h.children.length,j=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ge.stringify(p)," ").concat(Ge.stringify(h)));A||Q.moveNodes(t,{at:g,to:b,voids:s}),T&&Q.removeNodes(t,{at:T.current,voids:s}),de.isElement(h)&&v.isEmpty(t,h)||fe.isText(h)&&h.text===""&&y[y.length-1]!==0?Q.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:b,position:z,properties:j}),T&&T.unref()}}}})},hv=(e,t)=>{v.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)?rr(e,r):p=>de.isElement(p)&&v.isBlock(e,p));var o=v.pathRef(e,n),l=v.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(e,g)});for(var c of u){var m=c.unref(),f=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:f}),o.current&&P.isSibling(f,m)&&P.isAfter(f,m)&&(o.current=P.next(o.current))}o.unref()}})},mv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?rr(t,s):p=>de.isElement(p)&&v.isBlock(t,p)),!r&&U.isRange(s)&&(s=v.unhangRange(t,s,{voids:a}));var l=v.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(t,g)});for(var c of u){var m=c.unref();if(m){var[f]=v.node(t,m);t.apply({type:"remove_node",path:m,node:f})}}}})},pv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.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)?rr(t,i):z=>de.isElement(z)&&v.isBlock(t,z)),!l&&U.isRange(i)&&(i=v.unhangRange(t,i,{voids:m})),c&&U.isRange(i)){if(U.isCollapsed(i)&&v.leaf(t,i.anchor)[0].text.length>0)return;var f=v.rangeRef(t,i,{affinity:"inward"}),[p,g]=U.edges(i),h=u==="lowest"?"lowest":"highest",y=v.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:h,voids:m,always:!y});var b=v.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:h,voids:m,always:!b}),i=f.unref(),r.at==null&&Q.select(t,i)}s||(s=(z,N)=>z!==N);for(var[w,A]of v.nodes(t,{at:i,match:a,mode:u,voids:m})){var k={},E={};if(A.length!==0){var T=!1;for(var j in n)j==="children"||j==="text"||s(n[j],w[j])&&(T=!0,w.hasOwnProperty(j)&&(k[j]=w[j]),o?n[j]!=null&&(E[j]=o(w[j],n[j])):n[j]!=null&&(E[j]=n[j]));T&&t.apply({type:"set_node",path:A,properties:k,newProperties:E})}}}})},gv=(e,t)=>{if(U.isCollapsed(t))return t.anchor;var[,n]=U.edges(t),r=v.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},vv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>de.isElement(ne)&&v.isBlock(t,ne)),U.isRange(s)&&(s=gv(t,s)),P.isPath(s)){var u=s,c=v.point(t,u),[m]=v.parent(t,u);i=ne=>ne===m,o=c.path.length-u.length+1,s=c,l=!0}if(s){var f=v.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=v.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var h=v.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[b,w]=h;if(de.isElement(b)&&t.isInline(b)){var A=v.after(t,w);if(!A){var k={text:""},E=P.next(w);Q.insertNodes(t,k,{at:E,voids:a}),A=v.point(t,E)}s=A,l=!0}var T=s.path.length-w.length;o=T+1,l=!0}p=v.pointRef(t,s);var j=s.path.length-o,[,z]=g,N=s.path.slice(0,j),$=o===0?s.offset:s.path[j]+y;for(var[M,C]of v.levels(t,{at:N,reverse:!0,voids:a})){var B=!1;if(C.length<z.length||C.length===0||!a&&de.isElement(M)&&v.isVoid(t,M))break;var F=f.current,R=v.isEnd(t,F,C);if(l||!f||!v.isEdge(t,F,C)){B=!0;var L=se.extractProps(M);t.apply({type:"split_node",path:C,position:$,properties:L})}$=C[C.length-1]+(B||R?1:0)}if(n.at==null){var q=p.current||v.end(t,[]);Q.select(t,q)}}finally{var oe;f.unref(),(oe=p)===null||oe===void 0||oe.unref()}}})},bv=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;Q.setNodes(t,a,r)},yv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?rr(t,s):p=>de.isElement(p)&&v.isBlock(t,p)),P.isPath(s)&&(s=v.range(t,s));var l=U.isRange(s)?v.rangeRef(t,s):null,u=v.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return v.pathRef(t,g)}).reverse(),m=function(){var g=f.unref(),[h]=v.node(t,g),y=v.range(t,g);a&&l&&(y=U.intersection(l.current,y)),Q.liftNodes(t,{at:y,match:b=>de.isAncestor(h)&&h.children.includes(b),voids:i})};for(var f of c)m();l&&l.unref()}})};function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.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=rr(t,l):t.isInline(n)?o=y=>de.isElement(y)&&v.isInline(t,y)||fe.isText(y):o=y=>de.isElement(y)&&v.isBlock(t,y)),i&&U.isRange(l)){var[u,c]=U.edges(l),m=v.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:c,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&Q.select(t,l)}var f=Array.from(v.nodes(t,{at:l,match:t.isInline(n)?y=>de.isElement(y)&&v.isBlock(t,y):y=>v.isEditor(y),mode:"lowest",voids:s})),p=function(){var b=U.isRange(l)?U.intersection(l,v.range(t,h)):l;if(!b)return 0;var w=Array.from(v.nodes(t,{at:b,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,k=w[w.length-1],[,E]=A,[,T]=k;if(E.length===0&&T.length===0)return 0;var j=P.equals(E,T)?P.parent(E):P.common(E,T),z=v.range(t,E,T),N=v.node(t,j),[$]=N,M=j.length+1,C=P.next(T.slice(0,M)),B=ju(ju({},n),{},{children:[]});Q.insertNodes(t,B,{at:C,voids:s}),Q.moveNodes(t,{at:z,match:F=>de.isAncestor($)&&$.children.includes(F),to:C.concat(0),voids:s})}},g;for(var[,h]of f)g=p()}})},Cv=()=>{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 Vp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)}};return e},xv={isHistory(e){return Xe(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Xt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Xt.isOperationList(e.undos[0].operations))}},fi=new WeakMap,hi=new WeakMap,Mn={isHistoryEditor(e){return xv.isHistory(e.history)&&v.isEditor(e)},isMerging(e){return hi.get(e)},isSaving(e){return fi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Mn.isMerging(e);hi.set(e,!1),t(),hi.set(e,n)},withoutSaving(e,t){var n=Mn.isSaving(e);fi.set(e,!1),t(),fi.set(e,n)}},wv=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&&Q.setSelection(t,i.selectionBefore),Mn.withoutSaving(t,()=>{v.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];Mn.withoutSaving(t,()=>{v.withoutNormalizing(t,()=>{var s=i.operations.map(Xt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&Q.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=Mn.isSaving(t),c=Mn.isMerging(t);if(u==null&&(u=kv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=Ev(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},Ev=(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)),kv=(e,t)=>e.type!=="set_selection",_v=Fv,md="֑-߿יִ-﷽ﹰ-ﻼ",pd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Bv=new RegExp("^[^"+pd+"]*["+md+"]"),Av=new RegExp("^[^"+md+"]*["+pd+"]");function Fv(e){return e=String(e||""),Bv.test(e)?"rtl":Av.test(e)?"ltr":"neutral"}const gd=wn(_v);function Tv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xs=Tv,Sv=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,jv=Sv,Ov=jv,Pv=typeof self=="object"&&self&&self.Object===Object&&self,Rv=Ov||Pv||Function("return this")(),vd=Rv,Nv=vd,Mv=function(){return Nv.Date.now()},Iv=Mv,$v=/\s/;function Lv(e){for(var t=e.length;t--&&$v.test(e.charAt(t)););return t}var zv=Lv,qv=zv,Wv=/^\s+/;function Hv(e){return e&&e.slice(0,qv(e)+1).replace(Wv,"")}var Uv=Hv,Vv=vd,Kv=Vv.Symbol,bd=Kv,Ou=bd,yd=Object.prototype,Zv=yd.hasOwnProperty,Yv=yd.toString,ur=Ou?Ou.toStringTag:void 0;function Gv(e){var t=Zv.call(e,ur),n=e[ur];try{e[ur]=void 0;var r=!0}catch{}var a=Yv.call(e);return r&&(t?e[ur]=n:delete e[ur]),a}var Qv=Gv,Jv=Object.prototype,Xv=Jv.toString;function e0(e){return Xv.call(e)}var t0=e0,Pu=bd,n0=Qv,r0=t0,a0="[object Null]",i0="[object Undefined]",Ru=Pu?Pu.toStringTag:void 0;function s0(e){return e==null?e===void 0?i0:a0:Ru&&Ru in Object(e)?n0(e):r0(e)}var o0=s0;function u0(e){return e!=null&&typeof e=="object"}var l0=u0,c0=o0,d0=l0,f0="[object Symbol]";function h0(e){return typeof e=="symbol"||d0(e)&&c0(e)==f0}var m0=h0,p0=Uv,Nu=Xs,g0=m0,Mu=0/0,v0=/^[-+]0x[0-9a-f]+$/i,b0=/^0b[01]+$/i,y0=/^0o[0-7]+$/i,D0=parseInt;function C0(e){if(typeof e=="number")return e;if(g0(e))return Mu;if(Nu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Nu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=p0(e);var n=b0.test(e);return n||y0.test(e)?D0(e.slice(2),n?2:8):v0.test(e)?Mu:+e}var x0=C0,w0=Xs,mi=Iv,Iu=x0,E0="Expected a function",k0=Math.max,_0=Math.min;function B0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,m=!1,f=!0;if(typeof e!="function")throw new TypeError(E0);t=Iu(t)||0,w0(n)&&(c=!!n.leading,m="maxWait"in n,i=m?k0(Iu(n.maxWait)||0,t):i,f="trailing"in n?!!n.trailing:f);function p(T){var j=r,z=a;return r=a=void 0,u=T,s=e.apply(z,j),s}function g(T){return u=T,o=setTimeout(b,t),c?p(T):s}function h(T){var j=T-l,z=T-u,N=t-j;return m?_0(N,i-z):N}function y(T){var j=T-l,z=T-u;return l===void 0||j>=t||j<0||m&&z>=i}function b(){var T=mi();if(y(T))return w(T);o=setTimeout(b,h(T))}function w(T){return o=void 0,f&&r?p(T):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:w(mi())}function E(){var T=mi(),j=y(T);if(r=arguments,a=this,l=T,j){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return E.cancel=A,E.flush=k,E}var Dd=B0;const A0=wn(Dd);var F0=Dd,T0=Xs,S0="Expected a function";function j0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(S0);return T0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),F0(e,t,{leading:r,maxWait:t,trailing:a})}var O0=j0;const P0=wn(O0),$u=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Lu=(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 Lu(n.overflowY,t)||Lu(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},Wr=(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,R0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},zu=(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:L=>L!==u;if(!$u(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,p=[];let g=e;for(;$u(g)&&m(g);){if(g=R0(g),g===f){p.push(g);break}g!=null&&g===document.body&&pi(g)&&!pi(document.documentElement)||g!=null&&pi(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:w}=window,{height:A,width:k,top:E,right:T,bottom:j,left:z}=e.getBoundingClientRect(),{top:N,right:$,bottom:M,left:C}=(L=>{const q=window.getComputedStyle(L);return{top:parseFloat(q.scrollMarginTop)||0,right:parseFloat(q.scrollMarginRight)||0,bottom:parseFloat(q.scrollMarginBottom)||0,left:parseFloat(q.scrollMarginLeft)||0}})(e);let B=o==="start"||o==="nearest"?E-N:o==="end"?j+M:E+A/2-N+M,F=l==="center"?z+k/2-C+$:l==="end"?T+$:z-C;const R=[];for(let L=0;L<p.length;L++){const q=p[L],{height:oe,width:ne,top:D,right:H,bottom:X,left:_}=q.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&j<=y&&T<=h&&E>=D&&j<=X&&z>=_&&T<=H)return R;const S=getComputedStyle(q),W=parseInt(S.borderLeftWidth,10),I=parseInt(S.borderTopWidth,10),K=parseInt(S.borderRightWidth,10),te=parseInt(S.borderBottomWidth,10);let ee=0,ae=0;const le="offsetWidth"in q?q.offsetWidth-q.clientWidth-W-K:0,V="offsetHeight"in q?q.offsetHeight-q.clientHeight-I-te:0,he="offsetWidth"in q?q.offsetWidth===0?0:ne/q.offsetWidth:0,pe="offsetHeight"in q?q.offsetHeight===0?0:oe/q.offsetHeight:0;if(f===q)ee=o==="start"?B:o==="end"?B-y:o==="nearest"?Wr(w,w+y,y,I,te,w+B,w+B+A,A):B-y/2,ae=l==="start"?F:l==="center"?F-h/2:l==="end"?F-h:Wr(b,b+h,h,W,K,b+F,b+F+k,k),ee=Math.max(0,ee+w),ae=Math.max(0,ae+b);else{ee=o==="start"?B-D-I:o==="end"?B-X+te+V:o==="nearest"?Wr(D,X,oe,I,te+V,B,B+A,A):B-(D+oe/2)+V/2,ae=l==="start"?F-_-W:l==="center"?F-(_+ne/2)+le/2:l==="end"?F-H+K+le:Wr(_,H,ne,W,K+le,F,F+k,k);const{scrollLeft:we,scrollTop:je}=q;ee=pe===0?0:Math.max(0,Math.min(je+ee/pe,q.scrollHeight-oe/pe+V)),ae=he===0?0:Math.max(0,Math.min(we+ae/he,q.scrollWidth-ne/he+le)),B+=je-ee,F+=we-ae}R.push({el:q,top:ee,left:ae})}return R},N0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function M0(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(zu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of zu(e,N0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var gn=[],I0=function(){return gn.some(function(e){return e.activeTargets.length>0})},$0=function(){return gn.some(function(e){return e.skippedTargets.length>0})},qu="ResizeObserver loop completed with undelivered notifications.",L0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:qu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=qu),window.dispatchEvent(e)},Br;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Br||(Br={}));var vn=function(e){return Object.freeze(e)},z0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,vn(this)}return e}(),Cd=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,vn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),eo=function(e){return e instanceof SVGElement&&"getBBox"in e},xd=function(e){if(eo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Wu=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)},q0=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},gr=typeof window<"u"?window:{},Hr=new WeakMap,Hu=/auto|scroll/,W0=/^tb|vertical/,H0=/msie|trident/i.test(gr.navigator&&gr.navigator.userAgent),At=function(e){return parseFloat(e||"0")},zn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new z0((n?t:e)||0,(n?e:t)||0)},Uu=vn({devicePixelContentBoxSize:zn(),borderBoxSize:zn(),contentBoxSize:zn(),contentRect:new Cd(0,0,0,0)}),wd=function(e,t){if(t===void 0&&(t=!1),Hr.has(e)&&!t)return Hr.get(e);if(xd(e))return Hr.set(e,Uu),Uu;var n=getComputedStyle(e),r=eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!H0&&n.boxSizing==="border-box",i=W0.test(n.writingMode||""),s=!r&&Hu.test(n.overflowY||""),o=!r&&Hu.test(n.overflowX||""),l=r?0:At(n.paddingTop),u=r?0:At(n.paddingRight),c=r?0:At(n.paddingBottom),m=r?0:At(n.paddingLeft),f=r?0:At(n.borderTopWidth),p=r?0:At(n.borderRightWidth),g=r?0:At(n.borderBottomWidth),h=r?0:At(n.borderLeftWidth),y=m+u,b=l+c,w=h+p,A=f+g,k=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-w-e.clientWidth:0,T=a?y+w:0,j=a?b+A:0,z=r?r.width:At(n.width)-T-E,N=r?r.height:At(n.height)-j-k,$=z+y+E+w,M=N+b+k+A,C=vn({devicePixelContentBoxSize:zn(Math.round(z*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:zn($,M,i),contentBoxSize:zn(z,N,i),contentRect:new Cd(m,l,z,N)});return Hr.set(e,C),C},Ed=function(e,t,n){var r=wd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Br.DEVICE_PIXEL_CONTENT_BOX:return s;case Br.BORDER_BOX:return a;default:return i}},U0=function(){function e(t){var n=wd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=vn([n.borderBoxSize]),this.contentBoxSize=vn([n.contentBoxSize]),this.devicePixelContentBoxSize=vn([n.devicePixelContentBoxSize])}return e}(),kd=function(e){if(xd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},V0=function(){var e=1/0,t=[];gn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new U0(u.target),m=kd(u.target);o.push(c),u.lastReportedSize=Ed(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},Vu=function(e){gn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(kd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},K0=function(){var e=0;for(Vu(e);I0();)e=V0(),Vu(e);return $0()&&L0(),e>0},gi,_d=[],Z0=function(){return _d.splice(0).forEach(function(e){return e()})},Y0=function(e){if(!gi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Z0()}).observe(n,r),gi=function(){n.textContent="".concat(t?t--:t++)}}_d.push(e),gi()},G0=function(e){Y0(function(){requestAnimationFrame(e)})},la=0,Q0=function(){return!!la},J0=250,X0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ku=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Zu=function(e){return e===void 0&&(e=0),Date.now()+e},vi=!1,eb=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=J0),!vi){vi=!0;var r=Zu(t);G0(function(){var a=!1;try{a=K0()}finally{if(vi=!1,t=r-Zu(),!Q0())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,X0)};document.body?n():gr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ku.forEach(function(n){return gr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ku.forEach(function(n){return gr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),ps=new eb,Yu=function(e){!la&&e>0&&ps.start(),la+=e,!la&&ps.stop()},tb=function(e){return!eo(e)&&!q0(e)&&getComputedStyle(e).display==="inline"},nb=function(){function e(t,n){this.target=t,this.observedBox=n||Br.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Ed(this.target,this.observedBox,!0);return tb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),rb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Ur=new WeakMap,Gu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Vr=function(){function e(){}return e.connect=function(t,n){var r=new rb(t,n);Ur.set(t,r)},e.observe=function(t,n,r){var a=Ur.get(t),i=a.observationTargets.length===0;Gu(a.observationTargets,n)<0&&(i&&gn.push(a),a.observationTargets.push(new nb(n,r&&r.box)),Yu(1),ps.schedule())},e.unobserve=function(t,n){var r=Ur.get(t),a=Gu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&gn.splice(gn.indexOf(r),1),r.observationTargets.splice(a,1),Yu(-1))},e.disconnect=function(t){var n=this,r=Ur.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),ab=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.");Vr.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(!Wu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.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(!Wu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.unobserve(this,t)},e.prototype.disconnect=function(){Vr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var ib=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),bi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Bd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:ib?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},to={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 Kr=1;Kr<20;Kr++)to["f"+Kr]=111+Kr;function Va(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Ad(s,t)}),a=function(o){return r.some(function(l){return Fd(l,o)})},i=n==null?a:a(n);return i}function sb(e,t){return Va(e,t)}function ob(e,t){return Va(e,{byKey:!0},t)}function Ad(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in bi)r[bi[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 f=m.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var g=no(f),h=bi[g];if(f.length>1&&!h&&!Bd[f]&&!to[g])throw new TypeError('Unknown modifier: "'+f+'"');(i===1||!h)&&(n?r.key=g:r.which=Td(f)),h&&(r[h]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Fd(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 Td(e){e=no(e);var t=to[e]||e.toUpperCase().charCodeAt(0);return t}function no(e){return e=e.toLowerCase(),e=Bd[e]||e,e}var ub=Vt.default=Va,yi=Vt.isHotkey=Va;Vt.isCodeHotkey=sb;Vt.isKeyHotkey=ob;Vt.parseHotkey=Ad;Vt.compareHotkey=Fd;Vt.toKeyCode=Td;Vt.toKeyName=no;function lb(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 Kn(e,t){if(e==null)return{};var n=lb(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 Ar(e){"@babel/helpers - typeof";return Ar=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},Ar(e)}function cb(e,t){if(Ar(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ar(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function db(e){var t=cb(e,"string");return Ar(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=db(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=x.createContext(null),on=()=>{var e=x.useContext(ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Sd=parseInt(x.version.split(".")[0],10),fb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),st=typeof navigator<"u"&&/Android/.test(navigator.userAgent),In=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),hr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),hb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),jd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),mb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),pb=st&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),gb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),vb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),bb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zt=(!mb||!pb)&&!hb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ao=new WeakMap,io=new WeakMap,Od=new WeakMap,da=new WeakMap,gs=new WeakMap,Fr=new WeakMap,bn=new WeakMap,ka=new WeakMap,Ka=new WeakMap,vs=new WeakMap,en=new WeakMap,mn=new WeakMap,vr=new WeakMap,bs=new WeakMap,so=new WeakMap,kt=new WeakMap,Wt=new WeakMap,ct=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,Pd=new WeakMap,Zn=Symbol("placeholder"),Rd=Symbol("mark-placeholder"),yb=globalThis.Text,oo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Db=e=>nn(e)&&e.nodeType===8,Ct=e=>nn(e)&&e.nodeType===1,nn=e=>{var t=oo(e);return!!t&&e instanceof t.Node},ys=e=>{var t=e&&e.anchorNode&&oo(e.anchorNode);return!!t&&e instanceof t.Selection},Nd=e=>nn(e)&&e.nodeType===3,Cb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,xb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Md(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Eb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},wb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Md=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Db(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},Eb=(e,t,n)=>{var[r]=Md(e,t,n);return r},Id=e=>{var t="";if(Nd(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Id(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
103
- `)}return t},kb=/data-slate-fragment="(.+?)"/m,_b=e=>{var t=e.getData("text/html"),[,n]=t.match(kb)||[];return n},uo=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.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:uo(e,i,n)},Bb=0;class Ab{constructor(){xt(this,"id",void 0),this.id="".concat(Bb++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=so.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);en.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&Q.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.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=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(de.isElement(i)&&v.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=v.point(e,s,{edge:l?"start":"end"}),c=l?v.before(e,u):v.after(e,u);if(c){var m=v.range(e,c);return m}}var f,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)f=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(f=p.createRange(),f.setStart(g.offsetNode,g.offset),f.setEnd(g.offsetNode,g.offset))}if(!f)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var h=J.toSlateRange(e,f,{exactMatch:!1,suppressThrow:!1});return h},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new Ab,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=io.get(r);if(a==null){if(v.isEditor(r))return n;break}var i=ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ge.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!en.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(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(Q.select(t,v.start(t,[])),t.onChange()),en.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Od.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=J.toDOMNode(t,t),s;try{s=Ct(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)=>nn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return v.hasPath(e,n.path)&&v.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!mn.get(e),isFocused:e=>!!en.get(e),isReadOnly:e=>!!vs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(vs.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return de.isElement(n)&&v.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Ka.get(e),r=v.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ge.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=v.node(e,t.path),r=J.toDOMNode(e,n),a;v.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,f=u.getAttribute("data-slate-length"),p=f==null?m:parseInt(f,10),g=o+p,h=s[l+1];if(t.offset===g&&h!==null&&h!==void 0&&h.hasAttribute("data-slate-mark-placeholder")){var y,b=h.childNodes[0];a=[b instanceof yb?b:h,(y=h.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var w=Math.min(m,Math.max(0,t.offset-o));a=[c,w];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ge.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=U.isBackward(t),i=J.toDOMPoint(e,n),s=U.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[m,f]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),h=Ct(m)?m:m.parentElement,y=!!h.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(m,y?1:f),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Fr.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:xb(t),o=i.parentNode,l=null,u=0;if(o){var c,m,f=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&f.contains(p)?p:null,h=o.closest("[data-slate-leaf]"),y=null;if(h){if(l=h.closest('[data-slate-node="text"]'),l){var b=J.getWindow(e),w=b.document.createRange();w.setStart(l,0),w.setEnd(i,s);var A=w.cloneContents(),k=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];k.forEach(F=>{if(st&&!r&&F.hasAttribute("data-slate-zero-width")&&F.textContent.length>0&&F.textContext!=="\uFEFF"){F.textContent.startsWith("\uFEFF")&&(F.textContent=F.textContent.slice(1));return}F.parentNode.removeChild(F)}),u=A.textContent.length,y=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),T=0;T<E.length;T++){var j=E[T];if(J.hasDOMNode(e,j)){h=j;break}}h?(l=h.closest('[data-slate-node="text"]'),y=h,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(F=>{u-=F.textContent.length})):u=1}y&&u===y.textContent.length&&st&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||In&&(m=y.textContent)!==null&&m!==void 0&&m.endsWith(`
102
+ */function Zo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xe(e){var t,n;return Zo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Zo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var ad=Symbol.for("immer-nothing"),Yo=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Um=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 dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Um[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 Vn=Object.getPrototypeOf;function yn(e){return!!e&&!!e[gt]}function Dn(e){var t;return e?id(e)||Array.isArray(e)||!!e[Yo]||!!((t=e.constructor)!=null&&t[Yo])||Wa(e)||Ha(e):!1}var Vm=Object.prototype.constructor.toString();function id(e){if(!e||typeof e!="object")return!1;const t=Vn(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)===Vm}function Da(e,t){qa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Wa(e)?2:Ha(e)?3:0}function ls(e,t){return qa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function sd(e,t,n){const r=qa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Km(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wa(e){return e instanceof Map}function Ha(e){return e instanceof Set}function cn(e){return e.copy_||e.base_}function cs(e,t){if(Wa(e))return new Map(e);if(Ha(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&id(e))return Vn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Vn(e),n)}function Ks(e,t=!1){return Ua(e)||yn(e)||!Dn(e)||(qa(e)>1&&(e.set=e.add=e.clear=e.delete=Zm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ks(r,!0))),e}function Zm(){dt(2)}function Ua(e){return Object.isFrozen(e)}var Ym={};function Cn(e){const t=Ym[e];return t||dt(0,e),t}var Er;function od(){return Er}function Gm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Go(e,t){t&&(Cn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ds(e){fs(e),e.drafts_.forEach(Qm),e.drafts_=null}function fs(e){e===Er&&(Er=e.parent_)}function Qo(e){return Er=Gm(Er,e)}function Qm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(ds(t),dt(4)),Dn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Cn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ad?e:void 0}function Ca(e,t,n){if(Ua(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>Xo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(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),Da(i,(o,l)=>Xo(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Cn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Xo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),yn(a)){const o=i&&t&&t.type_!==3&&!ls(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(sd(n,r,l),yn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Dn(a)&&!Ua(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ks(t,n)}function Jm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:od(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Zs;n&&(a=[r],i=kr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Zs={get(e,t){if(t===gt)return e;const n=cn(e);if(!ls(n,t))return Xm(e,n,t);const r=n[t];return e.finalized_||!Dn(r)?r:r===ci(e.base_,t)?(di(e),e.copy_[t]=ms(r,e)):r},has(e,t){return t in cn(e)},ownKeys(e){return Reflect.ownKeys(cn(e))},set(e,t,n){const r=ud(cn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ci(cn(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Km(n,a)&&(n!==void 0||ls(e.base_,t)))return!0;di(e),hs(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 ci(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,di(e),hs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Vn(e.base_)},setPrototypeOf(){dt(12)}},kr={};Da(Zs,(e,t)=>{kr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});kr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),kr.set.call(this,e,t,void 0)};kr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Zs.set.call(this,e[0],t,n,e[0])};function ci(e,t){const n=e[gt];return(n?cn(n):e)[t]}function Xm(e,t,n){var a;const r=ud(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function ud(e,t){if(!(t in e))return;let n=Vn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Vn(n)}}function hs(e){e.modified_||(e.modified_=!0,e.parent_&&hs(e.parent_))}function di(e){e.copy_||(e.copy_=cs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ep=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"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(Dn(t)){const i=Qo(this),s=ms(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?ds(i):fs(i)}return Go(i,r),Jo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===ad&&(a=void 0),this.autoFreeze_&&Ks(a,!0),r){const i=[],s=[];Cn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(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){Dn(e)||dt(8),yn(e)&&(e=tp(e));const t=Qo(this),n=ms(e,void 0);return n[gt].isManual_=!0,fs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Go(r,t),Jo(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=Cn("Patches").applyPatches_;return yn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ms(e,t){const n=Wa(e)?Cn("MapSet").proxyMap_(e,t):Ha(e)?Cn("MapSet").proxySet_(e,t):Jm(e,t);return(t?t.scope_:od()).drafts_.push(n),n}function tp(e){return yn(e)||dt(10,e),ld(e)}function ld(e){if(!Dn(e)||Ua(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=cs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=cs(e,!0);return Da(n,(r,a)=>{sd(n,r,ld(a))}),t&&(t.finalized_=!1),n}var vt=new ep,Ys=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var eu=vt.createDraft.bind(vt),tu=vt.finishDraft.bind(vt),np={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()}}},rp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=xe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=U.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,pr=new WeakMap,cd=new WeakMap,nu=new WeakMap,ru=new WeakMap,au=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:h}=t;if(P.equals(m,h))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var p=h.slice();return P.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else P.isSibling(m,h)&&(P.isAncestor(h,r)||P.equals(h,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(h,r)||P.equals(h,r)||P.isAncestor(h,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):P.endsBefore(m,r)&&(P.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function ip(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sp(e){var t=ip(e,"string");return _r(t)==="symbol"?t:String(t)}function ot(e,t,n){return t=sp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 or(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){ot(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 op=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of U.points(t))t[l]=xe.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:m}=n;if(m.length===0)break;var h=se.leaf(e,u),p=h.text.slice(0,c),g=h.text.slice(c);if(h.text=p+m+g,t)for(var[f,y]of U.points(t))t[y]=xe.transform(f,n);break}case"merge_node":{var{path:b}=n,w=se.get(e,b),A=P.previous(b),k=se.get(e,A),E=se.parent(e,b),F=b[b.length-1];if(fe.isText(w)&&fe.isText(k))k.text+=w.text;else if(!fe.isText(w)&&!fe.isText(k))k.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Ge.stringify(w)," ").concat(Ge.stringify(k)));if(E.children.splice(F,1),t)for(var[j,z]of U.points(t))t[z]=xe.transform(j,n);break}case"move_node":{var{path:N,newPath:$}=n;if(P.isAncestor(N,$))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat($,"] because the destination is inside itself."));var M=se.get(e,N),C=se.parent(e,N),B=N[N.length-1];C.children.splice(B,1);var T=P.transform(N,n),R=se.get(e,P.parent(T)),L=T[T.length-1];if(R.children.splice(L,0,M),t)for(var[q,oe]of U.points(t))t[oe]=xe.transform(q,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],H=se.parent(e,ne);if(H.children.splice(D,1),t)for(var[X,_]of U.points(t)){var S=xe.transform(X,n);if(t!=null&&S!=null)t[_]=S;else{var W=void 0,I=void 0;for(var[K,te]of se.texts(e))if(P.compare(te,ne)===-1)W=[K,te];else{I=[K,te];break}var ee=!1;W&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(W[1],ne).length<P.common(I[1],ne).length),W&&!ee?(X.path=W[1],X.offset=W[0].text.length):I?(X.path=I[1],X.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:le,text:V}=n;if(V.length===0)break;var he=se.leaf(e,ae),pe=he.text.slice(0,le),we=he.text.slice(le+V.length);if(he.text=pe+we,t)for(var[je,Oe]of U.points(t))t[Oe]=xe.transform(je,n);break}case"set_node":{var{path:Qe,properties:Ze,newProperties:Ye}=n;if(Qe.length===0)throw new Error("Cannot set properties on the root node!");var nt=se.get(e,Qe);for(var Fe in Ye){if(Fe==="children"||Fe==="text")throw new Error('Cannot set the "'.concat(Fe,'" property of nodes!'));var He=Ye[Fe];He==null?delete nt[Fe]:nt[Fe]=He}for(var ze in Ze)Ye.hasOwnProperty(ze)||delete nt[ze];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!U.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ge.stringify(Y)," when there is no current selection."));t=or({},Y)}for(var ie in Y){var me=Y[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:Ce,properties:Ve}=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 Ke=se.get(e,ve),mt=se.parent(e,ve),It=ve[ve.length-1],Et;if(fe.isText(Ke)){var Je=Ke.text.slice(0,Ce),Bt=Ke.text.slice(Ce);Ke.text=Je,Et=or(or({},Ve),{},{text:Bt})}else{var pt=Ke.children.slice(0,Ce),ei=Ke.children.slice(Ce);Ke.children=pt,Et=or(or({},Ve),{},{children:ei})}if(mt.children.splice(It+1,0,Et),t)for(var[ar,Mr]of U.points(t))t[Mr]=xe.transform(ar,n);break}}return t},up={transform(e,t){e.children=eu(e.children);var n=e.selection&&eu(e.selection);try{n=op(e,n,t)}finally{e.children=tu(e.children),n?e.selection=yn(n)?tu(n):n:e.selection=null}}},lp={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)}},cp={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)}},dd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Xe(r)&&Xe(a)){if(!dd(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 dp(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 Ut(e,t){if(e==null)return{};var n=dp(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 fp=["anchor","focus"];function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?su(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var U={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return U.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=U.edges(e);return t},equals(e,t){return xe.equals(e.anchor,t.anchor)&&xe.equals(e.focus,t.focus)},includes(e,t){if(U.isRange(t)){if(U.includes(e,t.anchor)||U.includes(e,t.focus))return!0;var[n,r]=U.edges(e),[a,i]=U.edges(t);return xe.isBefore(n,a)&&xe.isAfter(r,i)}var[s,o]=U.edges(e),l=!1,u=!1;return xe.isPoint(t)?(l=xe.compare(t,s)>=0,u=xe.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=Ut(e,fp),[r,a]=U.edges(e),[i,s]=U.edges(t),o=xe.isBefore(r,i)?i:r,l=xe.isBefore(a,s)?a:s;return xe.isBefore(l,o)?null:hp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return xe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return xe.equals(t,n)},isExpanded(e){return!U.isCollapsed(e)},isForward(e){return!U.isBackward(e)},isRange(e){return Xe(e)&&xe.isPoint(e.anchor)&&xe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=U.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=U.isCollapsed(r);U.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?U.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=xe.transform(r.anchor,t,{affinity:i}),u=xe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ou=e=>Xe(e)&&se.isNodeList(e.children)&&!v.isEditor(e),de={isAncestor(e){return Xe(e)&&se.isNodeList(e.children)},isElement:ou,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 ou(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},mp=["children"],pp=["text"],uu=new WeakMap,se={ancestor(e,t){var n=se.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(Ge.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=se.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(Ge.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ge.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(v.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ge.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Ut(e,mp);return t}else{var t=Ut(e,pp);return t}},first(e,t){for(var n=t.slice(),r=se.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(Ge.stringify(e)));var n=Ys({children:e.children},r=>{var[a,i]=U.edges(t),s=se.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!U.includes(t,p)}});for(var[,o]of s){if(!U.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=se.leaf(r,o);m.text=m.text.slice(a.offset)}}v.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(Ge.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)||v.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=uu.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return uu.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.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=se.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(Ge.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=se.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=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=se.get(e,o);continue}o=P.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=se.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(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))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 Ie(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){ot(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 Xt={isNodeOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Xe(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&se.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)&&Xe(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&se.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)&&Xe(e.properties)&&Xe(e.newProperties);case"set_selection":return e.properties===null&&U.isRange(e.newProperties)||e.newProperties===null&&U.isRange(e.properties)||Xe(e.properties)&&Xe(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&Xe(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Xt.isOperation(t))},isSelectionOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ie(Ie({},e),{},{type:"remove_node"});case"insert_text":return Ie(Ie({},e),{},{type:"remove_text"});case"merge_node":return Ie(Ie({},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 Ie(Ie({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ie(Ie({},e),{},{path:r,newPath:a})}case"remove_node":return Ie(Ie({},e),{},{type:"insert_node"});case"remove_text":return Ie(Ie({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ie(Ie({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ie(Ie({},e),{},{properties:l,newProperties:null}):l==null?Ie(Ie({},e),{},{properties:null,newProperties:o}):Ie(Ie({},e),{},{properties:l,newProperties:o})}case"split_node":return Ie(Ie({},e),{},{type:"merge_node",path:P.next(e.path)})}}},cu=new WeakMap,gp=e=>{var t=cu.get(e);if(t!==void 0)return t;if(!Xe(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||Xe(e.marks))&&(e.selection===null||U.isRange(e.selection))&&se.isNodeList(e.children)&&Xt.isOperationList(e.operations);return cu.set(e,n),n},v={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 gp(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)}},vp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var xe={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 xe.compare(e,t)===1},isBefore(e,t){return xe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return Xe(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(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,fu(fu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},hu=void 0,Ge={setScrubber(e){hu=e},stringify(e){return JSON.stringify(e,hu)}},bp=["text"],yp=["anchor","focus"];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 Lt(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){ot(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,bp);return s}return dd(r?a(e):e,r?a(t):t)},isText(e){return Xe(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=[Lt({},e)];for(var r of t){var a=Ut(r,yp),[i,s]=U.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var m of n){var{length:h}=m.text,p=l;if(l+=h,u<=p&&l<=c){Object.assign(m,a),o.push(m);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(m);continue}var g=m,f=void 0,y=void 0;if(c<l){var b=c-p;y=Lt(Lt({},g),{},{text:g.text.slice(b)}),g=Lt(Lt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var w=u-p;f=Lt(Lt({},g),{},{text:g.text.slice(0,w)}),g=Lt(Lt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),f&&o.push(f),o.push(g),y&&o.push(y)}n=o}return n}},Gs=e=>e.selection?e.selection:e.children.length>0?v.end(e,[]):[0],rr=(e,t)=>{var[n]=v.node(e,t);return r=>r===n},Qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?kp(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var c of a){var m=c.codePointAt(0);if(!m)break;var h=Mp(c,m);if([i,s]=r?[s,h]:[h,i],Nn(i,De.ZWJ)&&Nn(s,De.ExtPict)&&(r?l=pu(t.substring(0,o)):l=pu(t.substring(0,t.length-o)),!l)||Nn(i,De.RI)&&Nn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=qp(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&$p(i,s))break;o+=c.length}return o||1},Dp=/\s/,Cp=/[\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]/,xp=/['\u2018\u2019]/,wp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Qs(t,n),[s,o]=Js(t,i,n);if(Ep(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Js=(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)]},Ep=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Dp.test(t))return!1;if(xp.test(t)){var a=Qs(n,r),[i,s]=Js(n,a,r);if(e(i,s,r))return!0}return!Cp.test(t)},kp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Bp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(_p(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},_p=e=>e>=55296&&e<=56319,Bp=e=>e>=56320&&e<=57343,De;(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"})(De||(De={}));var Ap=/^(?:[\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])$/,Fp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Tp=/^(?:[\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])$/,Sp=/^[\u1100-\u115F\uA960-\uA97C]$/,jp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Op=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Pp=/^[\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]$/,Rp=/^[\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]$/,Np=/^(?:[\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])$/,Mp=(e,t)=>{var n=De.Any;return e.search(Ap)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(Fp)!==-1&&(n|=De.Prepend),e.search(Tp)!==-1&&(n|=De.SpacingMark),e.search(Sp)!==-1&&(n|=De.L),e.search(jp)!==-1&&(n|=De.V),e.search(Op)!==-1&&(n|=De.T),e.search(Pp)!==-1&&(n|=De.LV),e.search(Rp)!==-1&&(n|=De.LVT),e.search(Np)!==-1&&(n|=De.ExtPict),n};function Nn(e,t){return(e&t)!==0}var Ip=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function $p(e,t){return Ip.findIndex(n=>Nn(e,n[0])&&Nn(t,n[1]))===-1}var Lp=/(?:[\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$/,pu=e=>e.search(Lp)!==-1,zp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,qp=e=>{var t=e.match(zp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Wp={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Gs(e)}=n;if(P.isPath(a)&&(a=v.range(e,a)),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var i=U.end(a);if(!r&&v.void(e,{at:i}))return;var s=U.start(a),o=v.pointRef(e,s),l=v.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&v.void(e,{at:a})||v.elementReadOnly(e,{at:a}))){var{path:m,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qr(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){ot(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 Q=qr(qr(qr(qr({},up),lp),cp),Wp),ua=new WeakMap,Hp=e=>ua.get(e)||!1,Up=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function fd(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),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);wa.set(e,i),Ea.set(e,s)}var Vp=(e,t)=>{for(var n of v.pathRefs(e))np.transform(n,t);for(var r of v.pointRefs(e))rp.transform(r,t);for(var a of v.rangeRefs(e))ap.transform(a,t);if(!Hp(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;fd(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),v.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),pr.get(e)||(pr.set(e,!0),Promise.resolve().then(()=>{pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Kp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(se.nodes(r),$=>{var[,M]=$;return a.concat(M)});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 h=[],p=[];for(var g of P.ancestors(c)){var f=P.transform(g,t);h.push(f)}for(var y of P.ancestors(m)){var b=P.transform(y,t);p.push(b)}var w=p[p.length-1],A=m[m.length-1],k=w.concat(A);return[...h,...p,k]}case"remove_node":{var{path:E}=t,F=P.ancestors(E);return[...F]}case"split_node":{var{path:j}=t,z=P.levels(j),N=P.next(j);return[...z,N]}default:return[]}},Zp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Yp=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=v.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=se.get(e,r);if(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],m=o===n.children.length-1,h=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(h!==i)Q.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 p={text:""};Q.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Gp=(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},Qp=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=v.path(t,i),l=a==="lowest";for(var[u,c]of v.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(U.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 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){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,h)=>{if(!fe.isText(m))return!1;var[p,g]=v.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=U.isExpanded(r),s=!1;if(!i){var[o,l]=v.node(e,r);if(o&&a(o,l)){var[u]=v.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=bu(bu({},v.marks(e)||{}),{},{[t]:n});e.marks=c,pr.get(e)||e.onChange()}}};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.point(t,n,{edge:"end"}),i=v.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,Du(Du({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.start(t,[]),i=v.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,xu(xu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},tg=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},ng=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t})},rg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&U.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},ag=(e,t)=>[v.start(e,t),v.end(e,t)];function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,Eu(Eu({},n),{},{match:r=>de.isElement(r)&&v.isElementReadOnly(t,r)}))},sg=(e,t)=>v.point(e,t,{edge:"end"}),og=(e,t)=>{var n=v.path(e,t,{edge:"start"});return v.node(e,n)},ug=(e,t)=>{var n=v.range(e,t);return se.fragment(e,n)};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 _u(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){ot(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 lg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,_u(_u({},n),{},{match:r=>de.isElement(r)&&v.isVoid(t,r)}))},cg=(e,t)=>t.children.some(n=>de.isElement(n)&&v.isBlock(e,n)),dg=(e,t)=>t.children.some(n=>fe.isText(n)||v.isInline(e,n)),fg=(e,t)=>se.has(e,t),hg=(e,t)=>t.children.every(n=>fe.isText(n)),mg=e=>{Q.splitNodes(e,{always:!0})},pg=(e,t,n)=>{Q.insertNodes(e,t,n)},gg=e=>{Q.splitNodes(e,{always:!0})};function Bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function vg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bg=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=vg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},yg=(e,t)=>!e.isInline(t),Dg=(e,t,n)=>v.isStart(e,t,n)||v.isEnd(e,t,n),Cg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},xg=(e,t,n)=>{var r=v.end(e,n);return xe.equals(t,r)},wg=e=>{var t=cd.get(e);return t===void 0?!0:t},Eg=(e,t,n)=>{if(t.offset!==0)return!1;var r=v.start(e,n);return xe.equals(t,r)},kg=(e,t)=>{var n=v.path(e,t,{edge:"end"});return v.node(e,n)},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=se.leaf(t,a);return[i,a]};function Bg(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=v.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&v.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Ag=["text"],Fg=["text"],Tg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(U.isExpanded(r)){var s=v.isEnd(t,a,a.path);if(s){var o=v.after(t,a);o&&(a=o)}var[l]=v.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,Ag);return c}else return{}}var{path:m}=a,[h]=v.leaf(t,m);if(a.offset===0){var p=v.previous(t,{at:m,match:fe.isText}),g=v.above(t,{match:k=>de.isElement(k)&&v.isVoid(t,k)&&t.markableVoid(k)});if(!g){var f=v.above(t,{match:k=>de.isElement(k)&&v.isBlock(t,k)});if(p&&f){var[y,b]=p,[,w]=f;P.isAncestor(w,b)&&(h=y)}}}var A=Ut(h,Fg);return A},Sg=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=v.after(t,s,{voids:a});if(o){var[,l]=v.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]=v.parent(t,s);i=h=>c.children.includes(h)}else i=()=>!0;var[m]=v.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=se.get(t,a);return[i,a]};function Og(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,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(vp.isSpan(n))u=n[0],c=n[1];else{var m=v.path(e,n,{edge:"start"}),h=v.path(e,n,{edge:"end"});u=i?h:m,c=i?m:h}var p=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return de.isElement(E)?!!(!s&&(v.isVoid(e,E)||v.isElementReadOnly(e,E))||o&&!v.isSelectable(e,E)):!1}}),g=[],f;for(var[y,b]of p)if(!(o&&de.isElement(y)&&!v.isSelectable(e,y))){var w=f&&P.compare(b,f[1])===0;if(!(r==="highest"&&w)){if(!l(y,b)){if(a&&!w&&fe.isText(y))return;continue}if(r==="lowest"&&w){f=[y,b];continue}var A=r==="lowest"?f:[y,b];A&&(a?g.push(A):yield A),f=[y,b]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var Pg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var m=i(c).pop(),h=m.join(",");return s(c).delete(h),m};if(v.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,m]=c;return m}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&v.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var m=v.node(t,c),[h,p]=m;de.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:f,operation:a}))return;var b=o(t);if(se.has(t,b)){var w=v.node(t,b);t.normalizeNode(w,{operation:a})}y++,g=i(t)}})}},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=P.parent(a),s=v.node(t,i);return s},Ng=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=v.pathRefs(t);return l.delete(i),i.current=null,o}},s=v.pathRefs(t);return s.add(i),i},Mg=e=>{var t=nu.get(e);return t||(t=new Set,nu.set(e,t)),t},Ig=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]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return U.isRange(n)&&(i==="start"?n=U.start(n):i==="end"?n=U.end(n):n=P.common(n.anchor.path,n.focus.path)),xe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},$g=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=v.pointRefs(t);return l.delete(i),i.current=null,o}},s=v.pointRefs(t);return s.add(i),i},Lg=e=>{var t=ru.get(e);return t||(t=new Set,ru.set(e,t)),t},zg=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]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.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(U.isRange(n)){var[u,c]=U.edges(n);return a==="start"?u:c}return n};function qg(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=v.range(e,n),[l,u]=U.edges(o),c=a?u:l,m=!1,h="",p=0,g=0,f=0;for(var[y,b]of v.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield v.start(e,b);continue}if(e.isInline(y))continue;if(v.hasInlines(e,y)){var w=P.isAncestor(b,u.path)?u:v.end(e,b),A=P.isAncestor(b,l.path)?l:v.start(e,b);h=v.string(e,{anchor:A,focus:w},{voids:i}),m=!0}}if(fe.isText(y)){var k=P.equals(b,c.path);for(k?(g=a?c.offset:y.text.length-c.offset,f=c.offset):(g=y.text.length,f=a?g:0),(k||m||r==="offset")&&(yield{path:b,offset:f},m=!1);;){if(p===0){if(h==="")break;p=E(h,r,a),h=Js(h,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:f}}}}function E(F,j,z){return j==="character"?Qs(F,z):j==="word"?wp(F,z):j==="line"||j==="block"?F.length:1}}()}var Wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=v.before(t,s,{voids:a});if(o){var[,l]=v.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]=v.parent(t,s);i=h=>c.children.includes(h)}else i=()=>!0;var[m]=v.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},Hg=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=v.rangeRefs(t);return l.delete(i),i.current=null,o}},s=v.rangeRefs(t);return s.add(i),i},Ug=e=>{var t=au.get(e);return t||(t=new Set,au.set(e,t)),t},Vg=(e,t,n)=>{if(U.isRange(t)&&!n)return t;var r=v.start(e,t),a=v.end(e,n||t);return{anchor:r,focus:a}};function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Kg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,m)=>{if(!fe.isText(c))return!1;var[h,p]=v.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},a=U.isExpanded(n),i=!1;if(!a){var[s,o]=v.node(e,n);if(s&&r(s,o)){var[l]=v.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Kg({},v.marks(e)||{});delete u[t],e.marks=u,pr.get(e)||e.onChange()}}},Yg=(e,t)=>{cd.set(e,t)},Gg=(e,t)=>v.point(e,t,{edge:"start"}),Qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=v.range(t,n),[s,o]=U.edges(i),l="";for(var[u,c]of v.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},Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=U.edges(n);if(i.offset!==0||s.offset!==0||U.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=v.above(t,{at:s,match:g=>de.isElement(g)&&v.isBlock(t,g),voids:a}),l=o?o[1]:[],u=v.start(t,i),c={anchor:u,focus:s},m=!0;for(var[h,p]of v.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(h.text!==""||P.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:i,focus:s}},Xg=(e,t)=>{var n=v.isNormalizing(e);v.setNormalizing(e,!1);try{t()}finally{v.setNormalizing(e,n)}v.normalize(e)},ev=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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(U.isRange(u)&&U.isCollapsed(u)&&(m=!0,u=u.anchor),xe.isPoint(u)){var h=v.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var g={unit:s,distance:o},f=i?v.before(t,u,g)||v.start(t,[]):v.after(t,u,g)||v.end(t,[]);u={anchor:u,focus:f},c=!0}}if(P.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!U.isCollapsed(u)){if(!c){var[,y]=U.edges(u),b=v.end(t,[]);xe.equals(y,b)||(u=v.unhangRange(t,u,{voids:l}))}var[w,A]=U.edges(u),k=v.above(t,{match:pe=>de.isElement(pe)&&v.isBlock(t,pe),at:w,voids:l}),E=v.above(t,{match:pe=>de.isElement(pe)&&v.isBlock(t,pe),at:A,voids:l}),F=k&&E&&!P.equals(k[1],E[1]),j=P.equals(w.path,A.path),z=l?null:(r=v.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:v.elementReadOnly(t,{at:w,mode:"highest"}),N=l?null:(a=v.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:v.elementReadOnly(t,{at:A,mode:"highest"});if(z){var $=v.before(t,w);$&&k&&P.isAncestor(k[1],$.path)&&(w=$)}if(N){var M=v.after(t,A);M&&E&&P.isAncestor(E[1],M.path)&&(A=M)}var C=[],B;for(var T of v.nodes(t,{at:u,voids:l})){var[R,L]=T;B&&P.compare(L,B)===0||(!l&&de.isElement(R)&&(v.isVoid(t,R)||v.isElementReadOnly(t,R))||!P.isCommon(L,w.path)&&!P.isCommon(L,A.path))&&(C.push(T),B=L)}var q=Array.from(C,pe=>{var[,we]=pe;return v.pathRef(t,we)}),oe=v.pointRef(t,w),ne=v.pointRef(t,A),D="";if(!j&&!z){var H=oe.current,[X]=v.leaf(t,H),{path:_}=H,{offset:S}=w,W=X.text.slice(S);W.length>0&&(t.apply({type:"remove_text",path:_,offset:S,text:W}),D=W)}if(q.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>Q.removeNodes(t,{at:pe,voids:l})),!N){var I=ne.current,[K]=v.leaf(t,I),{path:te}=I,ee=j?w.offset:0,ae=K.text.slice(ee,A.offset);ae.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:ae}),D=ae)}!j&&F&&ne.current&&oe.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),m&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,D.slice(0,D.length-o));var le=oe.unref(),V=ne.unref(),he=i?le||V:V||le;n.at==null&&he&&Q.select(t,he)}}})},tv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Gs(t),batchDirty:o=!0}=r;if(n.length){if(U.isRange(s))if(a||(s=v.unhangRange(t,s,{voids:i})),U.isCollapsed(s))s=s.anchor;else{var[,l]=U.edges(s);if(!i&&v.void(t,{at:l}))return;var u=v.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=v.start(t,s));if(!(!i&&v.void(t,{at:s}))){var c=v.above(t,{at:s,match:W=>de.isElement(W)&&v.isInline(t,W),mode:"highest",voids:i});if(c){var[,m]=c;if(v.isEnd(t,s,m)){var h=v.after(t,m);s=h}else if(v.isStart(t,s,m)){var p=v.before(t,m);s=p}}var g=v.above(t,{match:W=>de.isElement(W)&&v.isBlock(t,W),at:s,voids:i}),[,f]=g,y=v.isStart(t,s,f),b=v.isEnd(t,s,f),w=y&&b,A=!y||y&&b,k=!b,[,E]=se.first({children:n},[]),[,F]=se.last({children:n},[]),j=[],z=W=>{var[I,K]=W,te=K.length===0;return te?!1:w?!0:!(A&&P.isAncestor(K,E)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||k&&P.isAncestor(K,F)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var N of se.nodes({children:n},{pass:z}))z(N)&&j.push(N);var $=[],M=[],C=[],B=!0,T=!1;for(var[R]of j)de.isElement(R)&&!t.isInline(R)?(B=!1,T=!0,M.push(R)):B?$.push(R):C.push(R);var[L]=v.nodes(t,{at:s,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i}),[,q]=L,oe=v.isStart(t,s,q),ne=v.isEnd(t,s,q),D=v.pathRef(t,b&&!C.length?P.next(f):f),H=v.pathRef(t,ne?P.next(q):q);Q.splitNodes(t,{at:s,match:W=>T?de.isElement(W)&&v.isBlock(t,W):fe.isText(W)||v.isInline(t,W),mode:T?"lowest":"highest",always:T&&(!y||$.length>0)&&(!b||C.length>0),voids:i});var X=v.pathRef(t,!oe||oe&&ne?P.next(q):q);if(Q.insertNodes(t,$,{at:X.current,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),w&&!$.length&&M.length&&!C.length&&Q.delete(t,{at:f,voids:i}),Q.insertNodes(t,M,{at:D.current,match:W=>de.isElement(W)&&v.isBlock(t,W),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,C,{at:H.current,match:W=>fe.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(C.length>0&&H.current?_=P.previous(H.current):M.length>0&&D.current?_=P.previous(D.current):X.current&&(_=P.previous(X.current)),_){var S=v.end(t,_);Q.select(t,S)}}X.unref(),D.unref(),H.unref()}}})},nv=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")Q.select(t,a.anchor);else if(r==="focus")Q.select(t,a.focus);else if(r==="start"){var[i]=U.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=U.edges(a);Q.select(t,s)}}else return},rv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},av=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=U.isBackward(r)?"focus":"anchor"),o==="end"&&(o=U.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?v.before(t,l,c):v.after(t,l,c);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?v.before(t,u,c):v.after(t,u,c);p&&(m.focus=p)}Q.setSelection(t,m)}},iv=(e,t)=>{var{selection:n}=e;if(t=v.range(e,t),n){Q.setSelection(e,t);return}if(!U.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(Ge.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sv=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=U.isBackward(a)?"focus":"anchor"),i==="end"&&(i=U.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Tu(Tu({},l),n)})}},ov=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!xe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!xe.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})}},uv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=Gs(t),c!==!1&&(c=!0)),c==null&&(c=!1),U.isRange(l))if(a||(l=v.unhangRange(t,l,{voids:i})),U.isCollapsed(l))l=l.anchor;else{var[,h]=U.edges(l),p=v.pointRef(t,h);Q.delete(t,{at:l}),l=p.unref()}if(xe.isPoint(l)){u==null&&(fe.isText(m)?u=$=>fe.isText($):t.isInline(m)?u=$=>fe.isText($)||v.isInline(t,$):u=$=>de.isElement($)&&v.isBlock(t,$));var[g]=v.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,y=v.pathRef(t,f),b=v.isEnd(t,l,f);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=y.unref();l=b?P.next(w):w}else return}var A=P.parent(l),k=l[l.length-1];if(!(!i&&v.void(t,{at:A}))){if(o){var E=[],F=P.levels(A);Up(t,()=>{var $=function(){var B=A.concat(k);k++;var T={type:"insert_node",path:B,node:M};t.apply(T),l=P.next(l),E.push(T),fe.isText?F.push(...Array.from(se.nodes(M),R=>{var[,L]=R;return B.concat(L)})):F.push(B)};for(var M of n)$()},()=>{fd(t,F,$=>{var M=$;for(var C of E)if(P.operationCanTransformPath(C)&&(M=P.transform(M,C),!M))return null;return M})})}else for(var j of n){var z=A.concat(k);k++,t.apply({type:"insert_node",path:z,node:j}),l=P.next(l)}if(l=P.previous(l),c){var N=v.end(t,l);N&&Q.select(t,N)}}}})},lv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?rr(t,r):k=>de.isElement(k)&&v.isBlock(t,k)),!!r){var o=v.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return v.pathRef(t,E)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var m=v.node(t,P.parent(c)),[h,p]=m,g=c[c.length-1],{length:f}=h.children;if(f===1){var y=P.next(p);Q.moveNodes(t,{at:c,to:y,voids:i}),Q.removeNodes(t,{at:p,voids:i})}else if(g===0)Q.moveNodes(t,{at:c,to:p,voids:i});else if(g===f-1){var b=P.next(p);Q.moveNodes(t,{at:c,to:b,voids:i})}else{var w=P.next(c),A=P.next(p);Q.splitNodes(t,{at:w,voids:i}),Q.moveNodes(t,{at:c,to:A,voids:i})}}}})},cv=["text"],dv=["children"],hd=(e,t)=>{if(de.isElement(t)){var n=t;return v.isVoid(e,t)?!0:n.children.length===1?hd(e,n.children[0]):!1}else return!v.isEditor(t)},fv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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]=v.parent(t,a);r=$=>l.children.includes($)}else r=$=>de.isElement($)&&v.isBlock(t,$);if(!i&&U.isRange(a)&&(a=v.unhangRange(t,a,{voids:s})),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var[,u]=U.edges(a),c=v.pointRef(t,u);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.select(t,a)}var[m]=v.nodes(t,{at:a,match:r,voids:s,mode:o}),h=v.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!h)){var[p,g]=m,[f,y]=h;if(!(g.length===0||y.length===0)){var b=P.next(y),w=P.common(g,y),A=P.isSibling(g,y),k=Array.from(v.levels(t,{at:g}),$=>{var[M]=$;return M}).slice(w.length).slice(0,-1),E=v.above(t,{at:g,mode:"highest",match:$=>k.includes($)&&hd(t,$)}),F=E&&v.pathRef(t,E[1]),j,z;if(fe.isText(p)&&fe.isText(f)){var N=Ut(p,cv);z=f.text.length,j=N}else if(de.isElement(p)&&de.isElement(f)){var N=Ut(p,dv);z=f.children.length,j=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ge.stringify(p)," ").concat(Ge.stringify(f)));A||Q.moveNodes(t,{at:g,to:b,voids:s}),F&&Q.removeNodes(t,{at:F.current,voids:s}),de.isElement(f)&&v.isEmpty(t,f)||fe.isText(f)&&f.text===""&&y[y.length-1]!==0?Q.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:b,position:z,properties:j}),F&&F.unref()}}}})},hv=(e,t)=>{v.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)?rr(e,r):p=>de.isElement(p)&&v.isBlock(e,p));var o=v.pathRef(e,n),l=v.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(e,g)});for(var c of u){var m=c.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&P.isSibling(h,m)&&P.isAfter(h,m)&&(o.current=P.next(o.current))}o.unref()}})},mv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?rr(t,s):p=>de.isElement(p)&&v.isBlock(t,p)),!r&&U.isRange(s)&&(s=v.unhangRange(t,s,{voids:a}));var l=v.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(t,g)});for(var c of u){var m=c.unref();if(m){var[h]=v.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},pv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.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)?rr(t,i):z=>de.isElement(z)&&v.isBlock(t,z)),!l&&U.isRange(i)&&(i=v.unhangRange(t,i,{voids:m})),c&&U.isRange(i)){if(U.isCollapsed(i)&&v.leaf(t,i.anchor)[0].text.length>0)return;var h=v.rangeRef(t,i,{affinity:"inward"}),[p,g]=U.edges(i),f=u==="lowest"?"lowest":"highest",y=v.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!y});var b=v.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:f,voids:m,always:!b}),i=h.unref(),r.at==null&&Q.select(t,i)}s||(s=(z,N)=>z!==N);for(var[w,A]of v.nodes(t,{at:i,match:a,mode:u,voids:m})){var k={},E={};if(A.length!==0){var F=!1;for(var j in n)j==="children"||j==="text"||s(n[j],w[j])&&(F=!0,w.hasOwnProperty(j)&&(k[j]=w[j]),o?n[j]!=null&&(E[j]=o(w[j],n[j])):n[j]!=null&&(E[j]=n[j]));F&&t.apply({type:"set_node",path:A,properties:k,newProperties:E})}}}})},gv=(e,t)=>{if(U.isCollapsed(t))return t.anchor;var[,n]=U.edges(t),r=v.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},vv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>de.isElement(ne)&&v.isBlock(t,ne)),U.isRange(s)&&(s=gv(t,s)),P.isPath(s)){var u=s,c=v.point(t,u),[m]=v.parent(t,u);i=ne=>ne===m,o=c.path.length-u.length+1,s=c,l=!0}if(s){var h=v.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=v.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=v.void(t,{at:s,mode:"highest"}),y=0;if(!a&&f){var[b,w]=f;if(de.isElement(b)&&t.isInline(b)){var A=v.after(t,w);if(!A){var k={text:""},E=P.next(w);Q.insertNodes(t,k,{at:E,voids:a}),A=v.point(t,E)}s=A,l=!0}var F=s.path.length-w.length;o=F+1,l=!0}p=v.pointRef(t,s);var j=s.path.length-o,[,z]=g,N=s.path.slice(0,j),$=o===0?s.offset:s.path[j]+y;for(var[M,C]of v.levels(t,{at:N,reverse:!0,voids:a})){var B=!1;if(C.length<z.length||C.length===0||!a&&de.isElement(M)&&v.isVoid(t,M))break;var T=h.current,R=v.isEnd(t,T,C);if(l||!h||!v.isEdge(t,T,C)){B=!0;var L=se.extractProps(M);t.apply({type:"split_node",path:C,position:$,properties:L})}$=C[C.length-1]+(B||R?1:0)}if(n.at==null){var q=p.current||v.end(t,[]);Q.select(t,q)}}finally{var oe;h.unref(),(oe=p)===null||oe===void 0||oe.unref()}}})},bv=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;Q.setNodes(t,a,r)},yv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?rr(t,s):p=>de.isElement(p)&&v.isBlock(t,p)),P.isPath(s)&&(s=v.range(t,s));var l=U.isRange(s)?v.rangeRef(t,s):null,u=v.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return v.pathRef(t,g)}).reverse(),m=function(){var g=h.unref(),[f]=v.node(t,g),y=v.range(t,g);a&&l&&(y=U.intersection(l.current,y)),Q.liftNodes(t,{at:y,match:b=>de.isAncestor(f)&&f.children.includes(b),voids:i})};for(var h of c)m();l&&l.unref()}})};function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.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=rr(t,l):t.isInline(n)?o=y=>de.isElement(y)&&v.isInline(t,y)||fe.isText(y):o=y=>de.isElement(y)&&v.isBlock(t,y)),i&&U.isRange(l)){var[u,c]=U.edges(l),m=v.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:c,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&Q.select(t,l)}var h=Array.from(v.nodes(t,{at:l,match:t.isInline(n)?y=>de.isElement(y)&&v.isBlock(t,y):y=>v.isEditor(y),mode:"lowest",voids:s})),p=function(){var b=U.isRange(l)?U.intersection(l,v.range(t,f)):l;if(!b)return 0;var w=Array.from(v.nodes(t,{at:b,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,k=w[w.length-1],[,E]=A,[,F]=k;if(E.length===0&&F.length===0)return 0;var j=P.equals(E,F)?P.parent(E):P.common(E,F),z=v.range(t,E,F),N=v.node(t,j),[$]=N,M=j.length+1,C=P.next(F.slice(0,M)),B=ju(ju({},n),{},{children:[]});Q.insertNodes(t,B,{at:C,voids:s}),Q.moveNodes(t,{at:z,match:T=>de.isAncestor($)&&$.children.includes(T),to:C.concat(0),voids:s})}},g;for(var[,f]of h)g=p()}})},Cv=()=>{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 Vp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)}};return e},xv={isHistory(e){return Xe(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Xt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Xt.isOperationList(e.undos[0].operations))}},fi=new WeakMap,hi=new WeakMap,Mn={isHistoryEditor(e){return xv.isHistory(e.history)&&v.isEditor(e)},isMerging(e){return hi.get(e)},isSaving(e){return fi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Mn.isMerging(e);hi.set(e,!1),t(),hi.set(e,n)},withoutSaving(e,t){var n=Mn.isSaving(e);fi.set(e,!1),t(),fi.set(e,n)}},wv=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&&Q.setSelection(t,i.selectionBefore),Mn.withoutSaving(t,()=>{v.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];Mn.withoutSaving(t,()=>{v.withoutNormalizing(t,()=>{var s=i.operations.map(Xt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&Q.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=Mn.isSaving(t),c=Mn.isMerging(t);if(u==null&&(u=kv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=Ev(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},Ev=(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)),kv=(e,t)=>e.type!=="set_selection",_v=Fv,md="֑-߿יִ-﷽ﹰ-ﻼ",pd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Bv=new RegExp("^[^"+pd+"]*["+md+"]"),Av=new RegExp("^[^"+md+"]*["+pd+"]");function Fv(e){return e=String(e||""),Bv.test(e)?"rtl":Av.test(e)?"ltr":"neutral"}const gd=wn(_v);function Tv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xs=Tv,Sv=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,jv=Sv,Ov=jv,Pv=typeof self=="object"&&self&&self.Object===Object&&self,Rv=Ov||Pv||Function("return this")(),vd=Rv,Nv=vd,Mv=function(){return Nv.Date.now()},Iv=Mv,$v=/\s/;function Lv(e){for(var t=e.length;t--&&$v.test(e.charAt(t)););return t}var zv=Lv,qv=zv,Wv=/^\s+/;function Hv(e){return e&&e.slice(0,qv(e)+1).replace(Wv,"")}var Uv=Hv,Vv=vd,Kv=Vv.Symbol,bd=Kv,Ou=bd,yd=Object.prototype,Zv=yd.hasOwnProperty,Yv=yd.toString,ur=Ou?Ou.toStringTag:void 0;function Gv(e){var t=Zv.call(e,ur),n=e[ur];try{e[ur]=void 0;var r=!0}catch{}var a=Yv.call(e);return r&&(t?e[ur]=n:delete e[ur]),a}var Qv=Gv,Jv=Object.prototype,Xv=Jv.toString;function e0(e){return Xv.call(e)}var t0=e0,Pu=bd,n0=Qv,r0=t0,a0="[object Null]",i0="[object Undefined]",Ru=Pu?Pu.toStringTag:void 0;function s0(e){return e==null?e===void 0?i0:a0:Ru&&Ru in Object(e)?n0(e):r0(e)}var o0=s0;function u0(e){return e!=null&&typeof e=="object"}var l0=u0,c0=o0,d0=l0,f0="[object Symbol]";function h0(e){return typeof e=="symbol"||d0(e)&&c0(e)==f0}var m0=h0,p0=Uv,Nu=Xs,g0=m0,Mu=0/0,v0=/^[-+]0x[0-9a-f]+$/i,b0=/^0b[01]+$/i,y0=/^0o[0-7]+$/i,D0=parseInt;function C0(e){if(typeof e=="number")return e;if(g0(e))return Mu;if(Nu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Nu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=p0(e);var n=b0.test(e);return n||y0.test(e)?D0(e.slice(2),n?2:8):v0.test(e)?Mu:+e}var x0=C0,w0=Xs,mi=Iv,Iu=x0,E0="Expected a function",k0=Math.max,_0=Math.min;function B0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(E0);t=Iu(t)||0,w0(n)&&(c=!!n.leading,m="maxWait"in n,i=m?k0(Iu(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(F){var j=r,z=a;return r=a=void 0,u=F,s=e.apply(z,j),s}function g(F){return u=F,o=setTimeout(b,t),c?p(F):s}function f(F){var j=F-l,z=F-u,N=t-j;return m?_0(N,i-z):N}function y(F){var j=F-l,z=F-u;return l===void 0||j>=t||j<0||m&&z>=i}function b(){var F=mi();if(y(F))return w(F);o=setTimeout(b,f(F))}function w(F){return o=void 0,h&&r?p(F):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:w(mi())}function E(){var F=mi(),j=y(F);if(r=arguments,a=this,l=F,j){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return E.cancel=A,E.flush=k,E}var Dd=B0;const A0=wn(Dd);var F0=Dd,T0=Xs,S0="Expected a function";function j0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(S0);return T0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),F0(e,t,{leading:r,maxWait:t,trailing:a})}var O0=j0;const P0=wn(O0),$u=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Lu=(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 Lu(n.overflowY,t)||Lu(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},Wr=(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,R0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},zu=(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:L=>L!==u;if(!$u(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;$u(g)&&m(g);){if(g=R0(g),g===h){p.push(g);break}g!=null&&g===document.body&&pi(g)&&!pi(document.documentElement)||g!=null&&pi(g,c)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:w}=window,{height:A,width:k,top:E,right:F,bottom:j,left:z}=e.getBoundingClientRect(),{top:N,right:$,bottom:M,left:C}=(L=>{const q=window.getComputedStyle(L);return{top:parseFloat(q.scrollMarginTop)||0,right:parseFloat(q.scrollMarginRight)||0,bottom:parseFloat(q.scrollMarginBottom)||0,left:parseFloat(q.scrollMarginLeft)||0}})(e);let B=o==="start"||o==="nearest"?E-N:o==="end"?j+M:E+A/2-N+M,T=l==="center"?z+k/2-C+$:l==="end"?F+$:z-C;const R=[];for(let L=0;L<p.length;L++){const q=p[L],{height:oe,width:ne,top:D,right:H,bottom:X,left:_}=q.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&j<=y&&F<=f&&E>=D&&j<=X&&z>=_&&F<=H)return R;const S=getComputedStyle(q),W=parseInt(S.borderLeftWidth,10),I=parseInt(S.borderTopWidth,10),K=parseInt(S.borderRightWidth,10),te=parseInt(S.borderBottomWidth,10);let ee=0,ae=0;const le="offsetWidth"in q?q.offsetWidth-q.clientWidth-W-K:0,V="offsetHeight"in q?q.offsetHeight-q.clientHeight-I-te:0,he="offsetWidth"in q?q.offsetWidth===0?0:ne/q.offsetWidth:0,pe="offsetHeight"in q?q.offsetHeight===0?0:oe/q.offsetHeight:0;if(h===q)ee=o==="start"?B:o==="end"?B-y:o==="nearest"?Wr(w,w+y,y,I,te,w+B,w+B+A,A):B-y/2,ae=l==="start"?T:l==="center"?T-f/2:l==="end"?T-f:Wr(b,b+f,f,W,K,b+T,b+T+k,k),ee=Math.max(0,ee+w),ae=Math.max(0,ae+b);else{ee=o==="start"?B-D-I:o==="end"?B-X+te+V:o==="nearest"?Wr(D,X,oe,I,te+V,B,B+A,A):B-(D+oe/2)+V/2,ae=l==="start"?T-_-W:l==="center"?T-(_+ne/2)+le/2:l==="end"?T-H+K+le:Wr(_,H,ne,W,K+le,T,T+k,k);const{scrollLeft:we,scrollTop:je}=q;ee=pe===0?0:Math.max(0,Math.min(je+ee/pe,q.scrollHeight-oe/pe+V)),ae=he===0?0:Math.max(0,Math.min(we+ae/he,q.scrollWidth-ne/he+le)),B+=je-ee,T+=we-ae}R.push({el:q,top:ee,left:ae})}return R},N0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function M0(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(zu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of zu(e,N0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var gn=[],I0=function(){return gn.some(function(e){return e.activeTargets.length>0})},$0=function(){return gn.some(function(e){return e.skippedTargets.length>0})},qu="ResizeObserver loop completed with undelivered notifications.",L0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:qu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=qu),window.dispatchEvent(e)},Br;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Br||(Br={}));var vn=function(e){return Object.freeze(e)},z0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,vn(this)}return e}(),Cd=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,vn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),eo=function(e){return e instanceof SVGElement&&"getBBox"in e},xd=function(e){if(eo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Wu=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)},q0=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},gr=typeof window<"u"?window:{},Hr=new WeakMap,Hu=/auto|scroll/,W0=/^tb|vertical/,H0=/msie|trident/i.test(gr.navigator&&gr.navigator.userAgent),At=function(e){return parseFloat(e||"0")},zn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new z0((n?t:e)||0,(n?e:t)||0)},Uu=vn({devicePixelContentBoxSize:zn(),borderBoxSize:zn(),contentBoxSize:zn(),contentRect:new Cd(0,0,0,0)}),wd=function(e,t){if(t===void 0&&(t=!1),Hr.has(e)&&!t)return Hr.get(e);if(xd(e))return Hr.set(e,Uu),Uu;var n=getComputedStyle(e),r=eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!H0&&n.boxSizing==="border-box",i=W0.test(n.writingMode||""),s=!r&&Hu.test(n.overflowY||""),o=!r&&Hu.test(n.overflowX||""),l=r?0:At(n.paddingTop),u=r?0:At(n.paddingRight),c=r?0:At(n.paddingBottom),m=r?0:At(n.paddingLeft),h=r?0:At(n.borderTopWidth),p=r?0:At(n.borderRightWidth),g=r?0:At(n.borderBottomWidth),f=r?0:At(n.borderLeftWidth),y=m+u,b=l+c,w=f+p,A=h+g,k=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-w-e.clientWidth:0,F=a?y+w:0,j=a?b+A:0,z=r?r.width:At(n.width)-F-E,N=r?r.height:At(n.height)-j-k,$=z+y+E+w,M=N+b+k+A,C=vn({devicePixelContentBoxSize:zn(Math.round(z*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:zn($,M,i),contentBoxSize:zn(z,N,i),contentRect:new Cd(m,l,z,N)});return Hr.set(e,C),C},Ed=function(e,t,n){var r=wd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Br.DEVICE_PIXEL_CONTENT_BOX:return s;case Br.BORDER_BOX:return a;default:return i}},U0=function(){function e(t){var n=wd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=vn([n.borderBoxSize]),this.contentBoxSize=vn([n.contentBoxSize]),this.devicePixelContentBoxSize=vn([n.devicePixelContentBoxSize])}return e}(),kd=function(e){if(xd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},V0=function(){var e=1/0,t=[];gn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new U0(u.target),m=kd(u.target);o.push(c),u.lastReportedSize=Ed(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},Vu=function(e){gn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(kd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},K0=function(){var e=0;for(Vu(e);I0();)e=V0(),Vu(e);return $0()&&L0(),e>0},gi,_d=[],Z0=function(){return _d.splice(0).forEach(function(e){return e()})},Y0=function(e){if(!gi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Z0()}).observe(n,r),gi=function(){n.textContent="".concat(t?t--:t++)}}_d.push(e),gi()},G0=function(e){Y0(function(){requestAnimationFrame(e)})},la=0,Q0=function(){return!!la},J0=250,X0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ku=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Zu=function(e){return e===void 0&&(e=0),Date.now()+e},vi=!1,eb=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=J0),!vi){vi=!0;var r=Zu(t);G0(function(){var a=!1;try{a=K0()}finally{if(vi=!1,t=r-Zu(),!Q0())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,X0)};document.body?n():gr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ku.forEach(function(n){return gr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ku.forEach(function(n){return gr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),ps=new eb,Yu=function(e){!la&&e>0&&ps.start(),la+=e,!la&&ps.stop()},tb=function(e){return!eo(e)&&!q0(e)&&getComputedStyle(e).display==="inline"},nb=function(){function e(t,n){this.target=t,this.observedBox=n||Br.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Ed(this.target,this.observedBox,!0);return tb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),rb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Ur=new WeakMap,Gu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Vr=function(){function e(){}return e.connect=function(t,n){var r=new rb(t,n);Ur.set(t,r)},e.observe=function(t,n,r){var a=Ur.get(t),i=a.observationTargets.length===0;Gu(a.observationTargets,n)<0&&(i&&gn.push(a),a.observationTargets.push(new nb(n,r&&r.box)),Yu(1),ps.schedule())},e.unobserve=function(t,n){var r=Ur.get(t),a=Gu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&gn.splice(gn.indexOf(r),1),r.observationTargets.splice(a,1),Yu(-1))},e.disconnect=function(t){var n=this,r=Ur.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),ab=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.");Vr.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(!Wu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.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(!Wu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.unobserve(this,t)},e.prototype.disconnect=function(){Vr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var ib=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),bi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Bd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:ib?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},to={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 Kr=1;Kr<20;Kr++)to["f"+Kr]=111+Kr;function Va(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Ad(s,t)}),a=function(o){return r.some(function(l){return Fd(l,o)})},i=n==null?a:a(n);return i}function sb(e,t){return Va(e,t)}function ob(e,t){return Va(e,{byKey:!0},t)}function Ad(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in bi)r[bi[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 h=m.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var g=no(h),f=bi[g];if(h.length>1&&!f&&!Bd[h]&&!to[g])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!f)&&(n?r.key=g:r.which=Td(h)),f&&(r[f]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Fd(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 Td(e){e=no(e);var t=to[e]||e.toUpperCase().charCodeAt(0);return t}function no(e){return e=e.toLowerCase(),e=Bd[e]||e,e}var ub=Vt.default=Va,yi=Vt.isHotkey=Va;Vt.isCodeHotkey=sb;Vt.isKeyHotkey=ob;Vt.parseHotkey=Ad;Vt.compareHotkey=Fd;Vt.toKeyCode=Td;Vt.toKeyName=no;function lb(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 Kn(e,t){if(e==null)return{};var n=lb(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 Ar(e){"@babel/helpers - typeof";return Ar=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},Ar(e)}function cb(e,t){if(Ar(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ar(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function db(e){var t=cb(e,"string");return Ar(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=db(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=x.createContext(null),on=()=>{var e=x.useContext(ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Sd=parseInt(x.version.split(".")[0],10),fb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),st=typeof navigator<"u"&&/Android/.test(navigator.userAgent),In=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),hr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),hb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),jd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),mb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),pb=st&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),gb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),vb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),bb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zt=(!mb||!pb)&&!hb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ao=new WeakMap,io=new WeakMap,Od=new WeakMap,da=new WeakMap,gs=new WeakMap,Fr=new WeakMap,bn=new WeakMap,ka=new WeakMap,Ka=new WeakMap,vs=new WeakMap,en=new WeakMap,mn=new WeakMap,vr=new WeakMap,bs=new WeakMap,so=new WeakMap,kt=new WeakMap,Wt=new WeakMap,ct=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,Pd=new WeakMap,Zn=Symbol("placeholder"),Rd=Symbol("mark-placeholder"),yb=globalThis.Text,oo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Db=e=>nn(e)&&e.nodeType===8,Ct=e=>nn(e)&&e.nodeType===1,nn=e=>{var t=oo(e);return!!t&&e instanceof t.Node},ys=e=>{var t=e&&e.anchorNode&&oo(e.anchorNode);return!!t&&e instanceof t.Selection},Nd=e=>nn(e)&&e.nodeType===3,Cb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,xb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Md(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Eb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},wb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Md=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Db(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},Eb=(e,t,n)=>{var[r]=Md(e,t,n);return r},Id=e=>{var t="";if(Nd(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Id(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
103
+ `)}return t},kb=/data-slate-fragment="(.+?)"/m,_b=e=>{var t=e.getData("text/html"),[,n]=t.match(kb)||[];return n},uo=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.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:uo(e,i,n)},Bb=0;class Ab{constructor(){xt(this,"id",void 0),this.id="".concat(Bb++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=so.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);en.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&Q.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.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=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(de.isElement(i)&&v.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=v.point(e,s,{edge:l?"start":"end"}),c=l?v.before(e,u):v.after(e,u);if(c){var m=v.range(e,c);return m}}var h,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(h=p.createRange(),h.setStart(g.offsetNode,g.offset),h.setEnd(g.offsetNode,g.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=J.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new Ab,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=io.get(r);if(a==null){if(v.isEditor(r))return n;break}var i=ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ge.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!en.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(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(Q.select(t,v.start(t,[])),t.onChange()),en.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Od.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=J.toDOMNode(t,t),s;try{s=Ct(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)=>nn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return v.hasPath(e,n.path)&&v.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!mn.get(e),isFocused:e=>!!en.get(e),isReadOnly:e=>!!vs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(vs.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return de.isElement(n)&&v.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Ka.get(e),r=v.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ge.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=v.node(e,t.path),r=J.toDOMNode(e,n),a;v.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,h=u.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var y,b=f.childNodes[0];a=[b instanceof yb?b:f,(y=f.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var w=Math.min(m,Math.max(0,t.offset-o));a=[c,w];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ge.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=U.isBackward(t),i=J.toDOMPoint(e,n),s=U.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[m,h]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ct(m)?m:m.parentElement,y=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(m,y?1:h),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Fr.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:xb(t),o=i.parentNode,l=null,u=0;if(o){var c,m,h=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&h.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),y=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var b=J.getWindow(e),w=b.document.createRange();w.setStart(l,0),w.setEnd(i,s);var A=w.cloneContents(),k=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];k.forEach(T=>{if(st&&!r&&T.hasAttribute("data-slate-zero-width")&&T.textContent.length>0&&T.textContext!=="\uFEFF"){T.textContent.startsWith("\uFEFF")&&(T.textContent=T.textContent.slice(1));return}T.parentNode.removeChild(T)}),u=A.textContent.length,y=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),F=0;F<E.length;F++){var j=E[F];if(J.hasDOMNode(e,j)){f=j;break}}f?(l=f.closest('[data-slate-node="text"]'),y=f,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(T=>{u-=T.textContent.length})):u=1}y&&u===y.textContent.length&&st&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||In&&(m=y.textContent)!==null&&m!==void 0&&m.endsWith(`
104
104
 
105
- `))&&u--}if(st&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&J.hasDOMNode(e,z,{editable:!0})){var N=J.toSlateNode(e,z),{path:$,offset:M}=v.start(e,J.findPath(e,N));return z.querySelector("[data-slate-leaf]")||(M=s),{path:$,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var C=J.toSlateNode(e,l),B=J.findPath(e,C);return{path:B,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=ys(t)?t.anchorNode:t.startContainer,o,l,u,c,m;if(s)if(ys(t)){if(In&&t.rangeCount>1){u=t.focusNode;var f=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&f.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let T=function(j){return j.childElementCount>0?T(j.children[0]):j};var g=f.startContainer,h=p.startContainer,y=T(g.children[f.startOffset]),b=T(h.children[p.startOffset]);c=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,y.childNodes.length>0?u=y.childNodes[0]:u=y,b instanceof HTMLElement?l=b.innerHTML.length:l=0}else f.startContainer===u?(o=p.endContainer,l=p.endOffset,c=f.startOffset):(o=f.startContainer,l=f.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;jd&&wb(o)||In?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(In&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
105
+ `))&&u--}if(st&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&J.hasDOMNode(e,z,{editable:!0})){var N=J.toSlateNode(e,z),{path:$,offset:M}=v.start(e,J.findPath(e,N));return z.querySelector("[data-slate-leaf]")||(M=s),{path:$,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var C=J.toSlateNode(e,l),B=J.findPath(e,C);return{path:B,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=ys(t)?t.anchorNode:t.startContainer,o,l,u,c,m;if(s)if(ys(t)){if(In&&t.rangeCount>1){u=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let F=function(j){return j.childElementCount>0?F(j.children[0]):j};var g=h.startContainer,f=p.startContainer,y=F(g.children[h.startOffset]),b=F(f.children[p.startOffset]);c=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,y.childNodes.length>0?u=y.childNodes[0]:u=y,b instanceof HTMLElement?l=b.innerHTML.length:l=0}else h.startContainer===u?(o=p.endContainer,l=p.endOffset,c=h.startOffset):(o=h.startContainer,l=h.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;jd&&wb(o)||In?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(In&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
106
106
 
107
- `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,c=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=m?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:A,focus:k};return U.isExpanded(E)&&U.isForward(E)&&Ct(u)&&v.void(e,{at:E.focus,mode:"highest"})&&(E=v.unhangRange(e,E,{voids:!0})),E}};function Fb(e,t){var{path:n,diff:r}=t;if(!v.hasPath(e,n))return!1;var a=se.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(!v.hasPath(e,i))return!1;var s=se.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function $d(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 Tb(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 Sb(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 Ld(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Tb(i,a),o=Math.min(i.length-s,a.length-s),l=Sb(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 jb(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=$d(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 Ld(e,{start:r,end:l,text:o})}function Ob(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ds(e,t){var{path:n,offset:r}=t;if(!v.hasPath(e,n))return null;var a=se.get(e,n);if(!fe.isText(a))return null;var i=v.above(e,{match:o=>de.isElement(o)&&v.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=v.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 Ju(e,t){var n=Ds(e,t.anchor);if(!n)return null;if(U.isCollapsed(t))return{anchor:n,focus:n};var r=Ds(e,t.focus);return r?{anchor:n,focus:r}:null}function Cs(e,t,n){var r=ct.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 xe.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=xe.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=xe.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 Xu(e,t,n){var r=Cs(e,t.anchor,n);if(!r)return null;if(U.isCollapsed(t))return{anchor:r,focus:r};var a=Cs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function Pb(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 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 Zr(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){xt(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 Rb=25,Nb=200,Mb=function(){},Ib=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function $b(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var C=Qt.get(t);if(Qt.delete(t),C){var{selection:B}=t,F=Ju(t,C);F&&(!B||!U.equals(F,B))&&Q.select(t,F)}},m=()=>{var C=Gt.get(t);if(Gt.delete(t),!!C){if(C.at){var B=xe.isPoint(C.at)?Ds(t,C.at):Ju(t,C.at);if(!B)return;var F=v.range(t,B);(!t.selection||!U.equals(t.selection,F))&&Q.select(t,B)}C.run()}},f=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var C=t.selection&&v.rangeRef(t,t.selection,{affinity:"forward"});Wt.set(t,t.marks),Mb("flush",Gt.get(t),ct.get(t));for(var B=k(),F;F=(R=ct.get(t))===null||R===void 0?void 0:R[0];){var R,L,q=kt.get(t);q!==void 0&&(kt.delete(t),t.marks=q),q&&u===!1&&(u=null);var oe=Ob(F);(!t.selection||!U.equals(t.selection,oe))&&Q.select(t,oe),F.diff.text?v.insertText(t,F.diff.text):v.deleteFragment(t),ct.set(t,(L=ct.get(t))===null||L===void 0?void 0:L.filter(H=>{var{id:X}=H;return X!==F.id})),Fb(t,F)||(B=!1,Gt.delete(t),Wt.delete(t),a="action",Qt.delete(t),n.cancel(),r.cancel(),C==null||C.unref())}var ne=C==null?void 0:C.unref();if(ne&&!Qt.get(t)&&(!t.selection||!U.equals(ne,t.selection))&&Q.select(t,ne),A()){m();return}B&&n(),n.flush(),r.flush(),c();var D=Wt.get(t);Wt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=C=>{i&&clearTimeout(i),i=setTimeout(()=>{mn.set(t,!1),f()},Rb)},g=C=>{mn.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=gs.get(t);if(F){if(k()||B){F.style.display="none";return}F.style.removeProperty("display")}},y=(C,B)=>{var F,R=(F=ct.get(t))!==null&&F!==void 0?F:[];ct.set(t,R);var L=se.leaf(t,C),q=R.findIndex(D=>P.equals(D.path,C));if(q<0){var oe=Ld(L.text,B);oe&&R.push({path:C,diff:B,id:l++}),h();return}var ne=jb(L.text,R[q].diff,B);if(!ne){R.splice(q,1),h();return}R[q]=Zr(Zr({},R[q]),{},{diff:ne})},b=function(B){var{at:F}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Qt.delete(t),n.cancel(),r.cancel(),A()&&f(),Gt.set(t,{at:F,run:B}),o=setTimeout(f)},w=C=>{var B;s&&(clearTimeout(s),s=null);var{inputType:F}=C,R=null,L=C.dataTransfer||C.data||void 0;u!==!1&&F!=="insertText"&&F!=="insertCompositionText"&&(u=!1);var[q]=C.getTargetRanges();q&&(R=J.toSlateRange(t,q,{exactMatch:!1,suppressThrow:!0}));var oe=J.getWindow(t),ne=oe.getSelection();if(!R&&ne&&(q=ne,R=J.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),R=(B=R)!==null&&B!==void 0?B:t.selection,!!R){var D=!0;if(F.startsWith("delete")){if(U.isExpanded(R)){var[H,X]=U.edges(R),_=se.leaf(t,H.path);if(_.text.length===H.offset&&X.offset===0){var S=v.next(t,{at:H.path,match:fe.isText});S&&P.equals(S[1],X.path)&&(R={anchor:X,focus:X})}}var W=F.endsWith("Backward")?"backward":"forward",[I,K]=U.edges(R),[te,ee]=v.leaf(t,I.path),ae={text:"",start:I.offset,end:K.offset},le=ct.get(t),V=le==null?void 0:le.find(ve=>P.equals(ve.path,ee)),he=V?[V.diff,ae]:[ae],pe=$d(te.text,...he);if(pe.length===0&&(D=!1),U.isExpanded(R)){if(D&&P.equals(R.anchor.path,R.focus.path)){var we={path:R.anchor.path,offset:I.offset},je=v.range(t,we,we);return j(je),y(R.anchor.path,{text:"",end:K.offset,start:I.offset})}return b(()=>v.deleteFragment(t,{direction:W}),{at:R})}}switch(F){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>v.deleteFragment(t),{at:R});case"deleteContent":case"deleteContentForward":{var{anchor:Oe}=R;if(D&&U.isCollapsed(R)){var Qe=se.leaf(t,Oe.path);if(Oe.offset<Qe.text.length)return y(Oe.path,{text:"",start:Oe.offset,end:Oe.offset+1})}return b(()=>v.deleteForward(t),{at:R})}case"deleteContentBackward":{var Ze,{anchor:Ye}=R,nt=ys(q)?q.isCollapsed:!!((Ze=q)!==null&&Ze!==void 0&&Ze.collapsed);return D&&nt&&U.isCollapsed(R)&&Ye.offset>0?y(Ye.path,{text:"",start:Ye.offset-1,end:Ye.offset}):b(()=>v.deleteBackward(t),{at:R})}case"deleteEntireSoftLine":return b(()=>{v.deleteBackward(t,{unit:"line"}),v.deleteForward(t,{unit:"line"})},{at:R});case"deleteHardLineBackward":return b(()=>v.deleteBackward(t,{unit:"block"}),{at:R});case"deleteSoftLineBackward":return b(()=>v.deleteBackward(t,{unit:"line"}),{at:R});case"deleteHardLineForward":return b(()=>v.deleteForward(t,{unit:"block"}),{at:R});case"deleteSoftLineForward":return b(()=>v.deleteForward(t,{unit:"line"}),{at:R});case"deleteWordBackward":return b(()=>v.deleteBackward(t,{unit:"word"}),{at:R});case"deleteWordForward":return b(()=>v.deleteForward(t,{unit:"word"}),{at:R});case"insertLineBreak":return b(()=>v.insertSoftBreak(t),{at:R});case"insertParagraph":return b(()=>v.insertBreak(t),{at:R});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(Ib(L))return b(()=>J.insertData(t,L),{at:R});var Fe=L??"";if(kt.get(t)&&(Fe=Fe.replace("\uFEFF","")),F==="insertText"&&/.*\n.*\n$/.test(Fe)&&(Fe=Fe.slice(0,-1)),Fe.includes(`
107
+ `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,c=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=m?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:A,focus:k};return U.isExpanded(E)&&U.isForward(E)&&Ct(u)&&v.void(e,{at:E.focus,mode:"highest"})&&(E=v.unhangRange(e,E,{voids:!0})),E}};function Fb(e,t){var{path:n,diff:r}=t;if(!v.hasPath(e,n))return!1;var a=se.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(!v.hasPath(e,i))return!1;var s=se.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function $d(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 Tb(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 Sb(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 Ld(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Tb(i,a),o=Math.min(i.length-s,a.length-s),l=Sb(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 jb(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=$d(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 Ld(e,{start:r,end:l,text:o})}function Ob(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ds(e,t){var{path:n,offset:r}=t;if(!v.hasPath(e,n))return null;var a=se.get(e,n);if(!fe.isText(a))return null;var i=v.above(e,{match:o=>de.isElement(o)&&v.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=v.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 Ju(e,t){var n=Ds(e,t.anchor);if(!n)return null;if(U.isCollapsed(t))return{anchor:n,focus:n};var r=Ds(e,t.focus);return r?{anchor:n,focus:r}:null}function Cs(e,t,n){var r=ct.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 xe.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=xe.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=xe.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 Xu(e,t,n){var r=Cs(e,t.anchor,n);if(!r)return null;if(U.isCollapsed(t))return{anchor:r,focus:r};var a=Cs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function Pb(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 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 Zr(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){xt(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 Rb=25,Nb=200,Mb=function(){},Ib=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function $b(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var C=Qt.get(t);if(Qt.delete(t),C){var{selection:B}=t,T=Ju(t,C);T&&(!B||!U.equals(T,B))&&Q.select(t,T)}},m=()=>{var C=Gt.get(t);if(Gt.delete(t),!!C){if(C.at){var B=xe.isPoint(C.at)?Ds(t,C.at):Ju(t,C.at);if(!B)return;var T=v.range(t,B);(!t.selection||!U.equals(t.selection,T))&&Q.select(t,B)}C.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var C=t.selection&&v.rangeRef(t,t.selection,{affinity:"forward"});Wt.set(t,t.marks),Mb("flush",Gt.get(t),ct.get(t));for(var B=k(),T;T=(R=ct.get(t))===null||R===void 0?void 0:R[0];){var R,L,q=kt.get(t);q!==void 0&&(kt.delete(t),t.marks=q),q&&u===!1&&(u=null);var oe=Ob(T);(!t.selection||!U.equals(t.selection,oe))&&Q.select(t,oe),T.diff.text?v.insertText(t,T.diff.text):v.deleteFragment(t),ct.set(t,(L=ct.get(t))===null||L===void 0?void 0:L.filter(H=>{var{id:X}=H;return X!==T.id})),Fb(t,T)||(B=!1,Gt.delete(t),Wt.delete(t),a="action",Qt.delete(t),n.cancel(),r.cancel(),C==null||C.unref())}var ne=C==null?void 0:C.unref();if(ne&&!Qt.get(t)&&(!t.selection||!U.equals(ne,t.selection))&&Q.select(t,ne),A()){m();return}B&&n(),n.flush(),r.flush(),c();var D=Wt.get(t);Wt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=C=>{i&&clearTimeout(i),i=setTimeout(()=>{mn.set(t,!1),h()},Rb)},g=C=>{mn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,T=gs.get(t);if(T){if(k()||B){T.style.display="none";return}T.style.removeProperty("display")}},y=(C,B)=>{var T,R=(T=ct.get(t))!==null&&T!==void 0?T:[];ct.set(t,R);var L=se.leaf(t,C),q=R.findIndex(D=>P.equals(D.path,C));if(q<0){var oe=Ld(L.text,B);oe&&R.push({path:C,diff:B,id:l++}),f();return}var ne=jb(L.text,R[q].diff,B);if(!ne){R.splice(q,1),f();return}R[q]=Zr(Zr({},R[q]),{},{diff:ne})},b=function(B){var{at:T}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Qt.delete(t),n.cancel(),r.cancel(),A()&&h(),Gt.set(t,{at:T,run:B}),o=setTimeout(h)},w=C=>{var B;s&&(clearTimeout(s),s=null);var{inputType:T}=C,R=null,L=C.dataTransfer||C.data||void 0;u!==!1&&T!=="insertText"&&T!=="insertCompositionText"&&(u=!1);var[q]=C.getTargetRanges();q&&(R=J.toSlateRange(t,q,{exactMatch:!1,suppressThrow:!0}));var oe=J.getWindow(t),ne=oe.getSelection();if(!R&&ne&&(q=ne,R=J.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),R=(B=R)!==null&&B!==void 0?B:t.selection,!!R){var D=!0;if(T.startsWith("delete")){if(U.isExpanded(R)){var[H,X]=U.edges(R),_=se.leaf(t,H.path);if(_.text.length===H.offset&&X.offset===0){var S=v.next(t,{at:H.path,match:fe.isText});S&&P.equals(S[1],X.path)&&(R={anchor:X,focus:X})}}var W=T.endsWith("Backward")?"backward":"forward",[I,K]=U.edges(R),[te,ee]=v.leaf(t,I.path),ae={text:"",start:I.offset,end:K.offset},le=ct.get(t),V=le==null?void 0:le.find(ve=>P.equals(ve.path,ee)),he=V?[V.diff,ae]:[ae],pe=$d(te.text,...he);if(pe.length===0&&(D=!1),U.isExpanded(R)){if(D&&P.equals(R.anchor.path,R.focus.path)){var we={path:R.anchor.path,offset:I.offset},je=v.range(t,we,we);return j(je),y(R.anchor.path,{text:"",end:K.offset,start:I.offset})}return b(()=>v.deleteFragment(t,{direction:W}),{at:R})}}switch(T){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>v.deleteFragment(t),{at:R});case"deleteContent":case"deleteContentForward":{var{anchor:Oe}=R;if(D&&U.isCollapsed(R)){var Qe=se.leaf(t,Oe.path);if(Oe.offset<Qe.text.length)return y(Oe.path,{text:"",start:Oe.offset,end:Oe.offset+1})}return b(()=>v.deleteForward(t),{at:R})}case"deleteContentBackward":{var Ze,{anchor:Ye}=R,nt=ys(q)?q.isCollapsed:!!((Ze=q)!==null&&Ze!==void 0&&Ze.collapsed);return D&&nt&&U.isCollapsed(R)&&Ye.offset>0?y(Ye.path,{text:"",start:Ye.offset-1,end:Ye.offset}):b(()=>v.deleteBackward(t),{at:R})}case"deleteEntireSoftLine":return b(()=>{v.deleteBackward(t,{unit:"line"}),v.deleteForward(t,{unit:"line"})},{at:R});case"deleteHardLineBackward":return b(()=>v.deleteBackward(t,{unit:"block"}),{at:R});case"deleteSoftLineBackward":return b(()=>v.deleteBackward(t,{unit:"line"}),{at:R});case"deleteHardLineForward":return b(()=>v.deleteForward(t,{unit:"block"}),{at:R});case"deleteSoftLineForward":return b(()=>v.deleteForward(t,{unit:"line"}),{at:R});case"deleteWordBackward":return b(()=>v.deleteBackward(t,{unit:"word"}),{at:R});case"deleteWordForward":return b(()=>v.deleteForward(t,{unit:"word"}),{at:R});case"insertLineBreak":return b(()=>v.insertSoftBreak(t),{at:R});case"insertParagraph":return b(()=>v.insertBreak(t),{at:R});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(Ib(L))return b(()=>J.insertData(t,L),{at:R});var Fe=L??"";if(kt.get(t)&&(Fe=Fe.replace("\uFEFF","")),T==="insertText"&&/.*\n.*\n$/.test(Fe)&&(Fe=Fe.slice(0,-1)),Fe.includes(`
108
108
  `))return b(()=>{var ve=Fe.split(`
109
- `);ve.forEach((Ce,Ve)=>{Ce&&v.insertText(t,Ce),Ve!==ve.length-1&&v.insertSoftBreak(t)})},{at:R});if(P.equals(R.anchor.path,R.focus.path)){var[He,ze]=U.edges(R),Y={start:He.offset,end:ze.offset,text:Fe};if(Fe&&u&&F==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),me=Y.start+Y.text.search(/\S|$/);me===ie+1&&Y.end===u.start+u.text.length?(Y.start-=1,u=null,$()):u=!1}else F==="insertText"?u===null?u=Y:u&&U.isCollapsed(R)&&u.end+u.text.length===He.offset?u=Zr(Zr({},u),{},{text:u.text+Fe}):u=!1:u=!1;if(D){y(He.path,Y);return}}return b(()=>v.insertText(t,Fe),{at:R})}}}},A=()=>!!Gt.get(t),k=()=>{var C;return!!((C=ct.get(t))!==null&&C!==void 0&&C.length)},E=()=>A()||k(),T=()=>a,j=C=>{Qt.set(t,C),s&&(clearTimeout(s),s=null);var{selection:B}=t;if(C){var F=!B||!P.equals(B.anchor.path,C.anchor.path),R=!B||!P.equals(B.anchor.path.slice(0,-1),C.anchor.path.slice(0,-1));(F&&u||R)&&(u=!1),(F||k())&&(s=setTimeout(f,Nb))}},z=()=>{(A()||!k())&&f()},N=C=>{k()||(h(!0),setTimeout(h))},$=()=>{A()||(o=setTimeout(f))},M=C=>{if(!(k()||A())&&C.some(F=>uo(t,F,C))){var B;(B=Pd.get(t))===null||B===void 0||B()}};return{flush:f,scheduleFlush:$,hasPendingDiffs:k,hasPendingAction:A,hasPendingChanges:E,isFlushing:T,handleUserSelect:j,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:w,handleKeyDown:N,handleDomMutations:M,handleInput:z}}function Lb(){var e=x.useRef(!1);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Tr=ca?x.useLayoutEffect:x.useEffect;function zb(e,t,n){var[r]=x.useState(()=>new MutationObserver(t));Tr(()=>{r.takeRecords()}),x.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 qb=["node"];function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hb={subtree:!0,childList:!0,characterData:!0},Ub=st?e=>{var{node:t}=e,n=Kn(e,qb);if(!st)return null;var r=on(),a=Lb(),[i]=x.useState(()=>$b(Wb({editor:r},n)));return zb(t,i.handleDomMutations,Hb),so.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Vb=["anchor","focus"],Kb=["anchor","focus"],Zb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),zd=(e,t)=>{var n=Kn(e,Vb),r=Kn(t,Kb);return e[Zn]===t[Zn]&&Zb(n,r)},Yb=(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(!U.equals(r,a)||!zd(r,a))return!1}return!0},Gb=(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||!zd(r,a))return!1}return!0};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 Qb(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){xt(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 Jb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=on(),s=J.findPath(i,a),o=P.parent(s),l=!!n[Rd];return i.isVoid(r)?x.createElement(Di,{length:se.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&v.string(i,o)===""?x.createElement(Di,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?x.createElement(Di,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
109
+ `);ve.forEach((Ce,Ve)=>{Ce&&v.insertText(t,Ce),Ve!==ve.length-1&&v.insertSoftBreak(t)})},{at:R});if(P.equals(R.anchor.path,R.focus.path)){var[He,ze]=U.edges(R),Y={start:He.offset,end:ze.offset,text:Fe};if(Fe&&u&&T==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),me=Y.start+Y.text.search(/\S|$/);me===ie+1&&Y.end===u.start+u.text.length?(Y.start-=1,u=null,$()):u=!1}else T==="insertText"?u===null?u=Y:u&&U.isCollapsed(R)&&u.end+u.text.length===He.offset?u=Zr(Zr({},u),{},{text:u.text+Fe}):u=!1:u=!1;if(D){y(He.path,Y);return}}return b(()=>v.insertText(t,Fe),{at:R})}}}},A=()=>!!Gt.get(t),k=()=>{var C;return!!((C=ct.get(t))!==null&&C!==void 0&&C.length)},E=()=>A()||k(),F=()=>a,j=C=>{Qt.set(t,C),s&&(clearTimeout(s),s=null);var{selection:B}=t;if(C){var T=!B||!P.equals(B.anchor.path,C.anchor.path),R=!B||!P.equals(B.anchor.path.slice(0,-1),C.anchor.path.slice(0,-1));(T&&u||R)&&(u=!1),(T||k())&&(s=setTimeout(h,Nb))}},z=()=>{(A()||!k())&&h()},N=C=>{k()||(f(!0),setTimeout(f))},$=()=>{A()||(o=setTimeout(h))},M=C=>{if(!(k()||A())&&C.some(T=>uo(t,T,C))){var B;(B=Pd.get(t))===null||B===void 0||B()}};return{flush:h,scheduleFlush:$,hasPendingDiffs:k,hasPendingAction:A,hasPendingChanges:E,isFlushing:F,handleUserSelect:j,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:w,handleKeyDown:N,handleDomMutations:M,handleInput:z}}function Lb(){var e=x.useRef(!1);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Tr=ca?x.useLayoutEffect:x.useEffect;function zb(e,t,n){var[r]=x.useState(()=>new MutationObserver(t));Tr(()=>{r.takeRecords()}),x.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 qb=["node"];function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hb={subtree:!0,childList:!0,characterData:!0},Ub=st?e=>{var{node:t}=e,n=Kn(e,qb);if(!st)return null;var r=on(),a=Lb(),[i]=x.useState(()=>$b(Wb({editor:r},n)));return zb(t,i.handleDomMutations,Hb),so.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Vb=["anchor","focus"],Kb=["anchor","focus"],Zb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),zd=(e,t)=>{var n=Kn(e,Vb),r=Kn(t,Kb);return e[Zn]===t[Zn]&&Zb(n,r)},Yb=(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(!U.equals(r,a)||!zd(r,a))return!1}return!0},Gb=(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||!zd(r,a))return!1}return!0};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 Qb(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){xt(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 Jb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=on(),s=J.findPath(i,a),o=P.parent(s),l=!!n[Rd];return i.isVoid(r)?x.createElement(Di,{length:se.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&v.string(i,o)===""?x.createElement(Di,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?x.createElement(Di,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
110
110
  `?x.createElement(rl,{isTrailing:!0,text:n.text}):x.createElement(rl,{text:n.text})},rl=e=>{var{text:t,isTrailing:n=!1}=e,r=x.useRef(null),a=()=>"".concat(t??"").concat(n?`
111
- `:""),[i]=x.useState(a);return Tr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),x.createElement(Xb,{ref:r},i)},Xb=x.memo(x.forwardRef((e,t)=>x.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Di=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),x.createElement("span",Qb({},a),!st||!n?"\uFEFF":null,n?x.createElement("br",null):null)};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 qd(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){xt(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 ey=st?300:0;function ty(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function il(e){e.current&&(clearTimeout(e.current),e.current=null)}var ny=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>x.createElement(ay,qd({},w))}=e,o=on(),l=x.useRef(null),u=x.useRef(null),[c,m]=x.useState(!1),f=x.useRef(null),p=x.useCallback(w=>{if(ty(l,w==null),w==null){var A;gs.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(gs.set(o,w),!l.current){var k=window.ResizeObserver||ab;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=x.createElement(Jb,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[Zn];if(x.useEffect(()=>(h?f.current||(f.current=setTimeout(()=>{m(!0),f.current=null},ey)):(il(f),m(!1)),()=>il(f)),[h,m]),h&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:hr?"inherit":void 0},contentEditable:!1,ref:p}};g=x.createElement(x.Fragment,null,i(y),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},ry=x.memo(ny,(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[Zn]===e.leaf[Zn]),ay=e=>{var{attributes:t,children:n}=e;return x.createElement("span",qd({},t),n)},iy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=on(),l=x.useRef(null),u=fe.decorations(s,t),c=J.findKey(o,s),m=[],f=0;f<u.length;f++){var p=u[f];m.push(x.createElement(ry,{isLast:n&&f===u.length-1,key:"".concat(c.id,"-").concat(f),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=x.useCallback(h=>{var y=Ka.get(o);h?(y==null||y.set(c,h),bn.set(s,h),Fr.set(h,s)):(y==null||y.delete(c),bn.delete(s),l.current&&Fr.delete(l.current)),l.current=h},[l,o,c,s]);return x.createElement("span",{"data-slate-node":"text",ref:g},m)},Wd=x.memo(iy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Gb(t.decorations,e.decorations));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 xs(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){xt(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 sy=e=>{var{decorations:t,element:n,renderElement:r=w=>x.createElement(uy,xs({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=on(),l=dy(),u=o.isInline(n),c=J.findKey(o,n),m=x.useCallback(w=>{var A=Ka.get(o);w?(A==null||A.set(c,w),bn.set(n,w),Fr.set(w,n)):(A==null||A.delete(c),bn.delete(n))},[o,c,n]),f=Ud({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&v.hasInlines(o,n)){var g=se.string(n),h=gd(g);h==="rtl"&&(p.dir=h)}if(v.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[b]]=se.texts(n);f=x.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},x.createElement(Wd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),ao.set(b,0),io.set(b,n)}return r({attributes:p,children:f,element:n})},oy=x.memo(sy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Yb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&U.equals(e.selection,t.selection))),uy=e=>{var{attributes:t,children:n,element:r}=e,a=on(),i=a.isInline(r)?"span":"div";return x.createElement(i,xs(xs({},t),{},{style:{position:"relative"}}),n)},Hd=x.createContext(()=>[]),ly=()=>x.useContext(Hd),cy=x.createContext(!1),Ud=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=ly(),l=on(),u=J.findPath(l,n),c=[],m=de.isElement(n)&&!l.isInline(n)&&v.hasInlines(l,n),f=0;f<n.children.length;f++){var p=u.concat(f),g=n.children[f],h=J.findKey(l,g),y=v.range(l,p),b=s&&U.intersection(y,s),w=o([g,p]);for(var A of t){var k=U.intersection(A,y);k&&w.push(k)}de.isElement(g)?c.push(x.createElement(cy.Provider,{key:"provider-".concat(h.id),value:!!b},x.createElement(oy,{decorations:w,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):c.push(x.createElement(Wd,{decorations:w,key:h.id,isLast:m&&f===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ao.set(g,f),io.set(g,n)}return c},Vd=x.createContext(!1),dy=()=>x.useContext(Vd),Kd=x.createContext(null),_n=()=>{var e=x.useContext(Kd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function fy(){var e=on(),t=x.useRef(!1),n=x.useRef(0),r=x.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return x.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var hy=3,my={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"},py={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"},gy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},$e=e=>{var t=my[e],n=py[e],r=gy[e],a=t&&yi(t),i=n&&yi(n),s=r&&yi(r);return o=>!!(a&&a(o)||Qu&&i&&i(o)||!Qu&&s&&s(o))},Le={isBold:$e("bold"),isCompose:$e("compose"),isMoveBackward:$e("moveBackward"),isMoveForward:$e("moveForward"),isDeleteBackward:$e("deleteBackward"),isDeleteForward:$e("deleteForward"),isDeleteLineBackward:$e("deleteLineBackward"),isDeleteLineForward:$e("deleteLineForward"),isDeleteWordBackward:$e("deleteWordBackward"),isDeleteWordForward:$e("deleteWordForward"),isExtendBackward:$e("extendBackward"),isExtendForward:$e("extendForward"),isExtendLineBackward:$e("extendLineBackward"),isExtendLineForward:$e("extendLineForward"),isItalic:$e("italic"),isMoveLineBackward:$e("moveLineBackward"),isMoveLineForward:$e("moveLineForward"),isMoveWordBackward:$e("moveWordBackward"),isMoveWordForward:$e("moveWordForward"),isRedo:$e("redo"),isSoftBreak:$e("insertSoftBreak"),isSplitBlock:$e("splitBlock"),isTransposeCharacter:$e("transposeCharacter"),isUndo:$e("undo")},vy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>uo(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}},by={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Zd extends x.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(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,by)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=vy(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}}xt(Zd,"contextType",ro);var yy=st?Zd:e=>{var{children:t}=e;return x.createElement(x.Fragment,null,t)},Dy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Cy=["text"];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 Tt(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){xt(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 xy=e=>x.createElement(x.Fragment,null,Ud(e)),wy=e=>{var t=x.useCallback(S=>x.createElement(Ey,Tt({},S)),[]),{autoFocus:n,decorate:r=ky,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=_y,style:m={},as:f="div",disableDefaultStyles:p=!1}=e,g=Kn(e,Dy),h=_n(),[y,b]=x.useState(!1),w=x.useRef(null),A=x.useRef([]),[k,E]=x.useState(),{onUserInput:T,receivedUserInput:j}=fy(),[,z]=x.useReducer(S=>S+1,0);Pd.set(h,z),vs.set(h,s);var N=x.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);x.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var $=x.useRef(),M=x.useMemo(()=>P0(()=>{var S=$.current;if((st||!J.isComposing(h))&&(!N.isUpdatingSelection||S!=null&&S.isFlushing())&&!N.isDraggingInternally){var W=J.findDocumentOrShadowRoot(h),{activeElement:I}=W,K=J.toDOMNode(h,h),te=W.getSelection();if(I===K?(N.latestElement=I,en.set(h,!0)):en.delete(h),!te)return Q.deselect(h);var{anchorNode:ee,focusNode:ae}=te,le=J.hasEditableTarget(h,ee)||J.isTargetInsideNonReadonlyVoid(h,ee),V=J.hasEditableTarget(h,ae)||J.isTargetInsideNonReadonlyVoid(h,ae);if(le&&V){var he=J.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});he&&(!J.isComposing(h)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?Q.select(h,he):S==null||S.handleUserSelect(he))}s&&(!le||!V)&&Q.deselect(h)}},100),[h,s,N]),C=x.useMemo(()=>A0(M,0),[M]);$.current=Ub({node:w,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:C}),Tr(()=>{var S,W,I;w.current&&(I=oo(w.current))?(Od.set(h,I),da.set(h,w.current),bn.set(h,w.current),Fr.set(w.current,h)):bn.delete(h);var{selection:K}=h,te=J.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!J.isFocused(h)||(S=$.current)!==null&&S!==void 0&&S.hasPendingAction())){var ae=pe=>{var we=ee.type!=="None";if(!(!K&&!we)){var je=ee.focusNode,Oe;if(In&&ee.rangeCount>1){var Qe=ee.getRangeAt(0),Ze=ee.getRangeAt(ee.rangeCount-1);Qe.startContainer===je?Oe=Ze.endContainer:Oe=Qe.startContainer}else Oe=ee.anchorNode;var Ye=da.get(h),nt=!1;if(Ye.contains(Oe)&&Ye.contains(je)&&(nt=!0),we&&nt&&K&&!pe){var Fe=J.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Fe&&U.equals(Fe,K)){var He;if(!N.hasMarkPlaceholder||(He=Oe)!==null&&He!==void 0&&(He=He.parentElement)!==null&&He!==void 0&&He.hasAttribute("data-slate-mark-placeholder"))return}}if(K&&!J.hasRange(h,K)){h.selection=J.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ze=K&&J.toDOMRange(h,K);return ze?(J.isComposing(h)&&!st?ee.collapseToEnd():U.isBackward(K)?ee.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):ee.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),c(h,ze)):ee.removeAllRanges(),ze}};ee.rangeCount<=1&&ae();var le=((W=$.current)===null||W===void 0?void 0:W.isFlushing())==="action";if(!st||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var V=null,he=requestAnimationFrame(()=>{if(le){var pe=we=>{try{var je=J.toDOMNode(h,h);je.focus(),ae(we)}catch{}};pe(),V=setTimeout(()=>{pe(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(he),V&&clearTimeout(V)}}});var B=x.useCallback(S=>{if(T(),!s&&J.hasEditableTarget(h,S.target)&&!By(S,a)){var W;if($.current)return $.current.handleDOMBeforeInput(S);C.flush(),M.flush();var{selection:I}=h,{inputType:K}=S,te=S.dataTransfer||S.data||void 0,ee=K==="insertCompositionText"||K==="deleteCompositionText";if(ee&&J.isComposing(h))return;var ae=!1;if(K==="insertText"&&I&&U.isCollapsed(I)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&I.anchor.offset!==0){var le,V;ae=!0,h.marks&&(ae=!1);var{anchor:he}=I,[pe,we]=J.toDOMPoint(h,he),je=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Oe=J.getWindow(h);if(ae&&je&&J.hasDOMNode(h,je)){var Qe,Ze=Oe==null?void 0:Oe.document.createTreeWalker(je,NodeFilter.SHOW_TEXT).lastChild();Ze===pe&&((Qe=Ze.textContent)===null||Qe===void 0?void 0:Qe.length)===we&&(ae=!1)}if(ae&&pe.parentElement&&(Oe==null||(V=Oe.getComputedStyle(pe.parentElement))===null||V===void 0?void 0:V.whiteSpace)==="pre"){var Ye=v.above(h,{at:he.path,match:ie=>de.isElement(ie)&&v.isBlock(h,ie)});Ye&&se.string(Ye[0]).includes(" ")&&(ae=!1)}}if(!K.startsWith("delete")||K.startsWith("deleteBy")){var[nt]=S.getTargetRanges();if(nt){var Fe=J.toSlateRange(h,nt,{exactMatch:!1,suppressThrow:!1});if(!I||!U.equals(I,Fe)){ae=!1;var He=!ee&&h.selection&&v.rangeRef(h,h.selection);Q.select(h,Fe),He&&vr.set(h,He)}}}if(ee)return;if(ae||S.preventDefault(),I&&U.isExpanded(I)&&K.startsWith("delete")){var ze=K.endsWith("Backward")?"backward":"forward";v.deleteFragment(h,{direction:ze});return}switch(K){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{v.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{v.deleteForward(h);break}case"deleteContentBackward":{v.deleteBackward(h);break}case"deleteEntireSoftLine":{v.deleteBackward(h,{unit:"line"}),v.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{v.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{v.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{v.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{v.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{v.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{v.deleteForward(h,{unit:"word"});break}case"insertLineBreak":v.insertSoftBreak(h);break;case"insertParagraph":{v.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{K==="insertFromComposition"&&J.isComposing(h)&&(b(!1),mn.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(h,te):typeof te=="string"&&(ae?A.current.push(()=>v.insertText(h,te)):v.insertText(h,te));break}}var Y=(W=vr.get(h))===null||W===void 0?void 0:W.unref();vr.delete(h),Y&&(!h.selection||!U.equals(h.selection,Y))&&Q.select(h,Y)}},[h,M,T,a,s,C]),F=x.useCallback(S=>{S==null?(M.cancel(),C.cancel(),da.delete(h),bn.delete(h),w.current&&Zt&&w.current.removeEventListener("beforeinput",B)):Zt&&S.addEventListener("beforeinput",B),w.current=S},[M,C,h,B]);Tr(()=>{var S=J.getWindow(h);return S.document.addEventListener("selectionchange",C),()=>{S.document.removeEventListener("selectionchange",C)}},[C]);var R=r([h,[]]),L=i&&h.children.length===1&&Array.from(se.texts(h)).length===1&&se.string(h)===""&&!y,q=x.useCallback(S=>{if(S&&L){var W;E((W=S.getBoundingClientRect())===null||W===void 0?void 0:W.height)}else E(void 0)},[L]);if(L){var oe=v.start(h,[]);R.push({[Zn]:!0,placeholder:i,onPlaceholderResize:q,anchor:oe,focus:oe})}var{marks:ne}=h;if(N.hasMarkPlaceholder=!1,h.selection&&U.isCollapsed(h.selection)&&ne){var{anchor:D}=h.selection,H=se.leaf(h,D.path),X=Kn(H,Cy);if(!fe.equals(H,ne,{loose:!0})){N.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(S=>[S,null]));R.push(Tt(Tt(Tt({[Rd]:!0},_),ne),{},{anchor:D,focus:D}))}}return x.useEffect(()=>{setTimeout(()=>{var{selection:S}=h;if(S){var{anchor:W}=S,I=se.leaf(h,W.path);if(ne&&!fe.equals(I,ne,{loose:!0})){kt.set(h,ne);return}}kt.delete(h)})}),x.createElement(Vd.Provider,{value:s},x.createElement(Hd.Provider,{value:r},x.createElement(yy,{node:w,receivedUserInput:j},x.createElement(f,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Zt||!ca?g.spellCheck:!1,autoCorrect:Zt||!ca?g.autoCorrect:"false",autoCapitalize:Zt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:F,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),m),onBeforeInput:x.useCallback(S=>{if(!Zt&&!s&&!at(S,g.onBeforeInput)&&J.hasSelectableTarget(h,S.target)&&(S.preventDefault(),!J.isComposing(h))){var W=S.data;v.insertText(h,W)}},[g.onBeforeInput,h,s]),onInput:x.useCallback(S=>{if(!at(S,g.onInput)){if($.current){$.current.handleInput();return}for(var W of A.current)W();A.current=[]}},[g.onInput]),onBlur:x.useCallback(S=>{if(!(s||N.isUpdatingSelection||!J.hasSelectableTarget(h,S.target)||at(S,g.onBlur))){var W=J.findDocumentOrShadowRoot(h);if(N.latestElement!==W.activeElement){var{relatedTarget:I}=S,K=J.toDOMNode(h,h);if(I!==K&&!(Ct(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&nn(I)&&J.hasDOMNode(h,I)){var te=J.toSlateNode(h,I);if(de.isElement(te)&&!h.isVoid(te))return}if(hr){var ee=W.getSelection();ee==null||ee.removeAllRanges()}en.delete(h)}}}},[s,N.isUpdatingSelection,N.latestElement,h,g.onBlur]),onClick:x.useCallback(S=>{if(J.hasTarget(h,S.target)&&!at(S,g.onClick)&&nn(S.target)){var W=J.toSlateNode(h,S.target),I=J.findPath(h,W);if(!v.hasPath(h,I)||se.get(h,I)!==W)return;if(S.detail===hy&&I.length>=1){var K=I;if(!(de.isElement(W)&&v.isBlock(h,W))){var te,ee=v.above(h,{match:je=>de.isElement(je)&&v.isBlock(h,je),at:I});K=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var ae=v.range(h,K);Q.select(h,ae);return}if(s)return;var le=v.start(h,I),V=v.end(h,I),he=v.void(h,{at:le}),pe=v.void(h,{at:V});if(he&&pe&&P.equals(he[1],pe[1])){var we=v.range(h,le);Q.select(h,we)}}},[h,g.onClick,s]),onCompositionEnd:x.useCallback(S=>{if(J.hasSelectableTarget(h,S.target)){var W;if(J.isComposing(h)&&Promise.resolve().then(()=>{b(!1),mn.set(h,!1)}),(W=$.current)===null||W===void 0||W.handleCompositionEnd(S),at(S,g.onCompositionEnd)||st)return;if(!hr&&!gb&&!fb&&!bb&&!vb&&S.data){var I=kt.get(h);kt.delete(h),I!==void 0&&(Wt.set(h,h.marks),h.marks=I),v.insertText(h,S.data);var K=Wt.get(h);Wt.delete(h),K!==void 0&&(h.marks=K)}}},[g.onCompositionEnd,h]),onCompositionUpdate:x.useCallback(S=>{J.hasSelectableTarget(h,S.target)&&!at(S,g.onCompositionUpdate)&&(J.isComposing(h)||(b(!0),mn.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:x.useCallback(S=>{if(J.hasSelectableTarget(h,S.target)){var W;if((W=$.current)===null||W===void 0||W.handleCompositionStart(S),at(S,g.onCompositionStart)||st)return;b(!0);var{selection:I}=h;if(I&&U.isExpanded(I)){v.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:x.useCallback(S=>{J.hasSelectableTarget(h,S.target)&&!at(S,g.onCopy)&&!ul(S)&&(S.preventDefault(),J.setFragmentData(h,S.clipboardData,"copy"))},[g.onCopy,h]),onCut:x.useCallback(S=>{if(!s&&J.hasSelectableTarget(h,S.target)&&!at(S,g.onCut)&&!ul(S)){S.preventDefault(),J.setFragmentData(h,S.clipboardData,"cut");var{selection:W}=h;if(W)if(U.isExpanded(W))v.deleteFragment(h);else{var I=se.parent(h,W.anchor.path);v.isVoid(h,I)&&Q.delete(h)}}},[s,h,g.onCut]),onDragOver:x.useCallback(S=>{if(J.hasTarget(h,S.target)&&!at(S,g.onDragOver)){var W=J.toSlateNode(h,S.target);de.isElement(W)&&v.isVoid(h,W)&&S.preventDefault()}},[g.onDragOver,h]),onDragStart:x.useCallback(S=>{if(!s&&J.hasTarget(h,S.target)&&!at(S,g.onDragStart)){var W=J.toSlateNode(h,S.target),I=J.findPath(h,W),K=de.isElement(W)&&v.isVoid(h,W)||v.void(h,{at:I,voids:!0});if(K){var te=v.range(h,I);Q.select(h,te)}N.isDraggingInternally=!0,J.setFragmentData(h,S.dataTransfer,"drag")}},[s,h,g.onDragStart,N]),onDrop:x.useCallback(S=>{if(!s&&J.hasTarget(h,S.target)&&!at(S,g.onDrop)){S.preventDefault();var W=h.selection,I=J.findEventRange(h,S),K=S.dataTransfer;Q.select(h,I),N.isDraggingInternally&&W&&!U.equals(W,I)&&!v.void(h,{at:I,voids:!0})&&Q.delete(h,{at:W}),J.insertData(h,K),J.isFocused(h)||J.focus(h)}N.isDraggingInternally=!1},[s,h,g.onDrop,N]),onDragEnd:x.useCallback(S=>{!s&&N.isDraggingInternally&&g.onDragEnd&&J.hasTarget(h,S.target)&&g.onDragEnd(S),N.isDraggingInternally=!1},[s,N,g,h]),onFocus:x.useCallback(S=>{if(!s&&!N.isUpdatingSelection&&J.hasEditableTarget(h,S.target)&&!at(S,g.onFocus)){var W=J.toDOMNode(h,h),I=J.findDocumentOrShadowRoot(h);if(N.latestElement=I.activeElement,In&&S.target!==W){W.focus();return}en.set(h,!0)}},[s,N,h,g.onFocus]),onKeyDown:x.useCallback(S=>{if(!s&&J.hasEditableTarget(h,S.target)){var W;(W=$.current)===null||W===void 0||W.handleKeyDown(S);var{nativeEvent:I}=S;if(J.isComposing(h)&&I.isComposing===!1&&(mn.set(h,!1),b(!1)),at(S,g.onKeyDown)||J.isComposing(h))return;var{selection:K}=h,te=h.children[K!==null?K.focus.path[0]:0],ee=gd(se.string(te))==="rtl";if(Le.isRedo(I)){S.preventDefault();var ae=h;typeof ae.redo=="function"&&ae.redo();return}if(Le.isUndo(I)){S.preventDefault();var le=h;typeof le.undo=="function"&&le.undo();return}if(Le.isMoveLineBackward(I)){S.preventDefault(),Q.move(h,{unit:"line",reverse:!0});return}if(Le.isMoveLineForward(I)){S.preventDefault(),Q.move(h,{unit:"line"});return}if(Le.isExtendLineBackward(I)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(Le.isExtendLineForward(I)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus"});return}if(Le.isMoveBackward(I)){S.preventDefault(),K&&U.isCollapsed(K)?Q.move(h,{reverse:!ee}):Q.collapse(h,{edge:ee?"end":"start"});return}if(Le.isMoveForward(I)){S.preventDefault(),K&&U.isCollapsed(K)?Q.move(h,{reverse:ee}):Q.collapse(h,{edge:ee?"start":"end"});return}if(Le.isMoveWordBackward(I)){S.preventDefault(),K&&U.isExpanded(K)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:!ee});return}if(Le.isMoveWordForward(I)){S.preventDefault(),K&&U.isExpanded(K)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:ee});return}if(Zt){if((jd||hr)&&K&&(Le.isDeleteBackward(I)||Le.isDeleteForward(I))&&U.isCollapsed(K)){var V=se.parent(h,K.anchor.path);if(de.isElement(V)&&v.isVoid(h,V)&&(v.isInline(h,V)||v.isBlock(h,V))){S.preventDefault(),v.deleteBackward(h,{unit:"block"});return}}}else{if(Le.isBold(I)||Le.isItalic(I)||Le.isTransposeCharacter(I)){S.preventDefault();return}if(Le.isSoftBreak(I)){S.preventDefault(),v.insertSoftBreak(h);return}if(Le.isSplitBlock(I)){S.preventDefault(),v.insertBreak(h);return}if(Le.isDeleteBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h);return}if(Le.isDeleteForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h);return}if(Le.isDeleteLineBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"line"});return}if(Le.isDeleteLineForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h,{unit:"line"});return}if(Le.isDeleteWordBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"word"});return}if(Le.isDeleteWordForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:x.useCallback(S=>{!s&&J.hasEditableTarget(h,S.target)&&!at(S,g.onPaste)&&(!Zt||Cb(S.nativeEvent)||hr)&&(S.preventDefault(),J.insertData(h,S.clipboardData))},[s,h,g.onPaste])}),x.createElement(xy,{decorations:R,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},Ey=e=>{var{attributes:t,children:n}=e;return x.createElement("span",Tt({},t),n,st&&x.createElement("br",null))},ky=()=>[],_y=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&U.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),M0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ul=e=>nn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),By=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Ay=x.createContext(!1),Fy=x.createContext({});function Ty(e){var t=x.useRef([]).current,n=x.useRef({editor:e}).current,r=x.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=x.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var Sy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],jy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Kn(e,Sy),[l,u]=x.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ge.stringify(s)));if(!v.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ge.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:m}=Ty(t),f=x.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),m(t)},[t,m,r,a,i]);x.useEffect(()=>(bs.set(t,f),()=>{bs.set(t,()=>{})}),[t,f]);var[p,g]=x.useState(J.isFocused(t));return x.useEffect(()=>{g(J.isFocused(t))},[t]),Tr(()=>{var h=()=>g(J.isFocused(t));return Sd>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),x.createElement(Fy.Provider,{value:c},x.createElement(Kd.Provider,{value:l},x.createElement(ro.Provider,{value:l.editor},x.createElement(Ay.Provider,{value:p},n))))},ll=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},cl=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return ll(r,a)&&ll(a,r)},Oy=(e,t)=>{var n=v.range(e,U.end(t)),r=Array.from(v.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(cl(e,v.range(e,r[a]),n))return v.range(e,r[a],n);if(r.length<2)return v.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)cl(e,v.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return v.range(e,r[i],n)};function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Py=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 Ka.set(r,new WeakMap),r.addMark=(u,c)=>{var m,f;(m=so.get(r))===null||m===void 0||m(),!kt.get(r)&&(f=ct.get(r))!==null&&f!==void 0&&f.length&&kt.set(r,null),Wt.delete(r),o(u,c)},r.removeMark=u=>{var c;!kt.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&kt.set(r,null),Wt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&U.isCollapsed(r.selection)){var c=v.above(r,{match:g=>de.isElement(g)&&v.isBlock(r,g),at:r.selection});if(c){var[,m]=c,f=v.range(r,m,r.selection.anchor),p=Oy(r,f);U.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],m=[],f=ct.get(r);if(f!=null&&f.length){var p=f.map(F=>Pb(F,u)).filter(Boolean);ct.set(r,p)}var g=Qt.get(r);g&&Qt.set(r,Xu(r,g,u));var h=Gt.get(r);if(h!=null&&h.at){var y=xe.isPoint(h==null?void 0:h.at)?Cs(r,h.at,u):Xu(r,h.at,u);Gt.set(r,y?fl(fl({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Sn(r,u.path));break}case"set_selection":{var b;(b=vr.get(r))===null||b===void 0||b.unref(),vr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Sn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);c.push(...Sn(r,w));break}case"move_node":{var A=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...Sn(r,A));var k;P.isBefore(u.path,u.newPath)?(c.push(...Sn(r,P.parent(u.path))),k=u.newPath):(c.push(...Sn(r,P.parent(u.newPath))),k=u.path);var E=se.get(t,P.parent(k)),T=J.findKey(r,E),j=v.pathRef(r,P.parent(k));m.push([j,T]);break}}a(u);for(var[z,N]of c){var[$]=v.node(r,z);ka.set($,N)}for(var[M,C]of m)if(M.current){var[B]=v.node(r,M.current);ka.set(B,C)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[m,f]=U.edges(c),p=v.void(r,{at:m.path}),g=v.void(r,{at:f.path});if(!(U.isCollapsed(c)&&!p)){var h=J.toDOMRange(r,c),y=h.cloneContents(),b=y.childNodes[0];if(y.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(b=$)}),g){var[w]=g,A=h.cloneRange(),k=J.toDOMNode(r,w);A.setEndAfter(k),y=A.cloneContents()}if(p&&(b=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var M=$.getAttribute("data-slate-zero-width")==="n";$.textContent=M?`
112
- `:""}),Nd(b)){var E=b.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(b),y.appendChild(E),b=E}var T=r.getFragment(),j=JSON.stringify(T),z=window.btoa(encodeURIComponent(j));b.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var N=y.ownerDocument.createElement("div");return N.appendChild(y),N.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Id(N)),y.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||_b(u);if(c){var m=decodeURIComponent(window.atob(c)),f=JSON.parse(m);return r.insertFragment(f),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var m=c.split(/\r\n|\r|\n/),f=!1;for(var p of m)f&&Q.splitNodes(r,{always:!0}),r.insertText(p),f=!0;return!0}return!1},r.onChange=u=>{var c=Sd<18?gc.unstable_batchedUpdates:m=>m();c(()=>{var m=bs.get(r);m&&m(u),i(u)})},r},Sn=(e,t)=>{var n=[];for(var[r,a]of v.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ry={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Kt=x.createContext(Ry);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),Ot=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ot||{});const Ny=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return d.jsx("a",{...e,children:t});case Z.li:return d.jsx("li",{...e,children:t});case Z.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return d.jsx("ol",{...e,children:t});case Z.ul:return d.jsx("ul",{...e,children:t});case Z.span:return d.jsx("span",{...e,children:t});case Z.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},My=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=d.jsx("strong",{children:t})),r[Z.italic]&&(t=d.jsx("em",{children:t})),r[Z.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},ws="MENTION: ",Yd={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},hl={"mention-popover":35,default:-52},Ci=16,Gd=(e,t,n)=>{const r=x.useRef(null),{showLinkEditor:a,mentionPopover:i}=x.useContext(Kt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),x.useEffect(()=>{var p,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:h}=i;u=J.toDOMRange(e,h||Yd).getBoundingClientRect();const b=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((b==null?void 0:b.width)||0)/Ci}rem`),c=(b==null?void 0:b.left)||0}else{const h=document.getSelection();h!=null&&h.toString().trim().length&&(u=h==null?void 0:h.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=hl[t]||hl.default,f=((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=`${f/Ci}rem`,l.style.left=`${c/Ci}rem`},o),r},Iy=e=>{const[t,n]=x.useState(null);return x.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=v.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Rc(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 it=(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))(it||{});const $n={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ot.emphasis]:Z.italic,[Ot.strong]:Z.bold,[Ot.delete]:Z.strikethrough,[Ot.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function ml(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Qd=Object.prototype.toString,pl=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,vl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Qd.call(t)==="[object Array]"},bl=function(t){if(!t||Qd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},yl=function(t,n){pl&&n.name==="__proto__"?pl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Dl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(gl)return gl(t,n).value}else return;return t[n]},$y=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Dl(o,n),a=Dl(t,n),o!==a&&(c&&a&&(bl(a)||(i=vl(a)))?(i?(i=!1,s=r&&vl(r)?r:[]):s=r&&bl(r)?r:{},yl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&yl(o,{name:n,newValue:a}));return o};const xi=wn($y);function Es(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 Ly(){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?zy(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 zy(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 br(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Cl(e.position):"start"in e||"end"in e?Cl(e):"line"in e||"column"in e?ks(e):""}function ks(e){return xl(e&&e.line)+":"+xl(e&&e.column)}function Cl(e){return ks(e&&e.start)+"-"+ks(e&&e.end)}function xl(e){return e&&typeof e=="number"?e:1}class ht 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=br(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}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:qy,dirname:Wy,extname:Hy,join:Uy,sep:"/"};function qy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Or(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 Wy(e){if(Or(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 Hy(e){Or(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 Uy(...e){let t=-1,n;for(;++t<e.length;)Or(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Vy(n)}function Vy(e){Or(e);const t=e.codePointAt(0)===47;let n=Ky(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ky(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 Or(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Zy={cwd:Yy};function Yy(){return"/"}function _s(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Gy(e){if(typeof e=="string")e=new URL(e);else if(!_s(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 Qy(e)}function Qy(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const wi=["history","path","basename","stem","extname","dirname"];class Jy{constructor(t){let n;t?_s(t)?n={path:t}:typeof t=="string"||Xy(t)?n={value:t}:n=t:n={},this.cwd=Zy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wi.length;){const i=wi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)wi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){ki(t,"basename"),Ei(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){wl(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(Ei(t,"extname"),wl(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=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_s(t)&&(t=Gy(t)),ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){ki(t,"stem"),Ei(t,"stem"),this.path=St.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 ht(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 Ei(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Xy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e1=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},t1={}.hasOwnProperty;class lo extends e1{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=Ly()}copy(){const t=new lo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(xi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ai("data",this.frozen),this.namespace[t]=n,this):t1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ai("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=Yr(t),r=this.parser||this.Parser;return _i("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_i("process",this.parser||this.Parser),Bi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Yr(t),l=r.parse(o);r.run(l,o,function(c,m,f){if(c||!m||!f)return u(c);const p=m,g=r.stringify(p,f);a1(g)?f.value=g:f.result=g,u(c,f)});function u(c,m){c||!m?s(c):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),_i("processSync",this.parser||this.Parser),Bi("processSync",this.compiler||this.Compiler),this.process(t,a),kl("processSync","process",n),r;function a(i,s){n=!0,ml(i),r=s}}run(t,n,r){El(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=Yr(n);a.run(t,l,u);function u(c,m,f){const p=m||t;c?o(c):s?s(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),kl("runSync","run",r),a;function i(s,o){ml(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),a=this.compiler||this.Compiler;return Bi("stringify",a),El(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ai("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=xi(!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,f=-1;for(;++m<r.length;)if(r[m][0]===u){f=m;break}if(f===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const h=r[f][1];Es(h)&&Es(p)&&(p=xi(!0,h,p)),r[f]=[u,p,...g]}}}}const n1=new lo().freeze();function _i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ai(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 El(e){if(!Es(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return r1(e)?e:new Jy(e)}function r1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function a1(e){return typeof e=="string"||i1(e)}function i1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s1={};function o1(e,t){const n=t||s1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Jd(e,r,a)}function Jd(e,t,n){if(u1(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 _l(e.children,t,n)}return Array.isArray(e)?_l(e,t,n):""}function _l(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Jd(e[a],t,n);return r.join("")}function u1(e){return!!(e&&typeof e=="object")}const Bl=document.createElement("i");function co(e){const t="&"+e+";";Bl.innerHTML=t;const n=Bl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Nt(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 Dt(e,t){return e.length>0?(Nt(e,e.length,0,t),e):t}const Al={}.hasOwnProperty;function l1(e){const t={};let n=-1;for(;++n<e.length;)c1(t,e[n]);return t}function c1(e,t){let n;for(n in t){const a=(Al.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Al.call(a,s)||(a[s]=[]);const o=i[s];d1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function d1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Nt(e,0,0,r)}function Xd(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 jt=un(/[A-Za-z]/),_t=un(/[\dA-Za-z]/),f1=un(/[#-'*+\--9=?A-Z^-~]/);function Bs(e){return e!==null&&(e<32||e===127)}const As=un(/\d/),h1=un(/[\dA-Fa-f]/),m1=un(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Ae(e){return e===-2||e===-1||e===32}const p1=un(/\p{P}|\p{S}/u),g1=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ae(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ae(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const v1={tokenize:b1};function b1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ne(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return be(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const y1={tokenize:D1},Fl={tokenize:C1};function D1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const k=t.events.length;let E=k,T;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){T=t.events[E][1].end;break}b(r);let j=k;for(;j<t.events.length;)t.events[j][1].end=Object.assign({},T),j++;return Nt(t.events,E+1,0,t.events.slice(k)),t.events.length=j,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return f(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fl,c,m)(A)}function c(A){return a&&w(),b(r),f(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function f(A){return t.containerState={},e.attempt(Fl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),f(A)}function g(A){if(A===null){a&&w(),b(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(A)}function h(A){if(A===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(A);return}return be(A)?(e.consume(A),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),h)}function y(A,k){const E=t.sliceStream(A);if(k&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<s&&(!a.events[T][1].end||a.events[T][1].end.offset>s))return;const j=t.events.length;let z=j,N,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(N){$=t.events[z][1].end;break}N=!0}for(b(r),T=j;T<t.events.length;)t.events[T][1].end=Object.assign({},$),T++;Nt(t.events,z+1,0,t.events.slice(j)),t.events.length=T}}function b(A){let k=n.length;for(;k-- >A;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function C1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tl(e){if(e===null||ft(e)||g1(e))return 1;if(p1(e))return 2}function fo(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 Fs={name:"attention",tokenize:w1,resolveAll:x1};function x1(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),f=Object.assign({},e[n][1].start);Sl(m,-l),Sl(f,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:f},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=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,fo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(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=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Nt(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 w1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Tl(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=Tl(l),m=!c||c===2&&a||n.includes(l),f=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?m:m&&(a||!f)),u._close=!!(i===42?f:f&&(c||!m)),t(l)}}function Sl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const E1={name:"autolink",tokenize:k1};function k1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||_t(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||_t(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Bs(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):f1(p)?(e.consume(p),u):n(p)}function c(p){return _t(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||_t(p))&&r++<63){const g=p===45?f:m;return e.consume(p),g}return n(p)}}const Za={tokenize:_1,partial:!0};function _1(e,t,n){return r;function r(i){return Ae(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const ef={name:"blockQuote",tokenize:B1,continuation:{tokenize:A1},exit:F1};function B1(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 Ae(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function A1(e,t,n){const r=this;return a;function a(s){return Ae(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(ef,t,n)(s)}}function F1(e){e.exit("blockQuote")}const tf={name:"characterEscape",tokenize:T1};function T1(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 m1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nf={name:"characterReference",tokenize:S1};function S1(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=_t,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=h1,c):(e.enter("characterReferenceValue"),i=7,s=As,c(m))}function c(m){if(m===59&&a){const f=e.exit("characterReferenceValue");return s===_t&&!co(r.sliceSerialize(f))?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 jl={tokenize:O1,partial:!0},Ol={name:"codeFenced",tokenize:j1,concrete:!0};function j1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(T)}function c(T){return T===o?(s++,e.consume(T),c):s<3?n(T):(e.exit("codeFencedFenceSequence"),Ae(T)?Ne(e,m,"whitespace")(T):m(T))}function m(T){return T===null||be(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(jl,h,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(T))}function f(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):Ae(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),f)}function p(T){return T===null||be(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===o?n(T):(e.consume(T),g)}function h(T){return e.attempt(a,k,y)(T)}function y(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),b}function b(T){return i>0&&Ae(T)?Ne(e,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||be(T)?e.check(jl,h,k)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||be(T)?(e.exit("codeFlowValue"),w(T)):(e.consume(T),A)}function k(T){return e.exit("codeFenced"),t(T)}function E(T,j,z){let N=0;return $;function $(R){return T.enter("lineEnding"),T.consume(R),T.exit("lineEnding"),M}function M(R){return T.enter("codeFencedFence"),Ae(R)?Ne(T,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):C(R)}function C(R){return R===o?(T.enter("codeFencedFenceSequence"),B(R)):z(R)}function B(R){return R===o?(N++,T.consume(R),B):N>=s?(T.exit("codeFencedFenceSequence"),Ae(R)?Ne(T,F,"whitespace")(R):F(R)):z(R)}function F(R){return R===null||be(R)?(T.exit("codeFencedFence"),j(R)):z(R)}}}function O1(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 Fi={name:"codeIndented",tokenize:R1},P1={tokenize:N1,partial:!0};function R1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):be(u)?e.attempt(P1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||be(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function N1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ne(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):be(s)?a(s):n(s)}}const M1={name:"codeText",tokenize:L1,resolve:I1,previous:$1};function I1(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function $1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function L1(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)):be(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||be(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))}}function rf(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,z1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Nt(e,a,n-a+1,o))}}return!u}function z1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,m,f=-1,p=n,g=0,h=0;const y=[h];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(h=f+1,y.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),f=y.length;f--;){const b=o.slice(y[f],y[f+1]),w=i.pop();l.unshift([w,w+b.length-1]),Nt(e,w,2,b)}for(f=-1;++f<l.length;)u[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return u}const q1={tokenize:U1,resolve:H1},W1={tokenize:V1,partial:!0};function H1(e){return rf(e),e}function U1(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):be(o)?e.check(W1,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 V1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(e,i,"linePrefix")}function i(s){if(s===null||be(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function af(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return m;function m(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||Bs(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),h(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),f(b)):b===null||b===60||be(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function h(b){return!c&&(b===null||b===41||ft(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):c<u&&b===40?(e.consume(b),c++,h):b===41?(e.consume(b),c--,h):b===null||b===32||b===40||Bs(b)?n(b):(e.consume(b),b===92?y:h)}function y(b){return b===40||b===41||b===92?(e.consume(b),h):h(b)}}function sf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||be(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Ae(p)),p===92?f:m)}function f(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function of(e,t,n,r,a,i){let s;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(a),e.consume(f),e.exit(a),s=f===40?41:f,l):n(f)}function l(f){return f===s?(e.enter(a),e.consume(f),e.exit(a),e.exit(r),t):(e.enter(i),u(f))}function u(f){return f===s?(e.exit(i),l(s)):f===null?n(f):be(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===s||f===null||be(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?m:c)}function m(f){return f===s||f===92?(e.consume(f),c):c(f)}}function yr(e,t){let n;return r;function r(a){return be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ae(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const K1={name:"definition",tokenize:Y1},Z1={tokenize:G1,partial:!0};function Y1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return sf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ft(p)?yr(e,u)(p):u(p)}function u(p){return af(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Z1,m,m)(p)}function m(p){return Ae(p)?Ne(e,f,"whitespace")(p):f(p)}function f(p){return p===null||be(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function G1(e,t,n){return r;function r(o){return ft(o)?yr(e,a)(o):n(o)}function a(o){return of(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ae(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const Q1={name:"hardBreakEscape",tokenize:J1};function J1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return be(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const X1={name:"headingAtx",tokenize:tD,resolve:eD};function eD(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"},Nt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function tD(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||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||be(c)?(e.exit("atxHeading"),t(c)):Ae(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const nD=["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"],Pl=["pre","script","style","textarea"],rD={name:"htmlFlow",tokenize:oD,resolveTo:sD,concrete:!0},aD={tokenize:lD,partial:!0},iD={tokenize:uD,partial:!0};function sD(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 oD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),f):_===47?(e.consume(_),i=!0,h):_===63?(e.consume(_),a=3,r.interrupt?t:D):jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function f(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):jt(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const S="CDATA[";return _===S.charCodeAt(o++)?(e.consume(_),o===S.length?r.interrupt?t:C:g):n(_)}function h(_){return jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function y(_){if(_===null||_===47||_===62||ft(_)){const S=_===47,W=s.toLowerCase();return!S&&!i&&Pl.includes(W)?(a=1,r.interrupt?t(_):C(_)):nD.includes(s.toLowerCase())?(a=6,S?(e.consume(_),b):r.interrupt?t(_):C(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?w(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),y):n(_)}function b(_){return _===62?(e.consume(_),r.interrupt?t:C):n(_)}function w(_){return Ae(_)?(e.consume(_),w):$(_)}function A(_){return _===47?(e.consume(_),$):_===58||_===95||jt(_)?(e.consume(_),k):Ae(_)?(e.consume(_),A):$(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),T):Ae(_)?(e.consume(_),E):A(_)}function T(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,j):Ae(_)?(e.consume(_),T):z(_)}function j(_){return _===l?(e.consume(_),l=null,N):_===null||be(_)?n(_):(e.consume(_),j)}function z(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?E(_):(e.consume(_),z)}function N(_){return _===47||_===62||Ae(_)?A(_):n(_)}function $(_){return _===62?(e.consume(_),M):n(_)}function M(_){return _===null||be(_)?C(_):Ae(_)?(e.consume(_),M):n(_)}function C(_){return _===45&&a===2?(e.consume(_),L):_===60&&a===1?(e.consume(_),q):_===62&&a===4?(e.consume(_),H):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),ne):be(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(aD,X,B)(_)):_===null||be(_)?(e.exit("htmlFlowData"),B(_)):(e.consume(_),C)}function B(_){return e.check(iD,F,X)(_)}function F(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),R}function R(_){return _===null||be(_)?B(_):(e.enter("htmlFlowData"),C(_))}function L(_){return _===45?(e.consume(_),D):C(_)}function q(_){return _===47?(e.consume(_),s="",oe):C(_)}function oe(_){if(_===62){const S=s.toLowerCase();return Pl.includes(S)?(e.consume(_),H):C(_)}return jt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),oe):C(_)}function ne(_){return _===93?(e.consume(_),D):C(_)}function D(_){return _===62?(e.consume(_),H):_===45&&a===2?(e.consume(_),D):C(_)}function H(_){return _===null||be(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),H)}function X(_){return e.exit("htmlFlow"),t(_)}}function uD(e,t,n){const r=this;return a;function a(s){return be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function lD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Za,t,n)}}const cD={name:"htmlText",tokenize:dD};function dD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),E):D===63?(e.consume(D),A):jt(D)?(e.consume(D),z):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):jt(D)?(e.consume(D),w):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function m(D){return D===null?n(D):D===45?(e.consume(D),f):be(D)?(s=m,q(D)):(e.consume(D),m)}function f(D){return D===45?(e.consume(D),p):m(D)}function p(D){return D===62?L(D):D===45?f(D):m(D)}function g(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?h:g):n(D)}function h(D){return D===null?n(D):D===93?(e.consume(D),y):be(D)?(s=h,q(D)):(e.consume(D),h)}function y(D){return D===93?(e.consume(D),b):h(D)}function b(D){return D===62?L(D):D===93?(e.consume(D),b):h(D)}function w(D){return D===null||D===62?L(D):be(D)?(s=w,q(D)):(e.consume(D),w)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):be(D)?(s=A,q(D)):(e.consume(D),A)}function k(D){return D===62?L(D):A(D)}function E(D){return jt(D)?(e.consume(D),T):n(D)}function T(D){return D===45||_t(D)?(e.consume(D),T):j(D)}function j(D){return be(D)?(s=j,q(D)):Ae(D)?(e.consume(D),j):L(D)}function z(D){return D===45||_t(D)?(e.consume(D),z):D===47||D===62||ft(D)?N(D):n(D)}function N(D){return D===47?(e.consume(D),L):D===58||D===95||jt(D)?(e.consume(D),$):be(D)?(s=N,q(D)):Ae(D)?(e.consume(D),N):L(D)}function $(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),$):M(D)}function M(D){return D===61?(e.consume(D),C):be(D)?(s=M,q(D)):Ae(D)?(e.consume(D),M):N(D)}function C(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,B):be(D)?(s=C,q(D)):Ae(D)?(e.consume(D),C):(e.consume(D),F)}function B(D){return D===a?(e.consume(D),a=void 0,R):D===null?n(D):be(D)?(s=B,q(D)):(e.consume(D),B)}function F(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ft(D)?N(D):(e.consume(D),F)}function R(D){return D===47||D===62||ft(D)?N(D):n(D)}function L(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),oe}function oe(D){return Ae(D)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const ho={name:"labelEnd",tokenize:vD,resolveTo:gD,resolveAll:pD},fD={tokenize:bD},hD={tokenize:yD},mD={tokenize:DD};function pD(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 gD(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=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,fo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Nt(e,i,e.length,o),e}function vD(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(f){return i?i._inactive?m(f):(s=r.parser.defined.includes(qn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(fD,c,s?c:m)(f):f===91?e.attempt(hD,c,s?u:m)(f):s?c(f):m(f)}function u(f){return e.attempt(mD,c,m)(f)}function c(f){return t(f)}function m(f){return i._balanced=!0,n(f)}}function bD(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 ft(m)?yr(e,i)(m):i(m)}function i(m){return m===41?c(m):af(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ft(m)?yr(e,l)(m):c(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?of(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):c(m)}function u(m){return ft(m)?yr(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 yD(e,t,n){const r=this;return a;function a(o){return sf.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 DD(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 CD={name:"labelStartImage",tokenize:xD,resolveAll:ho.resolveAll};function xD(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 wD={name:"labelStartLink",tokenize:ED,resolveAll:ho.resolveAll};function ED(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 Ti={name:"lineEnding",tokenize:kD};function kD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:_D};function _D(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ae(u)?Ne(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:FD,continuation:{tokenize:TD},exit:jD},BD={tokenize:OD,partial:!0},AD={tokenize:SD,partial:!0};function FD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:As(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return As(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Za,r.interrupt?n:c,e.attempt(BD,f,m))}function c(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function m(p){return Ae(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function TD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Za,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ae(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(AD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function SD(e,t,n){const r=this;return Ne(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function jD(e){e.exit(this.containerState.type)}function OD(e,t,n){const r=this;return Ne(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Ae(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Rl={name:"setextUnderline",tokenize:RD,resolveTo:PD};function PD(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 RD(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"),Ae(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ND={tokenize:MD};function MD(e){const t=this,n=e.attempt(Za,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt(q1,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 ID={resolveAll:lf()},$D=uf("string"),LD=uf("text");function uf(e){return{tokenize:t,resolveAll:lf(e==="text"?zD: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 f=-1;if(m)for(;++f<m.length;){const p=m[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function lf(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 zD(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 qD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:A,exit:k,attempt:j(E),check:j(T),interrupt:j(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:f,now:g,defineSkip:h,write:m};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(M){return s=Dt(s,M),y(),s[s.length-1]!==null?[]:(z(t,0),u.events=fo(i,u.events,u),u.events)}function f(M,C){return HD(p(M),C)}function p(M){return WD(s,M)}function g(){const{line:M,column:C,offset:B,_index:F,_bufferIndex:R}=r;return{line:M,column:C,offset:B,_index:F,_bufferIndex:R}}function h(M){a[M.line]=M.column,$()}function y(){let M;for(;r._index<s.length;){const C=s[r._index];if(typeof C=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<C.length;)b(C.charCodeAt(r._bufferIndex));else b(C)}}function b(M){c=c(M)}function w(M){be(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,$()):M!==-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=M}function A(M,C){const B=C||{};return B.type=M,B.start=g(),u.events.push(["enter",B,u]),o.push(B),B}function k(M){const C=o.pop();return C.end=g(),u.events.push(["exit",C,u]),C}function E(M,C){z(M,C.from)}function T(M,C){C.restore()}function j(M,C){return B;function B(F,R,L){let q,oe,ne,D;return Array.isArray(F)?X(F):"tokenize"in F?X([F]):H(F);function H(I){return K;function K(te){const ee=te!==null&&I[te],ae=te!==null&&I.null,le=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return X(le)(te)}}function X(I){return q=I,oe=0,I.length===0?L:_(I[oe])}function _(I){return K;function K(te){return D=N(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?W():I.tokenize.call(C?Object.assign(Object.create(u),C):u,l,S,W)(te)}}function S(I){return M(ne,D),R}function W(I){return D.restore(),++oe<q.length?_(q[oe]):L}}}function z(M,C){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Nt(u.events,C,u.events.length-C,M.resolve(u.events.slice(C),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function N(){const M=g(),C=u.previous,B=u.currentConstruct,F=u.events.length,R=Array.from(o);return{restore:L,from:F};function L(){r=M,u.previous=C,u.currentConstruct=B,u.events.length=F,o=R,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function WD(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 HD(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=`
111
+ `:""),[i]=x.useState(a);return Tr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),x.createElement(Xb,{ref:r},i)},Xb=x.memo(x.forwardRef((e,t)=>x.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Di=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),x.createElement("span",Qb({},a),!st||!n?"\uFEFF":null,n?x.createElement("br",null):null)};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 qd(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){xt(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 ey=st?300:0;function ty(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function il(e){e.current&&(clearTimeout(e.current),e.current=null)}var ny=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>x.createElement(ay,qd({},w))}=e,o=on(),l=x.useRef(null),u=x.useRef(null),[c,m]=x.useState(!1),h=x.useRef(null),p=x.useCallback(w=>{if(ty(l,w==null),w==null){var A;gs.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(gs.set(o,w),!l.current){var k=window.ResizeObserver||ab;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=x.createElement(Jb,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Zn];if(x.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},ey)):(il(h),m(!1)),()=>il(h)),[f,m]),f&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:hr?"inherit":void 0},contentEditable:!1,ref:p}};g=x.createElement(x.Fragment,null,i(y),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},ry=x.memo(ny,(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[Zn]===e.leaf[Zn]),ay=e=>{var{attributes:t,children:n}=e;return x.createElement("span",qd({},t),n)},iy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=on(),l=x.useRef(null),u=fe.decorations(s,t),c=J.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(x.createElement(ry,{isLast:n&&h===u.length-1,key:"".concat(c.id,"-").concat(h),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=x.useCallback(f=>{var y=Ka.get(o);f?(y==null||y.set(c,f),bn.set(s,f),Fr.set(f,s)):(y==null||y.delete(c),bn.delete(s),l.current&&Fr.delete(l.current)),l.current=f},[l,o,c,s]);return x.createElement("span",{"data-slate-node":"text",ref:g},m)},Wd=x.memo(iy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Gb(t.decorations,e.decorations));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 xs(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){xt(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 sy=e=>{var{decorations:t,element:n,renderElement:r=w=>x.createElement(uy,xs({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=on(),l=dy(),u=o.isInline(n),c=J.findKey(o,n),m=x.useCallback(w=>{var A=Ka.get(o);w?(A==null||A.set(c,w),bn.set(n,w),Fr.set(w,n)):(A==null||A.delete(c),bn.delete(n))},[o,c,n]),h=Ud({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&v.hasInlines(o,n)){var g=se.string(n),f=gd(g);f==="rtl"&&(p.dir=f)}if(v.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[b]]=se.texts(n);h=x.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},x.createElement(Wd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),ao.set(b,0),io.set(b,n)}return r({attributes:p,children:h,element:n})},oy=x.memo(sy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Yb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&U.equals(e.selection,t.selection))),uy=e=>{var{attributes:t,children:n,element:r}=e,a=on(),i=a.isInline(r)?"span":"div";return x.createElement(i,xs(xs({},t),{},{style:{position:"relative"}}),n)},Hd=x.createContext(()=>[]),ly=()=>x.useContext(Hd),cy=x.createContext(!1),Ud=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=ly(),l=on(),u=J.findPath(l,n),c=[],m=de.isElement(n)&&!l.isInline(n)&&v.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),g=n.children[h],f=J.findKey(l,g),y=v.range(l,p),b=s&&U.intersection(y,s),w=o([g,p]);for(var A of t){var k=U.intersection(A,y);k&&w.push(k)}de.isElement(g)?c.push(x.createElement(cy.Provider,{key:"provider-".concat(f.id),value:!!b},x.createElement(oy,{decorations:w,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):c.push(x.createElement(Wd,{decorations:w,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ao.set(g,h),io.set(g,n)}return c},Vd=x.createContext(!1),dy=()=>x.useContext(Vd),Kd=x.createContext(null),_n=()=>{var e=x.useContext(Kd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function fy(){var e=on(),t=x.useRef(!1),n=x.useRef(0),r=x.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return x.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var hy=3,my={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"},py={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"},gy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},$e=e=>{var t=my[e],n=py[e],r=gy[e],a=t&&yi(t),i=n&&yi(n),s=r&&yi(r);return o=>!!(a&&a(o)||Qu&&i&&i(o)||!Qu&&s&&s(o))},Le={isBold:$e("bold"),isCompose:$e("compose"),isMoveBackward:$e("moveBackward"),isMoveForward:$e("moveForward"),isDeleteBackward:$e("deleteBackward"),isDeleteForward:$e("deleteForward"),isDeleteLineBackward:$e("deleteLineBackward"),isDeleteLineForward:$e("deleteLineForward"),isDeleteWordBackward:$e("deleteWordBackward"),isDeleteWordForward:$e("deleteWordForward"),isExtendBackward:$e("extendBackward"),isExtendForward:$e("extendForward"),isExtendLineBackward:$e("extendLineBackward"),isExtendLineForward:$e("extendLineForward"),isItalic:$e("italic"),isMoveLineBackward:$e("moveLineBackward"),isMoveLineForward:$e("moveLineForward"),isMoveWordBackward:$e("moveWordBackward"),isMoveWordForward:$e("moveWordForward"),isRedo:$e("redo"),isSoftBreak:$e("insertSoftBreak"),isSplitBlock:$e("splitBlock"),isTransposeCharacter:$e("transposeCharacter"),isUndo:$e("undo")},vy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>uo(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}},by={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Zd extends x.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(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,by)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=vy(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}}xt(Zd,"contextType",ro);var yy=st?Zd:e=>{var{children:t}=e;return x.createElement(x.Fragment,null,t)},Dy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Cy=["text"];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 Tt(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){xt(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 xy=e=>x.createElement(x.Fragment,null,Ud(e)),wy=e=>{var t=x.useCallback(S=>x.createElement(Ey,Tt({},S)),[]),{autoFocus:n,decorate:r=ky,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=_y,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,g=Kn(e,Dy),f=_n(),[y,b]=x.useState(!1),w=x.useRef(null),A=x.useRef([]),[k,E]=x.useState(),{onUserInput:F,receivedUserInput:j}=fy(),[,z]=x.useReducer(S=>S+1,0);Pd.set(f,z),vs.set(f,s);var N=x.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);x.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var $=x.useRef(),M=x.useMemo(()=>P0(()=>{var S=$.current;if((st||!J.isComposing(f))&&(!N.isUpdatingSelection||S!=null&&S.isFlushing())&&!N.isDraggingInternally){var W=J.findDocumentOrShadowRoot(f),{activeElement:I}=W,K=J.toDOMNode(f,f),te=W.getSelection();if(I===K?(N.latestElement=I,en.set(f,!0)):en.delete(f),!te)return Q.deselect(f);var{anchorNode:ee,focusNode:ae}=te,le=J.hasEditableTarget(f,ee)||J.isTargetInsideNonReadonlyVoid(f,ee),V=J.hasEditableTarget(f,ae)||J.isTargetInsideNonReadonlyVoid(f,ae);if(le&&V){var he=J.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});he&&(!J.isComposing(f)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?Q.select(f,he):S==null||S.handleUserSelect(he))}s&&(!le||!V)&&Q.deselect(f)}},100),[f,s,N]),C=x.useMemo(()=>A0(M,0),[M]);$.current=Ub({node:w,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:C}),Tr(()=>{var S,W,I;w.current&&(I=oo(w.current))?(Od.set(f,I),da.set(f,w.current),bn.set(f,w.current),Fr.set(w.current,f)):bn.delete(f);var{selection:K}=f,te=J.findDocumentOrShadowRoot(f),ee=te.getSelection();if(!(!ee||!J.isFocused(f)||(S=$.current)!==null&&S!==void 0&&S.hasPendingAction())){var ae=pe=>{var we=ee.type!=="None";if(!(!K&&!we)){var je=ee.focusNode,Oe;if(In&&ee.rangeCount>1){var Qe=ee.getRangeAt(0),Ze=ee.getRangeAt(ee.rangeCount-1);Qe.startContainer===je?Oe=Ze.endContainer:Oe=Qe.startContainer}else Oe=ee.anchorNode;var Ye=da.get(f),nt=!1;if(Ye.contains(Oe)&&Ye.contains(je)&&(nt=!0),we&&nt&&K&&!pe){var Fe=J.toSlateRange(f,ee,{exactMatch:!0,suppressThrow:!0});if(Fe&&U.equals(Fe,K)){var He;if(!N.hasMarkPlaceholder||(He=Oe)!==null&&He!==void 0&&(He=He.parentElement)!==null&&He!==void 0&&He.hasAttribute("data-slate-mark-placeholder"))return}}if(K&&!J.hasRange(f,K)){f.selection=J.toSlateRange(f,ee,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ze=K&&J.toDOMRange(f,K);return ze?(J.isComposing(f)&&!st?ee.collapseToEnd():U.isBackward(K)?ee.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):ee.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),c(f,ze)):ee.removeAllRanges(),ze}};ee.rangeCount<=1&&ae();var le=((W=$.current)===null||W===void 0?void 0:W.isFlushing())==="action";if(!st||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var V=null,he=requestAnimationFrame(()=>{if(le){var pe=we=>{try{var je=J.toDOMNode(f,f);je.focus(),ae(we)}catch{}};pe(),V=setTimeout(()=>{pe(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(he),V&&clearTimeout(V)}}});var B=x.useCallback(S=>{if(F(),!s&&J.hasEditableTarget(f,S.target)&&!By(S,a)){var W;if($.current)return $.current.handleDOMBeforeInput(S);C.flush(),M.flush();var{selection:I}=f,{inputType:K}=S,te=S.dataTransfer||S.data||void 0,ee=K==="insertCompositionText"||K==="deleteCompositionText";if(ee&&J.isComposing(f))return;var ae=!1;if(K==="insertText"&&I&&U.isCollapsed(I)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&I.anchor.offset!==0){var le,V;ae=!0,f.marks&&(ae=!1);var{anchor:he}=I,[pe,we]=J.toDOMPoint(f,he),je=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Oe=J.getWindow(f);if(ae&&je&&J.hasDOMNode(f,je)){var Qe,Ze=Oe==null?void 0:Oe.document.createTreeWalker(je,NodeFilter.SHOW_TEXT).lastChild();Ze===pe&&((Qe=Ze.textContent)===null||Qe===void 0?void 0:Qe.length)===we&&(ae=!1)}if(ae&&pe.parentElement&&(Oe==null||(V=Oe.getComputedStyle(pe.parentElement))===null||V===void 0?void 0:V.whiteSpace)==="pre"){var Ye=v.above(f,{at:he.path,match:ie=>de.isElement(ie)&&v.isBlock(f,ie)});Ye&&se.string(Ye[0]).includes(" ")&&(ae=!1)}}if(!K.startsWith("delete")||K.startsWith("deleteBy")){var[nt]=S.getTargetRanges();if(nt){var Fe=J.toSlateRange(f,nt,{exactMatch:!1,suppressThrow:!1});if(!I||!U.equals(I,Fe)){ae=!1;var He=!ee&&f.selection&&v.rangeRef(f,f.selection);Q.select(f,Fe),He&&vr.set(f,He)}}}if(ee)return;if(ae||S.preventDefault(),I&&U.isExpanded(I)&&K.startsWith("delete")){var ze=K.endsWith("Backward")?"backward":"forward";v.deleteFragment(f,{direction:ze});return}switch(K){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{v.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{v.deleteForward(f);break}case"deleteContentBackward":{v.deleteBackward(f);break}case"deleteEntireSoftLine":{v.deleteBackward(f,{unit:"line"}),v.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{v.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{v.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{v.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{v.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{v.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{v.deleteForward(f,{unit:"word"});break}case"insertLineBreak":v.insertSoftBreak(f);break;case"insertParagraph":{v.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{K==="insertFromComposition"&&J.isComposing(f)&&(b(!1),mn.set(f,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(f,te):typeof te=="string"&&(ae?A.current.push(()=>v.insertText(f,te)):v.insertText(f,te));break}}var Y=(W=vr.get(f))===null||W===void 0?void 0:W.unref();vr.delete(f),Y&&(!f.selection||!U.equals(f.selection,Y))&&Q.select(f,Y)}},[f,M,F,a,s,C]),T=x.useCallback(S=>{S==null?(M.cancel(),C.cancel(),da.delete(f),bn.delete(f),w.current&&Zt&&w.current.removeEventListener("beforeinput",B)):Zt&&S.addEventListener("beforeinput",B),w.current=S},[M,C,f,B]);Tr(()=>{var S=J.getWindow(f);return S.document.addEventListener("selectionchange",C),()=>{S.document.removeEventListener("selectionchange",C)}},[C]);var R=r([f,[]]),L=i&&f.children.length===1&&Array.from(se.texts(f)).length===1&&se.string(f)===""&&!y,q=x.useCallback(S=>{if(S&&L){var W;E((W=S.getBoundingClientRect())===null||W===void 0?void 0:W.height)}else E(void 0)},[L]);if(L){var oe=v.start(f,[]);R.push({[Zn]:!0,placeholder:i,onPlaceholderResize:q,anchor:oe,focus:oe})}var{marks:ne}=f;if(N.hasMarkPlaceholder=!1,f.selection&&U.isCollapsed(f.selection)&&ne){var{anchor:D}=f.selection,H=se.leaf(f,D.path),X=Kn(H,Cy);if(!fe.equals(H,ne,{loose:!0})){N.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(S=>[S,null]));R.push(Tt(Tt(Tt({[Rd]:!0},_),ne),{},{anchor:D,focus:D}))}}return x.useEffect(()=>{setTimeout(()=>{var{selection:S}=f;if(S){var{anchor:W}=S,I=se.leaf(f,W.path);if(ne&&!fe.equals(I,ne,{loose:!0})){kt.set(f,ne);return}}kt.delete(f)})}),x.createElement(Vd.Provider,{value:s},x.createElement(Hd.Provider,{value:r},x.createElement(yy,{node:w,receivedUserInput:j},x.createElement(h,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Zt||!ca?g.spellCheck:!1,autoCorrect:Zt||!ca?g.autoCorrect:"false",autoCapitalize:Zt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:T,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),m),onBeforeInput:x.useCallback(S=>{if(!Zt&&!s&&!at(S,g.onBeforeInput)&&J.hasSelectableTarget(f,S.target)&&(S.preventDefault(),!J.isComposing(f))){var W=S.data;v.insertText(f,W)}},[g.onBeforeInput,f,s]),onInput:x.useCallback(S=>{if(!at(S,g.onInput)){if($.current){$.current.handleInput();return}for(var W of A.current)W();A.current=[]}},[g.onInput]),onBlur:x.useCallback(S=>{if(!(s||N.isUpdatingSelection||!J.hasSelectableTarget(f,S.target)||at(S,g.onBlur))){var W=J.findDocumentOrShadowRoot(f);if(N.latestElement!==W.activeElement){var{relatedTarget:I}=S,K=J.toDOMNode(f,f);if(I!==K&&!(Ct(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&nn(I)&&J.hasDOMNode(f,I)){var te=J.toSlateNode(f,I);if(de.isElement(te)&&!f.isVoid(te))return}if(hr){var ee=W.getSelection();ee==null||ee.removeAllRanges()}en.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:x.useCallback(S=>{if(J.hasTarget(f,S.target)&&!at(S,g.onClick)&&nn(S.target)){var W=J.toSlateNode(f,S.target),I=J.findPath(f,W);if(!v.hasPath(f,I)||se.get(f,I)!==W)return;if(S.detail===hy&&I.length>=1){var K=I;if(!(de.isElement(W)&&v.isBlock(f,W))){var te,ee=v.above(f,{match:je=>de.isElement(je)&&v.isBlock(f,je),at:I});K=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var ae=v.range(f,K);Q.select(f,ae);return}if(s)return;var le=v.start(f,I),V=v.end(f,I),he=v.void(f,{at:le}),pe=v.void(f,{at:V});if(he&&pe&&P.equals(he[1],pe[1])){var we=v.range(f,le);Q.select(f,we)}}},[f,g.onClick,s]),onCompositionEnd:x.useCallback(S=>{if(J.hasSelectableTarget(f,S.target)){var W;if(J.isComposing(f)&&Promise.resolve().then(()=>{b(!1),mn.set(f,!1)}),(W=$.current)===null||W===void 0||W.handleCompositionEnd(S),at(S,g.onCompositionEnd)||st)return;if(!hr&&!gb&&!fb&&!bb&&!vb&&S.data){var I=kt.get(f);kt.delete(f),I!==void 0&&(Wt.set(f,f.marks),f.marks=I),v.insertText(f,S.data);var K=Wt.get(f);Wt.delete(f),K!==void 0&&(f.marks=K)}}},[g.onCompositionEnd,f]),onCompositionUpdate:x.useCallback(S=>{J.hasSelectableTarget(f,S.target)&&!at(S,g.onCompositionUpdate)&&(J.isComposing(f)||(b(!0),mn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:x.useCallback(S=>{if(J.hasSelectableTarget(f,S.target)){var W;if((W=$.current)===null||W===void 0||W.handleCompositionStart(S),at(S,g.onCompositionStart)||st)return;b(!0);var{selection:I}=f;if(I&&U.isExpanded(I)){v.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:x.useCallback(S=>{J.hasSelectableTarget(f,S.target)&&!at(S,g.onCopy)&&!ul(S)&&(S.preventDefault(),J.setFragmentData(f,S.clipboardData,"copy"))},[g.onCopy,f]),onCut:x.useCallback(S=>{if(!s&&J.hasSelectableTarget(f,S.target)&&!at(S,g.onCut)&&!ul(S)){S.preventDefault(),J.setFragmentData(f,S.clipboardData,"cut");var{selection:W}=f;if(W)if(U.isExpanded(W))v.deleteFragment(f);else{var I=se.parent(f,W.anchor.path);v.isVoid(f,I)&&Q.delete(f)}}},[s,f,g.onCut]),onDragOver:x.useCallback(S=>{if(J.hasTarget(f,S.target)&&!at(S,g.onDragOver)){var W=J.toSlateNode(f,S.target);de.isElement(W)&&v.isVoid(f,W)&&S.preventDefault()}},[g.onDragOver,f]),onDragStart:x.useCallback(S=>{if(!s&&J.hasTarget(f,S.target)&&!at(S,g.onDragStart)){var W=J.toSlateNode(f,S.target),I=J.findPath(f,W),K=de.isElement(W)&&v.isVoid(f,W)||v.void(f,{at:I,voids:!0});if(K){var te=v.range(f,I);Q.select(f,te)}N.isDraggingInternally=!0,J.setFragmentData(f,S.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:x.useCallback(S=>{if(!s&&J.hasTarget(f,S.target)&&!at(S,g.onDrop)){S.preventDefault();var W=f.selection,I=J.findEventRange(f,S),K=S.dataTransfer;Q.select(f,I),N.isDraggingInternally&&W&&!U.equals(W,I)&&!v.void(f,{at:I,voids:!0})&&Q.delete(f,{at:W}),J.insertData(f,K),J.isFocused(f)||J.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:x.useCallback(S=>{!s&&N.isDraggingInternally&&g.onDragEnd&&J.hasTarget(f,S.target)&&g.onDragEnd(S),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:x.useCallback(S=>{if(!s&&!N.isUpdatingSelection&&J.hasEditableTarget(f,S.target)&&!at(S,g.onFocus)){var W=J.toDOMNode(f,f),I=J.findDocumentOrShadowRoot(f);if(N.latestElement=I.activeElement,In&&S.target!==W){W.focus();return}en.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:x.useCallback(S=>{if(!s&&J.hasEditableTarget(f,S.target)){var W;(W=$.current)===null||W===void 0||W.handleKeyDown(S);var{nativeEvent:I}=S;if(J.isComposing(f)&&I.isComposing===!1&&(mn.set(f,!1),b(!1)),at(S,g.onKeyDown)||J.isComposing(f))return;var{selection:K}=f,te=f.children[K!==null?K.focus.path[0]:0],ee=gd(se.string(te))==="rtl";if(Le.isRedo(I)){S.preventDefault();var ae=f;typeof ae.redo=="function"&&ae.redo();return}if(Le.isUndo(I)){S.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Le.isMoveLineBackward(I)){S.preventDefault(),Q.move(f,{unit:"line",reverse:!0});return}if(Le.isMoveLineForward(I)){S.preventDefault(),Q.move(f,{unit:"line"});return}if(Le.isExtendLineBackward(I)){S.preventDefault(),Q.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Le.isExtendLineForward(I)){S.preventDefault(),Q.move(f,{unit:"line",edge:"focus"});return}if(Le.isMoveBackward(I)){S.preventDefault(),K&&U.isCollapsed(K)?Q.move(f,{reverse:!ee}):Q.collapse(f,{edge:ee?"end":"start"});return}if(Le.isMoveForward(I)){S.preventDefault(),K&&U.isCollapsed(K)?Q.move(f,{reverse:ee}):Q.collapse(f,{edge:ee?"start":"end"});return}if(Le.isMoveWordBackward(I)){S.preventDefault(),K&&U.isExpanded(K)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:!ee});return}if(Le.isMoveWordForward(I)){S.preventDefault(),K&&U.isExpanded(K)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:ee});return}if(Zt){if((jd||hr)&&K&&(Le.isDeleteBackward(I)||Le.isDeleteForward(I))&&U.isCollapsed(K)){var V=se.parent(f,K.anchor.path);if(de.isElement(V)&&v.isVoid(f,V)&&(v.isInline(f,V)||v.isBlock(f,V))){S.preventDefault(),v.deleteBackward(f,{unit:"block"});return}}}else{if(Le.isBold(I)||Le.isItalic(I)||Le.isTransposeCharacter(I)){S.preventDefault();return}if(Le.isSoftBreak(I)){S.preventDefault(),v.insertSoftBreak(f);return}if(Le.isSplitBlock(I)){S.preventDefault(),v.insertBreak(f);return}if(Le.isDeleteBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f);return}if(Le.isDeleteForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f);return}if(Le.isDeleteLineBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f,{unit:"line"});return}if(Le.isDeleteLineForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f,{unit:"line"});return}if(Le.isDeleteWordBackward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f,{unit:"word"});return}if(Le.isDeleteWordForward(I)){S.preventDefault(),K&&U.isExpanded(K)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:x.useCallback(S=>{!s&&J.hasEditableTarget(f,S.target)&&!at(S,g.onPaste)&&(!Zt||Cb(S.nativeEvent)||hr)&&(S.preventDefault(),J.insertData(f,S.clipboardData))},[s,f,g.onPaste])}),x.createElement(xy,{decorations:R,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},Ey=e=>{var{attributes:t,children:n}=e;return x.createElement("span",Tt({},t),n,st&&x.createElement("br",null))},ky=()=>[],_y=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&U.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),M0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ul=e=>nn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),By=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Ay=x.createContext(!1),Fy=x.createContext({});function Ty(e){var t=x.useRef([]).current,n=x.useRef({editor:e}).current,r=x.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=x.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var Sy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],jy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Kn(e,Sy),[l,u]=x.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ge.stringify(s)));if(!v.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ge.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:m}=Ty(t),h=x.useCallback(f=>{var y;switch(r&&r(t.children),f==null||(y=f.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),m(t)},[t,m,r,a,i]);x.useEffect(()=>(bs.set(t,h),()=>{bs.set(t,()=>{})}),[t,h]);var[p,g]=x.useState(J.isFocused(t));return x.useEffect(()=>{g(J.isFocused(t))},[t]),Tr(()=>{var f=()=>g(J.isFocused(t));return Sd>=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)})},[]),x.createElement(Fy.Provider,{value:c},x.createElement(Kd.Provider,{value:l},x.createElement(ro.Provider,{value:l.editor},x.createElement(Ay.Provider,{value:p},n))))},ll=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},cl=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return ll(r,a)&&ll(a,r)},Oy=(e,t)=>{var n=v.range(e,U.end(t)),r=Array.from(v.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(cl(e,v.range(e,r[a]),n))return v.range(e,r[a],n);if(r.length<2)return v.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)cl(e,v.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return v.range(e,r[i],n)};function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Py=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 Ka.set(r,new WeakMap),r.addMark=(u,c)=>{var m,h;(m=so.get(r))===null||m===void 0||m(),!kt.get(r)&&(h=ct.get(r))!==null&&h!==void 0&&h.length&&kt.set(r,null),Wt.delete(r),o(u,c)},r.removeMark=u=>{var c;!kt.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&kt.set(r,null),Wt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&U.isCollapsed(r.selection)){var c=v.above(r,{match:g=>de.isElement(g)&&v.isBlock(r,g),at:r.selection});if(c){var[,m]=c,h=v.range(r,m,r.selection.anchor),p=Oy(r,h);U.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],m=[],h=ct.get(r);if(h!=null&&h.length){var p=h.map(T=>Pb(T,u)).filter(Boolean);ct.set(r,p)}var g=Qt.get(r);g&&Qt.set(r,Xu(r,g,u));var f=Gt.get(r);if(f!=null&&f.at){var y=xe.isPoint(f==null?void 0:f.at)?Cs(r,f.at,u):Xu(r,f.at,u);Gt.set(r,y?fl(fl({},f),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Sn(r,u.path));break}case"set_selection":{var b;(b=vr.get(r))===null||b===void 0||b.unref(),vr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Sn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);c.push(...Sn(r,w));break}case"move_node":{var A=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...Sn(r,A));var k;P.isBefore(u.path,u.newPath)?(c.push(...Sn(r,P.parent(u.path))),k=u.newPath):(c.push(...Sn(r,P.parent(u.newPath))),k=u.path);var E=se.get(t,P.parent(k)),F=J.findKey(r,E),j=v.pathRef(r,P.parent(k));m.push([j,F]);break}}a(u);for(var[z,N]of c){var[$]=v.node(r,z);ka.set($,N)}for(var[M,C]of m)if(M.current){var[B]=v.node(r,M.current);ka.set(B,C)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[m,h]=U.edges(c),p=v.void(r,{at:m.path}),g=v.void(r,{at:h.path});if(!(U.isCollapsed(c)&&!p)){var f=J.toDOMRange(r,c),y=f.cloneContents(),b=y.childNodes[0];if(y.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(b=$)}),g){var[w]=g,A=f.cloneRange(),k=J.toDOMNode(r,w);A.setEndAfter(k),y=A.cloneContents()}if(p&&(b=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var M=$.getAttribute("data-slate-zero-width")==="n";$.textContent=M?`
112
+ `:""}),Nd(b)){var E=b.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(b),y.appendChild(E),b=E}var F=r.getFragment(),j=JSON.stringify(F),z=window.btoa(encodeURIComponent(j));b.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var N=y.ownerDocument.createElement("div");return N.appendChild(y),N.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Id(N)),y.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||_b(u);if(c){var m=decodeURIComponent(window.atob(c)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var m=c.split(/\r\n|\r|\n/),h=!1;for(var p of m)h&&Q.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=u=>{var c=Sd<18?gc.unstable_batchedUpdates:m=>m();c(()=>{var m=bs.get(r);m&&m(u),i(u)})},r},Sn=(e,t)=>{var n=[];for(var[r,a]of v.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ry={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Kt=x.createContext(Ry);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),Ot=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ot||{});const Ny=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return d.jsx("a",{...e,children:t});case Z.li:return d.jsx("li",{...e,children:t});case Z.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return d.jsx("ol",{...e,children:t});case Z.ul:return d.jsx("ul",{...e,children:t});case Z.span:return d.jsx("span",{...e,children:t});case Z.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},My=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=d.jsx("strong",{children:t})),r[Z.italic]&&(t=d.jsx("em",{children:t})),r[Z.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},ws="MENTION: ",Yd={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},hl={"mention-popover":35,default:-52},Ci=16,Gd=(e,t,n)=>{const r=x.useRef(null),{showLinkEditor:a,mentionPopover:i}=x.useContext(Kt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),x.useEffect(()=>{var p,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,y=v.nodes(e,{at:[]}),b=Array.from(y).map(([E,F])=>F);if(!(f?b.some(E=>{var F;return P.equals(E,(F=f==null?void 0:f.anchor)==null?void 0:F.path)})&&b.some(E=>{var F;return P.equals(E,(F=f==null?void 0:f.focus)==null?void 0:F.path)}):!1))return;u=J.toDOMRange(e,f||Yd).getBoundingClientRect();const k=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((k==null?void 0:k.width)||0)/Ci}rem`),c=(k==null?void 0:k.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=hl[t]||hl.default,h=((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=`${h/Ci}rem`,l.style.left=`${c/Ci}rem`},o),r},Iy=e=>{const[t,n]=x.useState(null);return x.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=v.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Rc(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 it=(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))(it||{});const $n={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ot.emphasis]:Z.italic,[Ot.strong]:Z.bold,[Ot.delete]:Z.strikethrough,[Ot.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function ml(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Qd=Object.prototype.toString,pl=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,vl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Qd.call(t)==="[object Array]"},bl=function(t){if(!t||Qd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},yl=function(t,n){pl&&n.name==="__proto__"?pl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Dl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(gl)return gl(t,n).value}else return;return t[n]},$y=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Dl(o,n),a=Dl(t,n),o!==a&&(c&&a&&(bl(a)||(i=vl(a)))?(i?(i=!1,s=r&&vl(r)?r:[]):s=r&&bl(r)?r:{},yl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&yl(o,{name:n,newValue:a}));return o};const xi=wn($y);function Es(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 Ly(){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?zy(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 zy(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 br(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Cl(e.position):"start"in e||"end"in e?Cl(e):"line"in e||"column"in e?ks(e):""}function ks(e){return xl(e&&e.line)+":"+xl(e&&e.column)}function Cl(e){return ks(e&&e.start)+"-"+ks(e&&e.end)}function xl(e){return e&&typeof e=="number"?e:1}class ht 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=br(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}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:qy,dirname:Wy,extname:Hy,join:Uy,sep:"/"};function qy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Or(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 Wy(e){if(Or(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 Hy(e){Or(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 Uy(...e){let t=-1,n;for(;++t<e.length;)Or(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Vy(n)}function Vy(e){Or(e);const t=e.codePointAt(0)===47;let n=Ky(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ky(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 Or(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Zy={cwd:Yy};function Yy(){return"/"}function _s(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Gy(e){if(typeof e=="string")e=new URL(e);else if(!_s(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 Qy(e)}function Qy(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const wi=["history","path","basename","stem","extname","dirname"];class Jy{constructor(t){let n;t?_s(t)?n={path:t}:typeof t=="string"||Xy(t)?n={value:t}:n=t:n={},this.cwd=Zy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wi.length;){const i=wi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)wi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){ki(t,"basename"),Ei(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){wl(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(Ei(t,"extname"),wl(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=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_s(t)&&(t=Gy(t)),ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){ki(t,"stem"),Ei(t,"stem"),this.path=St.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 ht(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 Ei(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Xy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e1=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},t1={}.hasOwnProperty;class lo extends e1{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=Ly()}copy(){const t=new lo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(xi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ai("data",this.frozen),this.namespace[t]=n,this):t1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ai("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=Yr(t),r=this.parser||this.Parser;return _i("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_i("process",this.parser||this.Parser),Bi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Yr(t),l=r.parse(o);r.run(l,o,function(c,m,h){if(c||!m||!h)return u(c);const p=m,g=r.stringify(p,h);a1(g)?h.value=g:h.result=g,u(c,h)});function u(c,m){c||!m?s(c):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),_i("processSync",this.parser||this.Parser),Bi("processSync",this.compiler||this.Compiler),this.process(t,a),kl("processSync","process",n),r;function a(i,s){n=!0,ml(i),r=s}}run(t,n,r){El(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=Yr(n);a.run(t,l,u);function u(c,m,h){const p=m||t;c?o(c):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),kl("runSync","run",r),a;function i(s,o){ml(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),a=this.compiler||this.Compiler;return Bi("stringify",a),El(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ai("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=xi(!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,h=-1;for(;++m<r.length;)if(r[m][0]===u){h=m;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const f=r[h][1];Es(f)&&Es(p)&&(p=xi(!0,f,p)),r[h]=[u,p,...g]}}}}const n1=new lo().freeze();function _i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ai(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 El(e){if(!Es(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return r1(e)?e:new Jy(e)}function r1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function a1(e){return typeof e=="string"||i1(e)}function i1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s1={};function o1(e,t){const n=t||s1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Jd(e,r,a)}function Jd(e,t,n){if(u1(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 _l(e.children,t,n)}return Array.isArray(e)?_l(e,t,n):""}function _l(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Jd(e[a],t,n);return r.join("")}function u1(e){return!!(e&&typeof e=="object")}const Bl=document.createElement("i");function co(e){const t="&"+e+";";Bl.innerHTML=t;const n=Bl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Nt(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 Dt(e,t){return e.length>0?(Nt(e,e.length,0,t),e):t}const Al={}.hasOwnProperty;function l1(e){const t={};let n=-1;for(;++n<e.length;)c1(t,e[n]);return t}function c1(e,t){let n;for(n in t){const a=(Al.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Al.call(a,s)||(a[s]=[]);const o=i[s];d1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function d1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Nt(e,0,0,r)}function Xd(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 jt=un(/[A-Za-z]/),_t=un(/[\dA-Za-z]/),f1=un(/[#-'*+\--9=?A-Z^-~]/);function Bs(e){return e!==null&&(e<32||e===127)}const As=un(/\d/),h1=un(/[\dA-Fa-f]/),m1=un(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Ae(e){return e===-2||e===-1||e===32}const p1=un(/\p{P}|\p{S}/u),g1=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ae(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ae(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const v1={tokenize:b1};function b1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ne(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return be(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const y1={tokenize:D1},Fl={tokenize:C1};function D1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const k=t.events.length;let E=k,F;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){F=t.events[E][1].end;break}b(r);let j=k;for(;j<t.events.length;)t.events[j][1].end=Object.assign({},F),j++;return Nt(t.events,E+1,0,t.events.slice(k)),t.events.length=j,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return h(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fl,c,m)(A)}function c(A){return a&&w(),b(r),h(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function h(A){return t.containerState={},e.attempt(Fl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),h(A)}function g(A){if(A===null){a&&w(),b(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(A)}function f(A){if(A===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(A);return}return be(A)?(e.consume(A),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),f)}function y(A,k){const E=t.sliceStream(A);if(k&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<s&&(!a.events[F][1].end||a.events[F][1].end.offset>s))return;const j=t.events.length;let z=j,N,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(N){$=t.events[z][1].end;break}N=!0}for(b(r),F=j;F<t.events.length;)t.events[F][1].end=Object.assign({},$),F++;Nt(t.events,z+1,0,t.events.slice(j)),t.events.length=F}}function b(A){let k=n.length;for(;k-- >A;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function C1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tl(e){if(e===null||ft(e)||g1(e))return 1;if(p1(e))return 2}function fo(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 Fs={name:"attention",tokenize:w1,resolveAll:x1};function x1(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),h=Object.assign({},e[n][1].start);Sl(m,-l),Sl(h,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:h},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=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,fo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(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=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Nt(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 w1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Tl(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=Tl(l),m=!c||c===2&&a||n.includes(l),h=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?m:m&&(a||!h)),u._close=!!(i===42?h:h&&(c||!m)),t(l)}}function Sl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const E1={name:"autolink",tokenize:k1};function k1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||_t(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||_t(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Bs(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):f1(p)?(e.consume(p),u):n(p)}function c(p){return _t(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||_t(p))&&r++<63){const g=p===45?h:m;return e.consume(p),g}return n(p)}}const Za={tokenize:_1,partial:!0};function _1(e,t,n){return r;function r(i){return Ae(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const ef={name:"blockQuote",tokenize:B1,continuation:{tokenize:A1},exit:F1};function B1(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 Ae(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function A1(e,t,n){const r=this;return a;function a(s){return Ae(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(ef,t,n)(s)}}function F1(e){e.exit("blockQuote")}const tf={name:"characterEscape",tokenize:T1};function T1(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 m1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nf={name:"characterReference",tokenize:S1};function S1(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=_t,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=h1,c):(e.enter("characterReferenceValue"),i=7,s=As,c(m))}function c(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return s===_t&&!co(r.sliceSerialize(h))?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 jl={tokenize:O1,partial:!0},Ol={name:"codeFenced",tokenize:j1,concrete:!0};function j1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(F){return u(F)}function u(F){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,o=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(F)}function c(F){return F===o?(s++,e.consume(F),c):s<3?n(F):(e.exit("codeFencedFenceSequence"),Ae(F)?Ne(e,m,"whitespace")(F):m(F))}function m(F){return F===null||be(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(jl,f,k)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(F))}function h(F){return F===null||be(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(F)):Ae(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),h)}function p(F){return F===null||be(F)?m(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(F))}function g(F){return F===null||be(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(F)):F===96&&F===o?n(F):(e.consume(F),g)}function f(F){return e.attempt(a,k,y)(F)}function y(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),b}function b(F){return i>0&&Ae(F)?Ne(e,w,"linePrefix",i+1)(F):w(F)}function w(F){return F===null||be(F)?e.check(jl,f,k)(F):(e.enter("codeFlowValue"),A(F))}function A(F){return F===null||be(F)?(e.exit("codeFlowValue"),w(F)):(e.consume(F),A)}function k(F){return e.exit("codeFenced"),t(F)}function E(F,j,z){let N=0;return $;function $(R){return F.enter("lineEnding"),F.consume(R),F.exit("lineEnding"),M}function M(R){return F.enter("codeFencedFence"),Ae(R)?Ne(F,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):C(R)}function C(R){return R===o?(F.enter("codeFencedFenceSequence"),B(R)):z(R)}function B(R){return R===o?(N++,F.consume(R),B):N>=s?(F.exit("codeFencedFenceSequence"),Ae(R)?Ne(F,T,"whitespace")(R):T(R)):z(R)}function T(R){return R===null||be(R)?(F.exit("codeFencedFence"),j(R)):z(R)}}}function O1(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 Fi={name:"codeIndented",tokenize:R1},P1={tokenize:N1,partial:!0};function R1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):be(u)?e.attempt(P1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||be(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function N1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ne(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):be(s)?a(s):n(s)}}const M1={name:"codeText",tokenize:L1,resolve:I1,previous:$1};function I1(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function $1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function L1(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)):be(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||be(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))}}function rf(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,z1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Nt(e,a,n-a+1,o))}}return!u}function z1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,m,h=-1,p=n,g=0,f=0;const y=[f];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(f=h+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),h=y.length;h--;){const b=o.slice(y[h],y[h+1]),w=i.pop();l.unshift([w,w+b.length-1]),Nt(e,w,2,b)}for(h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const q1={tokenize:U1,resolve:H1},W1={tokenize:V1,partial:!0};function H1(e){return rf(e),e}function U1(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):be(o)?e.check(W1,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 V1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(e,i,"linePrefix")}function i(s){if(s===null||be(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function af(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return m;function m(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),h):b===null||b===32||b===41||Bs(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function h(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),h(b)):b===null||b===60||be(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function f(b){return!c&&(b===null||b===41||ft(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):c<u&&b===40?(e.consume(b),c++,f):b===41?(e.consume(b),c--,f):b===null||b===32||b===40||Bs(b)?n(b):(e.consume(b),b===92?y:f)}function y(b){return b===40||b===41||b===92?(e.consume(b),f):f(b)}}function sf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||be(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Ae(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function of(e,t,n,r,a,i){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===s?(e.exit(i),l(s)):h===null?n(h):be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===s||h===null||be(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?m:c)}function m(h){return h===s||h===92?(e.consume(h),c):c(h)}}function yr(e,t){let n;return r;function r(a){return be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ae(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const K1={name:"definition",tokenize:Y1},Z1={tokenize:G1,partial:!0};function Y1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return sf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ft(p)?yr(e,u)(p):u(p)}function u(p){return af(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Z1,m,m)(p)}function m(p){return Ae(p)?Ne(e,h,"whitespace")(p):h(p)}function h(p){return p===null||be(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function G1(e,t,n){return r;function r(o){return ft(o)?yr(e,a)(o):n(o)}function a(o){return of(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ae(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const Q1={name:"hardBreakEscape",tokenize:J1};function J1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return be(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const X1={name:"headingAtx",tokenize:tD,resolve:eD};function eD(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"},Nt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function tD(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||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||be(c)?(e.exit("atxHeading"),t(c)):Ae(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const nD=["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"],Pl=["pre","script","style","textarea"],rD={name:"htmlFlow",tokenize:oD,resolveTo:sD,concrete:!0},aD={tokenize:lD,partial:!0},iD={tokenize:uD,partial:!0};function sD(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 oD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),h):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:D):jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function h(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):jt(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const S="CDATA[";return _===S.charCodeAt(o++)?(e.consume(_),o===S.length?r.interrupt?t:C:g):n(_)}function f(_){return jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function y(_){if(_===null||_===47||_===62||ft(_)){const S=_===47,W=s.toLowerCase();return!S&&!i&&Pl.includes(W)?(a=1,r.interrupt?t(_):C(_)):nD.includes(s.toLowerCase())?(a=6,S?(e.consume(_),b):r.interrupt?t(_):C(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?w(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),y):n(_)}function b(_){return _===62?(e.consume(_),r.interrupt?t:C):n(_)}function w(_){return Ae(_)?(e.consume(_),w):$(_)}function A(_){return _===47?(e.consume(_),$):_===58||_===95||jt(_)?(e.consume(_),k):Ae(_)?(e.consume(_),A):$(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),F):Ae(_)?(e.consume(_),E):A(_)}function F(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,j):Ae(_)?(e.consume(_),F):z(_)}function j(_){return _===l?(e.consume(_),l=null,N):_===null||be(_)?n(_):(e.consume(_),j)}function z(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?E(_):(e.consume(_),z)}function N(_){return _===47||_===62||Ae(_)?A(_):n(_)}function $(_){return _===62?(e.consume(_),M):n(_)}function M(_){return _===null||be(_)?C(_):Ae(_)?(e.consume(_),M):n(_)}function C(_){return _===45&&a===2?(e.consume(_),L):_===60&&a===1?(e.consume(_),q):_===62&&a===4?(e.consume(_),H):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),ne):be(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(aD,X,B)(_)):_===null||be(_)?(e.exit("htmlFlowData"),B(_)):(e.consume(_),C)}function B(_){return e.check(iD,T,X)(_)}function T(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),R}function R(_){return _===null||be(_)?B(_):(e.enter("htmlFlowData"),C(_))}function L(_){return _===45?(e.consume(_),D):C(_)}function q(_){return _===47?(e.consume(_),s="",oe):C(_)}function oe(_){if(_===62){const S=s.toLowerCase();return Pl.includes(S)?(e.consume(_),H):C(_)}return jt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),oe):C(_)}function ne(_){return _===93?(e.consume(_),D):C(_)}function D(_){return _===62?(e.consume(_),H):_===45&&a===2?(e.consume(_),D):C(_)}function H(_){return _===null||be(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),H)}function X(_){return e.exit("htmlFlow"),t(_)}}function uD(e,t,n){const r=this;return a;function a(s){return be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function lD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Za,t,n)}}const cD={name:"htmlText",tokenize:dD};function dD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),E):D===63?(e.consume(D),A):jt(D)?(e.consume(D),z):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):jt(D)?(e.consume(D),w):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function m(D){return D===null?n(D):D===45?(e.consume(D),h):be(D)?(s=m,q(D)):(e.consume(D),m)}function h(D){return D===45?(e.consume(D),p):m(D)}function p(D){return D===62?L(D):D===45?h(D):m(D)}function g(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?f:g):n(D)}function f(D){return D===null?n(D):D===93?(e.consume(D),y):be(D)?(s=f,q(D)):(e.consume(D),f)}function y(D){return D===93?(e.consume(D),b):f(D)}function b(D){return D===62?L(D):D===93?(e.consume(D),b):f(D)}function w(D){return D===null||D===62?L(D):be(D)?(s=w,q(D)):(e.consume(D),w)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):be(D)?(s=A,q(D)):(e.consume(D),A)}function k(D){return D===62?L(D):A(D)}function E(D){return jt(D)?(e.consume(D),F):n(D)}function F(D){return D===45||_t(D)?(e.consume(D),F):j(D)}function j(D){return be(D)?(s=j,q(D)):Ae(D)?(e.consume(D),j):L(D)}function z(D){return D===45||_t(D)?(e.consume(D),z):D===47||D===62||ft(D)?N(D):n(D)}function N(D){return D===47?(e.consume(D),L):D===58||D===95||jt(D)?(e.consume(D),$):be(D)?(s=N,q(D)):Ae(D)?(e.consume(D),N):L(D)}function $(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),$):M(D)}function M(D){return D===61?(e.consume(D),C):be(D)?(s=M,q(D)):Ae(D)?(e.consume(D),M):N(D)}function C(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,B):be(D)?(s=C,q(D)):Ae(D)?(e.consume(D),C):(e.consume(D),T)}function B(D){return D===a?(e.consume(D),a=void 0,R):D===null?n(D):be(D)?(s=B,q(D)):(e.consume(D),B)}function T(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ft(D)?N(D):(e.consume(D),T)}function R(D){return D===47||D===62||ft(D)?N(D):n(D)}function L(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),oe}function oe(D){return Ae(D)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const ho={name:"labelEnd",tokenize:vD,resolveTo:gD,resolveAll:pD},fD={tokenize:bD},hD={tokenize:yD},mD={tokenize:DD};function pD(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 gD(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=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,fo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Nt(e,i,e.length,o),e}function vD(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(h){return i?i._inactive?m(h):(s=r.parser.defined.includes(qn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(fD,c,s?c:m)(h):h===91?e.attempt(hD,c,s?u:m)(h):s?c(h):m(h)}function u(h){return e.attempt(mD,c,m)(h)}function c(h){return t(h)}function m(h){return i._balanced=!0,n(h)}}function bD(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 ft(m)?yr(e,i)(m):i(m)}function i(m){return m===41?c(m):af(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ft(m)?yr(e,l)(m):c(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?of(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):c(m)}function u(m){return ft(m)?yr(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 yD(e,t,n){const r=this;return a;function a(o){return sf.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 DD(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 CD={name:"labelStartImage",tokenize:xD,resolveAll:ho.resolveAll};function xD(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 wD={name:"labelStartLink",tokenize:ED,resolveAll:ho.resolveAll};function ED(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 Ti={name:"lineEnding",tokenize:kD};function kD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:_D};function _D(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ae(u)?Ne(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:FD,continuation:{tokenize:TD},exit:jD},BD={tokenize:OD,partial:!0},AD={tokenize:SD,partial:!0};function FD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:As(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return As(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Za,r.interrupt?n:c,e.attempt(BD,h,m))}function c(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return Ae(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function TD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Za,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ae(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(AD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function SD(e,t,n){const r=this;return Ne(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function jD(e){e.exit(this.containerState.type)}function OD(e,t,n){const r=this;return Ne(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Ae(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Rl={name:"setextUnderline",tokenize:RD,resolveTo:PD};function PD(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 RD(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"),Ae(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ND={tokenize:MD};function MD(e){const t=this,n=e.attempt(Za,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt(q1,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 ID={resolveAll:lf()},$D=uf("string"),LD=uf("text");function uf(e){return{tokenize:t,resolveAll:lf(e==="text"?zD: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 h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function lf(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 zD(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 qD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:A,exit:k,attempt:j(E),check:j(F),interrupt:j(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:g,defineSkip:f,write:m};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(M){return s=Dt(s,M),y(),s[s.length-1]!==null?[]:(z(t,0),u.events=fo(i,u.events,u),u.events)}function h(M,C){return HD(p(M),C)}function p(M){return WD(s,M)}function g(){const{line:M,column:C,offset:B,_index:T,_bufferIndex:R}=r;return{line:M,column:C,offset:B,_index:T,_bufferIndex:R}}function f(M){a[M.line]=M.column,$()}function y(){let M;for(;r._index<s.length;){const C=s[r._index];if(typeof C=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<C.length;)b(C.charCodeAt(r._bufferIndex));else b(C)}}function b(M){c=c(M)}function w(M){be(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,$()):M!==-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=M}function A(M,C){const B=C||{};return B.type=M,B.start=g(),u.events.push(["enter",B,u]),o.push(B),B}function k(M){const C=o.pop();return C.end=g(),u.events.push(["exit",C,u]),C}function E(M,C){z(M,C.from)}function F(M,C){C.restore()}function j(M,C){return B;function B(T,R,L){let q,oe,ne,D;return Array.isArray(T)?X(T):"tokenize"in T?X([T]):H(T);function H(I){return K;function K(te){const ee=te!==null&&I[te],ae=te!==null&&I.null,le=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return X(le)(te)}}function X(I){return q=I,oe=0,I.length===0?L:_(I[oe])}function _(I){return K;function K(te){return D=N(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?W():I.tokenize.call(C?Object.assign(Object.create(u),C):u,l,S,W)(te)}}function S(I){return M(ne,D),R}function W(I){return D.restore(),++oe<q.length?_(q[oe]):L}}}function z(M,C){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Nt(u.events,C,u.events.length-C,M.resolve(u.events.slice(C),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function N(){const M=g(),C=u.previous,B=u.currentConstruct,T=u.events.length,R=Array.from(o);return{restore:L,from:T};function L(){r=M,u.previous=C,u.currentConstruct=B,u.events.length=T,o=R,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function WD(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 HD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
113
113
  `;break}case-3:{s=`\r
114
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const UD={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:ef},VD={91:K1},KD={[-2]:Fi,[-1]:Fi,32:Fi},ZD={35:X1,42:ha,45:[Rl,ha],60:rD,61:Rl,95:ha,96:Ol,126:Ol},YD={38:nf,92:tf},GD={[-5]:Ti,[-4]:Ti,[-3]:Ti,33:CD,38:nf,42:Fs,60:[E1,cD],91:wD,92:[Q1,tf],93:ho,95:Fs,96:M1},QD={null:[Fs,ID]},JD={null:[42,95]},XD={null:[]},eC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:JD,contentInitial:VD,disable:XD,document:UD,flow:ZD,flowInitial:KD,insideSpan:QD,string:YD,text:GD},Symbol.toStringTag,{value:"Module"}));function tC(e){const n=l1([eC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(v1),document:a(y1),flow:a(ND),string:a($D),text:a(LD)};return r;function a(i){return s;function s(o){return qD(r,i,o)}}}function nC(e){for(;!rf(e););return e}const Nl=/[\0\t\n\r]/g;function rC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,m,f,p;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(Nl.lastIndex=m,u=Nl.exec(i),f=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(f),!u){t=i.slice(m);break}if(p===10&&m===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<f&&(l.push(i.slice(m,f)),e+=f-m),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=f+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const aC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iC(e){return e.replace(aC,sC)}function sC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Xd(n.slice(i?2:1),i?16:10)}return co(n)||e}const cf={}.hasOwnProperty;function oC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),uC(n)(nC(tC(n).document().write(rC()(e,t,!0))))}function uC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qe),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(pe),blockQuote:i(ee),characterEscape:N,characterReference:N,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(V),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(he),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(je,s),htmlFlowData:N,htmlText:i(je,s),htmlTextData:N,image:i(Oe),label:s,link:i(Qe),listItem:i(Ye),listItemValue:f,listOrdered:i(Ze,m),listUnordered:i(Ze),paragraph:i(nt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Fe),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:te,autolinkProtocol:K,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:I,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(b),codeText:l(R),codeTextData:$,data:$,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(C),hardBreakTrailing:l(C),htmlFlow:l(B),htmlFlowData:$,htmlText:l(F),htmlTextData:$,image:l(q),label:ne,labelText:oe,lineEnding:M,link:l(L),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:D,resourceTitleString:H,resource:X,setextHeading:l(z),setextHeadingLineSequence:j,setextHeadingText:T,strong:l(),thematicBreak:l()}};df(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let Ce=-1;for(;++Ce<Y.length;)if(Y[Ce][1].type==="listOrdered"||Y[Ce][1].type==="listUnordered")if(Y[Ce][0]==="enter")ve.push(Ce);else{const Ve=ve.pop();Ce=a(Y,Ve,Ce)}for(Ce=-1;++Ce<Y.length;){const Ve=t[Y[Ce][0]];cf.call(Ve,Y[Ce][1].type)&&Ve[Y[Ce][1].type].call(Object.assign({sliceSerialize:Y[Ce][2].sliceSerialize},me),Y[Ce][1])}if(me.tokenStack.length>0){const Ve=me.tokenStack[me.tokenStack.length-1];(Ve[1]||Ml).call(me,void 0,Ve[0])}for(ie.position={start:Yt(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:Yt(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)ie=t.transforms[Ce](ie)||ie;return ie}function a(Y,ie,me){let ve=ie-1,Ce=-1,Ve=!1,Ke,mt,It,Et;for(;++ve<=me;){const Je=Y[ve];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ce++:Ce--,Et=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Ke&&!Et&&!Ce&&!It&&(It=ve),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!Ce&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ce===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Ke){let Bt=ve;for(mt=void 0;Bt--;){const pt=Y[Bt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(Y[mt][1].type="lineEndingBlank",Ve=!0),pt[1].type="lineEnding",mt=Bt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}It&&(!mt||It<mt)&&(Ke._spread=!0),Ke.end=Object.assign({},mt?Y[mt][1].start:Je[1].end),Y.splice(mt||ve,0,["exit",Ke,Je[2]]),ve++,me++}if(Je[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Ke=Bt,Y.splice(ve,0,["enter",Bt,Je[2]]),ve++,me++,It=void 0,Et=!0}}}return Y[ie][1]._spread=Ve,me}function i(Y,ie){return me;function me(ve){o.call(this,Y(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,ie,me){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([ie,me]),Y.position={start:Yt(ie.start),end:void 0}}function l(Y){return ie;function ie(me){Y&&Y.call(this,me),u.call(this,me)}}function u(Y,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==Y.type&&(ie?ie.call(this,Y,ve[0]):(ve[1]||Ml).call(this,Y,ve[0]));else throw new Error("Cannot close `"+Y.type+"` ("+br({start:Y.start,end:Y.end})+"): it’s not open");me.position.end=Yt(Y.end)}function c(){return o1(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function f(Y){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=Y}function g(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=Y}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y.replace(/(\r?\n|\r)$/g,"")}function w(Y){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=qn(this.sliceSerialize(Y)).toLowerCase()}function A(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.title=Y}function k(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.url=Y}function E(Y){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(Y).length;ie.depth=me}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function j(Y){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function N(Y){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=He(),ve.position={start:Yt(Y.start),end:void 0},me.push(ve)),this.stack.push(ve)}function $(Y){const ie=this.stack.pop();ie.value+=this.sliceSerialize(Y),ie.position.end=Yt(Y.end)}function M(Y){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Yt(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(N.call(this,Y),$.call(this,Y))}function C(){this.data.atHardBreak=!0}function B(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function F(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function R(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function L(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=ie,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function q(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=ie,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function oe(Y){const ie=this.sliceSerialize(Y),me=this.stack[this.stack.length-2];me.label=iC(ie),me.identifier=qn(ie).toLowerCase()}function ne(){const Y=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=Y.children;me.children=ve}else me.alt=ie}function D(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.url=Y}function H(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.title=Y}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function S(Y){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=qn(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function W(Y){this.data.characterReferenceType=Y.type}function I(Y){const ie=this.sliceSerialize(Y),me=this.data.characterReferenceType;let ve;me?(ve=Xd(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=co(ie);const Ce=this.stack.pop();Ce.value+=ve,Ce.position.end=Yt(Y.end)}function K(Y){$.call(this,Y);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(Y)}function te(Y){$.call(this,Y);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(Y)}function ee(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function V(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function je(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Qe(){return{type:"link",title:null,url:"",children:[]}}function Ze(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Ye(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function He(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function df(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?df(e,r):lC(e,r)}}function lC(e,t){let n;for(n in t)if(cf.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 Ml(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+br({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is still open")}function cC(e){const t=this;t.parser=n;function n(r){return oC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ff(e,t){var l,u,c;const n={...$n,...t==null?void 0:t.nodeTypes,[Z.heading]:{...$n[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>ff({...m,ordered:e.ordered||!1},t))),e.type){case it.heading:return{type:n[Z.heading][e.depth||1],children:s};case it.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case it.listItem:return{type:n[Z.li],children:s};case it.paragraph:return{type:n[Z.paragraph],children:s};case it.link:return{type:n[Z.link],[r]:e.url,children:s};case it.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case it.blockquote:return{type:n[Z.blockquote],children:s};case it.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case it.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case it.emphasis:return{[n[Ot.emphasis]]:!0,...Si(s),...Gr(s)};case it.strong:return{[n[Ot.strong]]:!0,...Si(s),...Gr(s)};case it.delete:return{[n[Ot.delete]]:!0,...Si(s),...Gr(s)};case it.inlineCode:return{[n[Ot.code]]:!0,text:e.value,...Gr(s)};case it.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Si=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Gr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const dC=function(t){const n=r=>r.children.map(a=>ff(a,t));this.Compiler=n},fC=(e,t=n=>{})=>{n1().use(cC).use(dC).process(e).then(n=>{const r=pn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===Z.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=>{const o=s;if(o.type===Z.link){const l=o.children&&o.children[0];if(l&&"text"in l&&l.text.includes(ws)){const u=o,c=l.text.replace(ws,""),m="link"in u&&u.link?u.link:"";u.type=Z.mention,u.id=m,u.name=c,u.children=[{text:""}]}}"children"in s&&s.children&&s.children.forEach(l=>i(l))};r.forEach(i),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,""),f=o.text.indexOf(c),p=o.text.substring(0,f),g=o.text.substring(f+c.length),h=[{text:p},{text:m,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...h)})}})}),t(r)})},hC=e=>{const{selection:t}=e;return t?v.string(e,t):null},Il=e=>{let t="";for(const n of se.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},$l={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},mC=(e,t,n,r)=>{for(const a in $l)if(ub(a,e)){e.stopPropagation(),e.preventDefault();const i=$l[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(_C(i)){Df(t,i,r);return}gf(t,i,r)}},hf=(e,t,n)=>{var u;const{selectedUser:r,possibleUsers:a}=t,i=a[r];if(!i)return;const s=i.userId||"",o=(u=i.user)==null?void 0:u.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const l={type:Z.mention,id:s,name:o,children:[{text:""}]};Q.select(e,(t==null?void 0:t.position)||Yd),Q.insertNodes(e,[l,{text:" "}]),Q.move(e,{distance:1,unit:"offset"})},pC=/^@(\w+)$/,gC=async(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[i]=U.edges(a),s=v.before(e,i,{unit:"word"}),o=s&&v.before(e,s),l=o&&v.range(e,o,i),u=l&&v.string(e,l),c=u&&u.match(pC),m=v.after(e,i),f=v.range(e,i,m),g=v.string(e,f).match(/^(\s|$)/);if(c&&g){const h=c[1];let y=[];n&&(y=await n({name:h})),r([{type:"mentionPopover",value:{show:!0,selectedUser:0,possibleUsers:y,position:l}}]);return}}t&&r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])},jn=e=>typeof e.text=="string",vC=[Z.hr,Z.image,Z.mention],Ll="<br>";function mf(e,t={nodeTypes:$n}){const{nodeTypes:n=$n,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...$n,...n,heading:{...$n[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!jn(e)&&s!==Z.mention&&(u=e.children.map(c=>{const m=jn(c)?!1:l.includes(c.type||""),f=l.includes(e.type||"");let p=!1;return!jn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!jn(g)&&g.type===o.link)),mf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||f||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
114
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const UD={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:ef},VD={91:K1},KD={[-2]:Fi,[-1]:Fi,32:Fi},ZD={35:X1,42:ha,45:[Rl,ha],60:rD,61:Rl,95:ha,96:Ol,126:Ol},YD={38:nf,92:tf},GD={[-5]:Ti,[-4]:Ti,[-3]:Ti,33:CD,38:nf,42:Fs,60:[E1,cD],91:wD,92:[Q1,tf],93:ho,95:Fs,96:M1},QD={null:[Fs,ID]},JD={null:[42,95]},XD={null:[]},eC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:JD,contentInitial:VD,disable:XD,document:UD,flow:ZD,flowInitial:KD,insideSpan:QD,string:YD,text:GD},Symbol.toStringTag,{value:"Module"}));function tC(e){const n=l1([eC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(v1),document:a(y1),flow:a(ND),string:a($D),text:a(LD)};return r;function a(i){return s;function s(o){return qD(r,i,o)}}}function nC(e){for(;!rf(e););return e}const Nl=/[\0\t\n\r]/g;function rC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,m,h,p;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(Nl.lastIndex=m,u=Nl.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(m);break}if(p===10&&m===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<h&&(l.push(i.slice(m,h)),e+=h-m),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const aC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iC(e){return e.replace(aC,sC)}function sC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Xd(n.slice(i?2:1),i?16:10)}return co(n)||e}const cf={}.hasOwnProperty;function oC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),uC(n)(nC(tC(n).document().write(rC()(e,t,!0))))}function uC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qe),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(pe),blockQuote:i(ee),characterEscape:N,characterReference:N,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(V),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(he),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(je,s),htmlFlowData:N,htmlText:i(je,s),htmlTextData:N,image:i(Oe),label:s,link:i(Qe),listItem:i(Ye),listItemValue:h,listOrdered:i(Ze,m),listUnordered:i(Ze),paragraph:i(nt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Fe),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:te,autolinkProtocol:K,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:I,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(b),codeText:l(R),codeTextData:$,data:$,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(C),hardBreakTrailing:l(C),htmlFlow:l(B),htmlFlowData:$,htmlText:l(T),htmlTextData:$,image:l(q),label:ne,labelText:oe,lineEnding:M,link:l(L),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:D,resourceTitleString:H,resource:X,setextHeading:l(z),setextHeadingLineSequence:j,setextHeadingText:F,strong:l(),thematicBreak:l()}};df(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let Ce=-1;for(;++Ce<Y.length;)if(Y[Ce][1].type==="listOrdered"||Y[Ce][1].type==="listUnordered")if(Y[Ce][0]==="enter")ve.push(Ce);else{const Ve=ve.pop();Ce=a(Y,Ve,Ce)}for(Ce=-1;++Ce<Y.length;){const Ve=t[Y[Ce][0]];cf.call(Ve,Y[Ce][1].type)&&Ve[Y[Ce][1].type].call(Object.assign({sliceSerialize:Y[Ce][2].sliceSerialize},me),Y[Ce][1])}if(me.tokenStack.length>0){const Ve=me.tokenStack[me.tokenStack.length-1];(Ve[1]||Ml).call(me,void 0,Ve[0])}for(ie.position={start:Yt(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:Yt(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)ie=t.transforms[Ce](ie)||ie;return ie}function a(Y,ie,me){let ve=ie-1,Ce=-1,Ve=!1,Ke,mt,It,Et;for(;++ve<=me;){const Je=Y[ve];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ce++:Ce--,Et=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Ke&&!Et&&!Ce&&!It&&(It=ve),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!Ce&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ce===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Ke){let Bt=ve;for(mt=void 0;Bt--;){const pt=Y[Bt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(Y[mt][1].type="lineEndingBlank",Ve=!0),pt[1].type="lineEnding",mt=Bt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}It&&(!mt||It<mt)&&(Ke._spread=!0),Ke.end=Object.assign({},mt?Y[mt][1].start:Je[1].end),Y.splice(mt||ve,0,["exit",Ke,Je[2]]),ve++,me++}if(Je[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Ke=Bt,Y.splice(ve,0,["enter",Bt,Je[2]]),ve++,me++,It=void 0,Et=!0}}}return Y[ie][1]._spread=Ve,me}function i(Y,ie){return me;function me(ve){o.call(this,Y(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,ie,me){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([ie,me]),Y.position={start:Yt(ie.start),end:void 0}}function l(Y){return ie;function ie(me){Y&&Y.call(this,me),u.call(this,me)}}function u(Y,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==Y.type&&(ie?ie.call(this,Y,ve[0]):(ve[1]||Ml).call(this,Y,ve[0]));else throw new Error("Cannot close `"+Y.type+"` ("+br({start:Y.start,end:Y.end})+"): it’s not open");me.position.end=Yt(Y.end)}function c(){return o1(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(Y){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=Y}function g(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=Y}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y.replace(/(\r?\n|\r)$/g,"")}function w(Y){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=qn(this.sliceSerialize(Y)).toLowerCase()}function A(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.title=Y}function k(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.url=Y}function E(Y){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(Y).length;ie.depth=me}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function j(Y){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function N(Y){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=He(),ve.position={start:Yt(Y.start),end:void 0},me.push(ve)),this.stack.push(ve)}function $(Y){const ie=this.stack.pop();ie.value+=this.sliceSerialize(Y),ie.position.end=Yt(Y.end)}function M(Y){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Yt(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(N.call(this,Y),$.call(this,Y))}function C(){this.data.atHardBreak=!0}function B(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function T(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function R(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.value=Y}function L(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=ie,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function q(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=ie,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function oe(Y){const ie=this.sliceSerialize(Y),me=this.stack[this.stack.length-2];me.label=iC(ie),me.identifier=qn(ie).toLowerCase()}function ne(){const Y=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=Y.children;me.children=ve}else me.alt=ie}function D(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.url=Y}function H(){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.title=Y}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function S(Y){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=qn(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function W(Y){this.data.characterReferenceType=Y.type}function I(Y){const ie=this.sliceSerialize(Y),me=this.data.characterReferenceType;let ve;me?(ve=Xd(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=co(ie);const Ce=this.stack.pop();Ce.value+=ve,Ce.position.end=Yt(Y.end)}function K(Y){$.call(this,Y);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(Y)}function te(Y){$.call(this,Y);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(Y)}function ee(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function V(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function je(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Qe(){return{type:"link",title:null,url:"",children:[]}}function Ze(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Ye(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function He(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function df(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?df(e,r):lC(e,r)}}function lC(e,t){let n;for(n in t)if(cf.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 Ml(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+br({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is still open")}function cC(e){const t=this;t.parser=n;function n(r){return oC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ff(e,t){var l,u,c;const n={...$n,...t==null?void 0:t.nodeTypes,[Z.heading]:{...$n[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>ff({...m,ordered:e.ordered||!1},t))),e.type){case it.heading:return{type:n[Z.heading][e.depth||1],children:s};case it.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case it.listItem:return{type:n[Z.li],children:s};case it.paragraph:return{type:n[Z.paragraph],children:s};case it.link:return{type:n[Z.link],[r]:e.url,children:s};case it.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case it.blockquote:return{type:n[Z.blockquote],children:s};case it.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case it.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case it.emphasis:return{[n[Ot.emphasis]]:!0,...Si(s),...Gr(s)};case it.strong:return{[n[Ot.strong]]:!0,...Si(s),...Gr(s)};case it.delete:return{[n[Ot.delete]]:!0,...Si(s),...Gr(s)};case it.inlineCode:return{[n[Ot.code]]:!0,text:e.value,...Gr(s)};case it.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Si=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Gr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const dC=function(t){const n=r=>r.children.map(a=>ff(a,t));this.Compiler=n},fC=(e,t=n=>{})=>{n1().use(cC).use(dC).process(e).then(n=>{const r=pn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===Z.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=>{const o=s;if(o.type===Z.link){const l=o.children&&o.children[0];if(l&&"text"in l&&l.text.includes(ws)){const u=o,c=l.text.replace(ws,""),m="link"in u&&u.link?u.link:"";u.type=Z.mention,u.id=m,u.name=c,u.children=[{text:""}]}}"children"in s&&s.children&&s.children.forEach(l=>i(l))};r.forEach(i),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,""),h=o.text.indexOf(c),p=o.text.substring(0,h),g=o.text.substring(h+c.length),f=[{text:p},{text:m,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},hC=e=>{const{selection:t}=e;return t?v.string(e,t):null},Il=e=>{let t="";for(const n of se.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},$l={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},mC=(e,t,n,r)=>{for(const a in $l)if(ub(a,e)){e.stopPropagation(),e.preventDefault();const i=$l[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(_C(i)){Df(t,i,r);return}gf(t,i,r)}},hf=(e,t,n)=>{var u;const{selectedUser:r,possibleUsers:a}=t,i=a[r];if(!i)return;const s=i.userId||"",o=(u=i.user)==null?void 0:u.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const l={type:Z.mention,id:s,name:o,children:[{text:""}]};Q.select(e,(t==null?void 0:t.position)||Yd),Q.insertNodes(e,[l,{text:" "}]),Q.move(e,{distance:1,unit:"offset"})},pC=/^@(\w+)$/,gC=async(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[i]=U.edges(a),s=v.before(e,i,{unit:"word"}),o=s&&v.before(e,s),l=o&&v.range(e,o,i),u=l&&v.string(e,l),c=u&&u.match(pC),m=v.after(e,i),h=v.range(e,i,m),g=v.string(e,h).match(/^(\s|$)/);if(c&&g){const f=c[1];let y=[];n&&(y=await n({name:f})),r([{type:"mentionPopover",value:{show:!0,selectedUser:0,possibleUsers:y,position:l}}]);return}}t&&r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])},jn=e=>typeof e.text=="string",vC=[Z.hr,Z.image,Z.mention],Ll="<br>";function mf(e,t={nodeTypes:$n}){const{nodeTypes:n=$n,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...$n,...n,heading:{...$n[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!jn(e)&&s!==Z.mention&&(u=e.children.map(c=>{const m=jn(c)?!1:l.includes(c.type||""),h=l.includes(e.type||"");let p=!1;return!jn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!jn(g)&&g.type===o.link)),mf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
115
115
  `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=Ll),!(u===""&&!vC.find(c=>o[c]===s)))switch(u!==Ll&&jn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=On(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=On(u,"***"):(e[Z.bold]&&(u=On(u,"**")),e[Z.italic]&&(u=On(u,"_")),e[Z.strikethrough]&&(u=On(u,"~~")),e[Z.code]&&(u=On(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
116
116
  `;case o[Z.heading][2]:return`## ${u}
117
117
  `;case o[Z.heading][3]:return`### ${u}
@@ -125,35 +125,35 @@ ${u}
125
125
  \`\`\`
126
126
  `;case o[Z.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[Z.mention]:const{id:c}=e;return e?`@{{${c}}}`:u;case o[Z.ul]:case o[Z.ol]:return`
127
127
  ${u}
128
- `;case o[Z.li]:const m=e&&e.parentType===o[Z.ol],f=e.children.length===1&&jn(e.children[0]);let p="";for(let g=0;a>g;g++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`${p}${m?"1.":"-"} ${u}${f?`
128
+ `;case o[Z.li]:const m=e&&e.parentType===o[Z.ol],h=e.children.length===1&&jn(e.children[0]);let p="";for(let g=0;a>g;g++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`${p}${m?"1.":"-"} ${u}${h?`
129
129
  `:""}`;case o[Z.paragraph]:return`${u}
130
130
 
131
131
  `;case o[Z.hr]:return`---
132
- `;default:return u}}function On(e,t){const n=e.trim(),r=n,a=`${t}${r}${zl(t)}`;if(r.length===e.length)return a;const i=t+r+zl(t);return e.replace(n,i)}const zl=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>mf(t)).join("").trim();const yC=()=>{const e=_n(),{dispatch:t,mentionPopover:n,id:r}=x.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Gd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Nc,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(tr,{element:"li",className:G({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation();const f={...n,selectedUser:c};t([{type:"mentionPopover",value:f}]),hf(e,f,t)}}},l))})})})},mo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=_n(),{id:u,tabbableOption:c,setFocus:m,openTooltip:f,dispatch:p}=x.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,b,w,A;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const k=h.currentTarget.closest("li");let E=k==null?void 0:k.nextElementSibling;if(h.key==="ArrowLeft"){const z=k==null?void 0:k.previousElementSibling;z?E=z:E=(y=k==null?void 0:k.parentElement)==null?void 0:y.lastElementChild}else E||(E=(b=k==null?void 0:k.parentElement)==null?void 0:b.firstElementChild);const T=E==null?void 0:E.className.split(" ")[0];T&&(m(T),(w=E==null?void 0:E.querySelector("button"))==null||w.focus());break;default:const j=h.currentTarget.closest("fieldset");if(j){(A=j==null?void 0:j.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Jn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:f===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},ql=[Z.ol,Z.ul],pf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(v.nodes(e,{at:v.unhangRange(e,n),match:a=>{const i=a;return!v.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=v.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},gf=(e,t,n)=>{try{const r=DC(e),a=pf(e,t),i=ql.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!v.isEditor(u)&&de.isElement(u)&&ql.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=v.parent(e,l,{edge:"end"});Array.from(v.nodes(e,{at:c,match:f=>{const p=f;return!v.isEditor(f)&&de.isElement(f)&&p.type===Z.li}})).forEach(([f,p])=>{se.string(f).trim()===""&&Q.removeNodes(e,{at:p})})}else{if(r){const u={type:Z.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=x.useContext(Kt),a=_n(),i=pf(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{gf(a,e,r),n(i?null:e)}})},Dr=e=>{const[t]=v.nodes(e,{match:n=>{const r=n;return!v.isEditor(n)&&de.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&po(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[s]=v.nodes(e,{match:o=>{const l=o;return!v.isEditor(o)&&de.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),vf(n)}}else po(e,t,n,r)},po=(e,t,n,r=a=>{console.error(a)})=>{try{Dr(e)&&bf(e);const{selection:a}=e,i=a&&U.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),vf(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},vf=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},bf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!v.isEditor(t)&&de.isElement(t)&&n.type===Z.link}})};let ji=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=x.useContext(Kt),s=_n(),o=Iy(s),l=(o==null?void 0:o.text)||hC(s),[u,c]=x.useState(Dr(s)),m=Gd(s,"link-editor",`${n}-link`),f=x.useRef(null);x.useEffect(()=>{var y;!u&&r&&((y=f.current)==null||y.focus())},[u]),x.useEffect(()=>{ji&&clearTimeout(ji),ji=setTimeout(()=>{c(Dr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const b={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":b.href=(o==null?void 0:o.full)||"",b.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},b.children=d.jsxs(d.Fragment,{children:[b.children,d.jsx(Me,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":b.onClick=()=>{c(!1)};break;case"remove":b.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];Dr(s)&&(bf(s),w.push({type:"lastAnchor",value:null})),a(w)};break}return b}),h=[{id:"url",type:"url",inputRef:f,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&h.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(Jn,{ref:m,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=f.current)==null?void 0:y.focus()})}},children:u?d.jsx(En,{wrappers:p,buttons:g}):d.jsx(nr,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const b=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:w}=Rc(y.url);o!=null&&o.full?wC(s,w,n,i):xC(s,w,n,i),b.push({type:"lastAnchor",value:null})}a(b)})}},fields:h,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=_n(),{setFocus:t,dispatch:n}=x.useContext(Kt),[r,a]=x.useState(!1);return x.useEffect(()=>{a(Dr(e))},[e.selection]),d.jsx(mo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),yf=(e,t)=>{const n=v.marks(e);return n?n[t]===!0:!1},Df=(e,t,n)=>{try{yf(e,t)?v.removeMark(e,t):v.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=x.useContext(Kt),a=_n(),i=yf(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{Df(a,e,r),n(i?null:e)}})},_a=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=x.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===_a.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const RC=wn(TC),NC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&RC(i)?po(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&se.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Cf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{getUsers:c,onChange:m=()=>{},reportError:f=F=>{console.error(F)}}=a||{},p=[{type:Z.paragraph,children:[{text:""}]}],g={originalValue:t||"",initialValue:t?null:p,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1},[h,y]=x.useReducer(jr,g),{originalValue:b,initialValue:w,stringValue:A,lastAnchor:k,lastKey:E,hasInteracted:T,mentionPopover:j}=h,z=F=>{const R=F||_a[0];F&&y([{type:"tabbableOption",value:R}])};x.useEffect(()=>{t&&(async()=>{let R=pn(t);R.includes("<")&&(R=new ya().turndown(R)),s&&s.mentions&&(R=await Oc({text:R,template:`[${ws}{{name}}]({{id}})`,mentions:s.mentions,getUsers:c||(()=>Promise.resolve([]))})),fC(R,L=>{y([{type:"initialValue",value:L}]),setTimeout(()=>{y([{type:"stringValue",value:Il(C)}])},150)})})()},[]),x.useEffect(()=>{t!==""||!C||vc(b,t)&&!T||(v.withoutNormalizing(C,()=>{Q.delete(C,{at:{anchor:v.start(C,[]),focus:v.end(C,[])}}),Q.deselect(C),C.children.length!==0&&Q.unwrapNodes(C,{at:[0]}),Q.insertNodes(C,p,{at:[0]})}),y([{type:"initialValue",value:p},{type:"lastAnchor",value:null}]))},[t]);const N=`rte-${e}`,$=x.useCallback(F=>d.jsx(Ny,{...F}),[]),M=x.useCallback(F=>d.jsx(My,{...F}),[]),C=x.useMemo(()=>NC(MC(IC(wv(Py(Cv())),f),f),N,f),[]),B=xc(()=>{gC(C,j.show,c,y)},100);return w?d.jsx("div",{id:N,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...h,id:N,setFocus:z,dispatch:y,reportError:f},children:[d.jsxs(jy,{editor:C,initialValue:w,onChange:F=>{if(C.operations.some(L=>L.type!=="set_selection")){const L=bC(F);m(L),y([{type:"stringValue",value:Il(C)}]),T||y([{type:"hasInteracted",value:!0}]),B(),u&&console.log({serialized:L,json:F})}},...o,children:[d.jsx(wy,{className:"input",renderElement:$,renderLeaf:M,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:F=>{if(F.key==="Enter"){j.show&&(F.preventDefault(),F.stopPropagation(),hf(C,j,y));const{selection:R}=C;if(R){const L=U.isCollapsed(R),[q,oe]=v.node(C,R,{depth:1});let ne=q,D=ne.type;const H=ne.children[0];if(H&&[Z.ol,Z.ul].includes(H.type)&&(ne=H,D=H.type),ne&&de.isElement(ne)&&D!==Z.paragraph){if(D===Z.blockquote&&!F.shiftKey){F.stopPropagation(),F.preventDefault(),Q.insertNodes(C,p);return}if(L){const[X]=v.parent(C,R,{edge:"end"}),S=X.type;if(E==="Enter"&&S===Z.li&&[Z.ul,Z.ol].includes(D)){F.stopPropagation(),F.preventDefault(),Q.insertNodes(C,p,{at:P.next(oe)}),Q.select(C,v.end(C,P.next(oe)));return}}}}}else if(F.key==="Escape"){if(j.show){F.preventDefault(),F.stopPropagation(),y([{type:"mentionPopover",value:{...j,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(F.key)&&j.show){F.preventDefault(),F.stopPropagation();const{selectedUser:R,possibleUsers:L}=j;let q=F.key==="ArrowUp"?R-1:R+1;q<0&&(q=L.length-1),q>=L.length&&(q=0),y([{type:"mentionPopover",value:{...j,selectedUser:q}}])}y([{type:"lastKey",value:F.key}]),mC(F,C,y,f)},onBlur:()=>{C.selection&&y([{type:"lastAnchor",value:C.selection.anchor}])},onFocus:()=>{if(k){if(!P.isPath(k.path)||!se.has(C,k.path))return;const F=se.get(C,k.path);let R=0;if(fe.isText(F)?R=F.text.length:F.children&&(R=F.children.length),k.offset>R)return;try{Q.select(C,{anchor:k,focus:k})}catch(L){const q=L.message;f(`Error focusing editor: ${q}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]}),d.jsx(Ws,{limit:r,valueLength:za(A)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.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 LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=x.useState(!1),[l,u]=x.useState(!1),c=x.useRef(null),m=async f=>{o(!0),u(!1);try{const p=f.target.files&&f.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:G("profile-image-change-figure",e),children:[d.jsx(sn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:m,hidden:!0,"data-testid":"file-input"}),d.jsx(Ee,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const xf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(nr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const wf=({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]=x.useState([]),[f,p]=x.useState(!0),[g,h]=x.useState(u),{formatMessage:y}=ue.useIntl(),b=async k=>{k.preventDefault();try{await l(c),m([]),h("SUCCESS")}catch(E){h("ERROR"),o(E)}},w=k=>{k.preventDefault(),h("NOT_SUBMITTED"),p(!0),m([])},A=k=>{k.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(tn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"secondary",onClick:w,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Ee,{onClick:A,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(Ee,{onClick:w,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:b,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(Dh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{m(k),p(!k.length)},autoFocus:!1,getLabel:(k,E,T)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(E),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},E)})]}),d.jsx(tn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Ee,{className:"sendEmailsButton",disabled:f,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=x.useState(null),[i,s]=x.useState(!1),[o,l]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!as(p[yt.NEW_PASSWORD]).isValid,m=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(as(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&m.push({component:Gc,props:{matchingRules:o}});const f={id:yt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(nr,{...f}),r&&d.jsx(an,{variant:"error",text:r})]})};const Ef=({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=ue.useIntl(),u=x.useRef(null);Hn(()=>{!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(Me,{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(Me,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Wl=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}])},qC=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"]}},WC=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=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,m=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},f=[{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"}),functions:{onBlur:()=>{Wl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Uc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(f.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"}],"data-testid":"signup-org-input"}),e.url&&f.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&f.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Wl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const UC=({className:e=""})=>d.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:m=!0,logInButton:f=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:m,logInButton:f,successMessage:p},[h,y]=x.useReducer(jr,VC),{validFields:b,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:E,showError:T}=h,[j,z]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{A===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[A]),x.useEffect(()=>{j["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[j]),x.useEffect(()=>{E&&j["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const $=x.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,N,g,h]),M=k?!0:A?!Object.values(b).every(C=>C===!0):!b.name||!b.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&E?d.jsx(UC,{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(ue.FormattedMessage,{id:"signup_title"})}),T&&d.jsx(an,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(nr,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{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 WC({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:C=>{r.handleError(C),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};var Ts={exports:{}},Qr={exports:{}},Te={};/** @license React v16.13.1
132
+ `;default:return u}}function On(e,t){const n=e.trim(),r=n,a=`${t}${r}${zl(t)}`;if(r.length===e.length)return a;const i=t+r+zl(t);return e.replace(n,i)}const zl=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>mf(t)).join("").trim();const yC=()=>{const e=_n(),{dispatch:t,mentionPopover:n,id:r}=x.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Gd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Nc,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(tr,{element:"li",className:G({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation();const h={...n,selectedUser:c};t([{type:"mentionPopover",value:h}]),hf(e,h,t)}}},l))})})})},mo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=_n(),{id:u,tabbableOption:c,setFocus:m,openTooltip:h,dispatch:p}=x.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var y,b,w,A;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const k=f.currentTarget.closest("li");let E=k==null?void 0:k.nextElementSibling;if(f.key==="ArrowLeft"){const z=k==null?void 0:k.previousElementSibling;z?E=z:E=(y=k==null?void 0:k.parentElement)==null?void 0:y.lastElementChild}else E||(E=(b=k==null?void 0:k.parentElement)==null?void 0:b.firstElementChild);const F=E==null?void 0:E.className.split(" ")[0];F&&(m(F),(w=E==null?void 0:E.querySelector("button"))==null||w.focus());break;default:const j=f.currentTarget.closest("fieldset");if(j){(A=j==null?void 0:j.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Jn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:h===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},ql=[Z.ol,Z.ul],pf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(v.nodes(e,{at:v.unhangRange(e,n),match:a=>{const i=a;return!v.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=v.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},gf=(e,t,n)=>{try{const r=DC(e),a=pf(e,t),i=ql.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!v.isEditor(u)&&de.isElement(u)&&ql.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=v.parent(e,l,{edge:"end"});Array.from(v.nodes(e,{at:c,match:h=>{const p=h;return!v.isEditor(h)&&de.isElement(h)&&p.type===Z.li}})).forEach(([h,p])=>{se.string(h).trim()===""&&Q.removeNodes(e,{at:p})})}else{if(r){const u={type:Z.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=x.useContext(Kt),a=_n(),i=pf(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{gf(a,e,r),n(i?null:e)}})},Dr=e=>{const[t]=v.nodes(e,{match:n=>{const r=n;return!v.isEditor(n)&&de.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&po(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[s]=v.nodes(e,{match:o=>{const l=o;return!v.isEditor(o)&&de.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),vf(n)}}else po(e,t,n,r)},po=(e,t,n,r=a=>{console.error(a)})=>{try{Dr(e)&&bf(e);const{selection:a}=e,i=a&&U.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),vf(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},vf=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},bf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!v.isEditor(t)&&de.isElement(t)&&n.type===Z.link}})};let ji=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=x.useContext(Kt),s=_n(),o=Iy(s),l=(o==null?void 0:o.text)||hC(s),[u,c]=x.useState(Dr(s)),m=Gd(s,"link-editor",`${n}-link`),h=x.useRef(null);x.useEffect(()=>{var y;!u&&r&&((y=h.current)==null||y.focus())},[u]),x.useEffect(()=>{ji&&clearTimeout(ji),ji=setTimeout(()=>{c(Dr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const b={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":b.href=(o==null?void 0:o.full)||"",b.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},b.children=d.jsxs(d.Fragment,{children:[b.children,d.jsx(Me,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":b.onClick=()=>{c(!1)};break;case"remove":b.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];Dr(s)&&(bf(s),w.push({type:"lastAnchor",value:null})),a(w)};break}return b}),f=[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&f.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(Jn,{ref:m,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=h.current)==null?void 0:y.focus()})}},children:u?d.jsx(En,{wrappers:p,buttons:g}):d.jsx(nr,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const b=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:w}=Rc(y.url);o!=null&&o.full?wC(s,w,n,i):xC(s,w,n,i),b.push({type:"lastAnchor",value:null})}a(b)})}},fields:f,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=_n(),{setFocus:t,dispatch:n}=x.useContext(Kt),[r,a]=x.useState(!1);return x.useEffect(()=>{a(Dr(e))},[e.selection]),d.jsx(mo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),yf=(e,t)=>{const n=v.marks(e);return n?n[t]===!0:!1},Df=(e,t,n)=>{try{yf(e,t)?v.removeMark(e,t):v.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=x.useContext(Kt),a=_n(),i=yf(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{Df(a,e,r),n(i?null:e)}})},_a=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=x.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===_a.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const RC=wn(TC),NC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&RC(i)?po(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&se.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Cf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{getUsers:c,onChange:m=()=>{},reportError:h=T=>{console.error(T)}}=a||{},p=[{type:Z.paragraph,children:[{text:""}]}],g={originalValue:t||"",initialValue:t?null:p,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1},[f,y]=x.useReducer(jr,g),{originalValue:b,initialValue:w,stringValue:A,lastAnchor:k,lastKey:E,hasInteracted:F,mentionPopover:j}=f,z=T=>{const R=T||_a[0];T&&y([{type:"tabbableOption",value:R}])};x.useEffect(()=>{t&&(async()=>{let R=pn(t);R.includes("<")&&(R=new ya().turndown(R)),s&&s.mentions&&(R=await Oc({text:R,template:`[${ws}{{name}}]({{id}})`,mentions:s.mentions,getUsers:c||(()=>Promise.resolve([]))})),fC(R,L=>{y([{type:"initialValue",value:L}]),setTimeout(()=>{y([{type:"stringValue",value:Il(C)}])},150)})})()},[]),x.useEffect(()=>{t!==""||!C||vc(b,t)&&!F||(v.withoutNormalizing(C,()=>{Q.delete(C,{at:{anchor:v.start(C,[]),focus:v.end(C,[])}}),Q.deselect(C),C.children.length!==0&&Q.unwrapNodes(C,{at:[0]}),Q.insertNodes(C,p,{at:[0]})}),y([{type:"initialValue",value:p},{type:"lastAnchor",value:null}]))},[t]);const N=`rte-${e}`,$=x.useCallback(T=>d.jsx(Ny,{...T}),[]),M=x.useCallback(T=>d.jsx(My,{...T}),[]),C=x.useMemo(()=>NC(MC(IC(wv(Py(Cv())),h),h),N,h),[]),B=xc(()=>{gC(C,j.show,c,y)},100);return w?d.jsx("div",{id:N,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...f,id:N,setFocus:z,dispatch:y,reportError:h},children:[d.jsxs(jy,{editor:C,initialValue:w,onChange:T=>{if(C.operations.some(L=>L.type!=="set_selection")){const L=bC(T);m(L),y([{type:"stringValue",value:Il(C)}]),F||y([{type:"hasInteracted",value:!0}]),B(),u&&console.log({serialized:L,json:T})}},...o,children:[d.jsx(wy,{className:"input",renderElement:$,renderLeaf:M,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:T=>{if(T.key==="Enter"){j.show&&(T.preventDefault(),T.stopPropagation(),hf(C,j,y));const{selection:R}=C;if(R){const L=U.isCollapsed(R),[q,oe]=v.node(C,R,{depth:1});let ne=q,D=ne.type;const H=ne.children[0];if(H&&[Z.ol,Z.ul].includes(H.type)&&(ne=H,D=H.type),ne&&de.isElement(ne)&&D!==Z.paragraph){if(D===Z.blockquote&&!T.shiftKey){T.stopPropagation(),T.preventDefault(),Q.insertNodes(C,p);return}if(L){const[X]=v.parent(C,R,{edge:"end"}),S=X.type;if(E==="Enter"&&S===Z.li&&[Z.ul,Z.ol].includes(D)){T.stopPropagation(),T.preventDefault(),Q.insertNodes(C,p,{at:P.next(oe)}),Q.select(C,v.end(C,P.next(oe)));return}}}}}else if(T.key==="Escape"){if(j.show){T.preventDefault(),T.stopPropagation(),y([{type:"mentionPopover",value:{...j,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(T.key)&&j.show){T.preventDefault(),T.stopPropagation();const{selectedUser:R,possibleUsers:L}=j;let q=T.key==="ArrowUp"?R-1:R+1;q<0&&(q=L.length-1),q>=L.length&&(q=0),y([{type:"mentionPopover",value:{...j,selectedUser:q}}])}y([{type:"lastKey",value:T.key}]),mC(T,C,y,h)},onBlur:()=>{C.selection&&y([{type:"lastAnchor",value:C.selection.anchor}])},onFocus:()=>{if(k){if(!P.isPath(k.path)||!se.has(C,k.path))return;const T=se.get(C,k.path);let R=0;if(fe.isText(T)?R=T.text.length:T.children&&(R=T.children.length),k.offset>R)return;try{Q.select(C,{anchor:k,focus:k})}catch(L){const q=L.message;h(`Error focusing editor: ${q}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]}),d.jsx(Ws,{limit:r,valueLength:za(A)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.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 LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=x.useState(!1),[l,u]=x.useState(!1),c=x.useRef(null),m=async h=>{o(!0),u(!1);try{const p=h.target.files&&h.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:G("profile-image-change-figure",e),children:[d.jsx(sn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:m,hidden:!0,"data-testid":"file-input"}),d.jsx(Ee,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const xf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(nr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const wf=({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]=x.useState([]),[h,p]=x.useState(!0),[g,f]=x.useState(u),{formatMessage:y}=ue.useIntl(),b=async k=>{k.preventDefault();try{await l(c),m([]),f("SUCCESS")}catch(E){f("ERROR"),o(E)}},w=k=>{k.preventDefault(),f("NOT_SUBMITTED"),p(!0),m([])},A=k=>{k.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(tn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"secondary",onClick:w,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Ee,{onClick:A,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(Ee,{onClick:w,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:b,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(Dh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{m(k),p(!k.length)},autoFocus:!1,getLabel:(k,E,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(E),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},E)})]}),d.jsx(tn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Ee,{className:"sendEmailsButton",disabled:h,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=x.useState(null),[i,s]=x.useState(!1),[o,l]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!as(p[yt.NEW_PASSWORD]).isValid,m=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(as(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&m.push({component:Gc,props:{matchingRules:o}});const h={id:yt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(nr,{...h}),r&&d.jsx(an,{variant:"error",text:r})]})};const Ef=({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=ue.useIntl(),u=x.useRef(null);Hn(()=>{!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(Me,{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(Me,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Wl=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}])},qC=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"]}},WC=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=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,m=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},h=[{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"}),functions:{onBlur:()=>{Wl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Uc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(h.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"}],"data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Wl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const UC=({className:e=""})=>d.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:m,logInButton:h,successMessage:p},[f,y]=x.useReducer(jr,VC),{validFields:b,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:E,showError:F}=f,[j,z]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{A===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[A]),x.useEffect(()=>{j["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[j]),x.useEffect(()=>{E&&j["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const $=x.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),M=k?!0:A?!Object.values(b).every(C=>C===!0):!b.name||!b.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&E?d.jsx(UC,{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(ue.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(an,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(nr,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{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 WC({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:f})},onCatch:C=>{r.handleError(C),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};var Ts={exports:{}},Qr={exports:{}},Te={};/** @license React v16.13.1
133
133
  * react-is.production.min.js
134
134
  *
135
135
  * Copyright (c) Facebook, Inc. and its affiliates.
136
136
  *
137
137
  * This source code is licensed under the MIT license found in the
138
138
  * LICENSE file in the root directory of this source tree.
139
- */var Hl;function ZC(){if(Hl)return Te;Hl=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,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(E){if(typeof E=="object"&&E!==null){var T=E.$$typeof;switch(T){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case c:case g:case p:case s:return E;default:return T}}case n:return T}}}function k(E){return A(E)===u}return Te.AsyncMode=l,Te.ConcurrentMode=u,Te.ContextConsumer=o,Te.ContextProvider=s,Te.Element=t,Te.ForwardRef=c,Te.Fragment=r,Te.Lazy=g,Te.Memo=p,Te.Portal=n,Te.Profiler=i,Te.StrictMode=a,Te.Suspense=m,Te.isAsyncMode=function(E){return k(E)||A(E)===l},Te.isConcurrentMode=k,Te.isContextConsumer=function(E){return A(E)===o},Te.isContextProvider=function(E){return A(E)===s},Te.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Te.isForwardRef=function(E){return A(E)===c},Te.isFragment=function(E){return A(E)===r},Te.isLazy=function(E){return A(E)===g},Te.isMemo=function(E){return A(E)===p},Te.isPortal=function(E){return A(E)===n},Te.isProfiler=function(E){return A(E)===i},Te.isStrictMode=function(E){return A(E)===a},Te.isSuspense=function(E){return A(E)===m},Te.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===f||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===c||E.$$typeof===y||E.$$typeof===b||E.$$typeof===w||E.$$typeof===h)},Te.typeOf=A,Te}var Se={};/** @license React v16.13.1
139
+ */var Hl;function ZC(){if(Hl)return Te;Hl=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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(E){if(typeof E=="object"&&E!==null){var F=E.$$typeof;switch(F){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case c:case g:case p:case s:return E;default:return F}}case n:return F}}}function k(E){return A(E)===u}return Te.AsyncMode=l,Te.ConcurrentMode=u,Te.ContextConsumer=o,Te.ContextProvider=s,Te.Element=t,Te.ForwardRef=c,Te.Fragment=r,Te.Lazy=g,Te.Memo=p,Te.Portal=n,Te.Profiler=i,Te.StrictMode=a,Te.Suspense=m,Te.isAsyncMode=function(E){return k(E)||A(E)===l},Te.isConcurrentMode=k,Te.isContextConsumer=function(E){return A(E)===o},Te.isContextProvider=function(E){return A(E)===s},Te.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Te.isForwardRef=function(E){return A(E)===c},Te.isFragment=function(E){return A(E)===r},Te.isLazy=function(E){return A(E)===g},Te.isMemo=function(E){return A(E)===p},Te.isPortal=function(E){return A(E)===n},Te.isProfiler=function(E){return A(E)===i},Te.isStrictMode=function(E){return A(E)===a},Te.isSuspense=function(E){return A(E)===m},Te.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===c||E.$$typeof===y||E.$$typeof===b||E.$$typeof===w||E.$$typeof===f)},Te.typeOf=A,Te}var Se={};/** @license React v16.13.1
140
140
  * react-is.development.js
141
141
  *
142
142
  * Copyright (c) Facebook, Inc. and its affiliates.
143
143
  *
144
144
  * This source code is licensed under the MIT license found in the
145
145
  * LICENSE file in the root directory of this source tree.
146
- */var Ul;function YC(){return Ul||(Ul=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,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(V){return typeof V=="string"||typeof V=="function"||V===r||V===u||V===i||V===a||V===m||V===f||typeof V=="object"&&V!==null&&(V.$$typeof===g||V.$$typeof===p||V.$$typeof===s||V.$$typeof===o||V.$$typeof===c||V.$$typeof===y||V.$$typeof===b||V.$$typeof===w||V.$$typeof===h)}function k(V){if(typeof V=="object"&&V!==null){var he=V.$$typeof;switch(he){case t:var pe=V.type;switch(pe){case l:case u:case r:case i:case a:case m:return pe;default:var we=pe&&pe.$$typeof;switch(we){case o:case c:case g:case p:case s:return we;default:return he}}case n:return he}}}var E=l,T=u,j=o,z=s,N=t,$=c,M=r,C=g,B=p,F=n,R=i,L=a,q=m,oe=!1;function ne(V){return oe||(oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(V)||k(V)===l}function D(V){return k(V)===u}function H(V){return k(V)===o}function X(V){return k(V)===s}function _(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function S(V){return k(V)===c}function W(V){return k(V)===r}function I(V){return k(V)===g}function K(V){return k(V)===p}function te(V){return k(V)===n}function ee(V){return k(V)===i}function ae(V){return k(V)===a}function le(V){return k(V)===m}Se.AsyncMode=E,Se.ConcurrentMode=T,Se.ContextConsumer=j,Se.ContextProvider=z,Se.Element=N,Se.ForwardRef=$,Se.Fragment=M,Se.Lazy=C,Se.Memo=B,Se.Portal=F,Se.Profiler=R,Se.StrictMode=L,Se.Suspense=q,Se.isAsyncMode=ne,Se.isConcurrentMode=D,Se.isContextConsumer=H,Se.isContextProvider=X,Se.isElement=_,Se.isForwardRef=S,Se.isFragment=W,Se.isLazy=I,Se.isMemo=K,Se.isPortal=te,Se.isProfiler=ee,Se.isStrictMode=ae,Se.isSuspense=le,Se.isValidElementType=A,Se.typeOf=k}()),Se}var Vl;function kf(){return Vl||(Vl=1,process.env.NODE_ENV==="production"?Qr.exports=ZC():Qr.exports=YC()),Qr.exports}/*
146
+ */var Ul;function YC(){return Ul||(Ul=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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(V){return typeof V=="string"||typeof V=="function"||V===r||V===u||V===i||V===a||V===m||V===h||typeof V=="object"&&V!==null&&(V.$$typeof===g||V.$$typeof===p||V.$$typeof===s||V.$$typeof===o||V.$$typeof===c||V.$$typeof===y||V.$$typeof===b||V.$$typeof===w||V.$$typeof===f)}function k(V){if(typeof V=="object"&&V!==null){var he=V.$$typeof;switch(he){case t:var pe=V.type;switch(pe){case l:case u:case r:case i:case a:case m:return pe;default:var we=pe&&pe.$$typeof;switch(we){case o:case c:case g:case p:case s:return we;default:return he}}case n:return he}}}var E=l,F=u,j=o,z=s,N=t,$=c,M=r,C=g,B=p,T=n,R=i,L=a,q=m,oe=!1;function ne(V){return oe||(oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(V)||k(V)===l}function D(V){return k(V)===u}function H(V){return k(V)===o}function X(V){return k(V)===s}function _(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function S(V){return k(V)===c}function W(V){return k(V)===r}function I(V){return k(V)===g}function K(V){return k(V)===p}function te(V){return k(V)===n}function ee(V){return k(V)===i}function ae(V){return k(V)===a}function le(V){return k(V)===m}Se.AsyncMode=E,Se.ConcurrentMode=F,Se.ContextConsumer=j,Se.ContextProvider=z,Se.Element=N,Se.ForwardRef=$,Se.Fragment=M,Se.Lazy=C,Se.Memo=B,Se.Portal=T,Se.Profiler=R,Se.StrictMode=L,Se.Suspense=q,Se.isAsyncMode=ne,Se.isConcurrentMode=D,Se.isContextConsumer=H,Se.isContextProvider=X,Se.isElement=_,Se.isForwardRef=S,Se.isFragment=W,Se.isLazy=I,Se.isMemo=K,Se.isPortal=te,Se.isProfiler=ee,Se.isStrictMode=ae,Se.isSuspense=le,Se.isValidElementType=A,Se.typeOf=k}()),Se}var Vl;function kf(){return Vl||(Vl=1,process.env.NODE_ENV==="production"?Qr.exports=ZC():Qr.exports=YC()),Qr.exports}/*
147
147
  object-assign
148
148
  (c) Sindre Sorhus
149
149
  @license MIT
150
- */var Oi,Kl;function GC(){if(Kl)return Oi;Kl=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 Oi=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 f=0;f<u.length;f++)n.call(o,u[f])&&(l[u[f]]=o[u[f]])}}return l},Oi}var Pi,Zl;function go(){if(Zl)return Pi;Zl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Pi=e,Pi}var Ri,Yl;function _f(){return Yl||(Yl=1,Ri=Function.call.bind(Object.prototype.hasOwnProperty)),Ri}var Ni,Gl;function QC(){if(Gl)return Ni;Gl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=go(),n={},r=_f();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 f=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 f.name="Invariant Violation",f}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 p=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ni=a,Ni}var Mi,Ql;function JC(){if(Ql)return Mi;Ql=1;var e=kf(),t=GC(),n=go(),r=_f(),a=QC(),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 Mi=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function m(D){var H=D&&(u&&D[u]||D[c]);if(typeof H=="function")return H}var f="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:w(),arrayOf:A,element:k(),elementType:E(),instanceOf:T,node:$(),objectOf:z,oneOf:j,oneOfType:N,shape:C,exact:B};function g(D,H){return D===H?D!==0||1/D===1/H:D!==D&&H!==H}function h(D,H){this.message=D,this.data=H&&typeof H=="object"?H:{},this.stack=""}h.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var H={},X=0;function _(W,I,K,te,ee,ae,le){if(te=te||f,ae=ae||K,le!==n){if(l){var V=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 V.name="Invariant Violation",V}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var he=te+":"+K;!H[he]&&X<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+te+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),H[he]=!0,X++)}}return I[K]==null?W?I[K]===null?new h("The "+ee+" `"+ae+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new h("The "+ee+" `"+ae+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:D(I,K,te,ee,ae)}var S=_.bind(null,!1);return S.isRequired=_.bind(null,!0),S}function b(D){function H(X,_,S,W,I,K){var te=X[_],ee=L(te);if(ee!==D){var ae=q(te);return new h("Invalid "+W+" `"+I+"` of type "+("`"+ae+"` supplied to `"+S+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(H)}function w(){return y(s)}function A(D){function H(X,_,S,W,I){if(typeof D!="function")return new h("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var K=X[_];if(!Array.isArray(K)){var te=L(K);return new h("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an array."))}for(var ee=0;ee<K.length;ee++){var ae=D(K,ee,S,W,I+"["+ee+"]",n);if(ae instanceof Error)return ae}return null}return y(H)}function k(){function D(H,X,_,S,W){var I=H[X];if(!o(I)){var K=L(I);return new h("Invalid "+S+" `"+W+"` of type "+("`"+K+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return y(D)}function E(){function D(H,X,_,S,W){var I=H[X];if(!e.isValidElementType(I)){var K=L(I);return new h("Invalid "+S+" `"+W+"` of type "+("`"+K+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return y(D)}function T(D){function H(X,_,S,W,I){if(!(X[_]instanceof D)){var K=D.name||f,te=ne(X[_]);return new h("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected ")+("instance of `"+K+"`."))}return null}return y(H)}function j(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function H(X,_,S,W,I){for(var K=X[_],te=0;te<D.length;te++)if(g(K,D[te]))return null;var ee=JSON.stringify(D,function(le,V){var he=q(V);return he==="symbol"?String(V):V});return new h("Invalid "+W+" `"+I+"` of value `"+String(K)+"` "+("supplied to `"+S+"`, expected one of "+ee+"."))}return y(H)}function z(D){function H(X,_,S,W,I){if(typeof D!="function")return new h("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var K=X[_],te=L(K);if(te!=="object")return new h("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an object."));for(var ee in K)if(r(K,ee)){var ae=D(K,ee,S,W,I+"."+ee,n);if(ae instanceof Error)return ae}return null}return y(H)}function N(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var H=0;H<D.length;H++){var X=D[H];if(typeof X!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+oe(X)+" at index "+H+"."),s}function _(S,W,I,K,te){for(var ee=[],ae=0;ae<D.length;ae++){var le=D[ae],V=le(S,W,I,K,te,n);if(V==null)return null;V.data&&r(V.data,"expectedType")&&ee.push(V.data.expectedType)}var he=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new h("Invalid "+K+" `"+te+"` supplied to "+("`"+I+"`"+he+"."))}return y(_)}function $(){function D(H,X,_,S,W){return F(H[X])?null:new h("Invalid "+S+" `"+W+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return y(D)}function M(D,H,X,_,S){return new h((D||"React class")+": "+H+" type `"+X+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function C(D){function H(X,_,S,W,I){var K=X[_],te=L(K);if(te!=="object")return new h("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));for(var ee in D){var ae=D[ee];if(typeof ae!="function")return M(S,W,I,ee,q(ae));var le=ae(K,ee,S,W,I+"."+ee,n);if(le)return le}return null}return y(H)}function B(D){function H(X,_,S,W,I){var K=X[_],te=L(K);if(te!=="object")return new h("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));var ee=t({},X[_],D);for(var ae in ee){var le=D[ae];if(r(D,ae)&&typeof le!="function")return M(S,W,I,ae,q(le));if(!le)return new h("Invalid "+W+" `"+I+"` key `"+ae+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(X[_],null," ")+`
151
- Valid keys: `+JSON.stringify(Object.keys(D),null," "));var V=le(K,ae,S,W,I+"."+ae,n);if(V)return V}return null}return y(H)}function F(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(F);if(D===null||o(D))return!0;var H=m(D);if(H){var X=H.call(D),_;if(H!==D.entries){for(;!(_=X.next()).done;)if(!F(_.value))return!1}else for(;!(_=X.next()).done;){var S=_.value;if(S&&!F(S[1]))return!1}}else return!1;return!0;default:return!1}}function R(D,H){return D==="symbol"?!0:H?H["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&H instanceof Symbol:!1}function L(D){var H=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":R(H,D)?"symbol":H}function q(D){if(typeof D>"u"||D===null)return""+D;var H=L(D);if(H==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return H}function oe(D){var H=q(D);switch(H){case"array":case"object":return"an "+H;case"boolean":case"date":case"regexp":return"a "+H;default:return H}}function ne(D){return!D.constructor||!D.constructor.name?f:D.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Mi}var Ii,Jl;function XC(){if(Jl)return Ii;Jl=1;var e=go();function t(){}function n(){}return n.resetWarningCache=t,Ii=function(){function r(s,o,l,u,c,m){if(m!==e){var f=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 f.name="Invariant Violation",f}}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},Ii}if(process.env.NODE_ENV!=="production"){var ex=kf(),tx=!0;Ts.exports=JC()(ex.isElement,tx)}else Ts.exports=XC()();var nx=Ts.exports;/*!
150
+ */var Oi,Kl;function GC(){if(Kl)return Oi;Kl=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 Oi=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 h=0;h<u.length;h++)n.call(o,u[h])&&(l[u[h]]=o[u[h]])}}return l},Oi}var Pi,Zl;function go(){if(Zl)return Pi;Zl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Pi=e,Pi}var Ri,Yl;function _f(){return Yl||(Yl=1,Ri=Function.call.bind(Object.prototype.hasOwnProperty)),Ri}var Ni,Gl;function QC(){if(Gl)return Ni;Gl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=go(),n={},r=_f();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 h=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 h.name="Invariant Violation",h}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 p=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ni=a,Ni}var Mi,Ql;function JC(){if(Ql)return Mi;Ql=1;var e=kf(),t=GC(),n=go(),r=_f(),a=QC(),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 Mi=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function m(D){var H=D&&(u&&D[u]||D[c]);if(typeof H=="function")return H}var h="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:w(),arrayOf:A,element:k(),elementType:E(),instanceOf:F,node:$(),objectOf:z,oneOf:j,oneOfType:N,shape:C,exact:B};function g(D,H){return D===H?D!==0||1/D===1/H:D!==D&&H!==H}function f(D,H){this.message=D,this.data=H&&typeof H=="object"?H:{},this.stack=""}f.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var H={},X=0;function _(W,I,K,te,ee,ae,le){if(te=te||h,ae=ae||K,le!==n){if(l){var V=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 V.name="Invariant Violation",V}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var he=te+":"+K;!H[he]&&X<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+te+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),H[he]=!0,X++)}}return I[K]==null?W?I[K]===null?new f("The "+ee+" `"+ae+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new f("The "+ee+" `"+ae+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:D(I,K,te,ee,ae)}var S=_.bind(null,!1);return S.isRequired=_.bind(null,!0),S}function b(D){function H(X,_,S,W,I,K){var te=X[_],ee=L(te);if(ee!==D){var ae=q(te);return new f("Invalid "+W+" `"+I+"` of type "+("`"+ae+"` supplied to `"+S+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(H)}function w(){return y(s)}function A(D){function H(X,_,S,W,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var K=X[_];if(!Array.isArray(K)){var te=L(K);return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an array."))}for(var ee=0;ee<K.length;ee++){var ae=D(K,ee,S,W,I+"["+ee+"]",n);if(ae instanceof Error)return ae}return null}return y(H)}function k(){function D(H,X,_,S,W){var I=H[X];if(!o(I)){var K=L(I);return new f("Invalid "+S+" `"+W+"` of type "+("`"+K+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return y(D)}function E(){function D(H,X,_,S,W){var I=H[X];if(!e.isValidElementType(I)){var K=L(I);return new f("Invalid "+S+" `"+W+"` of type "+("`"+K+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return y(D)}function F(D){function H(X,_,S,W,I){if(!(X[_]instanceof D)){var K=D.name||h,te=ne(X[_]);return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected ")+("instance of `"+K+"`."))}return null}return y(H)}function j(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function H(X,_,S,W,I){for(var K=X[_],te=0;te<D.length;te++)if(g(K,D[te]))return null;var ee=JSON.stringify(D,function(le,V){var he=q(V);return he==="symbol"?String(V):V});return new f("Invalid "+W+" `"+I+"` of value `"+String(K)+"` "+("supplied to `"+S+"`, expected one of "+ee+"."))}return y(H)}function z(D){function H(X,_,S,W,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var K=X[_],te=L(K);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an object."));for(var ee in K)if(r(K,ee)){var ae=D(K,ee,S,W,I+"."+ee,n);if(ae instanceof Error)return ae}return null}return y(H)}function N(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var H=0;H<D.length;H++){var X=D[H];if(typeof X!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+oe(X)+" at index "+H+"."),s}function _(S,W,I,K,te){for(var ee=[],ae=0;ae<D.length;ae++){var le=D[ae],V=le(S,W,I,K,te,n);if(V==null)return null;V.data&&r(V.data,"expectedType")&&ee.push(V.data.expectedType)}var he=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new f("Invalid "+K+" `"+te+"` supplied to "+("`"+I+"`"+he+"."))}return y(_)}function $(){function D(H,X,_,S,W){return T(H[X])?null:new f("Invalid "+S+" `"+W+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return y(D)}function M(D,H,X,_,S){return new f((D||"React class")+": "+H+" type `"+X+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function C(D){function H(X,_,S,W,I){var K=X[_],te=L(K);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));for(var ee in D){var ae=D[ee];if(typeof ae!="function")return M(S,W,I,ee,q(ae));var le=ae(K,ee,S,W,I+"."+ee,n);if(le)return le}return null}return y(H)}function B(D){function H(X,_,S,W,I){var K=X[_],te=L(K);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));var ee=t({},X[_],D);for(var ae in ee){var le=D[ae];if(r(D,ae)&&typeof le!="function")return M(S,W,I,ae,q(le));if(!le)return new f("Invalid "+W+" `"+I+"` key `"+ae+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(X[_],null," ")+`
151
+ Valid keys: `+JSON.stringify(Object.keys(D),null," "));var V=le(K,ae,S,W,I+"."+ae,n);if(V)return V}return null}return y(H)}function T(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(T);if(D===null||o(D))return!0;var H=m(D);if(H){var X=H.call(D),_;if(H!==D.entries){for(;!(_=X.next()).done;)if(!T(_.value))return!1}else for(;!(_=X.next()).done;){var S=_.value;if(S&&!T(S[1]))return!1}}else return!1;return!0;default:return!1}}function R(D,H){return D==="symbol"?!0:H?H["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&H instanceof Symbol:!1}function L(D){var H=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":R(H,D)?"symbol":H}function q(D){if(typeof D>"u"||D===null)return""+D;var H=L(D);if(H==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return H}function oe(D){var H=q(D);switch(H){case"array":case"object":return"an "+H;case"boolean":case"date":case"regexp":return"a "+H;default:return H}}function ne(D){return!D.constructor||!D.constructor.name?h:D.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Mi}var Ii,Jl;function XC(){if(Jl)return Ii;Jl=1;var e=go();function t(){}function n(){}return n.resetWarningCache=t,Ii=function(){function r(s,o,l,u,c,m){if(m!==e){var h=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 h.name="Invariant Violation",h}}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},Ii}if(process.env.NODE_ENV!=="production"){var ex=kf(),tx=!0;Ts.exports=JC()(ex.isElement,tx)}else Ts.exports=XC()();var nx=Ts.exports;/*!
152
152
  * tabbable 6.2.0
153
153
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
154
- */var Bf=["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])"],Ba=Bf.join(","),Af=typeof Element>"u",xn=Af?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Aa=!Af&&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},Fa=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},rx=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Ff=function(t,n,r){if(Fa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ba));return n&&xn.call(t,Ba)&&a.unshift(t),a=a.filter(r),a},Tf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Fa(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=xn.call(s,Ba);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!Fa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&f){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},Sf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Jt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||rx(t))&&!Sf(t)?0:t.tabIndex},ax=function(t,n){var r=Jt(t);return r<0&&n&&!Sf(t)?0:r},ix=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},jf=function(t){return t.tagName==="INPUT"},sx=function(t){return jf(t)&&t.type==="hidden"},ox=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ux=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},lx=function(t){if(!t.name)return!0;var n=t.form||Aa(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=ux(a,t.form);return!i||i===t},cx=function(t){return jf(t)&&t.type==="radio"},dx=function(t){return cx(t)&&!lx(t)},fx=function(t){var n,r=t&&Aa(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=Aa(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},Xl=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hx=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=xn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(xn.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=Aa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Xl(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(fx(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Xl(t);return!1},mx=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 xn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ta=function(t,n){return!(n.disabled||Fa(n)||sx(n)||hx(n,t)||ox(n)||mx(n))},Ss=function(t,n){return!(dx(n)||Jt(n)<0||!Ta(t,n))},px=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gx=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=ax(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(ix).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Of=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tf([t],n.includeContainer,{filter:Ss.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:px}):r=Ff(t,n.includeContainer,Ss.bind(null,n)),gx(r)},Pf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tf([t],n.includeContainer,{filter:Ta.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Ff(t,n.includeContainer,Ta.bind(null,n)),r},dn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,Ba)===!1?!1:Ss(n,t)},vx=Bf.concat("iframe").join(","),pa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,vx)===!1?!1:Ta(n,t)};const bx=Object.freeze(Object.defineProperty({__proto__:null,focusable:Pf,getTabIndex:Jt,isFocusable:pa,isTabbable:dn,tabbable:Of},Symbol.toStringTag,{value:"Module"}));/*!
154
+ */var Bf=["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])"],Ba=Bf.join(","),Af=typeof Element>"u",xn=Af?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Aa=!Af&&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},Fa=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},rx=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Ff=function(t,n,r){if(Fa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ba));return n&&xn.call(t,Ba)&&a.unshift(t),a=a.filter(r),a},Tf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Fa(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=xn.call(s,Ba);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Fa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},Sf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Jt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||rx(t))&&!Sf(t)?0:t.tabIndex},ax=function(t,n){var r=Jt(t);return r<0&&n&&!Sf(t)?0:r},ix=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},jf=function(t){return t.tagName==="INPUT"},sx=function(t){return jf(t)&&t.type==="hidden"},ox=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ux=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},lx=function(t){if(!t.name)return!0;var n=t.form||Aa(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=ux(a,t.form);return!i||i===t},cx=function(t){return jf(t)&&t.type==="radio"},dx=function(t){return cx(t)&&!lx(t)},fx=function(t){var n,r=t&&Aa(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=Aa(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},Xl=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hx=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=xn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(xn.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=Aa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Xl(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(fx(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Xl(t);return!1},mx=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 xn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ta=function(t,n){return!(n.disabled||Fa(n)||sx(n)||hx(n,t)||ox(n)||mx(n))},Ss=function(t,n){return!(dx(n)||Jt(n)<0||!Ta(t,n))},px=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gx=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=ax(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(ix).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Of=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tf([t],n.includeContainer,{filter:Ss.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:px}):r=Ff(t,n.includeContainer,Ss.bind(null,n)),gx(r)},Pf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tf([t],n.includeContainer,{filter:Ta.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Ff(t,n.includeContainer,Ta.bind(null,n)),r},dn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,Ba)===!1?!1:Ss(n,t)},vx=Bf.concat("iframe").join(","),pa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,vx)===!1?!1:Ta(n,t)};const bx=Object.freeze(Object.defineProperty({__proto__:null,focusable:Pf,getTabIndex:Jt,isFocusable:pa,isTabbable:dn,tabbable:Of},Symbol.toStringTag,{value:"Module"}));/*!
155
155
  * focus-trap 7.5.4
156
156
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
157
- */function ec(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 tc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){yx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yx(e,t,n){return t=Cx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dx(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 Cx(e){var t=Dx(e,"string");return typeof t=="symbol"?t:String(t)}var nc={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()}},xx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Cr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ex=function(t){return Cr(t)&&!t.shiftKey},kx=function(t){return Cr(t)&&t.shiftKey},rc=function(t){return setTimeout(t,0)},ac=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},lr=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},_x=[],Bx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_x,i=tc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ex,isKeyBackward:kx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(C,B,F){return C&&C[B]!==void 0?C[B]:i[F||B]},u=function(C,B){var F=typeof(B==null?void 0:B.composedPath)=="function"?B.composedPath():void 0;return s.containerGroups.findIndex(function(R){var L=R.container,q=R.tabbableNodes;return L.contains(C)||(F==null?void 0:F.includes(L))||q.find(function(oe){return oe===C})})},c=function(C){var B=i[C];if(typeof B=="function"){for(var F=arguments.length,R=new Array(F>1?F-1:0),L=1;L<F;L++)R[L-1]=arguments[L];B=B.apply(void 0,R)}if(B===!0&&(B=void 0),!B){if(B===void 0||B===!1)return B;throw new Error("`".concat(C,"` was specified but was not a node, or did not return a node"))}var q=B;if(typeof B=="string"&&(q=r.querySelector(B),!q))throw new Error("`".concat(C,"` as selector refers to no known node"));return q},m=function(){var C=c("initialFocus");if(C===!1)return!1;if(C===void 0||!pa(C,i.tabbableOptions))if(u(r.activeElement)>=0)C=r.activeElement;else{var B=s.tabbableGroups[0],F=B&&B.firstTabbableNode;C=F||c("fallbackFocus")}if(!C)throw new Error("Your focus-trap needs to have at least one focusable element");return C},f=function(){if(s.containerGroups=s.containers.map(function(C){var B=Of(C,i.tabbableOptions),F=Pf(C,i.tabbableOptions),R=B.length>0?B[0]:void 0,L=B.length>0?B[B.length-1]:void 0,q=F.find(function(D){return dn(D)}),oe=F.slice().reverse().find(function(D){return dn(D)}),ne=!!B.find(function(D){return Jt(D)>0});return{container:C,tabbableNodes:B,focusableNodes:F,posTabIndexesFound:ne,firstTabbableNode:R,lastTabbableNode:L,firstDomTabbableNode:q,lastDomTabbableNode:oe,nextTabbableNode:function(H){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=B.indexOf(H);return _<0?X?F.slice(F.indexOf(H)+1).find(function(S){return dn(S)}):F.slice(0,F.indexOf(H)).reverse().find(function(S){return dn(S)}):B[_+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(C){return C.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(C){return C.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function M(C){var B=C.activeElement;if(B)return B.shadowRoot&&B.shadowRoot.activeElement!==null?M(B.shadowRoot):B},g=function M(C){if(C!==!1&&C!==p(document)){if(!C||!C.focus){M(m());return}C.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=C,xx(C)&&C.select()}},h=function(C){var B=c("setReturnFocus",C);return B||(B===!1?!1:C)},y=function(C){var B=C.target,F=C.event,R=C.isBackward,L=R===void 0?!1:R;B=B||Jr(F),f();var q=null;if(s.tabbableGroups.length>0){var oe=u(B,F),ne=oe>=0?s.containerGroups[oe]:void 0;if(oe<0)L?q=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:q=s.tabbableGroups[0].firstTabbableNode;else if(L){var D=ac(s.tabbableGroups,function(I){var K=I.firstTabbableNode;return B===K});if(D<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B,!1))&&(D=oe),D>=0){var H=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[H];q=Jt(B)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else Cr(F)||(q=ne.nextTabbableNode(B,!1))}else{var _=ac(s.tabbableGroups,function(I){var K=I.lastTabbableNode;return B===K});if(_<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B))&&(_=oe),_>=0){var S=_===s.tabbableGroups.length-1?0:_+1,W=s.tabbableGroups[S];q=Jt(B)>=0?W.firstTabbableNode:W.firstDomTabbableNode}else Cr(F)||(q=ne.nextTabbableNode(B))}}else q=c("fallbackFocus");return q},b=function(C){var B=Jr(C);if(!(u(B,C)>=0)){if(lr(i.clickOutsideDeactivates,C)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}lr(i.allowOutsideClick,C)||C.preventDefault()}},w=function(C){var B=Jr(C),F=u(B,C)>=0;if(F||B instanceof Document)F&&(s.mostRecentlyFocusedNode=B);else{C.stopImmediatePropagation();var R,L=!0;if(s.mostRecentlyFocusedNode)if(Jt(s.mostRecentlyFocusedNode)>0){var q=u(s.mostRecentlyFocusedNode),oe=s.containerGroups[q].tabbableNodes;if(oe.length>0){var ne=oe.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<oe.length&&(R=oe[ne+1],L=!1):ne-1>=0&&(R=oe[ne-1],L=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(H){return Jt(H)>0})})||(L=!1);else L=!1;L&&(R=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(R||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},A=function(C){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=C;var F=y({event:C,isBackward:B});F&&(Cr(C)&&C.preventDefault(),g(F))},k=function(C){if(wx(C)&&lr(i.escapeDeactivates,C)!==!1){C.preventDefault(),o.deactivate();return}(i.isKeyForward(C)||i.isKeyBackward(C))&&A(C,i.isKeyBackward(C))},E=function(C){var B=Jr(C);u(B,C)>=0||lr(i.clickOutsideDeactivates,C)||lr(i.allowOutsideClick,C)||(C.preventDefault(),C.stopImmediatePropagation())},T=function(){if(s.active)return nc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?rc(function(){g(m())}):g(m()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},j=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},z=function(C){var B=C.some(function(F){var R=Array.from(F.removedNodes);return R.some(function(L){return L===s.mostRecentlyFocusedNode})});B&&g(m())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(C){N.observe(C,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(C){if(s.active)return this;var B=l(C,"onActivate"),F=l(C,"onPostActivate"),R=l(C,"checkCanFocusTrap");R||f(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,B==null||B();var L=function(){R&&f(),T(),$(),F==null||F()};return R?(R(s.containers.concat()).then(L,L),this):(L(),this)},deactivate:function(C){if(!s.active)return this;var B=tc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},C);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,j(),s.active=!1,s.paused=!1,$(),nc.deactivateTrap(a,o);var F=l(B,"onDeactivate"),R=l(B,"onPostDeactivate"),L=l(B,"checkCanReturnFocus"),q=l(B,"returnFocus","returnFocusOnDeactivate");F==null||F();var oe=function(){rc(function(){q&&g(h(s.nodeFocusedBeforeActivation)),R==null||R()})};return q&&L?(L(h(s.nodeFocusedBeforeActivation)).then(oe,oe),this):(oe(),this)},pause:function(C){if(s.paused||!s.active)return this;var B=l(C,"onPause"),F=l(C,"onPostPause");return s.paused=!0,B==null||B(),j(),$(),F==null||F(),this},unpause:function(C){if(!s.paused||!s.active)return this;var B=l(C,"onUnpause"),F=l(C,"onPostUnpause");return s.paused=!1,B==null||B(),f(),T(),$(),F==null||F(),this},updateContainerElements:function(C){var B=[].concat(C).filter(Boolean);return s.containers=B.map(function(F){return typeof F=="string"?r.querySelector(F):F}),s.active&&f(),$(),this}},o.updateContainerElements(t),o};const Ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bx},Symbol.toStringTag,{value:"Module"})),Fx=yc(Ax),Tx=yc(bx);function Yn(e){"@babel/helpers - typeof";return Yn=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},Yn(e)}function Sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ic(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,Rf(r.key),r)}}function jx(e,t,n){return t&&ic(e.prototype,t),n&&ic(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ox(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&&js(e,t)}function js(e,t){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},js(e,t)}function Px(e){var t=Nx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Rx(this,a)}}function Rx(e,t){if(t&&(Yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mr(e)}function mr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nx(){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 Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Mx(e,t,n){return t=Rf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e){var t=Ix(e,"string");return Yn(t)==="symbol"?t:String(t)}function Ix(e,t){if(Yn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Yn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=x,ge=nx,$x=Fx,Lx=$x.createFocusTrap,zx=Tx,qx=zx.isFocusable,vo=function(e){Ox(n,e);var t=Px(n);function n(r){var a;Sx(this,n),a=t.call(this,r),Mx(mr(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),f=1;f<c;f++)m[f-1]=arguments[f];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 p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(mr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(mr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(mr(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 jx(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&&!qx(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),cr=typeof Element>"u"?Function:Element;vo.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(cr)),children:ge.oneOfType([ge.element,ge.instanceOf(cr)])};vo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lx};var Wx=vo;const Hx=wn(Wx),Nf=({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(yh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Ux=x.createContext({client:sa});function Vx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=x.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&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return x.createElement(Ux.Provider,{value:{client:i}},t)}const Mf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Vx,{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}),If=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},bo=x.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt=x.createContext({isLoading:!0});function Ya(){return x.useContext(Mt)}const $f=({children:e,user:t})=>d.jsx(Mt.Provider,{value:t,children:e}),yo=x.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Lf=()=>x.useContext(yo),zf=({children:e})=>{const[t,n]=x.useState([]);x.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=x.useCallback(i=>{n(s=>[...s,i])},[]),a=x.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(yo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Kx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=x.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=x.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return x.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Pc(5e3)}).catch(c=>{c.message===Tc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(bo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(If,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ps.CookiesProvider,{children:d.jsx($f,{user:a,children:d.jsx(zf,{children:d.jsx(Nf,{showDevTools:r,children:d.jsx(Mf,{user:a,children:t})})})})})})})};const Do=({element:e="section",children:t,className:n,...r})=>x.createElement(e,{className:G("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Pr=({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 f=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Lf(),[h,y]=x.useState(t),b=k=>{k.key==="Escape"&&w(!1)};x.useEffect(()=>(window.addEventListener("keyup",b),()=>{window.removeEventListener("keyup",b)}));const w=k=>{y(k),k?(a(),p(e)):(i(),g(e))};x.useEffect(()=>(w(t),()=>{h&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:G("overlay",{open:h}),role:"dialog",children:d.jsx(Do,{id:e,className:G("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:A,children:t&&d.jsx(Hx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:f.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(tn,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(tn,{}),d.jsx(En,{buttons:u})]}),s&&d.jsx(wr,{className:"error",children:s})]})})})})},qf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Zx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.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(Pr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:d.jsx(wf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Yx=({members:e})=>{const[t,n]=x.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(sn,{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(Pr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Un,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Gx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:G("testimonial-block",a),children:[d.jsx(Pt,{className:"testimonial",children:n}),r?d.jsx(tr,{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})})]})]}),Qx=x.memo(Gx);const Jx=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=x.useState(e);return x.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(Rt,{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 Ga=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const m=c/60,f=Math.floor(m),p=(m-f)*60,g=Math.round(p),h=`${i.formatMessage({id:`${s}hours`},{time:f})}${f>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${f>0?`${i.formatMessage({id:`${s}hours_short`},{time:f})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText: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 Xx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(er,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const ln=({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 ew=({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(ln,{className:G("download-section",n),children:d.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(En,{buttons:r})]})})};function Wf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:G("edit-section-placeholder",{"has-icon":!!e}),style:Sc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Wf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},nw=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=x.useState(!1),c=typeof r=="string"||!!n,m=()=>u(!1);return d.jsxs("section",{className:G("edit-section",t),children:[n&&d.jsx(Pr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:m},className:G("edit-section-modal"),children:d.jsx(nr,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async f=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(f)),u(!1)},onCancel:m}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(Ee,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Wf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(tw,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(tn,{})]})};const rw=({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&&x.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:f=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const h=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:m});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:f?d.jsx("a",{href:f,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const aw=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],iw=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},f={};c.forEach(y=>{if(!t[y]){f[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){f[y]=t[y];const{text:b,element:w}=t[y];if(w&&aw.includes(w.toLowerCase()))return;f[y]={text:b,element:m[y]};return}f[y]={text:t[y],element:m[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),d.jsx(ln,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&f.eyebrow&&f.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:b,element:w=""}=f[y];return y==="text"?d.jsx(Un,{overrideType:"text-only",className:"text",children:b},y):x.createElement(w,{key:y,className:y},b)}return null}),l,p&&d.jsx(Ee,{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]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&d.jsx(er,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sw=x.memo(iw);const ow=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(ln,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const uw=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Un,{children:n}):n;return d.jsxs(ln,{className:G("highlight-section",t),children:[r&&d.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(er,{image:r})}),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})})})]})},lw=x.memo(uw);const cw=({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(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),dw=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const m=a&&rs(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"}):Ms(c)});if(o)return d.jsx(hn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&rs(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},ja={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"}},fw=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=ue.useIntl(),[i,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:m}=e,f=e.contentType;let p="";if((h=ja[f])!=null&&h.gtmEvent&&(p=ja[f].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?d.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(f)&&c!=="premium"){const b=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(b||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Ee,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${f}: ${m}`,"data-gtm-event-type":`${r}-${f}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${f}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const hw={title:66,text:3e3,secondaryText:1e3,partner:25},Co=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var N,$,M;const o=ue.useIntl(),l=x.useContext(Mt),u=l&&typeof l.id=="string",[c,m]=x.useState({data:null,isLoading:!0}),{data:f,isLoading:p}=c,g=x.useCallback(()=>{n(t,u).then(C=>{m(()=>({data:C,isLoading:!1}))}).catch(()=>m(C=>({...C,isLoading:!1})))},[e]);if(x.useEffect(()=>{g()},[]),p||!f)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:h}=f;if(!h||!ja[h])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:y="",className:b,length:w,gtmEvent:A}=ja[h];let k=f.slug?`${y}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(k=f.slug);const E=C=>{k&&(C.preventDefault(),C.stopPropagation(),window.location.href=k)},T={...hw,...w};let j={className:"card"},z={};return k&&(z={href:k,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},f.openInNewTab&&(z.target="_blank"),j={onClick:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`}),d.jsx("li",{className:G("card-wrapper text-medium",b,i,{"has-link":k,"no-link":!k,"has-image":f.banner}),"data-testid":`${h}-card`,children:d.jsxs("div",{...j,children:[d.jsx(Mc,{className:"card-label",contentType:h,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),h==="communityPage"&&(f==null?void 0:f.createdAt)&&Sh(f==null?void 0:f.createdAt,60)&&d.jsx(hn,{size:"small",variant:"information","data-testid":"new-community",children:o.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&d.jsx(hn,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?o.formatMessage({id:"card_ended"}):jc(f.startDate)}),f.banner?d.jsxs("p",{className:"img",children:[f.registered&&d.jsx(hn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(er,{image:{...f.banner,description:""}})]}):b==="people"?d.jsx(sn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&d.jsx(qs,{contributors:{data:f.contributors},styling:{size:"small",showGap:b!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(h)?o.formatMessage({id:`card_contributors_${h}`}):void 0,"data-testid":"contributors"}),f.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?o.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Wn(f.partner[0],T.partner)}),["title","text","secondaryText"].map(C=>{const B=f[C];if(!B)return null;const F=Bc(C),R={key:C,className:F,"data-testid":F},L={wrapper:"p",forceWrapper:!0,forceInline:!0},q=Wn(B,T[C]);return["title","text"].includes(C)&&k?(L.wrapper="a",d.jsx("p",{...R,children:d.jsx(Pt,{options:L,...z,children:q})})):d.jsx(Pt,{options:L,...R,children:q})}),(l==null?void 0:l.id)&&(f==null?void 0:f.members)&&d.jsxs("span",{className:"member-information",children:[((N=f==null?void 0:f.members)==null?void 0:N.isMember)&&d.jsx(hn,{size:"small",variant:"registered",icon:(($=f==null?void 0:f.members)==null?void 0:$.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(M=f==null?void 0:f.members)==null?void 0:M.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:f==null?void 0:f.members.count})})]}),d.jsx(dw,{type:b||"",data:f}),d.jsx(fw,{data:f,cta:r,link:k||"",gtmContext:a})]})})};const Hf=({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(Co,{id:s,card:{...a,contentType:t[i]},...r},s)})}),mw=(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},pw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return x.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 $i={fourCards:1024,threeCards:769,twoCards:480};let ea=null;const gw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:f}=u,[p,g]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,[b,w]=x.useState(""),A=t.length,k=Math.ceil(A/m),E=x.useRef(null),T=Qn(!0,!0,E==null?void 0:E.current);x.useEffect(()=>{let C=1;T&&(T>=$i.fourCards?C=4:T>=$i.threeCards?C=3:T>=$i.twoCards&&(C=2),C>A&&(C=A)),c(B=>({...B,cardsPerPage:C,isLoading:!1}))},[T,A]);const j=(C="next")=>{let B=h;if(typeof C=="string")if(C==="next")if(h<k-1)B=h+1;else return;else if(h>0)B=h-1;else return;else B=C;g(R=>({...R,currentPage:B,loadedPages:[...new Set([...y,B])]}));const F=()=>{const R=B*u.cardsPerPage,L=R+u.cardsPerPage;return t.slice(R,L).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:C,count:F()}))},z=C=>{ea=C.touches[0].clientX},N=C=>{if(ea===null)return;const B=C.touches[0].clientX,F=ea-B;F>5?j("next"):F<-5&&j("previous"),ea=null},$={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":m,"--page":h};if(f)return d.jsx(Ls,{layout:`carousel${a?"-with-title":""}`});const M=(C,B)=>{var R;let F=null;return(R=C==null?void 0:C.sys)!=null&&R.id?F=`card-${C.sys.id}`:C!=null&&C.slug?F=`card-${C.slug}`:[n[B],C.contentType].includes("customCard")&&(F=`card-${window.btoa(`${C.title} ${C.createdAt}`)}-${B}`),F};return d.jsxs("section",{ref:E,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(pw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:N,style:$,"data-testid":"carousel-list",children:t.map((C,B)=>{let F=M(C,B);return F&&mw(B,m,h,y)?d.jsx(Co,{id:F,card:{...C,contentType:n[B]},buildCardData:r,gtmContext:s,...o},F):(F=F||`${e}-card-${B}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},F))})}),k<=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(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:C=>{C.preventDefault(),C.stopPropagation(),j("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(k)].map((C,B)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:G("page-indicator",{selected:B===h}),onClick:F=>{F.preventDefault(),F.stopPropagation(),j(B)},children:d.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:B+1,total:k})})})},`page-indicator-${B}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:C=>{C.preventDefault(),C.stopPropagation(),j("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=k-1})})]}),d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},vw=({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(x.Fragment,{children:[d.jsx(Ls,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:d.jsx(tn,{})]},`placeholder-${c}`):d.jsxs(x.Fragment,{children:[d.jsx(gw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:d.jsx(tn,{})]},`carousel-${c}`)});const ta="joinCommunityButton",xo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=x.useContext(Mt),l=o&&typeof o.id=="string",u=r||!l,[c,m]=x.useState(e),[f,p]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{f==="joining"?p("joined"):f==="leaving"&&p("notJoined")},[c]);const g={},h={};return c&&f!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${ta}_leave`}),g["aria-label"]=s.formatMessage({id:`${ta}_member_aria`}),h["aria-hidden"]="true"),d.jsx(Ee,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&f!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${ta}_closed_tooltip`}):"",onClick:async y=>{u||(y.currentTarget.blur(),c?(p("leaving"),typeof i=="function"&&await i()):(p("joining"),typeof a=="function"&&await a()),m(!c))},className:G("join-community-button",f,{active:f==="joining"}),disabled:u,...g,children:d.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${ta}${["joining","leaving"].includes(f)?`_${f}`:c?"_member":n?"_short":""}`})})})};const Li="communityDetails_",bw=({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=ue.useIntl(),u=5,c=a||i.length,m=i.length?i:Array(u).fill({}),f=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:G("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${Li}members`}),d.jsx("span",{className:"count",children:c})]}),!f&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Li}viewAll`})})})]}),d.jsx(qs,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(xo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Li}invite`})})]})};const yw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Me,{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(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(kn,{href:s?void 0:i,...l,children:Wn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Dw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=x.useState(t?["all"]:[]),u=(c,m)=>{let f=[];o.includes(c)?f=o.filter(p=>p!==c):c==="all"?f=["all"]:n?f=[...o.filter(p=>p!=="all"),c]:f=[c],l(p=>(r&&typeof r=="function"&&r({current:f,previous:p}),f)),m&&typeof m=="function"&&m()};return d.jsx("ul",{className:G("filters",a),children:s.map(({id:c,text:m,disabled:f=!1,callback:p=()=>{}})=>{let g={};return f&&(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:h=>{h.preventDefault(),h.stopPropagation(),u(c,p)},...g,children:m})},c)})})},Cw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",xw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=x.useContext(bo),[m,f]=x.useState(e);if(x.useEffect(()=>{e!==m&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=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:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var A;if(!ga[y])return null;const b=(A=r[y])==null?void 0:A.post_name;let w={className:y};if(m===y)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const k=Cw(y,b,i);w={...w,href:typeof k=="string"?k:k.url,onClick:E=>{f(y),c(y),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(y,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(kn,{...w,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Pn.support,link:y=>{const b=`mailto:${y}`;return d.jsx("a",{href:b,children:y})}})})]})};const zi=ue.createIntl({locale:"en",messages:Xn}),Rr=({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:zi.formatMessage({id:"loadMore_button"}),endOfFeed:zi.formatMessage({id:"loadMore_endOfFeed"}),error:zi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,m]=x.useState(""),f=async p=>{if(!n)try{await t(p)}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(Ee,{variant:r,size:a,styling:i,icon:s,onClick:f,"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 wo=({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(Me,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Uf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=x.useRef(null),[s,o]=x.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),x.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:m,icon:f,...p},g)=>{const h={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(h.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Ee,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...h,children:m})},`${window.btoa(m)}_${g}`)})})]})})},ww=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Vf=({activeLink:e})=>{const t=ue.useIntl(),n=x.useContext(Mt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ew.map(({key:a,href:i})=>{const s=ww(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:G(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(sn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,kw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${dr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${dr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
157
+ */function ec(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 tc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){yx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yx(e,t,n){return t=Cx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dx(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 Cx(e){var t=Dx(e,"string");return typeof t=="symbol"?t:String(t)}var nc={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()}},xx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Cr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ex=function(t){return Cr(t)&&!t.shiftKey},kx=function(t){return Cr(t)&&t.shiftKey},rc=function(t){return setTimeout(t,0)},ac=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},lr=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},_x=[],Bx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_x,i=tc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ex,isKeyBackward:kx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(C,B,T){return C&&C[B]!==void 0?C[B]:i[T||B]},u=function(C,B){var T=typeof(B==null?void 0:B.composedPath)=="function"?B.composedPath():void 0;return s.containerGroups.findIndex(function(R){var L=R.container,q=R.tabbableNodes;return L.contains(C)||(T==null?void 0:T.includes(L))||q.find(function(oe){return oe===C})})},c=function(C){var B=i[C];if(typeof B=="function"){for(var T=arguments.length,R=new Array(T>1?T-1:0),L=1;L<T;L++)R[L-1]=arguments[L];B=B.apply(void 0,R)}if(B===!0&&(B=void 0),!B){if(B===void 0||B===!1)return B;throw new Error("`".concat(C,"` was specified but was not a node, or did not return a node"))}var q=B;if(typeof B=="string"&&(q=r.querySelector(B),!q))throw new Error("`".concat(C,"` as selector refers to no known node"));return q},m=function(){var C=c("initialFocus");if(C===!1)return!1;if(C===void 0||!pa(C,i.tabbableOptions))if(u(r.activeElement)>=0)C=r.activeElement;else{var B=s.tabbableGroups[0],T=B&&B.firstTabbableNode;C=T||c("fallbackFocus")}if(!C)throw new Error("Your focus-trap needs to have at least one focusable element");return C},h=function(){if(s.containerGroups=s.containers.map(function(C){var B=Of(C,i.tabbableOptions),T=Pf(C,i.tabbableOptions),R=B.length>0?B[0]:void 0,L=B.length>0?B[B.length-1]:void 0,q=T.find(function(D){return dn(D)}),oe=T.slice().reverse().find(function(D){return dn(D)}),ne=!!B.find(function(D){return Jt(D)>0});return{container:C,tabbableNodes:B,focusableNodes:T,posTabIndexesFound:ne,firstTabbableNode:R,lastTabbableNode:L,firstDomTabbableNode:q,lastDomTabbableNode:oe,nextTabbableNode:function(H){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=B.indexOf(H);return _<0?X?T.slice(T.indexOf(H)+1).find(function(S){return dn(S)}):T.slice(0,T.indexOf(H)).reverse().find(function(S){return dn(S)}):B[_+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(C){return C.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(C){return C.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function M(C){var B=C.activeElement;if(B)return B.shadowRoot&&B.shadowRoot.activeElement!==null?M(B.shadowRoot):B},g=function M(C){if(C!==!1&&C!==p(document)){if(!C||!C.focus){M(m());return}C.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=C,xx(C)&&C.select()}},f=function(C){var B=c("setReturnFocus",C);return B||(B===!1?!1:C)},y=function(C){var B=C.target,T=C.event,R=C.isBackward,L=R===void 0?!1:R;B=B||Jr(T),h();var q=null;if(s.tabbableGroups.length>0){var oe=u(B,T),ne=oe>=0?s.containerGroups[oe]:void 0;if(oe<0)L?q=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:q=s.tabbableGroups[0].firstTabbableNode;else if(L){var D=ac(s.tabbableGroups,function(I){var K=I.firstTabbableNode;return B===K});if(D<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B,!1))&&(D=oe),D>=0){var H=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[H];q=Jt(B)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else Cr(T)||(q=ne.nextTabbableNode(B,!1))}else{var _=ac(s.tabbableGroups,function(I){var K=I.lastTabbableNode;return B===K});if(_<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B))&&(_=oe),_>=0){var S=_===s.tabbableGroups.length-1?0:_+1,W=s.tabbableGroups[S];q=Jt(B)>=0?W.firstTabbableNode:W.firstDomTabbableNode}else Cr(T)||(q=ne.nextTabbableNode(B))}}else q=c("fallbackFocus");return q},b=function(C){var B=Jr(C);if(!(u(B,C)>=0)){if(lr(i.clickOutsideDeactivates,C)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}lr(i.allowOutsideClick,C)||C.preventDefault()}},w=function(C){var B=Jr(C),T=u(B,C)>=0;if(T||B instanceof Document)T&&(s.mostRecentlyFocusedNode=B);else{C.stopImmediatePropagation();var R,L=!0;if(s.mostRecentlyFocusedNode)if(Jt(s.mostRecentlyFocusedNode)>0){var q=u(s.mostRecentlyFocusedNode),oe=s.containerGroups[q].tabbableNodes;if(oe.length>0){var ne=oe.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<oe.length&&(R=oe[ne+1],L=!1):ne-1>=0&&(R=oe[ne-1],L=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(H){return Jt(H)>0})})||(L=!1);else L=!1;L&&(R=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(R||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},A=function(C){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=C;var T=y({event:C,isBackward:B});T&&(Cr(C)&&C.preventDefault(),g(T))},k=function(C){if(wx(C)&&lr(i.escapeDeactivates,C)!==!1){C.preventDefault(),o.deactivate();return}(i.isKeyForward(C)||i.isKeyBackward(C))&&A(C,i.isKeyBackward(C))},E=function(C){var B=Jr(C);u(B,C)>=0||lr(i.clickOutsideDeactivates,C)||lr(i.allowOutsideClick,C)||(C.preventDefault(),C.stopImmediatePropagation())},F=function(){if(s.active)return nc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?rc(function(){g(m())}):g(m()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},j=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},z=function(C){var B=C.some(function(T){var R=Array.from(T.removedNodes);return R.some(function(L){return L===s.mostRecentlyFocusedNode})});B&&g(m())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(C){N.observe(C,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(C){if(s.active)return this;var B=l(C,"onActivate"),T=l(C,"onPostActivate"),R=l(C,"checkCanFocusTrap");R||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,B==null||B();var L=function(){R&&h(),F(),$(),T==null||T()};return R?(R(s.containers.concat()).then(L,L),this):(L(),this)},deactivate:function(C){if(!s.active)return this;var B=tc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},C);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,j(),s.active=!1,s.paused=!1,$(),nc.deactivateTrap(a,o);var T=l(B,"onDeactivate"),R=l(B,"onPostDeactivate"),L=l(B,"checkCanReturnFocus"),q=l(B,"returnFocus","returnFocusOnDeactivate");T==null||T();var oe=function(){rc(function(){q&&g(f(s.nodeFocusedBeforeActivation)),R==null||R()})};return q&&L?(L(f(s.nodeFocusedBeforeActivation)).then(oe,oe),this):(oe(),this)},pause:function(C){if(s.paused||!s.active)return this;var B=l(C,"onPause"),T=l(C,"onPostPause");return s.paused=!0,B==null||B(),j(),$(),T==null||T(),this},unpause:function(C){if(!s.paused||!s.active)return this;var B=l(C,"onUnpause"),T=l(C,"onPostUnpause");return s.paused=!1,B==null||B(),h(),F(),$(),T==null||T(),this},updateContainerElements:function(C){var B=[].concat(C).filter(Boolean);return s.containers=B.map(function(T){return typeof T=="string"?r.querySelector(T):T}),s.active&&h(),$(),this}},o.updateContainerElements(t),o};const Ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bx},Symbol.toStringTag,{value:"Module"})),Fx=yc(Ax),Tx=yc(bx);function Yn(e){"@babel/helpers - typeof";return Yn=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},Yn(e)}function Sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ic(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,Rf(r.key),r)}}function jx(e,t,n){return t&&ic(e.prototype,t),n&&ic(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ox(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&&js(e,t)}function js(e,t){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},js(e,t)}function Px(e){var t=Nx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Rx(this,a)}}function Rx(e,t){if(t&&(Yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mr(e)}function mr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nx(){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 Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Mx(e,t,n){return t=Rf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e){var t=Ix(e,"string");return Yn(t)==="symbol"?t:String(t)}function Ix(e,t){if(Yn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Yn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=x,ge=nx,$x=Fx,Lx=$x.createFocusTrap,zx=Tx,qx=zx.isFocusable,vo=function(e){Ox(n,e);var t=Px(n);function n(r){var a;Sx(this,n),a=t.call(this,r),Mx(mr(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),h=1;h<c;h++)m[h-1]=arguments[h];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 p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(mr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(mr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(mr(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 jx(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&&!qx(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),cr=typeof Element>"u"?Function:Element;vo.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(cr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(cr)),children:ge.oneOfType([ge.element,ge.instanceOf(cr)])};vo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lx};var Wx=vo;const Hx=wn(Wx),Nf=({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(yh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Ux=x.createContext({client:sa});function Vx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=x.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&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return x.createElement(Ux.Provider,{value:{client:i}},t)}const Mf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Vx,{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}),If=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},bo=x.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt=x.createContext({isLoading:!0});function Ya(){return x.useContext(Mt)}const $f=({children:e,user:t})=>d.jsx(Mt.Provider,{value:t,children:e}),yo=x.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Lf=()=>x.useContext(yo),zf=({children:e})=>{const[t,n]=x.useState([]);x.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=x.useCallback(i=>{n(s=>[...s,i])},[]),a=x.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(yo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Kx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=x.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=x.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return x.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Pc(5e3)}).catch(c=>{c.message===Tc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(bo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(If,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ps.CookiesProvider,{children:d.jsx($f,{user:a,children:d.jsx(zf,{children:d.jsx(Nf,{showDevTools:r,children:d.jsx(Mf,{user:a,children:t})})})})})})})};const Do=({element:e="section",children:t,className:n,...r})=>x.createElement(e,{className:G("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Pr=({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 h=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Lf(),[f,y]=x.useState(t),b=k=>{k.key==="Escape"&&w(!1)};x.useEffect(()=>(window.addEventListener("keyup",b),()=>{window.removeEventListener("keyup",b)}));const w=k=>{y(k),k?(a(),p(e)):(i(),g(e))};x.useEffect(()=>(w(t),()=>{f&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:G("overlay",{open:f}),role:"dialog",children:d.jsx(Do,{id:e,className:G("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:A,children:t&&d.jsx(Hx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(tn,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(tn,{}),d.jsx(En,{buttons:u})]}),s&&d.jsx(wr,{className:"error",children:s})]})})})})},qf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Zx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.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(Pr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:d.jsx(wf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Yx=({members:e})=>{const[t,n]=x.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(sn,{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(Pr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Un,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Gx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:G("testimonial-block",a),children:[d.jsx(Pt,{className:"testimonial",children:n}),r?d.jsx(tr,{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})})]})]}),Qx=x.memo(Gx);const Jx=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=x.useState(e);return x.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(Rt,{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 Ga=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const m=c/60,h=Math.floor(m),p=(m-h)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:h})}${h>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${h>0?`${i.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${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 Xx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(er,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const ln=({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 ew=({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(ln,{className:G("download-section",n),children:d.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(En,{buttons:r})]})})};function Wf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:G("edit-section-placeholder",{"has-icon":!!e}),style:Sc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Wf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},nw=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=x.useState(!1),c=typeof r=="string"||!!n,m=()=>u(!1);return d.jsxs("section",{className:G("edit-section",t),children:[n&&d.jsx(Pr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:m},className:G("edit-section-modal"),children:d.jsx(nr,{...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 h=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(h)),u(!1)},onCancel:m}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(Ee,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Wf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(tw,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(tn,{})]})};const rw=({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&&x.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:h=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:m});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:h?d.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const aw=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],iw=({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"},h={};c.forEach(y=>{if(!t[y]){h[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){h[y]=t[y];const{text:b,element:w}=t[y];if(w&&aw.includes(w.toLowerCase()))return;h[y]={text:b,element:m[y]};return}h[y]={text:t[y],element:m[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),d.jsx(ln,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&h.eyebrow&&h.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(h[y]&&typeof h[y]=="object"){const{text:b,element:w=""}=h[y];return y==="text"?d.jsx(Un,{overrideType:"text-only",className:"text",children:b},y):x.createElement(w,{key:y,className:y},b)}return null}),l,p&&d.jsx(Ee,{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(er,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sw=x.memo(iw);const ow=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(ln,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const uw=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Un,{children:n}):n;return d.jsxs(ln,{className:G("highlight-section",t),children:[r&&d.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(er,{image:r})}),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})})})]})},lw=x.memo(uw);const cw=({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(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),dw=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const m=a&&rs(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"}):Ms(c)});if(o)return d.jsx(hn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&rs(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},ja={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"}},fw=({data:e,cta:t,link:n,gtmContext:r})=>{var f,y;const a=ue.useIntl(),[i,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:m}=e,h=e.contentType;let p="";if((f=ja[h])!=null&&f.gtmEvent&&(p=ja[h].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?d.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(h)&&c!=="premium"){const b=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(b||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Ee,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${h}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const hw={title:66,text:3e3,secondaryText:1e3,partner:25},Co=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var N,$,M;const o=ue.useIntl(),l=x.useContext(Mt),u=l&&typeof l.id=="string",[c,m]=x.useState({data:null,isLoading:!0}),{data:h,isLoading:p}=c,g=x.useCallback(()=>{n(t,u).then(C=>{m(()=>({data:C,isLoading:!1}))}).catch(()=>m(C=>({...C,isLoading:!1})))},[e]);if(x.useEffect(()=>{g()},[]),p||!h)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:f}=h;if(!f||!ja[f])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:y="",className:b,length:w,gtmEvent:A}=ja[f];let k=h.slug?`${y}${h.slug}`:!1;h.slug&&(h.slug.slice(0,4)==="http"||h.slug.slice(0,2)==="//"||h.slug.slice(0,6)==="mailto"||h.slug.slice(0,3)==="tel")&&(k=h.slug);const E=C=>{k&&(C.preventDefault(),C.stopPropagation(),window.location.href=k)},F={...hw,...w};let j={className:"card"},z={};return k&&(z={href:k,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},h.openInNewTab&&(z.target="_blank"),j={onClick:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`}),d.jsx("li",{className:G("card-wrapper text-medium",b,i,{"has-link":k,"no-link":!k,"has-image":h.banner}),"data-testid":`${f}-card`,children:d.jsxs("div",{...j,children:[d.jsx(Mc,{className:"card-label",contentType:f,customIcon:h.isPrivate?"lock-locked":h.customIcon,customLabel:h.customLabel}),f==="communityPage"&&(h==null?void 0:h.createdAt)&&Sh(h==null?void 0:h.createdAt,60)&&d.jsx(hn,{size:"small",variant:"information","data-testid":"new-community",children:o.formatMessage({id:"card_new"})}),h.startDate&&!h.isOngoingEvent&&d.jsx(hn,{size:"small",variant:h.dateHasPassed?"default":"information","data-testid":"date",children:h.dateHasPassed?o.formatMessage({id:"card_ended"}):jc(h.startDate)}),h.banner?d.jsxs("p",{className:"img",children:[h.registered&&d.jsx(hn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(er,{image:{...h.banner,description:""}})]}):b==="people"?d.jsx(sn,{name:h.title||"",src:h.profile,"data-testid":"people-profile-picture"}):null,h.contributors&&d.jsx(qs,{contributors:{data:h.contributors},styling:{size:"small",showGap:b!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(f)?o.formatMessage({id:`card_contributors_${f}`}):void 0,"data-testid":"contributors"}),h.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:h.partner.length>1?o.formatMessage({id:"card_partner"},{partner:h.partner[0],number:h.partner.length-1}):Wn(h.partner[0],F.partner)}),["title","text","secondaryText"].map(C=>{const B=h[C];if(!B)return null;const T=Bc(C),R={key:C,className:T,"data-testid":T},L={wrapper:"p",forceWrapper:!0,forceInline:!0},q=Wn(B,F[C]);return["title","text"].includes(C)&&k?(L.wrapper="a",d.jsx("p",{...R,children:d.jsx(Pt,{options:L,...z,children:q})})):d.jsx(Pt,{options:L,...R,children:q})}),(l==null?void 0:l.id)&&(h==null?void 0:h.members)&&d.jsxs("span",{className:"member-information",children:[((N=h==null?void 0:h.members)==null?void 0:N.isMember)&&d.jsx(hn,{size:"small",variant:"registered",icon:(($=h==null?void 0:h.members)==null?void 0:$.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(M=h==null?void 0:h.members)==null?void 0:M.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:h==null?void 0:h.members.count})})]}),d.jsx(dw,{type:b||"",data:h}),d.jsx(fw,{data:h,cta:r,link:k||"",gtmContext:a})]})})};const Hf=({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(Co,{id:s,card:{...a,contentType:t[i]},...r},s)})}),mw=(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},pw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return x.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 $i={fourCards:1024,threeCards:769,twoCards:480};let ea=null;const gw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:h}=u,[p,g]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:y}=p,[b,w]=x.useState(""),A=t.length,k=Math.ceil(A/m),E=x.useRef(null),F=Qn(!0,!0,E==null?void 0:E.current);x.useEffect(()=>{let C=1;F&&(F>=$i.fourCards?C=4:F>=$i.threeCards?C=3:F>=$i.twoCards&&(C=2),C>A&&(C=A)),c(B=>({...B,cardsPerPage:C,isLoading:!1}))},[F,A]);const j=(C="next")=>{let B=f;if(typeof C=="string")if(C==="next")if(f<k-1)B=f+1;else return;else if(f>0)B=f-1;else return;else B=C;g(R=>({...R,currentPage:B,loadedPages:[...new Set([...y,B])]}));const T=()=>{const R=B*u.cardsPerPage,L=R+u.cardsPerPage;return t.slice(R,L).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:C,count:T()}))},z=C=>{ea=C.touches[0].clientX},N=C=>{if(ea===null)return;const B=C.touches[0].clientX,T=ea-B;T>5?j("next"):T<-5&&j("previous"),ea=null},$={"--width":`${F||0}px`,"--total-cards":A,"--cards-per-page":m,"--page":f};if(h)return d.jsx(Ls,{layout:`carousel${a?"-with-title":""}`});const M=(C,B)=>{var R;let T=null;return(R=C==null?void 0:C.sys)!=null&&R.id?T=`card-${C.sys.id}`:C!=null&&C.slug?T=`card-${C.slug}`:[n[B],C.contentType].includes("customCard")&&(T=`card-${window.btoa(`${C.title} ${C.createdAt}`)}-${B}`),T};return d.jsxs("section",{ref:E,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(pw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:N,style:$,"data-testid":"carousel-list",children:t.map((C,B)=>{let T=M(C,B);return T&&mw(B,m,f,y)?d.jsx(Co,{id:T,card:{...C,contentType:n[B]},buildCardData:r,gtmContext:s,...o},T):(T=T||`${e}-card-${B}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},T))})}),k<=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(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:C=>{C.preventDefault(),C.stopPropagation(),j("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(k)].map((C,B)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:G("page-indicator",{selected:B===f}),onClick:T=>{T.preventDefault(),T.stopPropagation(),j(B)},children:d.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:B+1,total:k})})})},`page-indicator-${B}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:C=>{C.preventDefault(),C.stopPropagation(),j("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=k-1})})]}),d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},vw=({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(x.Fragment,{children:[d.jsx(Ls,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:d.jsx(tn,{})]},`placeholder-${c}`):d.jsxs(x.Fragment,{children:[d.jsx(gw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:d.jsx(tn,{})]},`carousel-${c}`)});const ta="joinCommunityButton",xo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=x.useContext(Mt),l=o&&typeof o.id=="string",u=r||!l,[c,m]=x.useState(e),[h,p]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[c]);const g={},f={};return c&&h!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${ta}_leave`}),g["aria-label"]=s.formatMessage({id:`${ta}_member_aria`}),f["aria-hidden"]="true"),d.jsx(Ee,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${ta}_closed_tooltip`}):"",onClick:async y=>{u||(y.currentTarget.blur(),c?(p("leaving"),typeof i=="function"&&await i()):(p("joining"),typeof a=="function"&&await a()),m(!c))},className:G("join-community-button",h,{active:h==="joining"}),disabled:u,...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${ta}${["joining","leaving"].includes(h)?`_${h}`:c?"_member":n?"_short":""}`})})})};const Li="communityDetails_",bw=({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=ue.useIntl(),u=5,c=a||i.length,m=i.length?i:Array(u).fill({}),h=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:G("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${Li}members`}),d.jsx("span",{className:"count",children:c})]}),!h&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Li}viewAll`})})})]}),d.jsx(qs,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(xo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Li}invite`})})]})};const yw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Me,{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(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(kn,{href:s?void 0:i,...l,children:Wn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Dw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=x.useState(t?["all"]:[]),u=(c,m)=>{let h=[];o.includes(c)?h=o.filter(p=>p!==c):c==="all"?h=["all"]:n?h=[...o.filter(p=>p!=="all"),c]:h=[c],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),m&&typeof m=="function"&&m()};return d.jsx("ul",{className:G("filters",a),children:s.map(({id:c,text:m,disabled:h=!1,callback:p=()=>{}})=>{let g={};return h&&(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,p)},...g,children:m})},c)})})},Cw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",xw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=x.useContext(bo),[m,h]=x.useState(e);if(x.useEffect(()=>{e!==m&&h(e)},[e]),!r||!Object.values(r).some(y=>y&&y.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:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var A;if(!ga[y])return null;const b=(A=r[y])==null?void 0:A.post_name;let w={className:y};if(m===y)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const k=Cw(y,b,i);w={...w,href:typeof k=="string"?k:k.url,onClick:E=>{h(y),c(y),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(y,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(kn,{...w,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Pn.support,link:y=>{const b=`mailto:${y}`;return d.jsx("a",{href:b,children:y})}})})]})};const zi=ue.createIntl({locale:"en",messages:Xn}),Rr=({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:zi.formatMessage({id:"loadMore_button"}),endOfFeed:zi.formatMessage({id:"loadMore_endOfFeed"}),error:zi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,m]=x.useState(""),h=async p=>{if(!n)try{await t(p)}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(Ee,{variant:r,size:a,styling:i,icon:s,onClick:h,"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 wo=({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(Me,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Uf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=x.useRef(null),[s,o]=x.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),x.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:m,icon:h,...p},g)=>{const f={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Ee,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},ww=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Vf=({activeLink:e})=>{const t=ue.useIntl(),n=x.useContext(Mt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ew.map(({key:a,href:i})=>{const s=ww(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:G(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(sn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,kw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${dr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${dr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
158
158
 
159
- ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const _w="shareLinks_",Bw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=kw({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:f=!0,onClick:p})=>{if(typeof f=="function"&&!f())return null;const g={};return p&&(g.onClick=h=>p(h,m)),d.jsx("li",{children:d.jsx(Ee,{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:`${_w}link_${u}`}),...g})},u)})})]})};const Aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,m,f)=>(c||(c=`panel-${window.btoa(m)}-${f}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(f=>f.id===c)){for(let f=0;f<e.length;f++)if(r(e[f].id,e[f].text,f)===c){a=f;break}}}const[i,s]=x.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));x.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:m,content:f,href:p,hasCarousel:g},h)=>{c=r(c,m,h);const y=i===c,b={};p||(b["aria-controls"]=c,b.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof f=="string"?d.jsx("p",{children:f}):f},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:G({selected:y}),role:"tab","aria-selected":y,...b,children:m})},`tab-${c}`))}),d.jsxs("div",{className:G("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Fw={"2-1":901,"1-3":769,"1-1":769},Kf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Qn(!0);let s=a;return x.Children.count(a)===1&&(s=x.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Fw[e]?null:o)})};let qi;const Wi="contactFooter_",Tw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,a]=x.useState(0),[i,s]=x.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(qi),qi=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(qi),window.removeEventListener("resize",l)}),[]),d.jsx(ln,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${Wi}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(ue.FormattedMessage,{id:`${Wi}text`})}),d.jsx(kn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${Wi}email`})})]}),d.jsx(xf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Sw=({activeLink:e,...t})=>d.jsx(ln,{children:d.jsx(Kf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Vf,{activeLink:e}),d.jsx(zc,{...t})]})})});const Hi="cookieBanner_",Ui=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Vi=new Date(Date.now()+12*30*24*60*60*1e3),Zf=()=>{const e=ue.useIntl(),[t,n,r]=Ps.useCookies(Ui),[a,i]=x.useState(!t["apol-cookie-banner"]),s=()=>{Ui.forEach(c=>{n(c,!0,{path:"/",expires:Vi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Vi}),Ui.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Vi});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:`${Hi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Hi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Hi}text`})}),d.jsx(En,{buttons:u})]})},qt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Pn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Pn["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:Pn.support,gtmType:"concierge-email-click"},business:{email:Pn.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 Ln="footer_",Oa="SiteFooter",sc=({group:e})=>{const t=qt[e].order||[];let n=!1;return"text"in qt[e]&&(n=qt[e].text),d.jsxs(x.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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}=qt[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":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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(x.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Eo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Ia,{element:"hr"}),d.jsx(wo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"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(sc,{group:e}),Object.keys(qt[e]).includes("child")&&d.jsx(sc,{group:qt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(qt.social.order)&&qt.social.order.map(e=>{const t=qt.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":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${Ln}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Pe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Pe.handlerCalled[e]&&i-Pe.handlerCalled[e]<500)return;Pe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=bc(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?Pe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Pe.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Pe.findFirstChild(u.children,"href")}else s=Pe.findFirstChild(t.current.children,"href");break;case"account":if(o=Pe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Pe.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(Pe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Pe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Pe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Pe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Sr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=bc(Sr,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 f=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const A=w.split("."),k=A[A.length-2];w=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}f={href:o.href},u&&(f={...f,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,h=f&&window.location.pathname===o.href;let y={},b={};if(h&&(y={...y,"aria-current":"page"}),p){const w=o.menuId||e,A={onClick:k=>Pe.events.onClick(k,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>Pe.events.onFocus({id:w}),onBlur:()=>Pe.events.onBlur({id:w,callback:a}),onMouseLeave:()=>Pe.events.onBlur({id:w,callback:a}),onMouseEnter:()=>Pe.events.onMouseEnter({id:w,callback:a})};n&&(g&&(y={...A,onKeyPress:k=>{k.key==="Enter"&&Pe.events.onClick(k,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),b={hidden:w in r?!r[w]:!0}),g||(b={...b,...A})}return d.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...y,children:[f?x.createElement(c?Ee:"a",f,s.formatMessage({id:m})):s.formatMessage({id:m}),o.order&&d.jsx("ul",{...b,children:o.order.map(w=>{if(!o[w])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[w].order?d.jsxs("li",{className:G({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${m}_${w}`}),d.jsx("ul",{children:o[w].order.map(k=>d.jsx(Pa,{id:`${e}.${w}.${k}`,...A},k))})]},w):d.jsx(Pa,{id:`${e}.${w}`,...A},w)})})]},e)};const jw={height:67,height_desktop:83},ko=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=x.useContext(Mt),r=Qn(!0,!0),a=n&&typeof n.id=="string",i=x.useMemo(()=>Pe.getIsDesktopVersion(a,r),[a,r]),[s,o]=x.useReducer(jr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,m=x.useRef(s);x.useEffect(()=>{m.current=s},[s]),Ec({scrollPosition:jw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=m.current.menus;!i&&h.navigation||Pe.shouldChangeHeaderIsVisible(!0,h,o)},scrollDown:()=>{const h=m.current.menus;!i&&h.navigation||Pe.shouldChangeHeaderIsVisible(!1,h,o)}}});const f=(h,y,b=!1)=>{Pe.handleMenus({id:h,value:y,menus:m.current.menus,dispatch:o,forceHandle:b})},p=x.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{m.current.menus[y]&&f(y,!1,!0)})};return x.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Hn(()=>{u.navigation&&Pe.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Hn(()=>{u.account&&Pe.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(wo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),f("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Me,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Sr.order.map(h=>d.jsx(Pa,{id:h,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:f},h))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),f("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Ef,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:h=>Pe.events.onClick(h,{id:"account",callback:f,isOpen:u.account}),onMouseEnter:()=>Pe.events.onMouseEnter({id:"account",callback:f}),onMouseLeave:()=>Pe.events.onBlur({id:"account",callback:f}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Me,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Sr.buttons.order.map(h=>d.jsx(Pa,{id:`buttons.${h}`},h))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:G("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Ow=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(ko,{}),d.jsx("div",{id:"content",children:d.jsx(an,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(Eo,{})]})},Yf=({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:f="default",modal:p="default"}=i,g=Cc();x.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=oa(e,{locale:o}),y=oa(t,{locale:o}),b=oa(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),m!=="default"&&(w[m]=!0),f!=="default"&&(w[f]=!0),d.jsx(Ch.ErrorBoundary,{onError:r,fallback:d.jsx(Ow,{}),children:d.jsx(x.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[d.jsx(ko,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:G("additional-content prepended",{"large-modal":p==="large"}),children:y}),x.createElement(c==="bold"?Do:"div",{id:"content",children:h,className:G({"large-modal":p==="large"})})]}),b&&d.jsx("div",{className:"additional-content appended",children:b}),u&&d.jsx(Eo,{}),d.jsx(Zf,{})]})})})},oc={default:"tags_",headerTopics:"header_topics_topics_"},Ki={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"},Pw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ki.topic[e.replace("topic_","")],e){const t=Sr.topics.topics[e].href;return t?{id:e,href:t,text:`${oc.headerTopics}${e}`}:null}return null}return Ki[e]?(e=Ki[e],{id:e,text:`${oc.default}${e}`}):null}};const Rw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pw.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 Nw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:G("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(tr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(hn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Rr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Mw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return x.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(Ga,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx($s,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Gf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>x.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Qf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=$a(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Fc(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(Ga,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const m=ue.useIntl(),f="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(La,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[m.formatMessage({id:`${f}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${f}time_completed`}):d.jsx(Ga,{time:s,appendedText:a?m.formatMessage({id:`${f}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:h,contentType:y,icon:b,image:w,isIntroduction:A,optional:k,slug:E,subsectionId:T,title:j,type:z})=>{const N=a&&t||A,$={};return w&&($.style={"--image":`url(${w})`}),d.jsx("li",{className:G({article:y===fr.ARTICLE,discussion:y===fr.DISCUSSION,quiz:y===fr.QUIZ,completed:g&&y===fr.ARTICLE,locked:!N}),...$,children:d.jsx(kn,{href:N?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Ac(j)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Gf,{sectionId:i,subsectionId:T,title:j,className:"course-title"})," ",d.jsx(Qf,{completionTime:h,icon:b,optional:k,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const $w=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className: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":""}`})})};let aa=null;const ut="discussion_form_",Qa=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},getUsers:()=>Promise.resolve([]),props:{create:{projectNames:["questions-answers"]}}},data:l={},gtmContext:u="DiscussionForm"})=>{var N,$,M;const c=ue.useIntl(),m=x.useContext(Mt),[f,p]=x.useState(r.isEditing&&r.isEditing.text||""),[g,h]=x.useState(s.error||!1),[y,b]=x.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const w=C=>{p(C);let B;!m||!m.id?B=Ft(c.formatMessage,`${ut}error_loggedOut`,t.type,"action"):n?i>0&&C.length>=i&&(B=`${ut}error_tooLong`):B=Ft(c.formatMessage,`${ut}error_noPermission`,t.type,"action"),B?h(B):g&&h(!1)};let A=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const C=((N=t.slugs)==null?void 0:N.reply)||(($=t.slugs)==null?void 0:$.answer)||((M=t.slugs)==null?void 0:M.question)||"";C&&(A=`${A}-${C.slice(-15)}`)}e&&(A=`${e}-${A}`);const k=async C=>{var F;if(C.preventDefault(),C.stopPropagation(),!m||!m.id||!n||T)return;aa&&clearTimeout(aa),b("submitting");const B=window.location.pathname;try{let R;switch(t.type){case"post":R=await o.create({content:f});break;case"question":R=await o.create({title:f,authorId:m&&m.id,...(F=o.props)==null?void 0:F.create});break;case"response":R=await o.create({questionSlug:t.slugs.question},{body:f,authorId:m&&m.id,contentPath:B});break;case"reply":R=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:f,authorId:m&&m.id,contentPath:B});break;default:break}await jh(1e3),o.callback&&await o.callback(R),aa=setTimeout(()=>{p(""),b("submitted");const L=new Event("discussionFormSubmitted");document.dispatchEvent(L),E()},500)}catch(R){const L=R;let q=`${ut}error`;L!=null&&L.message.includes("entry already exists")&&(q=Ft(c.formatMessage,`${ut}error_alreadyExists`,t.type,"action")),L!=null&&L.message.includes("429")?q=Ft(c.formatMessage,`${ut}error_tooMany`,t.type,"action"):L!=null&&L.message.includes("400")&&(q=`${ut}error`),h(q),E()}},E=()=>{aa=setTimeout(()=>{h(!1),b(!1)},5e3)},T=!f||!Lh(f),j=y==="submitting",z=[];return(r.isEditing&&!j||s.cancel)&&z.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!m||!m.id||!f),children:c.formatMessage({id:`${ut}cancel`})}),z.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:C=>{if(r.isEditing){b("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}k(C)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!n||T||j||r.isEditing&&f===r.isEditing.text,children:c.formatMessage({id:`${ut}${j?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:G("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Ft(c.formatMessage,`${ut}title`,t.type,"action")}),d.jsx(tr,{member:m||"community",gtmContext:u,gtmType:"profile-click"}),d.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:Ft(c.formatMessage,`${ut}label`,t.type,"action")}),d.jsx(Cf,{id:`${A}-input`,value:y==="submitting"&&!g?"":f,placeholder:a||Ft(c.formatMessage,`${ut}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:w,getUsers:o.getUsers},data:l,autoFocus:!!r.isEditing,"aria-invalid":!!g,"aria-errormessage":"error-message"}),d.jsx("small",{children:Ft(c.formatMessage,`${ut}explainer`,t.type,"action",{a:C=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:C})})}),d.jsx(En,{buttons:z}),y==="submitted"&&r.showSuccessMessage&&d.jsx(wr,{className:"success","data-testid":"success",children:Ft(c.formatMessage,`${ut}success`,t.type,"action")}),g&&d.jsx(wr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof g=="string"?g.includes(" ")?g:c.formatMessage({id:g},{action:c.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):g})]})},_o=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(an,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(xo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Qa,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Lw={showForm:!1},Ja=x.createContext(Lw),Jf=({children:e})=>{const[t,n]=x.useState({showForm:!1});return d.jsx(Ja.Provider,{value:{...t,updateConversation:n},children:e})},zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Os=({icon:e,...t})=>d.jsx(Ee,{className:"discussion-button",variant:"tertiary",icon:e,...t});let xr=!1;const Zi=()=>{xr!==!1&&(clearTimeout(xr),xr=!1)},Yi=5;let Gi=null;const Xf=({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=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,f]=x.useReducer(jr,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:y,tabbableLink:b}=m;x.useEffect(()=>{f([{type:"userLikedContent",value:a}])},[a]);const w=x.useMemo(()=>qw(n,Yi),[n]),A=j=>{if(j.preventDefault(),j.stopPropagation(),f([{type:"showLikers",value:!1}]),xr)return Zi(),!1;if(Zi(),h||!s)return!1;xr=setTimeout(k,350)},k=async()=>{if(Zi(),h||!s)return!1;let j=g?p-1:p+1;j<0&&(j=0),f([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:j},{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{f([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{f([{type:"ignoreInteractions",value:!1}])}},E=()=>{Gi=setTimeout(()=>{f([{type:"showLikers",value:!1}])},500)},T=()=>{Gi&&clearTimeout(Gi)};return x.createElement(e,{className:"likes-wrapper",onKeyDown:j=>{j.key==="Escape"&&f([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),f([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},d.jsxs(d.Fragment,{children:[d.jsx(Os,{className:G("discussion-button text-medium action-button",{"show-spinner":h,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>E,onClick:j=>{var N;j.preventDefault(),j.stopPropagation(),T(),f([{type:"showLikers",value:!0}]);const z=(N=j.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(f([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),E())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Jn,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[w.map((j,z)=>{if(typeof j=="string"||!j.name)return null;const N={};return b!==z&&(N.tabIndex=-1),d.jsx("li",{"data-index":z,children:d.jsx(kn,{href:j.id?`/profiles/${j.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>T(),onKeyDown:$=>{var R,L,q,oe;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const M=$.key==="ArrowUp"?"up":"down",C=(R=$.currentTarget)==null?void 0:R.parentElement;let B=C==null?void 0:C.nextElementSibling;if(M==="up"){const ne=C==null?void 0:C.previousElementSibling;ne?B=ne:(B=(L=C==null?void 0:C.parentElement)==null?void 0:L.lastElementChild,(B==null?void 0:B.getAttribute("data-index"))==="-1"&&(B=B==null?void 0:B.previousElementSibling))}else(!B||(B==null?void 0:B.getAttribute("data-index"))==="-1")&&(B=(q=C==null?void 0:C.parentElement)==null?void 0:q.firstElementChild);if(!B)return;const F=(B==null?void 0:B.getAttribute("data-index"))||"0";f([{type:"tabbableLink",value:F}]),(oe=B==null?void 0:B.querySelector("a"))==null||oe.focus()},...N,children:j.name})},j.id||window.btoa(j.name))}),t>Yi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Yi})})]})})]})]}))},uc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Xa=(e,t)=>e&&!t,Qi=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Ww=280,Hw=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Wn(e,Ww):e;return a=a.trim(),n?await Oc({text:a,template:'<a href="/profiles/{{id}}" class="mentioned-user">@{{name}}</a>',mentions:n,getUsers:r}):a};const zt="discussion_",Uw=195,Nr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}},mentions:{getUsers:f}={getUsers:()=>Promise.resolve([])}},links:p={},className:g,gtmContext:h="DiscussionAnswer",children:y,isTruncated:b=!1})=>{const w=ue.useIntl(),A=x.useContext(Mt),k=x.useContext(Ja),{author:E,canLike:T,createdAt:j,id:z,likes:N=0,userLiked:$,comments:M=0,mentions:C}=t,B=A&&A.id&&typeof E!="string"&&E.id&&E.id===A.id||!1,F=typeof T=="boolean"?T:n?!B:!1,R=B&&(!t.createdAt||Th(t.createdAt,10,"seconds")),L=x.useRef(null),[q,oe]=x.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[ne,D]=x.useState(!1),[H,X]=x.useState(R?"highlighted":"default"),[_,S]=x.useState("");x.useEffect(()=>{const le=L.current;if(!(!le||H==="default"))return document.addEventListener("discussionFormSubmitted",W),le.addEventListener("transitionend",I),()=>{document.removeEventListener("discussionFormSubmitted",W),le.removeEventListener("transitionend",I)}},[]),x.useEffect(()=>{oe({...q,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),x.useEffect(()=>{(async()=>{const V=await Hw(q.body,b,C,f);oe({...q,postBody:V})})()},[q.body,C]);const W=()=>{setTimeout(()=>{X("fading")},1e3)},I=({propertyName:le})=>{le==="background-color"&&X(V=>(V==="default"&&(document.removeEventListener("discussionFormSubmitted",W),L.current&&L.current.removeEventListener("transitionend",I)),V==="fading"?"default":V))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||q.postBody==="")return d.jsx(wt,{className:"discussion-card discussion-post"});const K=async le=>{le||(le=""),S("");try{if(!vc(le,q.body)){const V=t.type==="question"?{title:le}:{body:le};await l(uc(t.slugs),V)}oe({...q,body:le,isEditing:!1,didEdit:!0})}catch{S(`${zt}form_error`)}},te=()=>{k&&k.updateConversation&&k.updateConversation({showForm:!0}),setTimeout(()=>{var we,je,Oe;const V=`reply-form-${(t.type==="answer"?t.slug:((we=t.slugs)==null?void 0:we.reply)||((je=t.slugs)==null?void 0:je.answer)||((Oe=t.slugs)==null?void 0:Oe.question)||"").toLowerCase().slice(-15)}`,he=document.getElementById(V),pe=document.getElementById(`${V}-input`);pe&&pe.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},ee=async()=>{D(!1);try{await o(uc(t.slugs))}catch{S("delete-error")}},ae=[{text:w.formatMessage({id:`${zt}moreMenu_report`}),onClick:le=>{le.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${zt}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${zt}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&&B&&ae.push({text:w.formatMessage({id:`${zt}moreMenu_edit`}),onClick:()=>oe({...q,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${zt}moreMenu_delete`}),onClick:le=>{le.preventDefault(),le.stopPropagation(),D(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`delete-${t.type}-click`,...qf(`delete-${t.slug}-modal`,ne)}),x.createElement(e,{className:G("discussion-post",g,{[H]:!g||!g.includes("highlighted-text-box"),"has-link":p.post&&!q.isEditing}),ref:L,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${h}-post-click`,onClick:le=>{!p.post||q.isEditing||(le.preventDefault(),le.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:z||t.slug,className:G("discussion-card",t.type,{editing:q.isEditing,"has-link":p.post&&!q.isEditing}),children:[!q.isEditing&&d.jsx(tr,{member:E,additionalContent:{createdAt:j,didEdit:q.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:h,gtmType:"profile-click"}),q.isEditing?d.jsx(Qa,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:q.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:_!==""&&_!=="delete-error"?w.formatMessage({id:_},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:K,handleCancel:()=>{S(""),oe({...q,isEditing:!1})},getUsers:f},gtmContext:`${h}Form`,data:{mentions:t.mentions}}):p.post?d.jsxs("a",{href:p.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),q.postBody.length>Uw?d.jsx(Lc,{text:q.postBody,markdownOptions:{overrides:{a:ss,blockquote:{component:Qi}}}}):d.jsx(Un,{options:{overrides:{a:ss,blockquote:{component:Qi}}},children:q.postBody})]}):d.jsx(Un,{options:{wrapper:t.type==="question"?"h1":x.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Qi}}},children:q.postBody}),!q.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Xf,{element:"li",likes:N,isShort:!1,userLiked:$,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:F,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof m=="function")&&d.jsx("li",{children:d.jsx(Os,{onClick:le=>{le.preventDefault(),le.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof m=="function"&&m()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":h,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${zt}comments_screenReader`},{count:M}),children:w.formatMessage({id:`${zt}comments`},{count:M})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Os,{styling:{muted:!0},onClick:te,icon:{icon:"speech-bubble_square_thick"},children:w.formatMessage({id:`${zt}reply`})})}),d.jsx(Uf,{element:"li",id:`more-${t.slug}`,options:ae})]})]}),y,d.jsx(Pr,{id:`delete-${t.slug}-modal`,isOpen:ne,functions:{onOpen:()=>{},onClose:()=>D(!1)},forceShow:{error:_==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>D(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ee,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:le=>d.jsx("p",{children:le}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ji="discussion_responses_",eh=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Ji}title`},{action:n.formatMessage({id:`${Ji}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Ft(n.formatMessage,`${Ji}empty`,e,e)})]})};const th=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=x.useContext(Ja),o=oa(a,{element:"li"});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(Rr,{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(Qa,{...r})]})},Vw="post",Kw="reply",nh="00000000-0000-0000-0000-000000000000";function Bo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Ao({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 Zw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Yw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function rh(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 Gw({content:e}){return{content:e,id:nh,time:new Date().toISOString(),verb:Vw}}function lc({activity:e,user:t}){return{...e,actor:rh(t),...Zw()}}function Ra({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 ah({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 Qw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:nh,kind:Kw,parent:t||""}}function cc({reply:e,user:t}){const n=rh(t);return{...e,user_id:n.id,user:n,...Yw()}}function dc({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 Jw({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 ih=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let fc,Xi=0;const sh=()=>{x.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(fc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Xi=0;return}Xi++,!(Xi>10)&&(fc=setTimeout(()=>{e(t)},50))}},Gn=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}),rn=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}),oh=Object.freeze({actor:`SU:${Gn.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"}),Xw=Object.freeze({actor:`SU:${rn.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"}),eE=Object.freeze({actor:`SU:${Gn.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"}),tE=Object.freeze({actor:`SU:${rn.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:oh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:rn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:rn.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:oh.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:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Xw.id,data:{content:"Some content 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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:eE.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:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:tE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function nE({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=lc({activity:Gw(o),user:i});return hc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=lc({activity:o,user:i});r.setQueryData(a,hc(c,u,!0)),setTimeout(()=>{ih(c.id)},0)}});return s}function rE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.content=i),s}),onError:n});return r}function aE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=nE({...c,mutationFn:e}),f=rE({...c,mutationFn:t}),p=iE({...c,mutationFn:n}),g=oE({...c,mutationFn:a}),h=uE({...c,mutationFn:i}),{activities:y,...b}=sE({queryKey:s,queryFn:r});return{activities:y,mutations:{create:m,edit:f,remove:g,like:p,unlike:h},user:l,...b}}function iE({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=Na(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Na(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function sE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:cE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>lE(a,i)),onError:n});return r}function uE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Na(i,s);return o&&ah({activity:o,user:r}),s}),onError:n});return a}function hc(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 Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function lE(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 cE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const dE=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:c,hasNextPage:m,isLoading:f,mutations:{create:p,edit:g,remove:h,like:y,unlike:b},user:w}=aE({queryKey:[e,t,"activities"],queryFns:r});return sh(),u?d.jsx(an,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(_o,{form:{content:{type:"post",slugs:{}},functions:{create:p,getUsers:a.getUsers},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((A,k)=>{var L,q,oe,ne,D,H,X,_;const{id:E,own_reactions:T,latest_reactions:j,reaction_counts:z,mentioned_users:N}=A,$=(((L=j==null?void 0:j.like)==null?void 0:L.length)||0)>0,M=(((q=T==null?void 0:T.like)==null?void 0:q.length)||0)>0,C=M?T==null?void 0:T.like[0].id:"",B=$?(oe=j==null?void 0:j.like)==null?void 0:oe.map(S=>{var W,I,K;return{id:(W=S==null?void 0:S.user)==null?void 0:W.id,name:(K=(I=S==null?void 0:S.user)==null?void 0:I.data)==null?void 0:K.name}}):!1,F=A==null?void 0:A.actor,R=(F==null?void 0:F.id)===(w==null?void 0:w.id);return d.jsx(x.Fragment,{children:d.jsx(Nr,{content:{type:"post",title:A==null?void 0:A.title,body:A==null?void 0:A.content,canLike:Xa(n,R),createdAt:(A==null?void 0:A.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:F==null?void 0:F.id,name:(ne=F==null?void 0:F.data)==null?void 0:ne.name,organization:(D=F==null?void 0:F.data)==null?void 0:D.organization,jobTitle:(H=F==null?void 0:F.data)==null?void 0:H.jobTitle,location:(X=F==null?void 0:F.data)==null?void 0:X.location,image:{thumbnail:((_=F==null?void 0:F.data)==null?void 0:_.thumbnail)||void 0}},userLiked:M,likes:(z==null?void 0:z.like)||0,comments:(z==null?void 0:z.reply)||0,peopleWhoLiked:B,mentions:N},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>h({activityId:E}),updateContent:(S,{body:W})=>g({activityId:E,content:W})},likes:{createLike:()=>y({activityId:E}),deleteLike:()=>b({activityId:E,reactionId:C})},comments:{openComments:()=>null},mentions:a},isTruncated:!0})},E)}),!f&&d.jsx(Rr,{hasNextPage:m,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},fE={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 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=cc({reply:Qw(o),user:i});return mc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=cc({reply:o,user:i});r.setQueryData(a,mc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{ih(c.id)},0)}});return s}function mE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function uh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=hE({...c,mutationFn:e}),f=mE({...c,mutationFn:t}),p=pE({...c,mutationFn:n}),g=vE({...c,mutationFn:a}),h=bE({...c,mutationFn:i}),{replies:y,...b}=gE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:m,edit:f,remove:g,like:p,unlike:h},user:l,...b}}function pE({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=Ma(s,o);return l&&dc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ma(o,l);u&&dc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function gE({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=wE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function vE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>xE(a,i)),onError:n});return r}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ma(i,s);return o&&Jw({reply:o,user:r}),s}),onError:n});return a}function yE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function DE(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 CE(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 mc(e,t,n){return t?n!=null&&n.append?DE(e,t,n):CE(e,t,n):yE(e)}function Ma(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,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const EE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:m,mutations:{create:f,edit:p,like:g,remove:h,unlike:y},user:b}=uh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:k=>i.list({...k,reactionId:r})}});Rs([m]);const[w,A]=x.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&d.jsx(th,{loadMore:{isLoading:m,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(k,{body:E})=>f({activityId:n,replyId:r,content:E}),getUsers:i.getUsers},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(k=>{var D,H,X,_,S,W,I,K,te,ee,ae,le;const{id:E,own_children:T,latest_children:j,children_counts:z,data:{mentioned_users:N}}=k,M=(((D=T==null?void 0:T.like)==null?void 0:D.length)||0)>0?(H=T==null?void 0:T.like)==null?void 0:H.find(V=>{var he;return((he=V==null?void 0:V.user)==null?void 0:he.id)===(b==null?void 0:b.id)}):!1,C=M?M==null?void 0:M.id:"",B=!!M,R=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(V=>{var he,pe,we;return{id:(he=V==null?void 0:V.user)==null?void 0:he.id,name:(we=(pe=V==null?void 0:V.user)==null?void 0:pe.data)==null?void 0:we.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(b==null?void 0:b.id),oe=Xa(a,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Nr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k==null?void 0:k.parent},slug:"",author:{id:L==null?void 0:L.id,name:(K=L.data)==null?void 0:K.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((le=L.data)==null?void 0:le.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:E}),updateContent:(V,{body:he})=>p({replyId:E,content:he})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>y({replyId:E,reactionId:C})},comments:{},mentions:{getUsers:i.getUsers}}},E)}):null})]})};const lh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:c,fetchNextPage:m,hasNextPage:f,isLoading:p,mutations:{create:g,edit:h,like:y,remove:b,unlike:w},user:A}=uh({queryKey:[e,t,n,"replies"],queryFns:a});return Rs([p]),sh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(eh,{type:"comment",responses:c}),d.jsx(_o,{form:{content:{type:"reply",slugs:{}},functions:{create:(k,{body:E})=>g({activityId:n,content:E}),...i},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map(k=>{var D,H,X,_,S,W,I,K,te,ee,ae,le;const{id:E,own_children:T,latest_children:j,children_counts:z,data:{mentioned_users:N}}=k,M=(((D=T==null?void 0:T.like)==null?void 0:D.length)||0)>0?(H=T==null?void 0:T.like)==null?void 0:H.find(V=>{var he;return((he=V==null?void 0:V.user)==null?void 0:he.id)===(A==null?void 0:A.id)}):!1,C=M?M==null?void 0:M.id:"",B=!!M,R=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(V=>{var he,pe,we;return{id:(he=V==null?void 0:V.user)==null?void 0:he.id,name:(we=(pe=V==null?void 0:V.user)==null?void 0:pe.data)==null?void 0:we.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(A==null?void 0:A.id),oe=Xa(r,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Jf,{children:d.jsx(Nr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:L==null?void 0:L.id,name:(K=L.data)==null?void 0:K.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((le=L.data)==null?void 0:le.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:E}),updateContent:(V,{body:he})=>h({replyId:E,content:he})},likes:{createLike:()=>y({replyId:E}),deleteLike:()=>w({replyId:E,reactionId:C})},comments:{},mentions:i},children:d.jsx(EE,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a,...i}})},E)},E)}),!p&&d.jsx(Rr,{hasNextPage:f,loadNextPage:()=>m(),icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function kE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),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 BE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=We.useQueryClient(),s=Ya(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Bo(o),mutate:Ao(o)},user:s,...o},u=kE({...l,mutationFn:t}),c=AE({...l,mutationFn:n}),m=FE({...l,mutationFn:r}),{activity:f,...p}=_E({queryKey:a,queryFn:e});return{activity:f,mutations:{edit:u,like:c,unlike:m},user:s,...p}}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&ah({activity:s,user:r}),s)),onError:n});return a}const TE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var M,C,B,F,R,L,q,oe,ne,D;const c=ue.useIntl(),m=x.useContext(Mt),{activity:f,error:p,isLoading:g,mutations:{edit:h,like:y,unlike:b}}=BE({queryFns:i,queryKey:[e,t,n]});if(g)return d.jsx(wt,{style:{height:"400px"}});if(p||!f)return d.jsx(an,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:A,mentioned_users:k}=f,E=(((M=A==null?void 0:A.like)==null?void 0:M.length)||0)>0,T=(((C=w==null?void 0:w.like)==null?void 0:C.length)||0)>0,j=T?w==null?void 0:w.like[0].id:"",z=E?(B=A==null?void 0:A.like)==null?void 0:B.map(H=>{var X,_,S;return{id:(X=H==null?void 0:H.user)==null?void 0:X.id,name:(S=(_=H==null?void 0:H.user)==null?void 0:_.data)==null?void 0:S.name}}):!1,N=f==null?void 0:f.actor,$=(N==null?void 0:N.id)===(m==null?void 0:m.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Nr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Xa(r,$),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:N.id,name:(F=N.data)==null?void 0:F.name,organization:(R=N.data)==null?void 0:R.organization,jobTitle:(L=N.data)==null?void 0:L.jobTitle,location:(q=N.data)==null?void 0:q.location,image:{thumbnail:((oe=N.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:T,likes:((ne=f==null?void 0:f.reaction_counts)==null?void 0:ne.like)||0,comments:((D=f==null?void 0:f.reaction_counts)==null?void 0:D.reply)||0,peopleWhoLiked:z,mentions:k},originalAuthorId:N==null?void 0:N.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{body:X})=>h({content:X})},likes:{createLike:()=>y({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:j})},comments:{openComments:()=>{}},mentions:o}},n),d.jsx(lh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})},SE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),pc=[{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 ia="notFoundError_",jE=()=>{const e=ue.useIntl(),t=[];return pc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Yf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(ln,{children:[d.jsx(Hf,{cards:pc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=dE;exports.ActivitySection=TE;exports.AddPost=_o;exports.Banner=Xx;exports.BannerSection=sw;exports.Breadcrumbs=yw;exports.Buckets=Vh;exports.Button=Ee;exports.ButtonWrapper=En;exports.COURSE_CONTENT_TYPES=fr;exports.CacheProvider=Nf;exports.Card=Co;exports.CardBlock=Hf;exports.Carousel=vw;exports.CharacterLimit=Ws;exports.CollapsibleSection=La;exports.Columns=Kf;exports.CommunityDetails=bw;exports.ContactFooter=Tw;exports.ContactForm=xf;exports.ContentTypeLabel=Mc;exports.Contributors=qs;exports.ConversationContext=Ja;exports.CookieBanner=Zf;exports.CourseProgression=Mw;exports.CourseStructure=Iw;exports.CustomContentBanner=ow;exports.Directory=Yx;exports.DiscussionConversation=Jf;exports.DiscussionForm=Qa;exports.DiscussionLikes=Xf;exports.DiscussionPost=Nr;exports.DiscussionThread=th;exports.Divider=tn;exports.DownloadSection=ew;exports.EMAILS=Pn;exports.EditSection=nw;exports.EmailHelperTextBox=Uc;exports.EmptyStateBox=an;exports.Filters=Dw;exports.FlagsProvider=Mf;exports.Footer=Eo;exports.Form=nr;exports.Formatting=Z;exports.FullWidthSection=ln;exports.GET_STREAM_PRESTRING=ts;exports.GlobalProviders=Kx;exports.Header=ko;exports.HelperTextBox=$c;exports.HiddenFromScreenReaders=Ia;exports.HideShowTextBox=Lc;exports.HighlightSection=lw;exports.HighlightedTextBox=Rt;exports.INVALID_TOKEN=Tc;exports.IconBulletedList=Yh;exports.ImageContainer=Wh;exports.IntlProvider=If;exports.InviteForm=wf;exports.InviteModal=Zx;exports.JoinButton=xo;exports.LanguageContext=bo;exports.LanguageSwitcher=xw;exports.LessonName=Gf;exports.LessonType=Qf;exports.Link=kn;exports.LoadMore=Rr;exports.LoadingBlock=sm;exports.LoadingPlaceholder=wt;exports.LoadingState=Ls;exports.Logo=wo;exports.LogoSection=rw;exports.MarkCompleteButton=$w;exports.MarkdownText=Un;exports.MarketingBlock=cw;exports.Marks=Ot;exports.Member=tr;exports.MembersList=Nw;exports.Modal=Do;exports.MoreMenu=Uf;exports.NUMBER_OF_COUNTRIES=Fh;exports.NUMBER_OF_USERS=Ah;exports.NavigationMenu=Vf;exports.NotFoundError=jE;exports.Overlay=Pr;exports.OverlayContext=yo;exports.OverlayProvider=zf;exports.PageHeading=zc;exports.PageLayout=Yf;exports.PasswordForm=zC;exports.PasswordRules=Gc;exports.Pill=hn;exports.Popover=Nc;exports.Portal=Is;exports.ProfileImageChange=LC;exports.ProfilePicture=sn;exports.ProgressBar=$s;exports.ProgressTracker=Hh;exports.Rating=ym;exports.RepliesFeed=lh;exports.ResponsesHeading=eh;exports.ResponsiveImage=er;exports.ReturnToNavButton=Uh;exports.RichTextEditor=Cf;exports.SearchForm=Ef;exports.ShareLinks=Bw;exports.SignupForm=KC;exports.Span=ss;exports.StatusBanner=wr;exports.TableOfContents=Jx;exports.Tabs=Aw;exports.Tags=Rw;exports.TestimonialBlock=Qx;exports.TimeToComplete=Ga;exports.Toggle=$C;exports.Tooltip=Jn;exports.TopLevelPage=Sw;exports.UUID_V4_REGEX=ns;exports.UserContext=Mt;exports.UserProvider=$f;exports.VisuallyHidden=Me;exports.addAriaProps=qf;exports.basicReducer=jr;exports.camelCaseToDashCase=Bc;exports.checkIntlPathExists=$a;exports.generateConditions=ma;exports.generateCssIcon=Sc;exports.getCharacterLimitProps=Hc;exports.getLongDate=Ms;exports.getMember=zs;exports.getShortDate=jc;exports.getValueLength=za;exports.headerData=Sr;exports.mapGetStreamData=SE;exports.pageReady=Pc;exports.passwordValidator=as;exports.repliesFeedMock=fE;exports.supportedLanguages=ga;exports.toCamelCase=Ac;exports.toCapitalisedCase=Bh;exports.toSentenceCase=Fc;exports.useCurrentPath=Cc;exports.useEffectAfterMount=Hn;exports.useElementWidth=Qn;exports.useOverlay=Lf;exports.useScrollListener=Ec;exports.useScrollToHash=Rs;exports.useTooltips=Ns;exports.useUser=Ya;
159
+ ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const _w="shareLinks_",Bw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=kw({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:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=f=>p(f,m)),d.jsx("li",{children:d.jsx(Ee,{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:`${_w}link_${u}`}),...g})},u)})})]})};const Aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,m,h)=>(c||(c=`panel-${window.btoa(m)}-${h}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(h=>h.id===c)){for(let h=0;h<e.length;h++)if(r(e[h].id,e[h].text,h)===c){a=h;break}}}const[i,s]=x.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));x.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:m,content:h,href:p,hasCarousel:g},f)=>{c=r(c,m,f);const y=i===c,b={};p||(b["aria-controls"]=c,b.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof h=="string"?d.jsx("p",{children:h}):h},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:G({selected:y}),role:"tab","aria-selected":y,...b,children:m})},`tab-${c}`))}),d.jsxs("div",{className:G("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Fw={"2-1":901,"1-3":769,"1-1":769},Kf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Qn(!0);let s=a;return x.Children.count(a)===1&&(s=x.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Fw[e]?null:o)})};let qi;const Wi="contactFooter_",Tw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,a]=x.useState(0),[i,s]=x.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(qi),qi=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(qi),window.removeEventListener("resize",l)}),[]),d.jsx(ln,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${Wi}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(ue.FormattedMessage,{id:`${Wi}text`})}),d.jsx(kn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${Wi}email`})})]}),d.jsx(xf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Sw=({activeLink:e,...t})=>d.jsx(ln,{children:d.jsx(Kf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Vf,{activeLink:e}),d.jsx(zc,{...t})]})})});const Hi="cookieBanner_",Ui=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Vi=new Date(Date.now()+12*30*24*60*60*1e3),Zf=()=>{const e=ue.useIntl(),[t,n,r]=Ps.useCookies(Ui),[a,i]=x.useState(!t["apol-cookie-banner"]),s=()=>{Ui.forEach(c=>{n(c,!0,{path:"/",expires:Vi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Vi}),Ui.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Vi});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:`${Hi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Hi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Hi}text`})}),d.jsx(En,{buttons:u})]})},qt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Pn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Pn["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:Pn.support,gtmType:"concierge-email-click"},business:{email:Pn.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 Ln="footer_",Oa="SiteFooter",sc=({group:e})=>{const t=qt[e].order||[];let n=!1;return"text"in qt[e]&&(n=qt[e].text),d.jsxs(x.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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}=qt[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":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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(x.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}${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":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Eo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Ia,{element:"hr"}),d.jsx(wo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"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(sc,{group:e}),Object.keys(qt[e]).includes("child")&&d.jsx(sc,{group:qt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(qt.social.order)&&qt.social.order.map(e=>{const t=qt.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":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${Ln}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${Ln}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Pe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Pe.handlerCalled[e]&&i-Pe.handlerCalled[e]<500)return;Pe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=bc(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?Pe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Pe.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Pe.findFirstChild(u.children,"href")}else s=Pe.findFirstChild(t.current.children,"href");break;case"account":if(o=Pe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Pe.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(Pe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Pe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Pe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Pe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Sr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=bc(Sr,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 h=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const A=w.split("."),k=A[A.length-2];w=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}h={href:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=h&&window.location.pathname===o.href;let y={},b={};if(f&&(y={...y,"aria-current":"page"}),p){const w=o.menuId||e,A={onClick:k=>Pe.events.onClick(k,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>Pe.events.onFocus({id:w}),onBlur:()=>Pe.events.onBlur({id:w,callback:a}),onMouseLeave:()=>Pe.events.onBlur({id:w,callback:a}),onMouseEnter:()=>Pe.events.onMouseEnter({id:w,callback:a})};n&&(g&&(y={...A,onKeyPress:k=>{k.key==="Enter"&&Pe.events.onClick(k,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),b={hidden:w in r?!r[w]:!0}),g||(b={...b,...A})}return d.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...y,children:[h?x.createElement(c?Ee:"a",h,s.formatMessage({id:m})):s.formatMessage({id:m}),o.order&&d.jsx("ul",{...b,children:o.order.map(w=>{if(!o[w])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[w].order?d.jsxs("li",{className:G({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${m}_${w}`}),d.jsx("ul",{children:o[w].order.map(k=>d.jsx(Pa,{id:`${e}.${w}.${k}`,...A},k))})]},w):d.jsx(Pa,{id:`${e}.${w}`,...A},w)})})]},e)};const jw={height:67,height_desktop:83},ko=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=x.useContext(Mt),r=Qn(!0,!0),a=n&&typeof n.id=="string",i=x.useMemo(()=>Pe.getIsDesktopVersion(a,r),[a,r]),[s,o]=x.useReducer(jr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,m=x.useRef(s);x.useEffect(()=>{m.current=s},[s]),Ec({scrollPosition:jw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const f=m.current.menus;!i&&f.navigation||Pe.shouldChangeHeaderIsVisible(!0,f,o)},scrollDown:()=>{const f=m.current.menus;!i&&f.navigation||Pe.shouldChangeHeaderIsVisible(!1,f,o)}}});const h=(f,y,b=!1)=>{Pe.handleMenus({id:f,value:y,menus:m.current.menus,dispatch:o,forceHandle:b})},p=x.useRef(null),g=f=>{f.key==="Escape"&&["navigation","search","account"].forEach(y=>{m.current.menus[y]&&h(y,!1,!0)})};return x.useEffect(()=>{var f;return(f=document.getElementById("header"))==null||f.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Hn(()=>{u.navigation&&Pe.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Hn(()=>{u.account&&Pe.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(wo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:f=>{f.preventDefault(),f.stopPropagation(),h("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Me,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Sr.order.map(f=>d.jsx(Pa,{id:f,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:h},f))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:f=>{f.preventDefault(),f.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Ef,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:f=>Pe.events.onClick(f,{id:"account",callback:h,isOpen:u.account}),onMouseEnter:()=>Pe.events.onMouseEnter({id:"account",callback:h}),onMouseLeave:()=>Pe.events.onBlur({id:"account",callback:h}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Me,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Sr.buttons.order.map(f=>d.jsx(Pa,{id:`buttons.${f}`},f))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:G("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Ow=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(ko,{}),d.jsx("div",{id:"content",children:d.jsx(an,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(Eo,{})]})},Yf=({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:h="default",modal:p="default"}=i,g=Cc();x.useEffect(()=>{window.scrollTo(0,0)},[g]);const f=oa(e,{locale:o}),y=oa(t,{locale:o}),b=oa(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),m!=="default"&&(w[m]=!0),h!=="default"&&(w[h]=!0),d.jsx(Ch.ErrorBoundary,{onError:r,fallback:d.jsx(Ow,{}),children:d.jsx(x.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[d.jsx(ko,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:G("additional-content prepended",{"large-modal":p==="large"}),children:y}),x.createElement(c==="bold"?Do:"div",{id:"content",children:f,className:G({"large-modal":p==="large"})})]}),b&&d.jsx("div",{className:"additional-content appended",children:b}),u&&d.jsx(Eo,{}),d.jsx(Zf,{})]})})})},oc={default:"tags_",headerTopics:"header_topics_topics_"},Ki={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"},Pw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ki.topic[e.replace("topic_","")],e){const t=Sr.topics.topics[e].href;return t?{id:e,href:t,text:`${oc.headerTopics}${e}`}:null}return null}return Ki[e]?(e=Ki[e],{id:e,text:`${oc.default}${e}`}):null}};const Rw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pw.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 Nw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:G("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(tr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(hn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Rr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Mw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return x.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(Ga,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx($s,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Gf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>x.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Qf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=$a(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Fc(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(Ga,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const m=ue.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(La,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${h}time_completed`}):d.jsx(Ga,{time:s,appendedText:a?m.formatMessage({id:`${h}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:y,icon:b,image:w,isIntroduction:A,optional:k,slug:E,subsectionId:F,title:j,type:z})=>{const N=a&&t||A,$={};return w&&($.style={"--image":`url(${w})`}),d.jsx("li",{className:G({article:y===fr.ARTICLE,discussion:y===fr.DISCUSSION,quiz:y===fr.QUIZ,completed:g&&y===fr.ARTICLE,locked:!N}),...$,children:d.jsx(kn,{href:N?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Ac(j)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Gf,{sectionId:i,subsectionId:F,title:j,className:"course-title"})," ",d.jsx(Qf,{completionTime:f,icon:b,optional:k,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const $w=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className: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":""}`})})};let aa=null;const ut="discussion_form_",Qa=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},getUsers:()=>Promise.resolve([]),props:{create:{projectNames:["questions-answers"]}}},data:l={},gtmContext:u="DiscussionForm"})=>{var N,$,M;const c=ue.useIntl(),m=x.useContext(Mt),[h,p]=x.useState(r.isEditing&&r.isEditing.text||""),[g,f]=x.useState(s.error||!1),[y,b]=x.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const w=C=>{p(C);let B;!m||!m.id?B=Ft(c.formatMessage,`${ut}error_loggedOut`,t.type,"action"):n?i>0&&C.length>=i&&(B=`${ut}error_tooLong`):B=Ft(c.formatMessage,`${ut}error_noPermission`,t.type,"action"),B?f(B):g&&f(!1)};let A=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const C=((N=t.slugs)==null?void 0:N.reply)||(($=t.slugs)==null?void 0:$.answer)||((M=t.slugs)==null?void 0:M.question)||"";C&&(A=`${A}-${C.slice(-15)}`)}e&&(A=`${e}-${A}`);const k=async C=>{var T;if(C.preventDefault(),C.stopPropagation(),!m||!m.id||!n||F)return;aa&&clearTimeout(aa),b("submitting");const B=window.location.pathname;try{let R;switch(t.type){case"post":R=await o.create({content:h});break;case"question":R=await o.create({title:h,authorId:m&&m.id,...(T=o.props)==null?void 0:T.create});break;case"response":R=await o.create({questionSlug:t.slugs.question},{body:h,authorId:m&&m.id,contentPath:B});break;case"reply":R=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:h,authorId:m&&m.id,contentPath:B});break;default:break}await jh(1e3),o.callback&&await o.callback(R),aa=setTimeout(()=>{p(""),b("submitted");const L=new Event("discussionFormSubmitted");document.dispatchEvent(L),E()},500)}catch(R){const L=R;let q=`${ut}error`;L!=null&&L.message.includes("entry already exists")&&(q=Ft(c.formatMessage,`${ut}error_alreadyExists`,t.type,"action")),L!=null&&L.message.includes("429")?q=Ft(c.formatMessage,`${ut}error_tooMany`,t.type,"action"):L!=null&&L.message.includes("400")&&(q=`${ut}error`),f(q),E()}},E=()=>{aa=setTimeout(()=>{f(!1),b(!1)},5e3)},F=!h||!Lh(h),j=y==="submitting",z=[];return(r.isEditing&&!j||s.cancel)&&z.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!m||!m.id||!h),children:c.formatMessage({id:`${ut}cancel`})}),z.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:C=>{if(r.isEditing){b("submitting"),o.handleSaveEdit&&o.handleSaveEdit(h);return}k(C)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!n||F||j||r.isEditing&&h===r.isEditing.text,children:c.formatMessage({id:`${ut}${j?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:G("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Ft(c.formatMessage,`${ut}title`,t.type,"action")}),d.jsx(tr,{member:m||"community",gtmContext:u,gtmType:"profile-click"}),d.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:Ft(c.formatMessage,`${ut}label`,t.type,"action")}),d.jsx(Cf,{id:`${A}-input`,value:y==="submitting"&&!g?"":h,placeholder:a||Ft(c.formatMessage,`${ut}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:w,getUsers:o.getUsers},data:l,autoFocus:!!r.isEditing,"aria-invalid":!!g,"aria-errormessage":"error-message"}),d.jsx("small",{children:Ft(c.formatMessage,`${ut}explainer`,t.type,"action",{a:C=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:C})})}),d.jsx(En,{buttons:z}),y==="submitted"&&r.showSuccessMessage&&d.jsx(wr,{className:"success","data-testid":"success",children:Ft(c.formatMessage,`${ut}success`,t.type,"action")}),g&&d.jsx(wr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof g=="string"?g.includes(" ")?g:c.formatMessage({id:g},{action:c.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):g})]})},_o=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(an,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(xo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Qa,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Lw={showForm:!1},Ja=x.createContext(Lw),Jf=({children:e})=>{const[t,n]=x.useState({showForm:!1});return d.jsx(Ja.Provider,{value:{...t,updateConversation:n},children:e})},zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Os=({icon:e,...t})=>d.jsx(Ee,{className:"discussion-button",variant:"tertiary",icon:e,...t});let xr=!1;const Zi=()=>{xr!==!1&&(clearTimeout(xr),xr=!1)},Yi=5;let Gi=null;const Xf=({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=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,h]=x.useReducer(jr,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:f,showLikers:y,tabbableLink:b}=m;x.useEffect(()=>{h([{type:"userLikedContent",value:a}])},[a]);const w=x.useMemo(()=>qw(n,Yi),[n]),A=j=>{if(j.preventDefault(),j.stopPropagation(),h([{type:"showLikers",value:!1}]),xr)return Zi(),!1;if(Zi(),f||!s)return!1;xr=setTimeout(k,350)},k=async()=>{if(Zi(),f||!s)return!1;let j=g?p-1:p+1;j<0&&(j=0),h([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:j},{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{h([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{h([{type:"ignoreInteractions",value:!1}])}},E=()=>{Gi=setTimeout(()=>{h([{type:"showLikers",value:!1}])},500)},F=()=>{Gi&&clearTimeout(Gi)};return x.createElement(e,{className:"likes-wrapper",onKeyDown:j=>{j.key==="Escape"&&h([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),h([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},d.jsxs(d.Fragment,{children:[d.jsx(Os,{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:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>E,onClick:j=>{var N;j.preventDefault(),j.stopPropagation(),F(),h([{type:"showLikers",value:!0}]);const z=(N=j.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(h([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),E())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Jn,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[w.map((j,z)=>{if(typeof j=="string"||!j.name)return null;const N={};return b!==z&&(N.tabIndex=-1),d.jsx("li",{"data-index":z,children:d.jsx(kn,{href:j.id?`/profiles/${j.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>F(),onKeyDown:$=>{var R,L,q,oe;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const M=$.key==="ArrowUp"?"up":"down",C=(R=$.currentTarget)==null?void 0:R.parentElement;let B=C==null?void 0:C.nextElementSibling;if(M==="up"){const ne=C==null?void 0:C.previousElementSibling;ne?B=ne:(B=(L=C==null?void 0:C.parentElement)==null?void 0:L.lastElementChild,(B==null?void 0:B.getAttribute("data-index"))==="-1"&&(B=B==null?void 0:B.previousElementSibling))}else(!B||(B==null?void 0:B.getAttribute("data-index"))==="-1")&&(B=(q=C==null?void 0:C.parentElement)==null?void 0:q.firstElementChild);if(!B)return;const T=(B==null?void 0:B.getAttribute("data-index"))||"0";h([{type:"tabbableLink",value:T}]),(oe=B==null?void 0:B.querySelector("a"))==null||oe.focus()},...N,children:j.name})},j.id||window.btoa(j.name))}),t>Yi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Yi})})]})})]})]}))},uc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Xa=(e,t)=>e&&!t,Qi=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Ww=280,Hw=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Wn(e,Ww):e;return a=a.trim(),n?await Oc({text:a,template:'<a href="/profiles/{{id}}" class="mentioned-user">@{{name}}</a>',mentions:n,getUsers:r}):a};const zt="discussion_",Uw=195,Nr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}},mentions:{getUsers:h}={getUsers:()=>Promise.resolve([])}},links:p={},className:g,gtmContext:f="DiscussionAnswer",children:y,isTruncated:b=!1})=>{const w=ue.useIntl(),A=x.useContext(Mt),k=x.useContext(Ja),{author:E,canLike:F,createdAt:j,id:z,likes:N=0,userLiked:$,comments:M=0,mentions:C}=t,B=A&&A.id&&typeof E!="string"&&E.id&&E.id===A.id||!1,T=typeof F=="boolean"?F:n?!B:!1,R=B&&(!t.createdAt||Th(t.createdAt,10,"seconds")),L=x.useRef(null),[q,oe]=x.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[ne,D]=x.useState(!1),[H,X]=x.useState(R?"highlighted":"default"),[_,S]=x.useState("");x.useEffect(()=>{const le=L.current;if(!(!le||H==="default"))return document.addEventListener("discussionFormSubmitted",W),le.addEventListener("transitionend",I),()=>{document.removeEventListener("discussionFormSubmitted",W),le.removeEventListener("transitionend",I)}},[]),x.useEffect(()=>{oe({...q,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),x.useEffect(()=>{(async()=>{const V=await Hw(q.body,b,C,h);oe({...q,postBody:V})})()},[q.body,C]);const W=()=>{setTimeout(()=>{X("fading")},1e3)},I=({propertyName:le})=>{le==="background-color"&&X(V=>(V==="default"&&(document.removeEventListener("discussionFormSubmitted",W),L.current&&L.current.removeEventListener("transitionend",I)),V==="fading"?"default":V))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||q.postBody==="")return d.jsx(wt,{className:"discussion-card discussion-post"});const K=async le=>{le||(le=""),S("");try{if(!vc(le,q.body)){const V=t.type==="question"?{title:le}:{body:le};await l(uc(t.slugs),V)}oe({...q,body:le,isEditing:!1,didEdit:!0})}catch{S(`${zt}form_error`)}},te=()=>{k&&k.updateConversation&&k.updateConversation({showForm:!0}),setTimeout(()=>{var we,je,Oe;const V=`reply-form-${(t.type==="answer"?t.slug:((we=t.slugs)==null?void 0:we.reply)||((je=t.slugs)==null?void 0:je.answer)||((Oe=t.slugs)==null?void 0:Oe.question)||"").toLowerCase().slice(-15)}`,he=document.getElementById(V),pe=document.getElementById(`${V}-input`);pe&&pe.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},ee=async()=>{D(!1);try{await o(uc(t.slugs))}catch{S("delete-error")}},ae=[{text:w.formatMessage({id:`${zt}moreMenu_report`}),onClick:le=>{le.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${zt}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${zt}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&&B&&ae.push({text:w.formatMessage({id:`${zt}moreMenu_edit`}),onClick:()=>oe({...q,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${zt}moreMenu_delete`}),onClick:le=>{le.preventDefault(),le.stopPropagation(),D(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`delete-${t.type}-click`,...qf(`delete-${t.slug}-modal`,ne)}),x.createElement(e,{className:G("discussion-post",g,{[H]:!g||!g.includes("highlighted-text-box"),"has-link":p.post&&!q.isEditing}),ref:L,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${f}-post-click`,onClick:le=>{!p.post||q.isEditing||(le.preventDefault(),le.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:z||t.slug,className:G("discussion-card",t.type,{editing:q.isEditing,"has-link":p.post&&!q.isEditing}),children:[!q.isEditing&&d.jsx(tr,{member:E,additionalContent:{createdAt:j,didEdit:q.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:f,gtmType:"profile-click"}),q.isEditing?d.jsx(Qa,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:q.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:_!==""&&_!=="delete-error"?w.formatMessage({id:_},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:K,handleCancel:()=>{S(""),oe({...q,isEditing:!1})},getUsers:h},gtmContext:`${f}Form`,data:{mentions:t.mentions}}):p.post?d.jsxs("a",{href:p.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),q.postBody.length>Uw?d.jsx(Lc,{text:q.postBody,markdownOptions:{overrides:{a:ss,blockquote:{component:Qi}}}}):d.jsx(Un,{options:{overrides:{a:ss,blockquote:{component:Qi}}},children:q.postBody})]}):d.jsx(Un,{options:{wrapper:t.type==="question"?"h1":x.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Qi}}},children:q.postBody}),!q.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Xf,{element:"li",likes:N,isShort:!1,userLiked:$,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:T,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof m=="function")&&d.jsx("li",{children:d.jsx(Os,{onClick:le=>{le.preventDefault(),le.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof m=="function"&&m()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":f,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${zt}comments_screenReader`},{count:M}),children:w.formatMessage({id:`${zt}comments`},{count:M})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Os,{styling:{muted:!0},onClick:te,icon:{icon:"speech-bubble_square_thick"},children:w.formatMessage({id:`${zt}reply`})})}),d.jsx(Uf,{element:"li",id:`more-${t.slug}`,options:ae})]})]}),y,d.jsx(Pr,{id:`delete-${t.slug}-modal`,isOpen:ne,functions:{onOpen:()=>{},onClose:()=>D(!1)},forceShow:{error:_==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>D(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ee,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:le=>d.jsx("p",{children:le}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ji="discussion_responses_",eh=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Ji}title`},{action:n.formatMessage({id:`${Ji}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Ft(n.formatMessage,`${Ji}empty`,e,e)})]})};const th=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=x.useContext(Ja),o=oa(a,{element:"li"});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(Rr,{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(Qa,{...r})]})},Vw="post",Kw="reply",nh="00000000-0000-0000-0000-000000000000";function Bo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Ao({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 Zw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Yw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function rh(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 Gw({content:e}){return{content:e,id:nh,time:new Date().toISOString(),verb:Vw}}function lc({activity:e,user:t}){return{...e,actor:rh(t),...Zw()}}function Ra({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 ah({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 Qw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:nh,kind:Kw,parent:t||""}}function cc({reply:e,user:t}){const n=rh(t);return{...e,user_id:n.id,user:n,...Yw()}}function dc({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 Jw({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 ih=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let fc,Xi=0;const sh=()=>{x.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(fc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Xi=0;return}Xi++,!(Xi>10)&&(fc=setTimeout(()=>{e(t)},50))}},Gn=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}),rn=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}),oh=Object.freeze({actor:`SU:${Gn.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"}),Xw=Object.freeze({actor:`SU:${rn.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"}),eE=Object.freeze({actor:`SU:${Gn.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"}),tE=Object.freeze({actor:`SU:${rn.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:oh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:rn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:rn.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:oh.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:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Xw.id,data:{content:"Some content 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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:eE.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:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:tE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function nE({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=lc({activity:Gw(o),user:i});return hc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=lc({activity:o,user:i});r.setQueryData(a,hc(c,u,!0)),setTimeout(()=>{ih(c.id)},0)}});return s}function rE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.content=i),s}),onError:n});return r}function aE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=nE({...c,mutationFn:e}),h=rE({...c,mutationFn:t}),p=iE({...c,mutationFn:n}),g=oE({...c,mutationFn:a}),f=uE({...c,mutationFn:i}),{activities:y,...b}=sE({queryKey:s,queryFn:r});return{activities:y,mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...b}}function iE({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=Na(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Na(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function sE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:cE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>lE(a,i)),onError:n});return r}function uE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Na(i,s);return o&&ah({activity:o,user:r}),s}),onError:n});return a}function hc(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 Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function lE(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 cE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const dE=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:c,hasNextPage:m,isLoading:h,mutations:{create:p,edit:g,remove:f,like:y,unlike:b},user:w}=aE({queryKey:[e,t,"activities"],queryFns:r});return sh(),u?d.jsx(an,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(_o,{form:{content:{type:"post",slugs:{}},functions:{create:p,getUsers:a.getUsers},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((A,k)=>{var L,q,oe,ne,D,H,X,_;const{id:E,own_reactions:F,latest_reactions:j,reaction_counts:z,mentioned_users:N}=A,$=(((L=j==null?void 0:j.like)==null?void 0:L.length)||0)>0,M=(((q=F==null?void 0:F.like)==null?void 0:q.length)||0)>0,C=M?F==null?void 0:F.like[0].id:"",B=$?(oe=j==null?void 0:j.like)==null?void 0:oe.map(S=>{var W,I,K;return{id:(W=S==null?void 0:S.user)==null?void 0:W.id,name:(K=(I=S==null?void 0:S.user)==null?void 0:I.data)==null?void 0:K.name}}):!1,T=A==null?void 0:A.actor,R=(T==null?void 0:T.id)===(w==null?void 0:w.id);return d.jsx(x.Fragment,{children:d.jsx(Nr,{content:{type:"post",title:A==null?void 0:A.title,body:A==null?void 0:A.content,canLike:Xa(n,R),createdAt:(A==null?void 0:A.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:T==null?void 0:T.id,name:(ne=T==null?void 0:T.data)==null?void 0:ne.name,organization:(D=T==null?void 0:T.data)==null?void 0:D.organization,jobTitle:(H=T==null?void 0:T.data)==null?void 0:H.jobTitle,location:(X=T==null?void 0:T.data)==null?void 0:X.location,image:{thumbnail:((_=T==null?void 0:T.data)==null?void 0:_.thumbnail)||void 0}},userLiked:M,likes:(z==null?void 0:z.like)||0,comments:(z==null?void 0:z.reply)||0,peopleWhoLiked:B,mentions:N},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:E}),updateContent:(S,{body:W})=>g({activityId:E,content:W})},likes:{createLike:()=>y({activityId:E}),deleteLike:()=>b({activityId:E,reactionId:C})},comments:{openComments:()=>null},mentions:a},isTruncated:!0})},E)}),!h&&d.jsx(Rr,{hasNextPage:m,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},fE={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 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=cc({reply:Qw(o),user:i});return mc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=cc({reply:o,user:i});r.setQueryData(a,mc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{ih(c.id)},0)}});return s}function mE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function uh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=hE({...c,mutationFn:e}),h=mE({...c,mutationFn:t}),p=pE({...c,mutationFn:n}),g=vE({...c,mutationFn:a}),f=bE({...c,mutationFn:i}),{replies:y,...b}=gE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...b}}function pE({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=Ma(s,o);return l&&dc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ma(o,l);u&&dc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function gE({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=wE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function vE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>xE(a,i)),onError:n});return r}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ma(i,s);return o&&Jw({reply:o,user:r}),s}),onError:n});return a}function yE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function DE(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 CE(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 mc(e,t,n){return t?n!=null&&n.append?DE(e,t,n):CE(e,t,n):yE(e)}function Ma(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,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const EE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:m,mutations:{create:h,edit:p,like:g,remove:f,unlike:y},user:b}=uh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:k=>i.list({...k,reactionId:r})}});Rs([m]);const[w,A]=x.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&d.jsx(th,{loadMore:{isLoading:m,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(k,{body:E})=>h({activityId:n,replyId:r,content:E}),getUsers:i.getUsers},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(k=>{var D,H,X,_,S,W,I,K,te,ee,ae,le;const{id:E,own_children:F,latest_children:j,children_counts:z,data:{mentioned_users:N}}=k,M=(((D=F==null?void 0:F.like)==null?void 0:D.length)||0)>0?(H=F==null?void 0:F.like)==null?void 0:H.find(V=>{var he;return((he=V==null?void 0:V.user)==null?void 0:he.id)===(b==null?void 0:b.id)}):!1,C=M?M==null?void 0:M.id:"",B=!!M,R=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(V=>{var he,pe,we;return{id:(he=V==null?void 0:V.user)==null?void 0:he.id,name:(we=(pe=V==null?void 0:V.user)==null?void 0:pe.data)==null?void 0:we.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(b==null?void 0:b.id),oe=Xa(a,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Nr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k==null?void 0:k.parent},slug:"",author:{id:L==null?void 0:L.id,name:(K=L.data)==null?void 0:K.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((le=L.data)==null?void 0:le.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:E}),updateContent:(V,{body:he})=>p({replyId:E,content:he})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>y({replyId:E,reactionId:C})},comments:{},mentions:{getUsers:i.getUsers}}},E)}):null})]})};const lh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:c,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:g,edit:f,like:y,remove:b,unlike:w},user:A}=uh({queryKey:[e,t,n,"replies"],queryFns:a});return Rs([p]),sh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(eh,{type:"comment",responses:c}),d.jsx(_o,{form:{content:{type:"reply",slugs:{}},functions:{create:(k,{body:E})=>g({activityId:n,content:E}),...i},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map(k=>{var D,H,X,_,S,W,I,K,te,ee,ae,le;const{id:E,own_children:F,latest_children:j,children_counts:z,data:{mentioned_users:N}}=k,M=(((D=F==null?void 0:F.like)==null?void 0:D.length)||0)>0?(H=F==null?void 0:F.like)==null?void 0:H.find(V=>{var he;return((he=V==null?void 0:V.user)==null?void 0:he.id)===(A==null?void 0:A.id)}):!1,C=M?M==null?void 0:M.id:"",B=!!M,R=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(V=>{var he,pe,we;return{id:(he=V==null?void 0:V.user)==null?void 0:he.id,name:(we=(pe=V==null?void 0:V.user)==null?void 0:pe.data)==null?void 0:we.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(A==null?void 0:A.id),oe=Xa(r,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Jf,{children:d.jsx(Nr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:L==null?void 0:L.id,name:(K=L.data)==null?void 0:K.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((le=L.data)==null?void 0:le.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:E}),updateContent:(V,{body:he})=>f({replyId:E,content:he})},likes:{createLike:()=>y({replyId:E}),deleteLike:()=>w({replyId:E,reactionId:C})},comments:{},mentions:i},children:d.jsx(EE,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a,...i}})},E)},E)}),!p&&d.jsx(Rr,{hasNextPage:h,loadNextPage:()=>m(),icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function kE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),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 BE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=We.useQueryClient(),s=Ya(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Bo(o),mutate:Ao(o)},user:s,...o},u=kE({...l,mutationFn:t}),c=AE({...l,mutationFn:n}),m=FE({...l,mutationFn:r}),{activity:h,...p}=_E({queryKey:a,queryFn:e});return{activity:h,mutations:{edit:u,like:c,unlike:m},user:s,...p}}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&ah({activity:s,user:r}),s)),onError:n});return a}const TE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var M,C,B,T,R,L,q,oe,ne,D;const c=ue.useIntl(),m=x.useContext(Mt),{activity:h,error:p,isLoading:g,mutations:{edit:f,like:y,unlike:b}}=BE({queryFns:i,queryKey:[e,t,n]});if(g)return d.jsx(wt,{style:{height:"400px"}});if(p||!h)return d.jsx(an,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:A,mentioned_users:k}=h,E=(((M=A==null?void 0:A.like)==null?void 0:M.length)||0)>0,F=(((C=w==null?void 0:w.like)==null?void 0:C.length)||0)>0,j=F?w==null?void 0:w.like[0].id:"",z=E?(B=A==null?void 0:A.like)==null?void 0:B.map(H=>{var X,_,S;return{id:(X=H==null?void 0:H.user)==null?void 0:X.id,name:(S=(_=H==null?void 0:H.user)==null?void 0:_.data)==null?void 0:S.name}}):!1,N=h==null?void 0:h.actor,$=(N==null?void 0:N.id)===(m==null?void 0:m.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Nr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:h==null?void 0:h.content,canLike:Xa(r,$),createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:N.id,name:(T=N.data)==null?void 0:T.name,organization:(R=N.data)==null?void 0:R.organization,jobTitle:(L=N.data)==null?void 0:L.jobTitle,location:(q=N.data)==null?void 0:q.location,image:{thumbnail:((oe=N.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:F,likes:((ne=h==null?void 0:h.reaction_counts)==null?void 0:ne.like)||0,comments:((D=h==null?void 0:h.reaction_counts)==null?void 0:D.reply)||0,peopleWhoLiked:z,mentions:k},originalAuthorId:N==null?void 0:N.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{body:X})=>f({content:X})},likes:{createLike:()=>y({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:j})},comments:{openComments:()=>{}},mentions:o}},n),d.jsx(lh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})},SE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),pc=[{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 ia="notFoundError_",jE=()=>{const e=ue.useIntl(),t=[];return pc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Yf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(ln,{children:[d.jsx(Hf,{cards:pc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=dE;exports.ActivitySection=TE;exports.AddPost=_o;exports.Banner=Xx;exports.BannerSection=sw;exports.Breadcrumbs=yw;exports.Buckets=Vh;exports.Button=Ee;exports.ButtonWrapper=En;exports.COURSE_CONTENT_TYPES=fr;exports.CacheProvider=Nf;exports.Card=Co;exports.CardBlock=Hf;exports.Carousel=vw;exports.CharacterLimit=Ws;exports.CollapsibleSection=La;exports.Columns=Kf;exports.CommunityDetails=bw;exports.ContactFooter=Tw;exports.ContactForm=xf;exports.ContentTypeLabel=Mc;exports.Contributors=qs;exports.ConversationContext=Ja;exports.CookieBanner=Zf;exports.CourseProgression=Mw;exports.CourseStructure=Iw;exports.CustomContentBanner=ow;exports.Directory=Yx;exports.DiscussionConversation=Jf;exports.DiscussionForm=Qa;exports.DiscussionLikes=Xf;exports.DiscussionPost=Nr;exports.DiscussionThread=th;exports.Divider=tn;exports.DownloadSection=ew;exports.EMAILS=Pn;exports.EditSection=nw;exports.EmailHelperTextBox=Uc;exports.EmptyStateBox=an;exports.Filters=Dw;exports.FlagsProvider=Mf;exports.Footer=Eo;exports.Form=nr;exports.Formatting=Z;exports.FullWidthSection=ln;exports.GET_STREAM_PRESTRING=ts;exports.GlobalProviders=Kx;exports.Header=ko;exports.HelperTextBox=$c;exports.HiddenFromScreenReaders=Ia;exports.HideShowTextBox=Lc;exports.HighlightSection=lw;exports.HighlightedTextBox=Rt;exports.INVALID_TOKEN=Tc;exports.IconBulletedList=Yh;exports.ImageContainer=Wh;exports.IntlProvider=If;exports.InviteForm=wf;exports.InviteModal=Zx;exports.JoinButton=xo;exports.LanguageContext=bo;exports.LanguageSwitcher=xw;exports.LessonName=Gf;exports.LessonType=Qf;exports.Link=kn;exports.LoadMore=Rr;exports.LoadingBlock=sm;exports.LoadingPlaceholder=wt;exports.LoadingState=Ls;exports.Logo=wo;exports.LogoSection=rw;exports.MarkCompleteButton=$w;exports.MarkdownText=Un;exports.MarketingBlock=cw;exports.Marks=Ot;exports.Member=tr;exports.MembersList=Nw;exports.Modal=Do;exports.MoreMenu=Uf;exports.NUMBER_OF_COUNTRIES=Fh;exports.NUMBER_OF_USERS=Ah;exports.NavigationMenu=Vf;exports.NotFoundError=jE;exports.Overlay=Pr;exports.OverlayContext=yo;exports.OverlayProvider=zf;exports.PageHeading=zc;exports.PageLayout=Yf;exports.PasswordForm=zC;exports.PasswordRules=Gc;exports.Pill=hn;exports.Popover=Nc;exports.Portal=Is;exports.ProfileImageChange=LC;exports.ProfilePicture=sn;exports.ProgressBar=$s;exports.ProgressTracker=Hh;exports.Rating=ym;exports.RepliesFeed=lh;exports.ResponsesHeading=eh;exports.ResponsiveImage=er;exports.ReturnToNavButton=Uh;exports.RichTextEditor=Cf;exports.SearchForm=Ef;exports.ShareLinks=Bw;exports.SignupForm=KC;exports.Span=ss;exports.StatusBanner=wr;exports.TableOfContents=Jx;exports.Tabs=Aw;exports.Tags=Rw;exports.TestimonialBlock=Qx;exports.TimeToComplete=Ga;exports.Toggle=$C;exports.Tooltip=Jn;exports.TopLevelPage=Sw;exports.UUID_V4_REGEX=ns;exports.UserContext=Mt;exports.UserProvider=$f;exports.VisuallyHidden=Me;exports.addAriaProps=qf;exports.basicReducer=jr;exports.camelCaseToDashCase=Bc;exports.checkIntlPathExists=$a;exports.generateConditions=ma;exports.generateCssIcon=Sc;exports.getCharacterLimitProps=Hc;exports.getLongDate=Ms;exports.getMember=zs;exports.getShortDate=jc;exports.getValueLength=za;exports.headerData=Sr;exports.mapGetStreamData=SE;exports.pageReady=Pc;exports.passwordValidator=as;exports.repliesFeedMock=fE;exports.supportedLanguages=ga;exports.toCamelCase=Ac;exports.toCapitalisedCase=Bh;exports.toSentenceCase=Fc;exports.useCurrentPath=Cc;exports.useEffectAfterMount=Hn;exports.useElementWidth=Qn;exports.useOverlay=Lf;exports.useScrollListener=Ec;exports.useScrollToHash=Rs;exports.useTooltips=Ns;exports.useUser=Ya;