@apolitical/component-library 6.3.4 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ae=require("react-intl"),An=require("lodash.clonedeep"),cm=require("lodash.set"),Hc=require("react-dom"),Ht=require("markdown-to-jsx"),ir=require("truncate"),We=require("@tanstack/react-query"),dm=require("@tanstack/react-query-devtools"),_a=require("posthog-js"),to=require("react-cookie"),Na=require("lodash.isequal"),Kc=require("lodash.get"),fm=require("react-error-boundary"),hm=require("react-multi-email");var ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Yc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ie=require("react-intl"),It=require("lodash.clonedeep"),fm=require("lodash.set"),Kc=require("react-dom"),Kt=require("markdown-to-jsx"),ir=require("truncate"),We=require("@tanstack/react-query"),hm=require("@tanstack/react-query-devtools"),ka=require("posthog-js"),no=require("react-cookie"),Ia=require("lodash.isequal"),Zc=require("lodash.get"),mm=require("react-error-boundary"),pm=require("react-multi-email");var na=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function In(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Gc={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Yc);var mm=Yc.exports;const K=Rn(mm),pm=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:K("hidden",r,{"show-on-focus":t}),children:n}),Oe=y.memo(pm),gm=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),ii=y.memo(gm);var Ds={exports:{}},br={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Gc);var gm=Gc.exports;const K=In(gm),vm=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:K("hidden",r,{"show-on-focus":t}),children:n}),je=y.memo(vm),bm=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),si=y.memo(bm);var Ds={exports:{}},br={};/**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.min.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var cu;function vm(){if(cu)return br;cu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:a.current}}return br.Fragment=n,br.jsx=s,br.jsxs=s,br}var yr={};/**
13
+ */var du;function ym(){if(du)return br;du=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:a.current}}return br.Fragment=n,br.jsx=s,br.jsxs=s,br}var yr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,70 +18,70 @@
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 du;function bm(){return du||(du=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var se=v&&N[v]||N[f];return typeof se=="function"?se:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(N){{for(var se=arguments.length,ce=new Array(se>1?se-1:0),De=1;De<se;De++)ce[De-1]=arguments[De];E("error",N,ce)}}function E(N,se,ce){{var De=g.ReactDebugCurrentFrame,Pe=De.getStackAddendum();Pe!==""&&(se+="%s",ce=ce.concat([Pe]));var ze=ce.map(function(Se){return String(Se)});ze.unshift("Warning: "+se),Function.prototype.apply.call(console[N],console,ze)}}var A=!1,D=!1,k=!1,j=!1,L=!1,M;M=Symbol.for("react.module.reference");function q(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||L||N===a||N===u||N===d||j||N===m||A||D||k||typeof N=="object"&&N!==null&&(N.$$typeof===p||N.$$typeof===h||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===M||N.getModuleId!==void 0))}function I(N,se,ce){var De=N.displayName;if(De)return De;var Pe=se.displayName||se.name||"";return Pe!==""?ce+"("+Pe+")":ce}function B(N){return N.displayName||"Context"}function F(N){if(N==null)return null;if(typeof N.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var se=N;return B(se)+".Consumer";case s:var ce=N;return B(ce._context)+".Provider";case l:return I(N,N.render,"ForwardRef");case h:var De=N.displayName||null;return De!==null?De:F(N.type)||"Memo";case p:{var Pe=N,ze=Pe._payload,Se=Pe._init;try{return F(Se(ze))}catch{return null}}}return null}var P=Object.assign,O=0,U,W,ie,te,C,X,ue;function _(){}_.__reactDisabledLog=!0;function T(){{if(O===0){U=console.log,W=console.info,ie=console.warn,te=console.error,C=console.group,X=console.groupCollapsed,ue=console.groupEnd;var N={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}O++}}function $(){{if(O--,O===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},N,{value:U}),info:P({},N,{value:W}),warn:P({},N,{value:ie}),error:P({},N,{value:te}),group:P({},N,{value:C}),groupCollapsed:P({},N,{value:X}),groupEnd:P({},N,{value:ue})})}O<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=g.ReactCurrentDispatcher,z;function Y(N,se,ce){{if(z===void 0)try{throw Error()}catch(Pe){var De=Pe.stack.trim().match(/\n( *(at )?)/);z=De&&De[1]||""}return`
22
- `+z+N}}var G=!1,re;{var le=typeof WeakMap=="function"?WeakMap:Map;re=new le}function Q(N,se){if(!N||G)return"";{var ce=re.get(N);if(ce!==void 0)return ce}var De;G=!0;var Pe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ze;ze=S.current,S.current=null,T();try{if(se){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(Jt){De=Jt}Reflect.construct(N,[],Se)}else{try{Se.call()}catch(Jt){De=Jt}N.call(Se.prototype)}}else{try{throw Error()}catch(Jt){De=Jt}N()}}catch(Jt){if(Jt&&De&&typeof Jt.stack=="string"){for(var Be=Jt.stack.split(`
23
- `),dt=De.stack.split(`
21
+ */var fu;function xm(){return fu||(fu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var oe=v&&N[v]||N[f];return typeof oe=="function"?oe:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(N){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),Ce=1;Ce<oe;Ce++)ce[Ce-1]=arguments[Ce];D("error",N,ce)}}function D(N,oe,ce){{var Ce=g.ReactDebugCurrentFrame,Pe=Ce.getStackAddendum();Pe!==""&&(oe+="%s",ce=ce.concat([Pe]));var ze=ce.map(function(Se){return String(Se)});ze.unshift("Warning: "+oe),Function.prototype.apply.call(console[N],console,ze)}}var A=!1,E=!1,k=!1,S=!1,$=!1,M;M=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||$||N===a||N===u||N===d||S||N===m||A||E||k||typeof N=="object"&&N!==null&&(N.$$typeof===p||N.$$typeof===h||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===M||N.getModuleId!==void 0))}function R(N,oe,ce){var Ce=N.displayName;if(Ce)return Ce;var Pe=oe.displayName||oe.name||"";return Pe!==""?ce+"("+Pe+")":ce}function B(N){return N.displayName||"Context"}function F(N){if(N==null)return null;if(typeof N.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var oe=N;return B(oe)+".Consumer";case s:var ce=N;return B(ce._context)+".Provider";case l:return R(N,N.render,"ForwardRef");case h:var Ce=N.displayName||null;return Ce!==null?Ce:F(N.type)||"Memo";case p:{var Pe=N,ze=Pe._payload,Se=Pe._init;try{return F(Se(ze))}catch{return null}}}return null}var P=Object.assign,j=0,U,W,ne,re,w,Q,se;function _(){}_.__reactDisabledLog=!0;function O(){{if(j===0){U=console.log,W=console.info,ne=console.warn,re=console.error,w=console.group,Q=console.groupCollapsed,se=console.groupEnd;var N={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}j++}}function q(){{if(j--,j===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},N,{value:U}),info:P({},N,{value:W}),warn:P({},N,{value:ne}),error:P({},N,{value:re}),group:P({},N,{value:w}),groupCollapsed:P({},N,{value:Q}),groupEnd:P({},N,{value:se})})}j<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var T=g.ReactCurrentDispatcher,L;function G(N,oe,ce){{if(L===void 0)try{throw Error()}catch(Pe){var Ce=Pe.stack.trim().match(/\n( *(at )?)/);L=Ce&&Ce[1]||""}return`
22
+ `+L+N}}var Y=!1,te;{var le=typeof WeakMap=="function"?WeakMap:Map;te=new le}function X(N,oe){if(!N||Y)return"";{var ce=te.get(N);if(ce!==void 0)return ce}var Ce;Y=!0;var Pe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ze;ze=T.current,T.current=null,O();try{if(oe){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(Xt){Ce=Xt}Reflect.construct(N,[],Se)}else{try{Se.call()}catch(Xt){Ce=Xt}N.call(Se.prototype)}}else{try{throw Error()}catch(Xt){Ce=Xt}N()}}catch(Xt){if(Xt&&Ce&&typeof Xt.stack=="string"){for(var Be=Xt.stack.split(`
23
+ `),dt=Ce.stack.split(`
24
24
  `),Je=Be.length-1,tt=dt.length-1;Je>=1&&tt>=0&&Be[Je]!==dt[tt];)tt--;for(;Je>=1&&tt>=0;Je--,tt--)if(Be[Je]!==dt[tt]){if(Je!==1||tt!==1)do if(Je--,tt--,tt<0||Be[Je]!==dt[tt]){var At=`
25
- `+Be[Je].replace(" at new "," at ");return N.displayName&&At.includes("<anonymous>")&&(At=At.replace("<anonymous>",N.displayName)),typeof N=="function"&&re.set(N,At),At}while(Je>=1&&tt>=0);break}}}finally{G=!1,S.current=ze,$(),Error.prepareStackTrace=Pe}var Un=N?N.displayName||N.name:"",lu=Un?Y(Un):"";return typeof N=="function"&&re.set(N,lu),lu}function me(N,se,ce){return Q(N,!1)}function pe(N){var se=N.prototype;return!!(se&&se.isReactComponent)}function ke(N,se,ce){if(N==null)return"";if(typeof N=="function")return Q(N,pe(N));if(typeof N=="string")return Y(N);switch(N){case u:return Y("Suspense");case d:return Y("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return me(N.render);case h:return ke(N.type,se,ce);case p:{var De=N,Pe=De._payload,ze=De._init;try{return ke(ze(Pe),se,ce)}catch{}}}return""}var je=Object.prototype.hasOwnProperty,Te={},Ke=g.ReactDebugCurrentFrame;function Ne(N){if(N){var se=N._owner,ce=ke(N.type,N._source,se?se.type:null);Ke.setExtraStackFrame(ce)}else Ke.setExtraStackFrame(null)}function $e(N,se,ce,De,Pe){{var ze=Function.call.bind(je);for(var Se in N)if(ze(N,Se)){var Be=void 0;try{if(typeof N[Se]!="function"){var dt=Error((De||"React class")+": "+ce+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw dt.name="Invariant Violation",dt}Be=N[Se](se,Se,De,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Je){Be=Je}Be&&!(Be instanceof Error)&&(Ne(Pe),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).",De||"React class",ce,Se,typeof Be),Ne(null)),Be instanceof Error&&!(Be.message in Te)&&(Te[Be.message]=!0,Ne(Pe),w("Failed %s type: %s",ce,Be.message),Ne(null))}}}var Qe=Array.isArray;function Ae(N){return Qe(N)}function qe(N){{var se=typeof Symbol=="function"&&Symbol.toStringTag,ce=se&&N[Symbol.toStringTag]||N.constructor.name||"Object";return ce}}function be(N){try{return V(N),!1}catch{return!0}}function V(N){return""+N}function ne(N){if(be(N))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(N)),V(N)}var he=g.ReactCurrentOwner,ge={key:!0,ref:!0,__self:!0,__source:!0},we,Ye,Ge;Ge={};function ot(N){if(je.call(N,"ref")){var se=Object.getOwnPropertyDescriptor(N,"ref").get;if(se&&se.isReactWarning)return!1}return N.ref!==void 0}function Ft(N){if(je.call(N,"key")){var se=Object.getOwnPropertyDescriptor(N,"key").get;if(se&&se.isReactWarning)return!1}return N.key!==void 0}function gt(N,se){if(typeof N.ref=="string"&&he.current&&se&&he.current.stateNode!==se){var ce=F(he.current.type);Ge[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',F(he.current.type),N.ref),Ge[ce]=!0)}}function et(N,se){{var ce=function(){we||(we=!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)",se))};ce.isReactWarning=!0,Object.defineProperty(N,"key",{get:ce,configurable:!0})}}function xe(N,se){{var ce=function(){Ye||(Ye=!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)",se))};ce.isReactWarning=!0,Object.defineProperty(N,"ref",{get:ce,configurable:!0})}}var Fe=function(N,se,ce,De,Pe,ze,Se){var Be={$$typeof:t,type:N,key:se,ref:ce,props:Se,_owner:ze};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Pe}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function Mt(N,se,ce,De,Pe){{var ze,Se={},Be=null,dt=null;ce!==void 0&&(ne(ce),Be=""+ce),Ft(se)&&(ne(se.key),Be=""+se.key),ot(se)&&(dt=se.ref,gt(se,Pe));for(ze in se)je.call(se,ze)&&!ge.hasOwnProperty(ze)&&(Se[ze]=se[ze]);if(N&&N.defaultProps){var Je=N.defaultProps;for(ze in Je)Se[ze]===void 0&&(Se[ze]=Je[ze])}if(Be||dt){var tt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Be&&et(Se,tt),dt&&xe(Se,tt)}return Fe(N,Be,dt,Pe,De,he.current,Se)}}var vt=g.ReactCurrentOwner,wn=g.ReactDebugCurrentFrame;function Qt(N){if(N){var se=N._owner,ce=ke(N.type,N._source,se?se.type:null);wn.setExtraStackFrame(ce)}else wn.setExtraStackFrame(null)}var qn;qn=!1;function Ci(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function au(){{if(vt.current){var N=F(vt.current.type);if(N)return`
25
+ `+Be[Je].replace(" at new "," at ");return N.displayName&&At.includes("<anonymous>")&&(At=At.replace("<anonymous>",N.displayName)),typeof N=="function"&&te.set(N,At),At}while(Je>=1&&tt>=0);break}}}finally{Y=!1,T.current=ze,q(),Error.prepareStackTrace=Pe}var Un=N?N.displayName||N.name:"",cu=Un?G(Un):"";return typeof N=="function"&&te.set(N,cu),cu}function pe(N,oe,ce){return X(N,!1)}function fe(N){var oe=N.prototype;return!!(oe&&oe.isReactComponent)}function ke(N,oe,ce){if(N==null)return"";if(typeof N=="function")return X(N,fe(N));if(typeof N=="string")return G(N);switch(N){case u:return G("Suspense");case d:return G("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return pe(N.render);case h:return ke(N.type,oe,ce);case p:{var Ce=N,Pe=Ce._payload,ze=Ce._init;try{return ke(ze(Pe),oe,ce)}catch{}}}return""}var Oe=Object.prototype.hasOwnProperty,Te={},Ke=g.ReactDebugCurrentFrame;function Ne(N){if(N){var oe=N._owner,ce=ke(N.type,N._source,oe?oe.type:null);Ke.setExtraStackFrame(ce)}else Ke.setExtraStackFrame(null)}function $e(N,oe,ce,Ce,Pe){{var ze=Function.call.bind(Oe);for(var Se in N)if(ze(N,Se)){var Be=void 0;try{if(typeof N[Se]!="function"){var dt=Error((Ce||"React class")+": "+ce+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw dt.name="Invariant Violation",dt}Be=N[Se](oe,Se,Ce,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Je){Be=Je}Be&&!(Be instanceof Error)&&(Ne(Pe),C("%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).",Ce||"React class",ce,Se,typeof Be),Ne(null)),Be instanceof Error&&!(Be.message in Te)&&(Te[Be.message]=!0,Ne(Pe),C("Failed %s type: %s",ce,Be.message),Ne(null))}}}var Qe=Array.isArray;function Ae(N){return Qe(N)}function qe(N){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&N[Symbol.toStringTag]||N.constructor.name||"Object";return ce}}function be(N){try{return V(N),!1}catch{return!0}}function V(N){return""+N}function ae(N){if(be(N))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(N)),V(N)}var me=g.ReactCurrentOwner,ge={key:!0,ref:!0,__self:!0,__source:!0},we,Ye,Ge;Ge={};function ot(N){if(Oe.call(N,"ref")){var oe=Object.getOwnPropertyDescriptor(N,"ref").get;if(oe&&oe.isReactWarning)return!1}return N.ref!==void 0}function Ft(N){if(Oe.call(N,"key")){var oe=Object.getOwnPropertyDescriptor(N,"key").get;if(oe&&oe.isReactWarning)return!1}return N.key!==void 0}function gt(N,oe){if(typeof N.ref=="string"&&me.current&&oe&&me.current.stateNode!==oe){var ce=F(me.current.type);Ge[ce]||(C('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',F(me.current.type),N.ref),Ge[ce]=!0)}}function et(N,oe){{var ce=function(){we||(we=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ce.isReactWarning=!0,Object.defineProperty(N,"key",{get:ce,configurable:!0})}}function xe(N,oe){{var ce=function(){Ye||(Ye=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ce.isReactWarning=!0,Object.defineProperty(N,"ref",{get:ce,configurable:!0})}}var Fe=function(N,oe,ce,Ce,Pe,ze,Se){var Be={$$typeof:t,type:N,key:oe,ref:ce,props:Se,_owner:ze};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ce}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Pe}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function Mt(N,oe,ce,Ce,Pe){{var ze,Se={},Be=null,dt=null;ce!==void 0&&(ae(ce),Be=""+ce),Ft(oe)&&(ae(oe.key),Be=""+oe.key),ot(oe)&&(dt=oe.ref,gt(oe,Pe));for(ze in oe)Oe.call(oe,ze)&&!ge.hasOwnProperty(ze)&&(Se[ze]=oe[ze]);if(N&&N.defaultProps){var Je=N.defaultProps;for(ze in Je)Se[ze]===void 0&&(Se[ze]=Je[ze])}if(Be||dt){var tt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Be&&et(Se,tt),dt&&xe(Se,tt)}return Fe(N,Be,dt,Pe,Ce,me.current,Se)}}var vt=g.ReactCurrentOwner,En=g.ReactDebugCurrentFrame;function Jt(N){if(N){var oe=N._owner,ce=ke(N.type,N._source,oe?oe.type:null);En.setExtraStackFrame(ce)}else En.setExtraStackFrame(null)}var qn;qn=!1;function wi(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function iu(){{if(vt.current){var N=F(vt.current.type);if(N)return`
26
26
 
27
- Check the render method of \``+N+"`."}return""}}function nm(N){{if(N!==void 0){var se=N.fileName.replace(/^.*[\\\/]/,""),ce=N.lineNumber;return`
27
+ Check the render method of \``+N+"`."}return""}}function am(N){{if(N!==void 0){var oe=N.fileName.replace(/^.*[\\\/]/,""),ce=N.lineNumber;return`
28
28
 
29
- Check your code at `+se+":"+ce+"."}return""}}var iu={};function rm(N){{var se=au();if(!se){var ce=typeof N=="string"?N:N.displayName||N.name;ce&&(se=`
29
+ Check your code at `+oe+":"+ce+"."}return""}}var su={};function im(N){{var oe=iu();if(!oe){var ce=typeof N=="string"?N:N.displayName||N.name;ce&&(oe=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return se}}function su(N,se){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var ce=rm(se);if(iu[ce])return;iu[ce]=!0;var De="";N&&N._owner&&N._owner!==vt.current&&(De=" It was passed a child from "+F(N._owner.type)+"."),Qt(N),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,De),Qt(null)}}function ou(N,se){{if(typeof N!="object")return;if(Ae(N))for(var ce=0;ce<N.length;ce++){var De=N[ce];Ci(De)&&su(De,se)}else if(Ci(N))N._store&&(N._store.validated=!0);else if(N){var Pe=b(N);if(typeof Pe=="function"&&Pe!==N.entries)for(var ze=Pe.call(N),Se;!(Se=ze.next()).done;)Ci(Se.value)&&su(Se.value,se)}}}function am(N){{var se=N.type;if(se==null||typeof se=="string")return;var ce;if(typeof se=="function")ce=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===h))ce=se.propTypes;else return;if(ce){var De=F(se);$e(ce,N.props,"prop",De,N)}else if(se.PropTypes!==void 0&&!qn){qn=!0;var Pe=F(se);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Pe||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function im(N){{for(var se=Object.keys(N.props),ce=0;ce<se.length;ce++){var De=se[ce];if(De!=="children"&&De!=="key"){Qt(N),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),Qt(null);break}}N.ref!==null&&(Qt(N),w("Invalid attribute `ref` supplied to `React.Fragment`."),Qt(null))}}function uu(N,se,ce,De,Pe,ze){{var Se=q(N);if(!Se){var Be="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Be+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var dt=nm(Pe);dt?Be+=dt:Be+=au();var Je;N===null?Je="null":Ae(N)?Je="array":N!==void 0&&N.$$typeof===t?(Je="<"+(F(N.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Je=typeof N,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Je,Be)}var tt=Mt(N,se,ce,Pe,ze);if(tt==null)return tt;if(Se){var At=se.children;if(At!==void 0)if(De)if(Ae(At)){for(var Un=0;Un<At.length;Un++)ou(At[Un],N);Object.freeze&&Object.freeze(At)}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 ou(At,N)}return N===r?im(tt):am(tt),tt}}function sm(N,se,ce){return uu(N,se,ce,!0)}function om(N,se,ce){return uu(N,se,ce,!1)}var um=om,lm=sm;yr.Fragment=r,yr.jsx=um,yr.jsxs=lm}()),yr}process.env.NODE_ENV==="production"?Ds.exports=vm():Ds.exports=bm();var c=Ds.exports;const Gc=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},sr=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Qc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,w=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var E=y.useMemo(function(){var A=function(q){var I=o.current,B=l.current;return o.current=l.current=null,i.current=q,u.current=d.current.apply(B,I)},D=function(q,I){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(q):setTimeout(q,I)},k=function(q){if(!h.current)return!1;var I=q-a.current;return!a.current||I>=t||I<0||b&&q-i.current>=w},j=function(q){return s.current=null,f&&o.current?A(q):(o.current=l.current=null,u.current)},L=function q(){var I=Date.now();if(k(I))return j(I);if(h.current){var B=t-(I-a.current),F=b?Math.min(B,w-(I-i.current)):B;D(q,F)}},M=function(){if(p||g){var q=Date.now(),I=k(q);if(o.current=[].slice.call(arguments),l.current=r,a.current=q,I){if(!s.current&&h.current)return i.current=a.current,D(L,t),v?A(a.current):u.current;if(b)return D(L,t),A(a.current)}return s.current||D(L,t),u.current}};return M.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?j(Date.now()):u.current},M},[v,b,t,w,f,m,p,g]);return E}function Jc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Qc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let wi;const In=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(wi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=Jc(()=>{s()!==r&&(t&&(clearTimeout(wi),document.body.classList.add("is-resizing"),wi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Xc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Jc(()=>{l()},250);return a},no=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);sr(()=>{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)},ro=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const fu={},$n=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=ae.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),v=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:w=!1,hasForm:E=!1}=t,{onOpen:A=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...j}=l,L=fu[p];y.useEffect(()=>{const B=v==null?void 0:v.current;if(B)return B.addEventListener("transitionend",M),()=>{B.removeEventListener("transitionend",M)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const M=({propertyName:B})=>{B==="opacity"&&(L!==!1&&clearTimeout(L),b(F=>(F==="open"?A():F==="closed"&&D(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};sr(()=>{L!==!1&&clearTimeout(L);let B="open";n?b("opening"):(b("closing"),B="hidden"),fu[p||""]=setTimeout(()=>{b(B)},300)},[n]);const q={"aria-live":"polite",...u,...j};s&&s.onBlur&&(q.onBlur=s.onBlur);const I={className:"content"};return k?I.className=K("content",{hidden:f==="hidden"}):I.hidden=f==="hidden",c.jsx("aside",{ref:v,id:p,className:K("tooltip text-medium",f,i,{loading:r,"extra-padding":g,"has-pointer":w,bottom:w==="bottom","has-form":E}),...q,children:c.jsx("div",{...I,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Gr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=An(e);return t.forEach(({type:r,value:a})=>{cm(n,r,a)}),n},ed=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},td=(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},nd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),rd=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),ad=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),ym=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Zt="https://storage.googleapis.com/apolitical-assets/",Gn={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"},Cs="SU:",Ir="DELETED",id="Invalid token error: Logging user out...",xm="200,000+",Dm="160+",$r=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,sd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Cm(e){return e?{"--icon":`url(${Zt}icons/${e}.svg)`}:{}}const kn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},od=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),ao=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ws=e=>{let t;const n=Ra(),r=Ra(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/kn.milliseconds.inHour,i=Math.floor(t/kn.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<=kn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/kn.year.days)}},Ra=e=>{const n=(e||new Date).toUTCString();return new Date(n)},wm=(e,t,n)=>{let r;const a=Ra(),i=Ra(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/kn.milliseconds.inSecond<=t;case"minutes":return r/kn.milliseconds.inMinute<=t;case"hours":return r/kn.milliseconds.inHour<=t}return!1},Em=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},_m=e=>new Promise(t=>setTimeout(t,e)),km=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},hr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+ce+">.")}return oe}}function ou(N,oe){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var ce=im(oe);if(su[ce])return;su[ce]=!0;var Ce="";N&&N._owner&&N._owner!==vt.current&&(Ce=" It was passed a child from "+F(N._owner.type)+"."),Jt(N),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,Ce),Jt(null)}}function uu(N,oe){{if(typeof N!="object")return;if(Ae(N))for(var ce=0;ce<N.length;ce++){var Ce=N[ce];wi(Ce)&&ou(Ce,oe)}else if(wi(N))N._store&&(N._store.validated=!0);else if(N){var Pe=b(N);if(typeof Pe=="function"&&Pe!==N.entries)for(var ze=Pe.call(N),Se;!(Se=ze.next()).done;)wi(Se.value)&&ou(Se.value,oe)}}}function sm(N){{var oe=N.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===h))ce=oe.propTypes;else return;if(ce){var Ce=F(oe);$e(ce,N.props,"prop",Ce,N)}else if(oe.PropTypes!==void 0&&!qn){qn=!0;var Pe=F(oe);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Pe||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function om(N){{for(var oe=Object.keys(N.props),ce=0;ce<oe.length;ce++){var Ce=oe[ce];if(Ce!=="children"&&Ce!=="key"){Jt(N),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ce),Jt(null);break}}N.ref!==null&&(Jt(N),C("Invalid attribute `ref` supplied to `React.Fragment`."),Jt(null))}}function lu(N,oe,ce,Ce,Pe,ze){{var Se=z(N);if(!Se){var Be="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Be+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var dt=am(Pe);dt?Be+=dt:Be+=iu();var Je;N===null?Je="null":Ae(N)?Je="array":N!==void 0&&N.$$typeof===t?(Je="<"+(F(N.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Je=typeof N,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Je,Be)}var tt=Mt(N,oe,ce,Pe,ze);if(tt==null)return tt;if(Se){var At=oe.children;if(At!==void 0)if(Ce)if(Ae(At)){for(var Un=0;Un<At.length;Un++)uu(At[Un],N);Object.freeze&&Object.freeze(At)}else C("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 uu(At,N)}return N===r?om(tt):sm(tt),tt}}function um(N,oe,ce){return lu(N,oe,ce,!0)}function lm(N,oe,ce){return lu(N,oe,ce,!1)}var cm=lm,dm=um;yr.Fragment=r,yr.jsx=cm,yr.jsxs=dm}()),yr}process.env.NODE_ENV==="production"?Ds.exports=ym():Ds.exports=xm();var c=Ds.exports;const Qc=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},sr=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Jc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,C=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var D=y.useMemo(function(){var A=function(z){var R=o.current,B=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(B,R)},E=function(z,R){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(z):setTimeout(z,R)},k=function(z){if(!h.current)return!1;var R=z-a.current;return!a.current||R>=t||R<0||b&&z-i.current>=C},S=function(z){return s.current=null,f&&o.current?A(z):(o.current=l.current=null,u.current)},$=function z(){var R=Date.now();if(k(R))return S(R);if(h.current){var B=t-(R-a.current),F=b?Math.min(B,C-(R-i.current)):B;E(z,F)}},M=function(){if(p||g){var z=Date.now(),R=k(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,R){if(!s.current&&h.current)return i.current=a.current,E($,t),v?A(a.current):u.current;if(b)return E($,t),A(a.current)}return s.current||E($,t),u.current}};return M.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?S(Date.now()):u.current},M},[v,b,t,C,f,m,p,g]);return D}function Xc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Jc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Ei;const Rn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Ei),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=Xc(()=>{s()!==r&&(t&&(clearTimeout(Ei),document.body.classList.add("is-resizing"),Ei=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},ed=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Xc(()=>{l()},250);return a},ro=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);sr(()=>{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)},ao=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const hu={},$n=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=ie.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),v=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:C=!1,hasForm:D=!1}=t,{onOpen:A=()=>{},onClose:E=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...S}=l,$=hu[p];y.useEffect(()=>{const B=v==null?void 0:v.current;if(B)return B.addEventListener("transitionend",M),()=>{B.removeEventListener("transitionend",M)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const M=({propertyName:B})=>{B==="opacity"&&($!==!1&&clearTimeout($),b(F=>(F==="open"?A():F==="closed"&&E(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};sr(()=>{$!==!1&&clearTimeout($);let B="open";n?b("opening"):(b("closing"),B="hidden"),hu[p||""]=setTimeout(()=>{b(B)},300)},[n]);const z={"aria-live":"polite",...u,...S};s&&s.onBlur&&(z.onBlur=s.onBlur);const R={className:"content"};return k?R.className=K("content",{hidden:f==="hidden"}):R.hidden=f==="hidden",c.jsx("aside",{ref:v,id:p,className:K("tooltip text-medium",f,i,{loading:r,"extra-padding":g,"has-pointer":C,bottom:C==="bottom","has-form":D}),...z,children:c.jsx("div",{...R,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Qr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=It(e);return t.forEach(({type:r,value:a})=>{fm(n,r,a)}),n},td=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},nd=(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},rd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ad=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),id=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Cm=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Yt="https://storage.googleapis.com/apolitical-assets/",Gn={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"},ws="SU:",$r="DELETED",sd="Invalid token error: Logging user out...",Dm="200,000+",wm="160+",Lr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,od=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Em(e){return e?{"--icon":`url(${Yt}icons/${e}.svg)`}:{}}const Fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},ud=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),io=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Es=e=>{let t;const n=Ra(),r=Ra(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)}},Ra=e=>{const n=(e||new Date).toUTCString();return new Date(n)},_m=(e,t,n)=>{let r;const a=Ra(),i=Ra(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},km=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Fm=e=>new Promise(t=>setTimeout(t,e)),Am=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},hr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_title_error:"Please enter a title and body for your article.",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",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_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allowMultipleVotes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Fm={...hr,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>"},Am={...hr,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"},Bm={...hr,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>"},Tm=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:Fm,fr:Am,pt:Bm},Symbol.toStringTag,{value:"Module"})),si=(e,t=hr)=>e in t,Nt=(e,t,n,r,a={})=>{let i="";return si(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Sm=(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},ka=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),ud=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},jm=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},Om=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Ir).replace(/{{id}}/g,Ir):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),ld=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match($r);if(!a)return e;for(const s of a){const o=s.replace($r,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(Cs))try{const h=d.replace(Cs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:v}=p;u.name=v||m||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Om(e,u,t):s)}return e},io=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},cd=e=>new URLSearchParams(window.location.search).get(e),Ia=(e="")=>e.replace(/\s+/g,"").length>0,Es=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const v=In(typeof t=="object"),{showTooltip:f,tooltipProps:b}=ro(!!u);if(typeof t=="object"&&typeof v=="number"){const A=Object.assign({},t),D=ed(Object.keys(A));t=td(v,D,A)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const w={...p,className:K(e,o,g,{"no-text":!h,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:A=>{(!a||a[0]==="#")&&s&&(A.preventDefault(),A.stopPropagation()),s&&s(A)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const E=y.createElement(i,w,h||(d?c.jsx(Oe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx($n,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),E]}):E},mr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:K("button-wrapper",n),...r,children:i})};const $t=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:K(e,{"has-max-width":t}),style:n})},hu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},Pm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?hu[e]:hu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Mm=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},Ei=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Mm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Ln=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=Pm(e),v=Ei({format:"avif",query:s,range:p,url:o}),f=Ei({format:"webp",query:s,range:p,url:o}),b=Ei({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Nm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(Ln,{image:{...e},className:"image"})}),bn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:K("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const dd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:K("popover",e),"aria-live":"polite",children:t})}),pr=({parent:e=document.body,children:t})=>typeof document=="object"?Hc.createPortal(t,e):null,Rm=Object.freeze(Object.defineProperty({__proto__:null,default:pr},Symbol.toStringTag,{value:"Module"}));const Im=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Oe,{children:c.jsx(ae.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:K("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:K("line",{active:a<e})})]},r)})})})]});const $m=({elementId:e,offset:t=20})=>{const n=ae.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Lm=({items:e,className:t="",...n})=>c.jsx("ul",{className:K("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),mu=300,pu="ease-in-out";class zm{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:mu,easing:pu}),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:mu,easing:pu}),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 oi=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ae.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new zm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:K("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},gu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},qm=e=>{let t=e;return Object.keys(gu).includes(e)&&(t=gu[e]),`url(${Zt}icons/${t}.svg)`};const vu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},fd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ae.useIntl(),i=t?{"--custom-icon":qm(t)}:{},s=si(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:K("content-type-label text-small",e in vu?vu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Et=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Zt}icons/${t}.svg)`}:{};return c.jsx("div",{className:K("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const yn=({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=In(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=ed(Object.keys(h));a=td(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Et,{variant:"subtle",className:K("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Ht,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const _s=({children:e,...t})=>c.jsx("p",{...t,children:e}),hd={q:_s,blockquote:_s};for(let e=1;e<=6;e++)hd[`h${e}`]={component:_s,props:{className:"title"}};const md=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:K("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Ht,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:hd},children:r}):c.jsx("p",{children:r})]});const pd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ae.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",form_multipleInputs_label:"Input {number}",form_multipleInputs_filledInCount:"{number}/{total}",form_multipleInputs_filledInCount_aria:"{number} out of {total} available inputs have been filled in",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_title_error:"Please enter a title and body for your article.",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",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_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allowMultipleVotes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Bm={...hr,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>"},Tm={...hr,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"},Sm={...hr,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>"},jm=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:Bm,fr:Tm,pt:Sm},Symbol.toStringTag,{value:"Module"})),oi=(e,t=hr)=>e in t,Nt=(e,t,n,r,a={})=>{let i="";return oi(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Om=(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},Fa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),ld=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Pm=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},Mm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,$r).replace(/{{id}}/g,$r):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),cd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Lr);if(!a)return e;for(const s of a){const o=s.replace(Lr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(ws))try{const h=d.replace(ws,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:v}=p;u.name=v||m||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Mm(e,u,t):s)}return e},so=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},dd=e=>new URLSearchParams(window.location.search).get(e),$a=(e="")=>e.replace(/\s+/g,"").length>0,_s=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const v=Rn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=ao(!!u);if(typeof t=="object"&&typeof v=="number"){const A=Object.assign({},t),E=td(Object.keys(A));t=nd(v,E,A)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const C={...p,className:K(e,o,g,{"no-text":!h,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:A=>{(!a||a[0]==="#")&&s&&(A.preventDefault(),A.stopPropagation()),s&&s(A)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",C.href=a);const D=y.createElement(i,C,h||(d?c.jsx(je,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx($n,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),D]}):D},mr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:K("button-wrapper",n),...r,children:i})};const Lt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:K(e,{"has-max-width":t}),style:n})},mu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},Nm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?mu[e]:mu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Im=({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},_i=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Im({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Ln=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=Nm(e),v=_i({format:"avif",query:s,range:p,url:o}),f=_i({format:"webp",query:s,range:p,url:o}),b=_i({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Rm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(Ln,{image:{...e},className:"image"})}),yn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:K("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const fd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:K("popover",e),"aria-live":"polite",children:t})}),pr=({parent:e=document.body,children:t})=>typeof document=="object"?Kc.createPortal(t,e):null,$m=Object.freeze(Object.defineProperty({__proto__:null,default:pr},Symbol.toStringTag,{value:"Module"}));const Lm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(je,{children:c.jsx(ie.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:K("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:K("line",{active:a<e})})]},r)})})})]});const zm=({elementId:e,offset:t=20})=>{const n=ie.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const qm=({items:e,className:t="",...n})=>c.jsx("ul",{className:K("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),pu=300,gu="ease-in-out";class Um{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:pu,easing:gu}),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:pu,easing:gu}),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 ui=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ie.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Um(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:K("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},vu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Wm=e=>{let t=e;return Object.keys(vu).includes(e)&&(t=vu[e]),`url(${Yt}icons/${t}.svg)`};const bu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},hd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ie.useIntl(),i=t?{"--custom-icon":Wm(t)}:{},s=oi(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:K("content-type-label text-small",e in bu?bu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Et=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Yt}icons/${t}.svg)`}:{};return c.jsx("div",{className:K("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const xn=({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=Rn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=td(Object.keys(h));a=nd(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Et,{variant:"subtle",className:K("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Kt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ks=({children:e,...t})=>c.jsx("p",{...t,children:e}),md={q:ks,blockquote:ks};for(let e=1;e<=6;e++)md[`h${e}`]={component:ks,props:{className:"title"}};const pd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:K("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Kt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:md},children:r}):c.jsx("p",{children:r})]});const gd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ie.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
36
  `);h(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const v=({propertyName:b})=>{b==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(p);return c.jsxs(Et,{variant:"subtle",className:K("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:K("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:K({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Um=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:K("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${Zt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Ht,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Ht,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Ht,{options:d,children:l.text}):l.text},u)})})},ut=()=>y.Fragment,Wm=({children:e})=>c.jsx(Et,{variant:"secondary",children:e}),Vm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Hm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Km=({children:e})=>{const t=ae.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Hm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(oi,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Zm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Et,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Et,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Et,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},Tt=({children:e})=>c.jsx(c.Fragment,{children:e}),Ym=e=>{const t=ae.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},bu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Gm=({children:e,...t})=>{const n=ae.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||bu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&bu(a)==="button"&&(i=!0);else break}const s=`@${Ir}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},ks=({children:e,...t})=>c.jsx("span",{className:K({url:t==null?void 0:t.href}),children:e});const Qm={default:{a:Gm,CollapsibleSection:oi,TextBox:Et,CaseStudy:Wm,style:ut,details:Km,div:Zm,iframe:Ym,center:Vm},"text-only":{h1:ut,h2:ut,h3:ut,h4:ut,h5:ut,h6:ut,style:ut,details:ut,div:ut,TextBox:ut,CollapsibleSection:ut,CaseStudy:ut,blockquote:ut,iframe:ut,button:ut}},jn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=Qm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:K("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Ht,{options:{...o,...n,overrides:l},children:r})})};const gd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:K("page-heading",a),children:[c.jsxs("div",{className:K("content",{"has-max-width":e}),style:i,children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Kt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Zt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=ro(!!a),h={},p=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,m=a?typeof a=="string"?a:a.text:void 0;a&&p&&(h["aria-describedby"]=p);const v=y.createElement(a?"button":s,{className:K("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...h,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx($n,{id:p,isOpen:u,children:m})]})):v};const or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:K("status-banner text-small",n),"aria-live":"assertive"},t),so=y.createContext({badges:[],isLoading:!0});function vd(){return y.useContext(so)}const bd=({children:e,badges:t})=>c.jsx(so.Provider,{value:t,children:e}),yd=({showDevTools:e=!0,children:t})=>{const n=new We.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(We.QueryClientProvider,{client:n,children:[t,e&&c.jsx(dm.ReactQueryDevtools,{initialIsOpen:!1})]})};var Jm=y.createContext({client:_a});function Xm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(_a.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),_a.init(r,a)),_a)},[n,r]);return y.createElement(Jm.Provider,{value:{client:i}},t)}const xd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Xm,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Dd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Dd||{});const Cd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Tm[r],...n||{}};return c.jsx(ae.IntlProvider,{locale:r,messages:a,children:e})},oo=y.createContext({}),Fa={en:"English",es:"Español",fr:"Français",pt:"Português"},at=y.createContext({isLoading:!0});function ui(){return y.useContext(at)}const wd=({children:e,user:t,updateDetails:n})=>c.jsx(at.Provider,{value:{...t,updateDetails:n},children:e}),uo=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Ed=()=>y.useContext(uo),_d=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(uo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},ep=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),ud(5e3)}).catch(p=>{p.message===id&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(oo.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(Cd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(to.CookiesProvider,{children:c.jsx(wd,{user:a,updateDetails:i,children:c.jsx(bd,{badges:s,children:c.jsx(_d,{children:c.jsx(yd,{showDevTools:r,children:c.jsx(xd,{user:a,children:t})})})})})})})})},tp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const kd=({slug:e})=>{const{badges:t}=vd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Kt,{className:K("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&tp[a],element:"li",tooltip:s,children:r})};var lt=(e=>(e.Communities="communities",e.Platform="platform",e))(lt||{});const Fd=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(kd,{slug:s},o))}))})};const np=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ae.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:K(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Oe,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},lo=y.memo(np);const _i="loadingBlock_",rp=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ae.useIntl();t||(t={0:{text:r.formatMessage({id:`${_i}loading`})},75:{text:r.formatMessage({id:`${_i}almostDone`})},100:{text:r.formatMessage({id:`${_i}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Zt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Et,{className:K("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(lo,{progress:e})]})},Ad=y.memo(rp);const Pt=({element:e="div",className:t="",...n})=>c.jsx(ii,{element:e,className:K("loading-placeholder",t),...n});const Fs={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Bd=(e,t)=>e in Fs?c.jsx("div",{className:e,children:Fs[e].map((n,r)=>Bd(n,r))},t):c.jsx(Pt,{className:e},t),li=({layout:e="overview-page",...t})=>c.jsx("div",{className:K("loading-state",e),...t,children:Fs[e].map((n,r)=>Bd(n,r))}),Td=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):""},na=["#5AB6A3","#A2D7AF","#806056","#3962B3"],ap=e=>{const t=Math.ceil(26/na.length),n=Td(e).toLowerCase();if(n==="")return na[0];const r=n.charCodeAt(0)-96;for(let a=0;a<na.length;a++)if(r<=t*(a+1))return na[a]};const yu=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=yu,height:i=yu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const v=m.getContext("2d");if(!v)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=ap(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(Td(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:K("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var nt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(nt||{});const ci=e=>e==="apolitical"?{image:`${Zt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},ip=({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=ir(l,r)),l};const sp=y.lazy(()=>Promise.resolve().then(()=>Rm)),op=y.lazy(()=>Promise.resolve().then(()=>S_));let ra=null;const nn=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var F,P,O,U,W;const h=ae.useIntl(),{profile:p,...m}=i,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=a,w=y.useContext(at),E=p&&w&&typeof w.id=="string",[A,D]=y.useState(!1),k=ci(t);k.name||(k.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:j,image:L}=k;let{url:M}=k;typeof t=="object"&&t.link!==void 0&&(t.link===!1?M=void 0:M=t.link);const q=ip(k),I=r&&r.createdAt?ws(r.createdAt):!1,B=r&&r.createdAt?ao(r.createdAt):"";return y.createElement(e,{...d,className:K("member text-medium",v,f,l,{"has-profile-link":E}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(bn,{href:M,gtmType:o,gtmContext:s,onClick:ie=>{if(ie==null||ie.preventDefault(),ie==null||ie.stopPropagation(),!M)return;ra&&clearTimeout(ra),ra=setTimeout(()=>{window.location.href=M},150);const te=new CustomEvent(nt.MEMBER_CLICKED,{detail:{link:M,timeout:ra}});document.dispatchEvent(te)},children:[c.jsx(sn,{name:j,src:L,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:K("name",{"new-line":g}),"data-testid":"member-name",children:[c.jsx("span",{children:j}),(u==null?void 0:u.showBadges)&&(k==null?void 0:k.badges)&&c.jsx(Fd,{userBadges:k.badges,badgeOptions:u}),r&&c.jsxs("span",{className:K("additional-content",{"new-line":g}),children:[r.createdAt&&I&&!((F=r==null?void 0:r.customMessage)!=null&&F.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:h.formatMessage({id:`dates_${I.path}`},{number:I.number})}),r.createdAt&&I&&((P=r==null?void 0:r.customMessage)==null?void 0:P.text)&&c.jsx("span",{children:h.formatMessage({id:(O=r.customMessage)==null?void 0:O.text},{time:h.formatMessage({id:`dates_${I.path}`},{number:I.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:ie=>{var te,C;return c.jsx("a",{href:`${(C=(te=r.customMessage)==null?void 0:te.link)==null?void 0:C.url}`,onClick:X=>X.stopPropagation(),children:ie})}})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),q&&!g&&c.jsx("small",{className:K({"text-medium":v==="large"}),"data-testid":"member-details",children:b?q:c.jsxs(c.Fragment,{children:[k.role,k.organisation?` — ${k.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:k.country})]})})]})]}),q&&p&&E?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),D(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(sp,{children:c.jsx(op,{form:p,showModal:A,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{D(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},up=Object.freeze(Object.defineProperty({__proto__:null,default:nn},Symbol.toStringTag,{value:"Module"}));const xu={small:24,medium:48},co=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const h=ae.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:K("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let v,f="";if(m<o){const{name:b="",image:g=""}=ci(p);if(s)return c.jsx(Pt,{element:"li",className:"contributor"},m);v=c.jsx(sn,{name:b,src:g,width:xu[a||"medium"],height:xu[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:K({"large-number":b>99}),children:["+",Sm(b,0)]}),f="number-left"}return v?c.jsx("li",{className:K("contributor",f),children:v},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):ir(n[0].name||"",20):l||null})]})})};const fo=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:K("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var As={exports:{}},aa={exports:{}},Re={};/** @license React v16.13.1
37
+ `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const v=({propertyName:b})=>{b==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(p);return c.jsxs(Et,{variant:"subtle",className:K("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:K("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Kt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:K({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Vm=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:K("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${Yt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Kt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Kt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Kt,{options:d,children:l.text}):l.text},u)})})},ut=()=>y.Fragment,Hm=({children:e})=>c.jsx(Et,{variant:"secondary",children:e}),Km=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Zm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Ym=({children:e})=>{const t=ie.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Zm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(ui,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Gm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Et,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Et,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Et,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},Tt=({children:e})=>c.jsx(c.Fragment,{children:e}),Qm=e=>{const t=ie.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(je,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},yu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Jm=({children:e,...t})=>{const n=ie.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||yu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&yu(a)==="button"&&(i=!0);else break}const s=`@${$r}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Fs=({children:e,...t})=>c.jsx("span",{className:K({url:t==null?void 0:t.href}),children:e});const Xm={default:{a:Jm,CollapsibleSection:ui,TextBox:Et,CaseStudy:Hm,style:ut,details:Ym,div:Gm,iframe:Qm,center:Km},"text-only":{h1:ut,h2:ut,h3:ut,h4:ut,h5:ut,h6:ut,style:ut,details:ut,div:ut,TextBox:ut,CollapsibleSection:ut,CaseStudy:ut,blockquote:ut,iframe:ut,button:ut}},jn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=Xm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:K("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Kt,{options:{...o,...n,overrides:l},children:r})})};const vd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:K("page-heading",a),children:[c.jsxs("div",{className:K("content",{"has-max-width":e}),style:i,children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Zt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Yt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=ao(!!a),h={},p=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,m=a?typeof a=="string"?a:a.text:void 0;a&&p&&(h["aria-describedby"]=p);const v=y.createElement(a?"button":s,{className:K("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...h,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx($n,{id:p,isOpen:u,children:m})]})):v};const or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:K("status-banner text-small",n),"aria-live":"assertive"},t),oo=y.createContext({badges:[],isLoading:!0});function bd(){return y.useContext(oo)}const yd=({children:e,badges:t})=>c.jsx(oo.Provider,{value:t,children:e}),xd=({showDevTools:e=!0,children:t})=>{const n=new We.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(We.QueryClientProvider,{client:n,children:[t,e&&c.jsx(hm.ReactQueryDevtools,{initialIsOpen:!1})]})};var ep=y.createContext({client:ka});function tp(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ka.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ka.init(r,a)),ka)},[n,r]);return y.createElement(ep.Provider,{value:{client:i}},t)}const Cd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(tp,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Dd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Dd||{});const wd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...jm[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:a,children:e})},uo=y.createContext({}),Aa={en:"English",es:"Español",fr:"Français",pt:"Português"},at=y.createContext({isLoading:!0});function li(){return y.useContext(at)}const Ed=({children:e,user:t,updateDetails:n})=>c.jsx(at.Provider,{value:{...t,updateDetails:n},children:e}),lo=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),_d=()=>y.useContext(lo),kd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(lo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},np=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),ld(5e3)}).catch(p=>{p.message===sd&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(uo.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(wd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(no.CookiesProvider,{children:c.jsx(Ed,{user:a,updateDetails:i,children:c.jsx(yd,{badges:s,children:c.jsx(kd,{children:c.jsx(xd,{showDevTools:r,children:c.jsx(Cd,{user:a,children:t})})})})})})})})},rp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Fd=({slug:e})=>{const{badges:t}=bd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Zt,{className:K("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&rp[a],element:"li",tooltip:s,children:r})};var lt=(e=>(e.Communities="communities",e.Platform="platform",e))(lt||{});const Ad=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Fd,{slug:s},o))}))})};const ap=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ie.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:K(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":je,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},co=y.memo(ap);const ki="loadingBlock_",ip=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${ki}loading`})},75:{text:r.formatMessage({id:`${ki}almostDone`})},100:{text:r.formatMessage({id:`${ki}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(${Yt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Et,{className:K("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(co,{progress:e})]})},Bd=y.memo(ip);const Pt=({element:e="div",className:t="",...n})=>c.jsx(si,{element:e,className:K("loading-placeholder",t),...n});const As={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Td=(e,t)=>e in As?c.jsx("div",{className:e,children:As[e].map((n,r)=>Td(n,r))},t):c.jsx(Pt,{className:e},t),ci=({layout:e="overview-page",...t})=>c.jsx("div",{className:K("loading-state",e),...t,children:As[e].map((n,r)=>Td(n,r))}),Sd=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):""},ra=["#5AB6A3","#A2D7AF","#806056","#3962B3"],sp=e=>{const t=Math.ceil(26/ra.length),n=Sd(e).toLowerCase();if(n==="")return ra[0];const r=n.charCodeAt(0)-96;for(let a=0;a<ra.length;a++)if(r<=t*(a+1))return ra[a]};const xu=256,on=({className:e="",src:t="",name:n,alt:r,width:a=xu,height:i=xu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const v=m.getContext("2d");if(!v)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=sp(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(Sd(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:K("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var nt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(nt||{});const di=e=>e==="apolitical"?{image:`${Yt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Yt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},op=({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=ir(l,r)),l};const up=y.lazy(()=>Promise.resolve().then(()=>$m)),lp=y.lazy(()=>Promise.resolve().then(()=>O_));let aa=null;const rn=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var F,P,j,U,W;const h=ie.useIntl(),{profile:p,...m}=i,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=a,C=y.useContext(at),D=p&&C&&typeof C.id=="string",[A,E]=y.useState(!1),k=di(t);k.name||(k.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:S,image:$}=k;let{url:M}=k;typeof t=="object"&&t.link!==void 0&&(t.link===!1?M=void 0:M=t.link);const z=op(k),R=r&&r.createdAt?Es(r.createdAt):!1,B=r&&r.createdAt?io(r.createdAt):"";return y.createElement(e,{...d,className:K("member text-medium",v,f,l,{"has-profile-link":D}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(yn,{href:M,gtmType:o,gtmContext:s,onClick:ne=>{if(ne==null||ne.preventDefault(),ne==null||ne.stopPropagation(),!M)return;aa&&clearTimeout(aa),aa=setTimeout(()=>{window.location.href=M},150);const re=new CustomEvent(nt.MEMBER_CLICKED,{detail:{link:M,timeout:aa}});document.dispatchEvent(re)},children:[c.jsx(on,{name:S,src:$,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:K("name",{"new-line":g}),"data-testid":"member-name",children:[c.jsx("span",{children:S}),(u==null?void 0:u.showBadges)&&(k==null?void 0:k.badges)&&c.jsx(Ad,{userBadges:k.badges,badgeOptions:u}),r&&c.jsxs("span",{className:K("additional-content",{"new-line":g}),children:[r.createdAt&&R&&!((F=r==null?void 0:r.customMessage)!=null&&F.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:h.formatMessage({id:`dates_${R.path}`},{number:R.number})}),r.createdAt&&R&&((P=r==null?void 0:r.customMessage)==null?void 0:P.text)&&c.jsx("span",{children:h.formatMessage({id:(j=r.customMessage)==null?void 0:j.text},{time:h.formatMessage({id:`dates_${R.path}`},{number:R.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:ne=>{var re,w;return c.jsx("a",{href:`${(w=(re=r.customMessage)==null?void 0:re.link)==null?void 0:w.url}`,onClick:Q=>Q.stopPropagation(),children:ne})}})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),z&&!g&&c.jsx("small",{className:K({"text-medium":v==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[k.role,k.organisation?` — ${k.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:k.country})]})})]})]}),z&&p&&D?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),E(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(up,{children:c.jsx(lp,{form:p,showModal:A,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{E(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},cp=Object.freeze(Object.defineProperty({__proto__:null,default:rn},Symbol.toStringTag,{value:"Module"}));const Cu={small:24,medium:48},fo=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const h=ie.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:K("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let v,f="";if(m<o){const{name:b="",image:g=""}=di(p);if(s)return c.jsx(Pt,{element:"li",className:"contributor"},m);v=c.jsx(on,{name:b,src:g,width:Cu[a||"medium"],height:Cu[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:K({"large-number":b>99}),children:["+",Om(b,0)]}),f="number-left"}return v?c.jsx("li",{className:K("contributor",f),children:v},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):ir(n[0].name||"",20):l||null})]})})};const ho=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:K("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var Bs={exports:{}},ia={exports:{}},Ie={};/** @license React v16.13.1
38
38
  * react-is.production.min.js
39
39
  *
40
40
  * Copyright (c) Facebook, Inc. and its affiliates.
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var Du;function lp(){if(Du)return Re;Du=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function E(D){if(typeof D=="object"&&D!==null){var k=D.$$typeof;switch(k){case t:switch(D=D.type,D){case l:case u:case r:case i:case a:case h:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case v:case m:case s:return D;default:return k}}case n:return k}}}function A(D){return E(D)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=d,Re.Fragment=r,Re.Lazy=v,Re.Memo=m,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=h,Re.isAsyncMode=function(D){return A(D)||E(D)===l},Re.isConcurrentMode=A,Re.isContextConsumer=function(D){return E(D)===o},Re.isContextProvider=function(D){return E(D)===s},Re.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},Re.isForwardRef=function(D){return E(D)===d},Re.isFragment=function(D){return E(D)===r},Re.isLazy=function(D){return E(D)===v},Re.isMemo=function(D){return E(D)===m},Re.isPortal=function(D){return E(D)===n},Re.isProfiler=function(D){return E(D)===i},Re.isStrictMode=function(D){return E(D)===a},Re.isSuspense=function(D){return E(D)===h},Re.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===u||D===i||D===a||D===h||D===p||typeof D=="object"&&D!==null&&(D.$$typeof===v||D.$$typeof===m||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===b||D.$$typeof===g||D.$$typeof===w||D.$$typeof===f)},Re.typeOf=E,Re}var Ie={};/** @license React v16.13.1
44
+ */var Du;function dp(){if(Du)return Ie;Du=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function D(E){if(typeof E=="object"&&E!==null){var k=E.$$typeof;switch(k){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case h:return E;default:switch(E=E&&E.$$typeof,E){case o:case d:case v:case m:case s:return E;default:return k}}case n:return k}}}function A(E){return D(E)===u}return Ie.AsyncMode=l,Ie.ConcurrentMode=u,Ie.ContextConsumer=o,Ie.ContextProvider=s,Ie.Element=t,Ie.ForwardRef=d,Ie.Fragment=r,Ie.Lazy=v,Ie.Memo=m,Ie.Portal=n,Ie.Profiler=i,Ie.StrictMode=a,Ie.Suspense=h,Ie.isAsyncMode=function(E){return A(E)||D(E)===l},Ie.isConcurrentMode=A,Ie.isContextConsumer=function(E){return D(E)===o},Ie.isContextProvider=function(E){return D(E)===s},Ie.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Ie.isForwardRef=function(E){return D(E)===d},Ie.isFragment=function(E){return D(E)===r},Ie.isLazy=function(E){return D(E)===v},Ie.isMemo=function(E){return D(E)===m},Ie.isPortal=function(E){return D(E)===n},Ie.isProfiler=function(E){return D(E)===i},Ie.isStrictMode=function(E){return D(E)===a},Ie.isSuspense=function(E){return D(E)===h},Ie.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===h||E===p||typeof E=="object"&&E!==null&&(E.$$typeof===v||E.$$typeof===m||E.$$typeof===s||E.$$typeof===o||E.$$typeof===d||E.$$typeof===b||E.$$typeof===g||E.$$typeof===C||E.$$typeof===f)},Ie.typeOf=D,Ie}var Re={};/** @license React v16.13.1
45
45
  * react-is.development.js
46
46
  *
47
47
  * Copyright (c) Facebook, Inc. and its affiliates.
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var Cu;function cp(){return Cu||(Cu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function E(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===p||typeof Q=="object"&&Q!==null&&(Q.$$typeof===v||Q.$$typeof===m||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===d||Q.$$typeof===b||Q.$$typeof===g||Q.$$typeof===w||Q.$$typeof===f)}function A(Q){if(typeof Q=="object"&&Q!==null){var me=Q.$$typeof;switch(me){case t:var pe=Q.type;switch(pe){case l:case u:case r:case i:case a:case h:return pe;default:var ke=pe&&pe.$$typeof;switch(ke){case o:case d:case v:case m:case s:return ke;default:return me}}case n:return me}}}var D=l,k=u,j=o,L=s,M=t,q=d,I=r,B=v,F=m,P=n,O=i,U=a,W=h,ie=!1;function te(Q){return ie||(ie=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(Q)||A(Q)===l}function C(Q){return A(Q)===u}function X(Q){return A(Q)===o}function ue(Q){return A(Q)===s}function _(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function T(Q){return A(Q)===d}function $(Q){return A(Q)===r}function S(Q){return A(Q)===v}function z(Q){return A(Q)===m}function Y(Q){return A(Q)===n}function G(Q){return A(Q)===i}function re(Q){return A(Q)===a}function le(Q){return A(Q)===h}Ie.AsyncMode=D,Ie.ConcurrentMode=k,Ie.ContextConsumer=j,Ie.ContextProvider=L,Ie.Element=M,Ie.ForwardRef=q,Ie.Fragment=I,Ie.Lazy=B,Ie.Memo=F,Ie.Portal=P,Ie.Profiler=O,Ie.StrictMode=U,Ie.Suspense=W,Ie.isAsyncMode=te,Ie.isConcurrentMode=C,Ie.isContextConsumer=X,Ie.isContextProvider=ue,Ie.isElement=_,Ie.isForwardRef=T,Ie.isFragment=$,Ie.isLazy=S,Ie.isMemo=z,Ie.isPortal=Y,Ie.isProfiler=G,Ie.isStrictMode=re,Ie.isSuspense=le,Ie.isValidElementType=E,Ie.typeOf=A}()),Ie}var wu;function Sd(){return wu||(wu=1,process.env.NODE_ENV==="production"?aa.exports=lp():aa.exports=cp()),aa.exports}/*
51
+ */var wu;function fp(){return wu||(wu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function D(X){return typeof X=="string"||typeof X=="function"||X===r||X===u||X===i||X===a||X===h||X===p||typeof X=="object"&&X!==null&&(X.$$typeof===v||X.$$typeof===m||X.$$typeof===s||X.$$typeof===o||X.$$typeof===d||X.$$typeof===b||X.$$typeof===g||X.$$typeof===C||X.$$typeof===f)}function A(X){if(typeof X=="object"&&X!==null){var pe=X.$$typeof;switch(pe){case t:var fe=X.type;switch(fe){case l:case u:case r:case i:case a:case h:return fe;default:var ke=fe&&fe.$$typeof;switch(ke){case o:case d:case v:case m:case s:return ke;default:return pe}}case n:return pe}}}var E=l,k=u,S=o,$=s,M=t,z=d,R=r,B=v,F=m,P=n,j=i,U=a,W=h,ne=!1;function re(X){return ne||(ne=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),w(X)||A(X)===l}function w(X){return A(X)===u}function Q(X){return A(X)===o}function se(X){return A(X)===s}function _(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function O(X){return A(X)===d}function q(X){return A(X)===r}function T(X){return A(X)===v}function L(X){return A(X)===m}function G(X){return A(X)===n}function Y(X){return A(X)===i}function te(X){return A(X)===a}function le(X){return A(X)===h}Re.AsyncMode=E,Re.ConcurrentMode=k,Re.ContextConsumer=S,Re.ContextProvider=$,Re.Element=M,Re.ForwardRef=z,Re.Fragment=R,Re.Lazy=B,Re.Memo=F,Re.Portal=P,Re.Profiler=j,Re.StrictMode=U,Re.Suspense=W,Re.isAsyncMode=re,Re.isConcurrentMode=w,Re.isContextConsumer=Q,Re.isContextProvider=se,Re.isElement=_,Re.isForwardRef=O,Re.isFragment=q,Re.isLazy=T,Re.isMemo=L,Re.isPortal=G,Re.isProfiler=Y,Re.isStrictMode=te,Re.isSuspense=le,Re.isValidElementType=D,Re.typeOf=A}()),Re}var Eu;function jd(){return Eu||(Eu=1,process.env.NODE_ENV==="production"?ia.exports=dp():ia.exports=fp()),ia.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var ki,Eu;function dp(){if(Eu)return ki;Eu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ki=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},ki}var Fi,_u;function ho(){if(_u)return Fi;_u=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Fi=e,Fi}var Ai,ku;function jd(){return ku||(ku=1,Ai=Function.call.bind(Object.prototype.hasOwnProperty)),Ai}var Bi,Fu;function fp(){if(Fu)return Bi;Fu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ho(),n={},r=jd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var h;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[d](s,d,l,o,null,t)}catch(v){h=v}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Bi=a,Bi}var Ti,Au;function hp(){if(Au)return Ti;Au=1;var e=Sd(),t=dp(),n=ho(),r=jd(),a=fp(),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 Ti=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(C){var X=C&&(u&&C[u]||C[d]);if(typeof X=="function")return X}var p="<<anonymous>>",m={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:w(),arrayOf:E,element:A(),elementType:D(),instanceOf:k,node:q(),objectOf:L,oneOf:j,oneOfType:M,shape:B,exact:F};function v(C,X){return C===X?C!==0||1/C===1/X:C!==C&&X!==X}function f(C,X){this.message=C,this.data=X&&typeof X=="object"?X:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var X={},ue=0;function _($,S,z,Y,G,re,le){if(Y=Y||p,re=re||z,le!==n){if(l){var Q=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw Q.name="Invariant Violation",Q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var me=Y+":"+z;!X[me]&&ue<3&&(i("You are manually calling a React.PropTypes validation function for the `"+re+"` prop on `"+Y+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),X[me]=!0,ue++)}}return S[z]==null?$?S[z]===null?new f("The "+G+" `"+re+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new f("The "+G+" `"+re+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:C(S,z,Y,G,re)}var T=_.bind(null,!1);return T.isRequired=_.bind(null,!0),T}function g(C){function X(ue,_,T,$,S,z){var Y=ue[_],G=U(Y);if(G!==C){var re=W(Y);return new f("Invalid "+$+" `"+S+"` of type "+("`"+re+"` supplied to `"+T+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(X)}function w(){return b(s)}function E(C){function X(ue,_,T,$,S){if(typeof C!="function")return new f("Property `"+S+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var z=ue[_];if(!Array.isArray(z)){var Y=U(z);return new f("Invalid "+$+" `"+S+"` of type "+("`"+Y+"` supplied to `"+T+"`, expected an array."))}for(var G=0;G<z.length;G++){var re=C(z,G,T,$,S+"["+G+"]",n);if(re instanceof Error)return re}return null}return b(X)}function A(){function C(X,ue,_,T,$){var S=X[ue];if(!o(S)){var z=U(S);return new f("Invalid "+T+" `"+$+"` of type "+("`"+z+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(C)}function D(){function C(X,ue,_,T,$){var S=X[ue];if(!e.isValidElementType(S)){var z=U(S);return new f("Invalid "+T+" `"+$+"` of type "+("`"+z+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(C)}function k(C){function X(ue,_,T,$,S){if(!(ue[_]instanceof C)){var z=C.name||p,Y=te(ue[_]);return new f("Invalid "+$+" `"+S+"` of type "+("`"+Y+"` supplied to `"+T+"`, expected ")+("instance of `"+z+"`."))}return null}return b(X)}function j(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function X(ue,_,T,$,S){for(var z=ue[_],Y=0;Y<C.length;Y++)if(v(z,C[Y]))return null;var G=JSON.stringify(C,function(le,Q){var me=W(Q);return me==="symbol"?String(Q):Q});return new f("Invalid "+$+" `"+S+"` of value `"+String(z)+"` "+("supplied to `"+T+"`, expected one of "+G+"."))}return b(X)}function L(C){function X(ue,_,T,$,S){if(typeof C!="function")return new f("Property `"+S+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var z=ue[_],Y=U(z);if(Y!=="object")return new f("Invalid "+$+" `"+S+"` of type "+("`"+Y+"` supplied to `"+T+"`, expected an object."));for(var G in z)if(r(z,G)){var re=C(z,G,T,$,S+"."+G,n);if(re instanceof Error)return re}return null}return b(X)}function M(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var X=0;X<C.length;X++){var ue=C[X];if(typeof ue!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ie(ue)+" at index "+X+"."),s}function _(T,$,S,z,Y){for(var G=[],re=0;re<C.length;re++){var le=C[re],Q=le(T,$,S,z,Y,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&G.push(Q.data.expectedType)}var me=G.length>0?", expected one of type ["+G.join(", ")+"]":"";return new f("Invalid "+z+" `"+Y+"` supplied to "+("`"+S+"`"+me+"."))}return b(_)}function q(){function C(X,ue,_,T,$){return P(X[ue])?null:new f("Invalid "+T+" `"+$+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(C)}function I(C,X,ue,_,T){return new f((C||"React class")+": "+X+" type `"+ue+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function B(C){function X(ue,_,T,$,S){var z=ue[_],Y=U(z);if(Y!=="object")return new f("Invalid "+$+" `"+S+"` of type `"+Y+"` "+("supplied to `"+T+"`, expected `object`."));for(var G in C){var re=C[G];if(typeof re!="function")return I(T,$,S,G,W(re));var le=re(z,G,T,$,S+"."+G,n);if(le)return le}return null}return b(X)}function F(C){function X(ue,_,T,$,S){var z=ue[_],Y=U(z);if(Y!=="object")return new f("Invalid "+$+" `"+S+"` of type `"+Y+"` "+("supplied to `"+T+"`, expected `object`."));var G=t({},ue[_],C);for(var re in G){var le=C[re];if(r(C,re)&&typeof le!="function")return I(T,$,S,re,W(le));if(!le)return new f("Invalid "+$+" `"+S+"` key `"+re+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(ue[_],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var Q=le(z,re,T,$,S+"."+re,n);if(Q)return Q}return null}return b(X)}function P(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(P);if(C===null||o(C))return!0;var X=h(C);if(X){var ue=X.call(C),_;if(X!==C.entries){for(;!(_=ue.next()).done;)if(!P(_.value))return!1}else for(;!(_=ue.next()).done;){var T=_.value;if(T&&!P(T[1]))return!1}}else return!1;return!0;default:return!1}}function O(C,X){return C==="symbol"?!0:X?X["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&X instanceof Symbol:!1}function U(C){var X=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":O(X,C)?"symbol":X}function W(C){if(typeof C>"u"||C===null)return""+C;var X=U(C);if(X==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return X}function ie(C){var X=W(C);switch(X){case"array":case"object":return"an "+X;case"boolean":case"date":case"regexp":return"a "+X;default:return X}}function te(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},Ti}var Si,Bu;function mp(){if(Bu)return Si;Bu=1;var e=ho();function t(){}function n(){}return n.resetWarningCache=t,Si=function(){function r(s,o,l,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Si}if(process.env.NODE_ENV!=="production"){var pp=Sd(),gp=!0;As.exports=hp()(pp.isElement,gp)}else As.exports=mp()();var vp=As.exports;/*!
55
+ */var Fi,_u;function hp(){if(_u)return Fi;_u=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Fi=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Fi}var Ai,ku;function mo(){if(ku)return Ai;ku=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ai=e,Ai}var Bi,Fu;function Od(){return Fu||(Fu=1,Bi=Function.call.bind(Object.prototype.hasOwnProperty)),Bi}var Ti,Au;function mp(){if(Au)return Ti;Au=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=mo(),n={},r=Od();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var h;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[d](s,d,l,o,null,t)}catch(v){h=v}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ti=a,Ti}var Si,Bu;function pp(){if(Bu)return Si;Bu=1;var e=jd(),t=hp(),n=mo(),r=Od(),a=mp(),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 Si=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(w){var Q=w&&(u&&w[u]||w[d]);if(typeof Q=="function")return Q}var p="<<anonymous>>",m={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:C(),arrayOf:D,element:A(),elementType:E(),instanceOf:k,node:z(),objectOf:$,oneOf:S,oneOfType:M,shape:B,exact:F};function v(w,Q){return w===Q?w!==0||1/w===1/Q:w!==w&&Q!==Q}function f(w,Q){this.message=w,this.data=Q&&typeof Q=="object"?Q:{},this.stack=""}f.prototype=Error.prototype;function b(w){if(process.env.NODE_ENV!=="production")var Q={},se=0;function _(q,T,L,G,Y,te,le){if(G=G||p,te=te||L,le!==n){if(l){var X=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 X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=G+":"+L;!Q[pe]&&se<3&&(i("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+G+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),Q[pe]=!0,se++)}}return T[L]==null?q?T[L]===null?new f("The "+Y+" `"+te+"` is marked as required "+("in `"+G+"`, but its value is `null`.")):new f("The "+Y+" `"+te+"` is marked as required in "+("`"+G+"`, but its value is `undefined`.")):null:w(T,L,G,Y,te)}var O=_.bind(null,!1);return O.isRequired=_.bind(null,!0),O}function g(w){function Q(se,_,O,q,T,L){var G=se[_],Y=U(G);if(Y!==w){var te=W(G);return new f("Invalid "+q+" `"+T+"` of type "+("`"+te+"` supplied to `"+O+"`, expected ")+("`"+w+"`."),{expectedType:w})}return null}return b(Q)}function C(){return b(s)}function D(w){function Q(se,_,O,q,T){if(typeof w!="function")return new f("Property `"+T+"` of component `"+O+"` has invalid PropType notation inside arrayOf.");var L=se[_];if(!Array.isArray(L)){var G=U(L);return new f("Invalid "+q+" `"+T+"` of type "+("`"+G+"` supplied to `"+O+"`, expected an array."))}for(var Y=0;Y<L.length;Y++){var te=w(L,Y,O,q,T+"["+Y+"]",n);if(te instanceof Error)return te}return null}return b(Q)}function A(){function w(Q,se,_,O,q){var T=Q[se];if(!o(T)){var L=U(T);return new f("Invalid "+O+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(w)}function E(){function w(Q,se,_,O,q){var T=Q[se];if(!e.isValidElementType(T)){var L=U(T);return new f("Invalid "+O+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(w)}function k(w){function Q(se,_,O,q,T){if(!(se[_]instanceof w)){var L=w.name||p,G=re(se[_]);return new f("Invalid "+q+" `"+T+"` of type "+("`"+G+"` supplied to `"+O+"`, expected ")+("instance of `"+L+"`."))}return null}return b(Q)}function S(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function Q(se,_,O,q,T){for(var L=se[_],G=0;G<w.length;G++)if(v(L,w[G]))return null;var Y=JSON.stringify(w,function(le,X){var pe=W(X);return pe==="symbol"?String(X):X});return new f("Invalid "+q+" `"+T+"` of value `"+String(L)+"` "+("supplied to `"+O+"`, expected one of "+Y+"."))}return b(Q)}function $(w){function Q(se,_,O,q,T){if(typeof w!="function")return new f("Property `"+T+"` of component `"+O+"` has invalid PropType notation inside objectOf.");var L=se[_],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+T+"` of type "+("`"+G+"` supplied to `"+O+"`, expected an object."));for(var Y in L)if(r(L,Y)){var te=w(L,Y,O,q,T+"."+Y,n);if(te instanceof Error)return te}return null}return b(Q)}function M(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Q=0;Q<w.length;Q++){var se=w[Q];if(typeof se!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ne(se)+" at index "+Q+"."),s}function _(O,q,T,L,G){for(var Y=[],te=0;te<w.length;te++){var le=w[te],X=le(O,q,T,L,G,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&Y.push(X.data.expectedType)}var pe=Y.length>0?", expected one of type ["+Y.join(", ")+"]":"";return new f("Invalid "+L+" `"+G+"` supplied to "+("`"+T+"`"+pe+"."))}return b(_)}function z(){function w(Q,se,_,O,q){return P(Q[se])?null:new f("Invalid "+O+" `"+q+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(w)}function R(w,Q,se,_,O){return new f((w||"React class")+": "+Q+" type `"+se+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+O+"`.")}function B(w){function Q(se,_,O,q,T){var L=se[_],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+T+"` of type `"+G+"` "+("supplied to `"+O+"`, expected `object`."));for(var Y in w){var te=w[Y];if(typeof te!="function")return R(O,q,T,Y,W(te));var le=te(L,Y,O,q,T+"."+Y,n);if(le)return le}return null}return b(Q)}function F(w){function Q(se,_,O,q,T){var L=se[_],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+T+"` of type `"+G+"` "+("supplied to `"+O+"`, expected `object`."));var Y=t({},se[_],w);for(var te in Y){var le=w[te];if(r(w,te)&&typeof le!="function")return R(O,q,T,te,W(le));if(!le)return new f("Invalid "+q+" `"+T+"` key `"+te+"` supplied to `"+O+"`.\nBad object: "+JSON.stringify(se[_],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(w),null," "));var X=le(L,te,O,q,T+"."+te,n);if(X)return X}return null}return b(Q)}function P(w){switch(typeof w){case"number":case"string":case"undefined":return!0;case"boolean":return!w;case"object":if(Array.isArray(w))return w.every(P);if(w===null||o(w))return!0;var Q=h(w);if(Q){var se=Q.call(w),_;if(Q!==w.entries){for(;!(_=se.next()).done;)if(!P(_.value))return!1}else for(;!(_=se.next()).done;){var O=_.value;if(O&&!P(O[1]))return!1}}else return!1;return!0;default:return!1}}function j(w,Q){return w==="symbol"?!0:Q?Q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Q instanceof Symbol:!1}function U(w){var Q=typeof w;return Array.isArray(w)?"array":w instanceof RegExp?"object":j(Q,w)?"symbol":Q}function W(w){if(typeof w>"u"||w===null)return""+w;var Q=U(w);if(Q==="object"){if(w instanceof Date)return"date";if(w instanceof RegExp)return"regexp"}return Q}function ne(w){var Q=W(w);switch(Q){case"array":case"object":return"an "+Q;case"boolean":case"date":case"regexp":return"a "+Q;default:return Q}}function re(w){return!w.constructor||!w.constructor.name?p:w.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},Si}var ji,Tu;function gp(){if(Tu)return ji;Tu=1;var e=mo();function t(){}function n(){}return n.resetWarningCache=t,ji=function(){function r(s,o,l,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},ji}if(process.env.NODE_ENV!=="production"){var vp=jd(),bp=!0;Bs.exports=pp()(vp.isElement,bp)}else Bs.exports=gp()();var yp=Bs.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var Od=["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])"],$a=Od.join(","),Pd=typeof Element>"u",On=Pd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,La=!Pd&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},za=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},bp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Md=function(t,n,r){if(za(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll($a));return n&&On.call(t,$a)&&a.unshift(t),a=a.filter(r),a},Nd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!za(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=On.call(s,$a);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!za(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},Rd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},mn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||bp(t))&&!Rd(t)?0:t.tabIndex},yp=function(t,n){var r=mn(t);return r<0&&n&&!Rd(t)?0:r},xp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Id=function(t){return t.tagName==="INPUT"},Dp=function(t){return Id(t)&&t.type==="hidden"},Cp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},wp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ep=function(t){if(!t.name)return!0;var n=t.form||La(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=wp(a,t.form);return!i||i===t},_p=function(t){return Id(t)&&t.type==="radio"},kp=function(t){return _p(t)&&!Ep(t)},Fp=function(t){var n,r=t&&La(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,h;r=La(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},Tu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Ap=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=On.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(On.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=La(t);if(l&&!l.shadowRoot&&a(l)===!0)return Tu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Fp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Tu(t);return!1},Bp=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 On.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},qa=function(t,n){return!(n.disabled||za(n)||Dp(n)||Ap(n,t)||Cp(n)||Bp(n))},Bs=function(t,n){return!(kp(n)||mn(n)<0||!qa(t,n))},Tp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Sp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=yp(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(xp).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},$d=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Nd([t],n.includeContainer,{filter:Bs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Tp}):r=Md(t,n.includeContainer,Bs.bind(null,n)),Sp(r)},Ld=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Nd([t],n.includeContainer,{filter:qa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Md(t,n.includeContainer,qa.bind(null,n)),r},En=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return On.call(t,$a)===!1?!1:Bs(n,t)},jp=Od.concat("iframe").join(","),Aa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return On.call(t,jp)===!1?!1:qa(n,t)};const Op=Object.freeze(Object.defineProperty({__proto__:null,focusable:Ld,getTabIndex:mn,isFocusable:Aa,isTabbable:En,tabbable:$d},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var Pd=["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])"],La=Pd.join(","),Md=typeof Element>"u",On=Md?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,za=!Md&&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},qa=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},xp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Nd=function(t,n,r){if(qa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(La));return n&&On.call(t,La)&&a.unshift(t),a=a.filter(r),a},Id=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!qa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=On.call(s,La);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!qa(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},Rd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},pn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||xp(t))&&!Rd(t)?0:t.tabIndex},Cp=function(t,n){var r=pn(t);return r<0&&n&&!Rd(t)?0:r},Dp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},$d=function(t){return t.tagName==="INPUT"},wp=function(t){return $d(t)&&t.type==="hidden"},Ep=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},_p=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},kp=function(t){if(!t.name)return!0;var n=t.form||za(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=_p(a,t.form);return!i||i===t},Fp=function(t){return $d(t)&&t.type==="radio"},Ap=function(t){return Fp(t)&&!kp(t)},Bp=function(t){var n,r=t&&za(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,h;r=za(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},Su=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Tp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=On.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(On.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=za(t);if(l&&!l.shadowRoot&&a(l)===!0)return Su(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Bp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Su(t);return!1},Sp=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 On.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ua=function(t,n){return!(n.disabled||qa(n)||wp(n)||Tp(n,t)||Ep(n)||Sp(n))},Ts=function(t,n){return!(Ap(n)||pn(n)<0||!Ua(t,n))},jp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Op=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Cp(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(Dp).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Ld=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Id([t],n.includeContainer,{filter:Ts.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:jp}):r=Nd(t,n.includeContainer,Ts.bind(null,n)),Op(r)},zd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Id([t],n.includeContainer,{filter:Ua.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Nd(t,n.includeContainer,Ua.bind(null,n)),r},_n=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return On.call(t,La)===!1?!1:Ts(n,t)},Pp=Pd.concat("iframe").join(","),Ba=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return On.call(t,Pp)===!1?!1:Ua(n,t)};const Mp=Object.freeze(Object.defineProperty({__proto__:null,focusable:zd,getTabIndex:pn,isFocusable:Ba,isTabbable:_n,tabbable:Ld},Symbol.toStringTag,{value:"Module"}));/*!
60
60
  * focus-trap 7.5.4
61
61
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
62
- */function 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){Pp(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}function Pp(e,t,n){return t=Np(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mp(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 Np(e){var t=Mp(e,"string");return typeof t=="symbol"?t:String(t)}var Ou={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()}},Rp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Ip=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Tr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},$p=function(t){return Tr(t)&&!t.shiftKey},Lp=function(t){return Tr(t)&&t.shiftKey},Pu=function(t){return setTimeout(t,0)},Mu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},xr=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},ia=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},zp=[],qp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||zp,i=ju({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:$p,isKeyBackward:Lp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,F,P){return B&&B[F]!==void 0?B[F]:i[P||F]},u=function(B,F){var P=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(O){var U=O.container,W=O.tabbableNodes;return U.contains(B)||(P==null?void 0:P.includes(U))||W.find(function(ie){return ie===B})})},d=function(B){var F=i[B];if(typeof F=="function"){for(var P=arguments.length,O=new Array(P>1?P-1:0),U=1;U<P;U++)O[U-1]=arguments[U];F=F.apply(void 0,O)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=F;if(typeof F=="string"&&(W=r.querySelector(F),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},h=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Aa(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var F=s.tabbableGroups[0],P=F&&F.firstTabbableNode;B=P||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},p=function(){if(s.containerGroups=s.containers.map(function(B){var F=$d(B,i.tabbableOptions),P=Ld(B,i.tabbableOptions),O=F.length>0?F[0]:void 0,U=F.length>0?F[F.length-1]:void 0,W=P.find(function(C){return En(C)}),ie=P.slice().reverse().find(function(C){return En(C)}),te=!!F.find(function(C){return mn(C)>0});return{container:B,tabbableNodes:F,focusableNodes:P,posTabIndexesFound:te,firstTabbableNode:O,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:ie,nextTabbableNode:function(X){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(X);return _<0?ue?P.slice(P.indexOf(X)+1).find(function(T){return En(T)}):P.slice(0,P.indexOf(X)).reverse().find(function(T){return En(T)}):F[_+(ue?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(B){return B.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function I(B){var F=B.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?I(F.shadowRoot):F},v=function I(B){if(B!==!1&&B!==m(document)){if(!B||!B.focus){I(h());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,Rp(B)&&B.select()}},f=function(B){var F=d("setReturnFocus",B);return F||(F===!1?!1:B)},b=function(B){var F=B.target,P=B.event,O=B.isBackward,U=O===void 0?!1:O;F=F||ia(P),p();var W=null;if(s.tabbableGroups.length>0){var ie=u(F,P),te=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var C=Mu(s.tabbableGroups,function(S){var z=S.firstTabbableNode;return F===z});if(C<0&&(te.container===F||Aa(F,i.tabbableOptions)&&!En(F,i.tabbableOptions)&&!te.nextTabbableNode(F,!1))&&(C=ie),C>=0){var X=C===0?s.tabbableGroups.length-1:C-1,ue=s.tabbableGroups[X];W=mn(F)>=0?ue.lastTabbableNode:ue.lastDomTabbableNode}else Tr(P)||(W=te.nextTabbableNode(F,!1))}else{var _=Mu(s.tabbableGroups,function(S){var z=S.lastTabbableNode;return F===z});if(_<0&&(te.container===F||Aa(F,i.tabbableOptions)&&!En(F,i.tabbableOptions)&&!te.nextTabbableNode(F))&&(_=ie),_>=0){var T=_===s.tabbableGroups.length-1?0:_+1,$=s.tabbableGroups[T];W=mn(F)>=0?$.firstTabbableNode:$.firstDomTabbableNode}else Tr(P)||(W=te.nextTabbableNode(F))}}else W=d("fallbackFocus");return W},g=function(B){var F=ia(B);if(!(u(F,B)>=0)){if(xr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}xr(i.allowOutsideClick,B)||B.preventDefault()}},w=function(B){var F=ia(B),P=u(F,B)>=0;if(P||F instanceof Document)P&&(s.mostRecentlyFocusedNode=F);else{B.stopImmediatePropagation();var O,U=!0;if(s.mostRecentlyFocusedNode)if(mn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[W].tabbableNodes;if(ie.length>0){var te=ie.findIndex(function(C){return C===s.mostRecentlyFocusedNode});te>=0&&(i.isKeyForward(s.recentNavEvent)?te+1<ie.length&&(O=ie[te+1],U=!1):te-1>=0&&(O=ie[te-1],U=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(X){return mn(X)>0})})||(U=!1);else U=!1;U&&(O=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),v(O||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},E=function(B){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var P=b({event:B,isBackward:F});P&&(Tr(B)&&B.preventDefault(),v(P))},A=function(B){if(Ip(B)&&xr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&E(B,i.isKeyBackward(B))},D=function(B){var F=ia(B);u(F,B)>=0||xr(i.clickOutsideDeactivates,B)||xr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},k=function(){if(s.active)return Ou.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Pu(function(){v(h())}):v(h()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",A,{capture:!0,passive:!1}),o},j=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",A,!0),o},L=function(B){var F=B.some(function(P){var O=Array.from(P.removedNodes);return O.some(function(U){return U===s.mostRecentlyFocusedNode})});F&&v(h())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,q=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){M.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var F=l(B,"onActivate"),P=l(B,"onPostActivate"),O=l(B,"checkCanFocusTrap");O||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var U=function(){O&&p(),k(),q(),P==null||P()};return O?(O(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(B){if(!s.active)return this;var F=ju({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,j(),s.active=!1,s.paused=!1,q(),Ou.deactivateTrap(a,o);var P=l(F,"onDeactivate"),O=l(F,"onPostDeactivate"),U=l(F,"checkCanReturnFocus"),W=l(F,"returnFocus","returnFocusOnDeactivate");P==null||P();var ie=function(){Pu(function(){W&&v(f(s.nodeFocusedBeforeActivation)),O==null||O()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(B){if(s.paused||!s.active)return this;var F=l(B,"onPause"),P=l(B,"onPostPause");return s.paused=!0,F==null||F(),j(),q(),P==null||P(),this},unpause:function(B){if(!s.paused||!s.active)return this;var F=l(B,"onUnpause"),P=l(B,"onPostUnpause");return s.paused=!1,F==null||F(),p(),k(),q(),P==null||P(),this},updateContainerElements:function(B){var F=[].concat(B).filter(Boolean);return s.containers=F.map(function(P){return typeof P=="string"?r.querySelector(P):P}),s.active&&p(),q(),this}},o.updateContainerElements(t),o};const Up=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:qp},Symbol.toStringTag,{value:"Module"})),Wp=Zc(Up),Vp=Zc(Op);function ur(e){"@babel/helpers - typeof";return ur=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},ur(e)}function Hp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nu(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,zd(r.key),r)}}function Kp(e,t,n){return t&&Nu(e.prototype,t),n&&Nu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zp(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&&Ts(e,t)}function Ts(e,t){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ts(e,t)}function Yp(e){var t=Qp();return function(){var r=Ua(e),a;if(t){var i=Ua(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Gp(this,a)}}function Gp(e,t){if(t&&(ur(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ar(e)}function Ar(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qp(){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 Ua(e){return Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ua(e)}function Jp(e,t,n){return t=zd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zd(e){var t=Xp(e,"string");return ur(t)==="symbol"?t:String(t)}function Xp(e,t){if(ur(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ur(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sa=y,ve=vp,eg=Wp,tg=eg.createFocusTrap,ng=Vp,rg=ng.isFocusable,mo=function(e){Zp(n,e);var t=Yp(n);function n(r){var a;Hp(this,n),a=t.call(this,r),Jp(Ar(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var v;if(m=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(Ar(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Ar(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Ar(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 Kp(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&&!rg(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?sa.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===sa.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=sa.cloneElement(i,{ref:s});return o}return null}}]),n}(sa.Component),Dr=typeof Element>"u"?Function:Element;mo.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(Dr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(Dr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(Dr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(Dr)),children:ve.oneOfType([ve.element,ve.instanceOf(Dr)])};mo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:tg};var ag=mo;const ig=Rn(ag);const on=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:h="Modal"})=>{const p=ae.useIntl(),{registerOverlay:m,unregisterOverlay:v}=Ed(),[f,b]=y.useState(t),[g,w]=y.useState(null),E=y.useRef(null),A=M=>{f&&M.key==="Escape"&&j(!1)},D=M=>{w(M.target)},k=M=>{g===E.current&&M.target===E.current&&j(!1),w(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",A),()=>{window.removeEventListener("keyup",A)}},[f]),y.useEffect(()=>{const M=E.current;return M&&(M.addEventListener("mousedown",D),M.addEventListener("mouseup",k)),()=>{M&&(M.removeEventListener("mousedown",D),M.removeEventListener("mouseup",k))}},[g]);const j=M=>{if(b(M),M)a(),m(e);else{if(f===M)return;i(),v(e)}};y.useEffect(()=>(j(t),()=>{f&&v(e)}),[t]);const L=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:E,className:K("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(fo,{id:e,className:K("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:L,children:t&&c.jsx(ig,{containerElements:[E.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>j(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx($t,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx($t,{}),c.jsx(mr,{buttons:u})]}),s&&c.jsx(or,{className:"error",children:s})]})})})})},qd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Cr="joinCommunityButton",po=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ae.useIntl(),o=y.useContext(at),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const v={},f={};return d&&p!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${Cr}_leave`}),v["aria-label"]=s.formatMessage({id:`${Cr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Cr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Cr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const w=d?i:a;typeof w=="function"&&setTimeout(async()=>{await w()},500),h(!d)},className:K("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Cr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ji="communityDetails_",sg=({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=ae.useIntl(),{id:u}=y.useContext(at),d=u,h=5,p=a||i.length,m=i.length?i:Array(h).fill({}),v=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:K("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ji}members`}),c.jsx("span",{className:"count",children:p})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${ji}viewAll`})})})]}),d&&c.jsx(co,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(po,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ji}invite`})})]}):c.jsx(c.Fragment,{})]})};const Lr=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:K("action-button",t),variant:"tertiary",icon:e,...n}),og=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),ug=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function lg(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const cg=y.lazy(()=>Promise.resolve().then(()=>Jg));let Sr=!1;const Oi=()=>{Sr!==!1&&(clearTimeout(Sr),Sr=!1)},dg=5;let Pi=null;const Ud=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:p=async()=>({next:"",results:[]})}})=>{const m=ae.useIntl(),v={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Gr,v),{numberOfLikes:g,userLikedContent:w,ignoreInteractions:E,showLikers:A,tabbableLink:D,showLikesModal:k}=f,j=lg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const L=y.useMemo(()=>ug(n,dg),[n]),M=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Sr)return Oi(),!1;if(Oi(),E||!s)return!1;Sr=setTimeout(q,350)},q=async()=>{if(Oi(),E||!s)return!1;let F=w?g-1:g+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!w}]);try{if(i&&i.slugs){const P=og(i.slugs);w?await h(P):await d({...P,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},I=()=>{Pi=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{Pi&&clearTimeout(Pi)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{I()}},c.jsxs(c.Fragment,{children:[c.jsx(Lr,{className:K("discussion-button text-medium action-button likes-button",{"show-spinner":E,"is-liked":w,disabled:!s}),icon:{icon:w?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:M,screenreaderText:s?m.formatMessage({id:`discussion_likes_${w?"unlike":"like"}`},{action:m.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":w,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:m.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Oe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>I,onClick:F=>{var O;F.preventDefault(),F.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const P=(O=F.currentTarget.nextSibling)==null?void 0:O.childNodes[0];if(P){const U=P.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),I())},"aria-expanded":A,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Oe,{showOnFocus:!1,children:m.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx($n,{id:`likes-tooltip-${i.slug}`,isOpen:A,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[L.map((F,P)=>{if(typeof F=="string")return null;const O={};return D!==P&&(O.tabIndex=-1),c.jsx("li",{"data-index":P,children:c.jsx(bn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:j,...O,children:F.name?F.name:c.jsx("span",{className:"deleted-user",children:m.formatMessage({id:"member_deleted"})})})},F.id||window.btoa(F.name||""))}),c.jsx("li",{"data-index":L.length,className:"show-all",children:c.jsx(Ee,{variant:"tertiary",onClick:()=>{B(),I(),b([{type:"showLikesModal",value:!0}])},onKeyDown:j,children:m.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(pr,{children:c.jsx(y.Suspense,{children:c.jsx(cg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:p}}})})})]})]}))},Ss=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},gr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},fg="post",hg="reply",Wd="00000000-0000-0000-0000-000000000000";function go({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function vo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function mg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function pg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Vd(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 gg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Wd,time:new Date().toISOString(),verb:fg}}function Ru({activity:e,user:t}){return{...e,actor:Vd(t),...mg()}}function Wa({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 Hd({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Va({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Kd({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function vg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Wd,kind:hg,parent:t||""}}function Iu({reply:e,user:t}){const n=Vd(t);return{...e,user_id:n.id,user:n,...pg()}}function $u({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 bg({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function yg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function xg(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 Dg(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 Ha(e,t,n){return t?n!=null&&n.append?xg(e,t,n):Dg(e,t,n):yg(e)}function Lt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Zd(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 bo(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 Yd=(e,t)=>{const n=new CustomEvent(nt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Lu,Mi=0;const Gd=()=>{y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Lu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),Mi=0;return}Mi++,!(Mi>10)&&(Lu=setTimeout(()=>{e(t)},50))}},lr=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}),Yt=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}),yo=Object.freeze({actor:`SU:${lr.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"}),Cg=Object.freeze({actor:`SU:${Yt.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"}),wg=Object.freeze({actor:`SU:${lr.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"}),Eg=Object.freeze({actor:`SU:${Yt.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:yo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Yt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Yt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:yo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Yt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Yt.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:Yt.id,user:{id:Yt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:yo.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:lr.id,user:{id:lr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Cg.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:Yt.id,user:{id:Yt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wg.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:lr.id,user:{id:lr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Eg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function _g({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=Ru({activity:gg(o),user:i});return Ha(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ru({activity:o,user:i});r.setQueryData(a,Ha(d,u,{replace:!0})),setTimeout(()=>{Yd(d.id,"activity")},0)}});return s}function kg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Lt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Fg({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=We.useQueryClient(),h=ui(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:go(p),mutate:vo(p)},user:h,...p},v=_g({...m,mutationFn:e}),f=kg({...m,mutationFn:t}),b=Ag({...m,mutationFn:n}),g=Sg({...m,mutationFn:a}),w=jg({...m,mutationFn:i}),E=Tg({...m,mutationFn:s}),A=Og({...m,mutationFn:o}),{activities:D,...k}=Bg({queryKey:l,queryFn:r,filterOption:u});return{activities:D,mutations:{create:v,edit:f,remove:g,like:b,unlike:w,pin:E,unpin:A},user:h,...k}}function Ag({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=Lt(s,o);return l&&Wa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Lt(o,l);u&&Wa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Bg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:bo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Tg({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=Lt(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Lt(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Sg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Zd(a,i)),onError:n});return r}function jg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Lt(i,s);return o&&Hd({activity:o,user:r}),s}),onError:n});return a}function Og({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Lt(i,s);return o&&Kd({activity:o,user:r}),s}),onError:n});return a}const Pg=280,xo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?ir(e,typeof t=="number"?t:Pg):e;a=a.trim();const i=`<br>
62
+ */function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ou(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){Np(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Np(e,t,n){return t=Rp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ip(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 Rp(e){var t=Ip(e,"string");return typeof t=="symbol"?t:String(t)}var Pu={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()}},$p=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Lp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Sr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},zp=function(t){return Sr(t)&&!t.shiftKey},qp=function(t){return Sr(t)&&t.shiftKey},Mu=function(t){return setTimeout(t,0)},Nu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},xr=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},sa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Up=[],Wp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Up,i=Ou({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:zp,isKeyBackward:qp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,F,P){return B&&B[F]!==void 0?B[F]:i[P||F]},u=function(B,F){var P=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(j){var U=j.container,W=j.tabbableNodes;return U.contains(B)||(P==null?void 0:P.includes(U))||W.find(function(ne){return ne===B})})},d=function(B){var F=i[B];if(typeof F=="function"){for(var P=arguments.length,j=new Array(P>1?P-1:0),U=1;U<P;U++)j[U-1]=arguments[U];F=F.apply(void 0,j)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=F;if(typeof F=="string"&&(W=r.querySelector(F),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},h=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Ba(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var F=s.tabbableGroups[0],P=F&&F.firstTabbableNode;B=P||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},p=function(){if(s.containerGroups=s.containers.map(function(B){var F=Ld(B,i.tabbableOptions),P=zd(B,i.tabbableOptions),j=F.length>0?F[0]:void 0,U=F.length>0?F[F.length-1]:void 0,W=P.find(function(w){return _n(w)}),ne=P.slice().reverse().find(function(w){return _n(w)}),re=!!F.find(function(w){return pn(w)>0});return{container:B,tabbableNodes:F,focusableNodes:P,posTabIndexesFound:re,firstTabbableNode:j,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:ne,nextTabbableNode:function(Q){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(Q);return _<0?se?P.slice(P.indexOf(Q)+1).find(function(O){return _n(O)}):P.slice(0,P.indexOf(Q)).reverse().find(function(O){return _n(O)}):F[_+(se?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(B){return B.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function R(B){var F=B.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?R(F.shadowRoot):F},v=function R(B){if(B!==!1&&B!==m(document)){if(!B||!B.focus){R(h());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,$p(B)&&B.select()}},f=function(B){var F=d("setReturnFocus",B);return F||(F===!1?!1:B)},b=function(B){var F=B.target,P=B.event,j=B.isBackward,U=j===void 0?!1:j;F=F||sa(P),p();var W=null;if(s.tabbableGroups.length>0){var ne=u(F,P),re=ne>=0?s.containerGroups[ne]:void 0;if(ne<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var w=Nu(s.tabbableGroups,function(T){var L=T.firstTabbableNode;return F===L});if(w<0&&(re.container===F||Ba(F,i.tabbableOptions)&&!_n(F,i.tabbableOptions)&&!re.nextTabbableNode(F,!1))&&(w=ne),w>=0){var Q=w===0?s.tabbableGroups.length-1:w-1,se=s.tabbableGroups[Q];W=pn(F)>=0?se.lastTabbableNode:se.lastDomTabbableNode}else Sr(P)||(W=re.nextTabbableNode(F,!1))}else{var _=Nu(s.tabbableGroups,function(T){var L=T.lastTabbableNode;return F===L});if(_<0&&(re.container===F||Ba(F,i.tabbableOptions)&&!_n(F,i.tabbableOptions)&&!re.nextTabbableNode(F))&&(_=ne),_>=0){var O=_===s.tabbableGroups.length-1?0:_+1,q=s.tabbableGroups[O];W=pn(F)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else Sr(P)||(W=re.nextTabbableNode(F))}}else W=d("fallbackFocus");return W},g=function(B){var F=sa(B);if(!(u(F,B)>=0)){if(xr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}xr(i.allowOutsideClick,B)||B.preventDefault()}},C=function(B){var F=sa(B),P=u(F,B)>=0;if(P||F instanceof Document)P&&(s.mostRecentlyFocusedNode=F);else{B.stopImmediatePropagation();var j,U=!0;if(s.mostRecentlyFocusedNode)if(pn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ne=s.containerGroups[W].tabbableNodes;if(ne.length>0){var re=ne.findIndex(function(w){return w===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<ne.length&&(j=ne[re+1],U=!1):re-1>=0&&(j=ne[re-1],U=!1))}}else s.containerGroups.some(function(w){return w.tabbableNodes.some(function(Q){return pn(Q)>0})})||(U=!1);else U=!1;U&&(j=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),v(j||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},D=function(B){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var P=b({event:B,isBackward:F});P&&(Sr(B)&&B.preventDefault(),v(P))},A=function(B){if(Lp(B)&&xr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&D(B,i.isKeyBackward(B))},E=function(B){var F=sa(B);u(F,B)>=0||xr(i.clickOutsideDeactivates,B)||xr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},k=function(){if(s.active)return Pu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Mu(function(){v(h())}):v(h()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",A,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",A,!0),o},$=function(B){var F=B.some(function(P){var j=Array.from(P.removedNodes);return j.some(function(U){return U===s.mostRecentlyFocusedNode})});F&&v(h())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,z=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){M.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var F=l(B,"onActivate"),P=l(B,"onPostActivate"),j=l(B,"checkCanFocusTrap");j||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var U=function(){j&&p(),k(),z(),P==null||P()};return j?(j(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(B){if(!s.active)return this;var F=Ou({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,z(),Pu.deactivateTrap(a,o);var P=l(F,"onDeactivate"),j=l(F,"onPostDeactivate"),U=l(F,"checkCanReturnFocus"),W=l(F,"returnFocus","returnFocusOnDeactivate");P==null||P();var ne=function(){Mu(function(){W&&v(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(ne,ne),this):(ne(),this)},pause:function(B){if(s.paused||!s.active)return this;var F=l(B,"onPause"),P=l(B,"onPostPause");return s.paused=!0,F==null||F(),S(),z(),P==null||P(),this},unpause:function(B){if(!s.paused||!s.active)return this;var F=l(B,"onUnpause"),P=l(B,"onPostUnpause");return s.paused=!1,F==null||F(),p(),k(),z(),P==null||P(),this},updateContainerElements:function(B){var F=[].concat(B).filter(Boolean);return s.containers=F.map(function(P){return typeof P=="string"?r.querySelector(P):P}),s.active&&p(),z(),this}},o.updateContainerElements(t),o};const Vp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Wp},Symbol.toStringTag,{value:"Module"})),Hp=Yc(Vp),Kp=Yc(Mp);function ur(e){"@babel/helpers - typeof";return ur=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},ur(e)}function Zp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Iu(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,qd(r.key),r)}}function Yp(e,t,n){return t&&Iu(e.prototype,t),n&&Iu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gp(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&&Ss(e,t)}function Ss(e,t){return Ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ss(e,t)}function Qp(e){var t=Xp();return function(){var r=Wa(e),a;if(t){var i=Wa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Jp(this,a)}}function Jp(e,t){if(t&&(ur(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ar(e)}function Ar(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xp(){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 Wa(e){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wa(e)}function eg(e,t,n){return t=qd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qd(e){var t=tg(e,"string");return ur(t)==="symbol"?t:String(t)}function tg(e,t){if(ur(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ur(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var oa=y,ve=yp,ng=Hp,rg=ng.createFocusTrap,ag=Kp,ig=ag.isFocusable,po=function(e){Gp(n,e);var t=Qp(n);function n(r){var a;Zp(this,n),a=t.call(this,r),eg(Ar(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var v;if(m=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(Ar(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Ar(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Ar(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 Yp(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&&!ig(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?oa.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===oa.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=oa.cloneElement(i,{ref:s});return o}return null}}]),n}(oa.Component),Cr=typeof Element>"u"?Function:Element;po.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(Cr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(Cr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(Cr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(Cr)),children:ve.oneOfType([ve.element,ve.instanceOf(Cr)])};po.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:rg};var sg=po;const og=In(sg);const un=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:h="Modal"})=>{const p=ie.useIntl(),{registerOverlay:m,unregisterOverlay:v}=_d(),[f,b]=y.useState(t),[g,C]=y.useState(null),D=y.useRef(null),A=M=>{f&&M.key==="Escape"&&S(!1)},E=M=>{C(M.target)},k=M=>{g===D.current&&M.target===D.current&&S(!1),C(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",A),()=>{window.removeEventListener("keyup",A)}},[f]),y.useEffect(()=>{const M=D.current;return M&&(M.addEventListener("mousedown",E),M.addEventListener("mouseup",k)),()=>{M&&(M.removeEventListener("mousedown",E),M.removeEventListener("mouseup",k))}},[g]);const S=M=>{if(b(M),M)a(),m(e);else{if(f===M)return;i(),v(e)}};y.useEffect(()=>(S(t),()=>{f&&v(e)}),[t]);const $=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:D,className:K("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ho,{id:e,className:K("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:$,children:t&&c.jsx(og,{containerElements:[D.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Lt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Lt,{}),c.jsx(mr,{buttons:u})]}),s&&c.jsx(or,{className:"error",children:s})]})})})})},Ud=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Dr="joinCommunityButton",go=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ie.useIntl(),o=y.useContext(at),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const v={},f={};return d&&p!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${Dr}_leave`}),v["aria-label"]=s.formatMessage({id:`${Dr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Dr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Dr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const C=d?i:a;typeof C=="function"&&setTimeout(async()=>{await C()},500),h(!d)},className:K("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Dr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const Oi="communityDetails_",ug=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ie.useIntl(),{id:u}=y.useContext(at),d=u,h=5,p=a||i.length,m=i.length?i:Array(h).fill({}),v=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:K("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${Oi}members`}),c.jsx("span",{className:"count",children:p})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Oi}viewAll`})})})]}),d&&c.jsx(fo,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(go,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Oi}invite`})})]}):c.jsx(c.Fragment,{})]})};const zr=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:K("action-button",t),variant:"tertiary",icon:e,...n}),lg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),cg=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function dg(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const fg=y.lazy(()=>Promise.resolve().then(()=>ev));let jr=!1;const Pi=()=>{jr!==!1&&(clearTimeout(jr),jr=!1)},hg=5;let Mi=null;const Wd=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:p=async()=>({next:"",results:[]})}})=>{const m=ie.useIntl(),v={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Qr,v),{numberOfLikes:g,userLikedContent:C,ignoreInteractions:D,showLikers:A,tabbableLink:E,showLikesModal:k}=f,S=dg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const $=y.useMemo(()=>cg(n,hg),[n]),M=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),jr)return Pi(),!1;if(Pi(),D||!s)return!1;jr=setTimeout(z,350)},z=async()=>{if(Pi(),D||!s)return!1;let F=C?g-1:g+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!C}]);try{if(i&&i.slugs){const P=lg(i.slugs);C?await h(P):await d({...P,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},R=()=>{Mi=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{Mi&&clearTimeout(Mi)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{R()}},c.jsxs(c.Fragment,{children:[c.jsx(zr,{className:K("discussion-button text-medium action-button likes-button",{"show-spinner":D,"is-liked":C,disabled:!s}),icon:{icon:C?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:M,screenreaderText:s?m.formatMessage({id:`discussion_likes_${C?"unlike":"like"}`},{action:m.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":C,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:m.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(je,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>R,onClick:F=>{var j;F.preventDefault(),F.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const P=(j=F.currentTarget.nextSibling)==null?void 0:j.childNodes[0];if(P){const U=P.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),R())},"aria-expanded":A,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(je,{showOnFocus:!1,children:m.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx($n,{id:`likes-tooltip-${i.slug}`,isOpen:A,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[$.map((F,P)=>{if(typeof F=="string")return null;const j={};return E!==P&&(j.tabIndex=-1),c.jsx("li",{"data-index":P,children:c.jsx(yn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:S,...j,children:F.name?F.name:c.jsx("span",{className:"deleted-user",children:m.formatMessage({id:"member_deleted"})})})},F.id||window.btoa(F.name||""))}),c.jsx("li",{"data-index":$.length,className:"show-all",children:c.jsx(Ee,{variant:"tertiary",onClick:()=>{B(),R(),b([{type:"showLikesModal",value:!0}])},onKeyDown:S,children:m.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(pr,{children:c.jsx(y.Suspense,{children:c.jsx(fg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:p}}})})})]})]}))},js=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},gr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},mg="post",pg="reply",Vd="00000000-0000-0000-0000-000000000000";function vo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function bo({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 gg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Hd(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 bg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Vd,time:new Date().toISOString(),verb:mg}}function Ru({activity:e,user:t}){return{...e,actor:Hd(t),...gg()}}function Va({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 Kd({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 Ha({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Zd({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function yg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Vd,kind:pg,parent:t||""}}function $u({reply:e,user:t}){const n=Hd(t);return{...e,user_id:n.id,user:n,...vg()}}function Lu({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 xg({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Cg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Dg(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 wg(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 Ka(e,t,n){return t?n!=null&&n.append?Dg(e,t,n):wg(e,t,n):Cg(e)}function zt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Yd(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function yo(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const Gd=(e,t)=>{const n=new CustomEvent(nt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let zu,Ni=0;const Qd=()=>{y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(zu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),Ni=0;return}Ni++,!(Ni>10)&&(zu=setTimeout(()=>{e(t)},50))}},lr=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}),Gt=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}),xo=Object.freeze({actor:`SU:${lr.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"}),Eg=Object.freeze({actor:`SU:${Gt.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"}),_g=Object.freeze({actor:`SU:${lr.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"}),kg=Object.freeze({actor:`SU:${Gt.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:xo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Gt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Gt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:xo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Gt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Gt.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:Gt.id,user:{id:Gt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xo.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:lr.id,user:{id:lr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Eg.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:Gt.id,user:{id:Gt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:_g.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:lr.id,user:{id:lr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:kg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Fg({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=Ru({activity:bg(o),user:i});return Ka(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ru({activity:o,user:i});r.setQueryData(a,Ka(d,u,{replace:!0})),setTimeout(()=>{Gd(d.id,"activity")},0)}});return s}function Ag({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=zt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Bg({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=We.useQueryClient(),h=li(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:vo(p),mutate:bo(p)},user:h,...p},v=Fg({...m,mutationFn:e}),f=Ag({...m,mutationFn:t}),b=Tg({...m,mutationFn:n}),g=Og({...m,mutationFn:a}),C=Pg({...m,mutationFn:i}),D=jg({...m,mutationFn:s}),A=Mg({...m,mutationFn:o}),{activities:E,...k}=Sg({queryKey:l,queryFn:r,filterOption:u});return{activities:E,mutations:{create:v,edit:f,remove:g,like:b,unlike:C,pin:D,unpin:A},user:h,...k}}function Tg({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=zt(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=zt(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Sg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:yo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function jg({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=zt(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=zt(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Og({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Yd(a,i)),onError:n});return r}function Pg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=zt(i,s);return o&&Kd({activity:o,user:r}),s}),onError:n});return a}function Mg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=zt(i,s);return o&&Zd({activity:o,user:r}),s}),onError:n});return a}const Ng=280,Co=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?ir(e,typeof t=="number"?t:Ng):e;a=a.trim();const i=`<br>
63
63
 
64
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await ld({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},Do=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),Mg=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const h=ae.useIntl(),[p,m]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:b,error:g,fetchNextPage:w,hasNextPage:E,isLoading:A,mutations:{create:D,edit:k,remove:j,like:L,unlike:M,pin:q,unpin:I}}=Fg({queryKey:[e,t,"activities",p],queryFns:i,filterOption:p[0]});y.useEffect(()=>{a&&f(v.concat(a==null?void 0:a.map(({slug:O,name:U})=>({id:O,text:U,type:"category"}))))},[a]);const[B,F]=y.useState(null),P=()=>{F(b.length),w()};return Gd(),g?c.jsx(yn,{variant:"error",text:g.message}):c.jsxs("section",{children:[c.jsx(tu,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:D,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),c.jsx(rf,{className:"activities-feed-filtering",options:v.map(({id:O,text:U})=>({id:O,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),defaultOptions:p.map(({id:O,text:U})=>({id:O,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:O,previous:U})=>{if(O[0]===U[0])return;m([v.find(te=>te.id===O[0])]);const W=v.find(te=>te.id===O[0]);if(!W)return;const ie=new CustomEvent("ariaLive",{detail:{message:h.formatMessage({id:"community_sortSuccess"},{order:h.formatMessage({id:`activitiesFeed_rankingMethod_${W.text}`,defaultMessage:W.text})})}});document.dispatchEvent(ie)}}),b==null?void 0:b.map((O,U)=>{var Y,G,re;const{id:W,own_reactions:ie,latest_reactions:te,reaction_counts:C,mentioned_users:X,total_replies:ue,additional_data:_}=O,T=(((Y=te==null?void 0:te.like)==null?void 0:Y.length)||0)>0,$=(((G=ie==null?void 0:ie.like)==null?void 0:G.length)||0)>0,S=$?ie==null?void 0:ie.like[0].id:"",z=T?(re=te==null?void 0:te.like)==null?void 0:re.map(le=>{var Q,me,pe;return{id:(Q=le==null?void 0:le.user)==null?void 0:Q.id,name:(pe=(me=le==null?void 0:le.user)==null?void 0:me.data)==null?void 0:pe.name}}):!1;return(O==null?void 0:O.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(ea,{content:{type:"post",title:O==null?void 0:O.title,body:O==null?void 0:O.content,canLike:n,createdAt:(O==null?void 0:O.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:gr(O==null?void 0:O.actor),userLiked:$,likes:(C==null?void 0:C.like)||0,comments:ue||0,peopleWhoLiked:z,data:{mentions:X,..._||{}},pinned:(C==null?void 0:C.pin)&&(C==null?void 0:C.pin)>0||!1,categories:Do((O==null?void 0:O.categories)||[],a||[])},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>j({activityId:W}),updateContent:(le,{body:Q})=>k({activityId:W,content:Q})},likes:{createLike:()=>L({activityId:W}),deleteLike:()=>M({activityId:W,reactionId:S}),listLikes:le=>u.list({activityId:W,...le})},comments:{openComments:()=>null},pins:{createPin:()=>q({activityId:W}),deletePin:()=>I({activityId:W,reactionId:te==null?void 0:te.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:U===B,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t})},W)}),!A&&c.jsx(Qr,{hasNextPage:E,loadNextPage:P,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),b.length===0&&!A&&c.jsx(Et,{className:"no-activities",variant:"muted",icon:"text--input",children:p[0].type==="category"?c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ee,{variant:"secondary",size:"small",href:"/communities",children:h.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(nu,{form:d})]})},Ng={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Rg({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ae.useIntl();return c.jsx(tu,{form:{content:{type:"reply",slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function Ig({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ae.useIntl(),i=()=>{n(r),t()};return c.jsx(Qr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function $g({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=Iu({reply:vg(o),user:i});return Ha(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Iu({reply:o,user:i});r.setQueryData(a,Ha(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Yd(d.id,"reply")},0)}});return s}function Lg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Lt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function zg({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,g,w;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,h=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,p=d?(g=r==null?void 0:r.like)==null?void 0:g.find(E=>{var A;return((A=E==null?void 0:E.user)==null?void 0:A.id)===(t==null?void 0:t.id)}):!1,m=typeof p=="object"?(p==null?void 0:p.id)??"":"",v=h?(w=a==null?void 0:a.like)==null?void 0:w.map(E=>{var A,D,k;return{id:(A=E==null?void 0:E.user)==null?void 0:A.id,name:(k=(D=E==null?void 0:E.user)==null?void 0:D.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:Ug(s),createdAt:o,data:qg(s),likeId:m,liked:h,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!p}})}function qg(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function Ug(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function Qd({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=ui(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},h=$g({...d,mutationFn:e}),p=Lg({...d,mutationFn:t}),m=Wg({...d,mutationFn:n}),v=Hg({...d,mutationFn:a}),f=Kg({...d,mutationFn:i}),{replies:b,...g}=Vg({queryKey:s,queryFn:r});return{replies:zg({replies:b,user:l}),mutations:{create:h,edit:p,remove:v,like:m,unlike:f},user:l,...g}}function Wg({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=Lt(s,o);return l&&$u({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Lt(o,l);u&&$u({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Vg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:bo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Hg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Zd(a,i)),onError:n});return r}function Kg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Lt(i,s);return o&&bg({reply:o,user:r}),s}),onError:n});return a}const Zg=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:v,edit:f,like:b,remove:g,unlike:w}}=Qd({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:D=>i.list({...D,reactionId:a})}});no([m]);const[E,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${E?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!E),children:l.formatMessage({id:`discussion_thread_${E?"hide":"show"}`},{count:d==null?void 0:d.length})}),E&&c.jsx(Qh,{loadMore:{isLoading:m,hasNextPage:p,loadNextPage:()=>h()},form:{parentId:r,content:{type:"reply",slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(D,{body:k})=>v({activityId:e,replyId:a,content:k}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:D,likes:k,data:j,body:L,createdAt:M,userLiked:q,peopleWhoLiked:I,parent:B,user:F,likeId:P})=>c.jsx(ea,{isCommunity:!0,content:{id:D,type:"reply",body:L,canLike:n,createdAt:M,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:gr(F),userLiked:q,likes:k,peopleWhoLiked:I,data:j},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:D}),updateContent:(O,{body:U})=>f({replyId:D,content:U})},likes:{createLike:()=>b({replyId:D}),deleteLike:()=>w({replyId:D,reactionId:P}),listLikes:O=>o.list({replyId:D,...O})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:r||""},{scope:lt.Platform,area:"all"}]},basePath:t,parentId:r},D)):null})]})};function Yg({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:h,peopleWhoLiked:p,replyId:m,createdAt:v,user:f}=s,{edit:b,like:g,remove:w,unlike:E}=e.mutations;return c.jsx(Zh,{children:c.jsx(ea,{isCommunity:!0,content:{id:m,type:"reply",body:o,canLike:a,createdAt:v,slugs:{question:`${n}/${i}`,answer:t,reply:m},slug:m,author:gr(f),userLiked:d,likes:h,peopleWhoLiked:p,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>w({replyId:m}),updateContent:(A,{body:D})=>b({replyId:m,content:D})},likes:{createLike:()=>g({replyId:m}),deleteLike:()=>E({replyId:m,reactionId:u}),listLikes:A=>e.likes.list({replyId:m,...A})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:i||""},{scope:lt.Platform,area:"all"}]},children:c.jsx(Zg,{basePath:n,parentId:i,activityId:t,replyId:m,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},m)},m)}const Jd=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:h})=>{const{fetchNextPage:p,hasNextPage:m,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:w,like:E,unlike:A}}=Qd({queryKey:[t,n,e,"replies"],queryFns:u}),[D,k]=y.useState(null);no([v]),Gd();const j={create:(L,M)=>{const{body:q}=M;b({activityId:e,content:q})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(Gh,{type:"comment",responses:r,isLoading:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Rg,{parentId:n,isMember:a,join:s,leave:o,formFunctions:j}),f==null?void 0:f.map((L,M)=>c.jsx(Yg,{activityId:e,basePath:t,focus:D===M,formFns:{form:i,likes:l,reactions:u,mutations:{remove:g,edit:w,like:E,unlike:A}},isMember:a,parentId:n,reply:L},L.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(Ig,{hasNextPage:m,fetchNextPage:p,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(Et,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(nu,{form:d})]})};function Gg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=bo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function Qg({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=Gg({queryKey:t,queryFn:e});return{likes:n,...r}}function Xd({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=Qg({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?gr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Kh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const ef=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ae.useIntl();return c.jsx(on,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:K("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(Xd,{...i,likeCount:r??0,functions:{likes:n}})})},Jg=Object.freeze(Object.defineProperty({__proto__:null,default:ef},Symbol.toStringTag,{value:"Module"})),Xg={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const ev=3e3,tf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Lr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},ev)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx($n,{className:K({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const Wn="discussion_",nf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:K("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Ud,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Lr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Wn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${Wn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Lr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(tf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(af,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const tv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:K("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Oe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(bn,{href:s?void 0:i,...l,children:ir(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Co=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:K("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),i){i(h);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const rf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(p=>p.id):[]),h=(p,m)=>{let v=[];u.includes(p)&&!i?v=u.filter(f=>f!==p):p==="all"?v=["all"]:r?v=[...u.filter(f=>f!=="all"),p]:v=[p],d(f=>(a&&typeof a=="function"&&a({current:v,previous:f}),v)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:K("filters",s),children:l.map(({id:p,text:m,disabled:v=!1,callback:f=()=>{}})=>{let b={};return v&&(b={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:K(p,{selected:u.includes(p)}),onClick:g=>{g.preventDefault(),g.stopPropagation(),h(p,f)},"aria-selected":u.includes(p),...b,children:m})},p)})})},nv=(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 oa="languageSwitcher_",rv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(oo),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=h!==e;return c.jsxs("div",{className:K("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${oa}label`})}),c.jsx("ul",{children:v.map(b=>{var E;if(!Fa[b])return null;const g=(E=r[b])==null?void 0:E.post_name;let w={className:b};if(h===b)w["aria-label"]=u.formatMessage({id:`${oa}selected`},{language:Fa[b]});else{const A=nv(b,g,i);w={...w,href:typeof A=="string"?A:A.url,onClick:D=>{p(b),d(b),typeof a<"u"&&(D.preventDefault(),D.stopPropagation(),a(b,typeof A=="string"?A:A.urlForRouter))}}}return c.jsx("li",{children:c.jsx(bn,{...w,fallbackElement:"span",children:Fa[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${oa}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${oa}disclaimer`},{email:Gn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const Ni=ae.createIntl({locale:"en",messages:hr}),Qr=({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:Ni.formatMessage({id:"loadMore_button"}),endOfFeed:Ni.formatMessage({id:"loadMore_endOfFeed"}),error:Ni.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(v){v instanceof Error?h(v.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:K("load-more",l),children:!d&&e?c.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const wo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:K("logo",e,t,n),...r,children:c.jsx(Oe,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let ua=!1;const af=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ae.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:K("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},v)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ua&&(clearTimeout(ua),ua=!1)},onBlur:()=>{ua=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${v}`)})})]})})},av=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const iv=y.lazy(()=>Promise.resolve().then(()=>up)),sv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],sf=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(at),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[sv.map(({key:i,href:s})=>{const o=av(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:K(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(iv,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},wr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,ov=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${wr(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(`${wr(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(`${wr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
64
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await cd({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},Do=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),Ig=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const h=ie.useIntl(),[p,m]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:b,error:g,fetchNextPage:C,hasNextPage:D,isLoading:A,mutations:{create:E,edit:k,remove:S,like:$,unlike:M,pin:z,unpin:R}}=Bg({queryKey:[e,t,"activities",p],queryFns:i,filterOption:p[0]});y.useEffect(()=>{a&&f(v.concat(a==null?void 0:a.map(({slug:j,name:U})=>({id:j,text:U,type:"category"}))))},[a]);const[B,F]=y.useState(null),P=()=>{F(b.length),C()};return Qd(),g?c.jsx(xn,{variant:"error",text:g.message}):c.jsxs("section",{children:[c.jsx(nu,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:E,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),c.jsx(af,{className:"activities-feed-filtering",options:v.map(({id:j,text:U})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),defaultOptions:p.map(({id:j,text:U})=>({id:j,text:h.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:j,previous:U})=>{if(j[0]===U[0])return;m([v.find(re=>re.id===j[0])]);const W=v.find(re=>re.id===j[0]);if(!W)return;const ne=new CustomEvent("ariaLive",{detail:{message:h.formatMessage({id:"community_sortSuccess"},{order:h.formatMessage({id:`activitiesFeed_rankingMethod_${W.text}`,defaultMessage:W.text})})}});document.dispatchEvent(ne)}}),b==null?void 0:b.map((j,U)=>{var G,Y,te;const{id:W,own_reactions:ne,latest_reactions:re,reaction_counts:w,mentioned_users:Q,total_replies:se,additional_data:_}=j,O=(((G=re==null?void 0:re.like)==null?void 0:G.length)||0)>0,q=(((Y=ne==null?void 0:ne.like)==null?void 0:Y.length)||0)>0,T=q?ne==null?void 0:ne.like[0].id:"",L=O?(te=re==null?void 0:re.like)==null?void 0:te.map(le=>{var X,pe,fe;return{id:(X=le==null?void 0:le.user)==null?void 0:X.id,name:(fe=(pe=le==null?void 0:le.user)==null?void 0:pe.data)==null?void 0:fe.name}}):!1;return(j==null?void 0:j.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(ta,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:gr(j==null?void 0:j.actor),userLiked:q,likes:(w==null?void 0:w.like)||0,comments:se||0,peopleWhoLiked:L,data:{mentions:Q,..._||{}},pinned:(w==null?void 0:w.pin)&&(w==null?void 0:w.pin)>0||!1,categories:Do((j==null?void 0:j.categories)||[],a||[])},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>S({activityId:W}),updateContent:(le,{body:X})=>k({activityId:W,content:X})},likes:{createLike:()=>$({activityId:W}),deleteLike:()=>M({activityId:W,reactionId:T}),listLikes:le=>u.list({activityId:W,...le})},comments:{openComments:()=>null},pins:{createPin:()=>z({activityId:W}),deletePin:()=>R({activityId:W,reactionId:re==null?void 0:re.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:U===B,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t})},W)}),!A&&c.jsx(Jr,{hasNextPage:D,loadNextPage:P,icon:{icon:"arrow-down",position:"right"},messages:{button:h.formatMessage({id:"loadMore_button"}),error:h.formatMessage({id:"loadMore_error"})}}),b.length===0&&!A&&c.jsx(Et,{className:"no-activities",variant:"muted",icon:"text--input",children:p[0].type==="category"?c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:h.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ee,{variant:"secondary",size:"small",href:"/communities",children:h.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(ru,{form:d})]})},Rg={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function $g({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ie.useIntl();return c.jsx(nu,{form:{content:{type:"reply",slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function Lg({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ie.useIntl(),i=()=>{n(r),t()};return c.jsx(Jr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function zg({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=$u({reply:yg(o),user:i});return Ka(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=$u({reply:o,user:i});r.setQueryData(a,Ka(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Gd(d.id,"reply")},0)}});return s}function qg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=zt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Ug({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,g,C;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,h=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,p=d?(g=r==null?void 0:r.like)==null?void 0:g.find(D=>{var A;return((A=D==null?void 0:D.user)==null?void 0:A.id)===(t==null?void 0:t.id)}):!1,m=typeof p=="object"?(p==null?void 0:p.id)??"":"",v=h?(C=a==null?void 0:a.like)==null?void 0:C.map(D=>{var A,E,k;return{id:(A=D==null?void 0:D.user)==null?void 0:A.id,name:(k=(E=D==null?void 0:D.user)==null?void 0:E.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:Vg(s),createdAt:o,data:Wg(s),likeId:m,liked:h,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!p}})}function Wg(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function Vg(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function Jd({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=li(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:vo(u),mutate:bo(u)},user:l,...u},h=zg({...d,mutationFn:e}),p=qg({...d,mutationFn:t}),m=Hg({...d,mutationFn:n}),v=Zg({...d,mutationFn:a}),f=Yg({...d,mutationFn:i}),{replies:b,...g}=Kg({queryKey:s,queryFn:r});return{replies:Ug({replies:b,user:l}),mutations:{create:h,edit:p,remove:v,like:m,unlike:f},user:l,...g}}function Hg({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=zt(s,o);return l&&Lu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=zt(o,l);u&&Lu({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Kg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:yo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Zg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Yd(a,i)),onError:n});return r}function Yg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=zt(i,s);return o&&xg({reply:o,user:r}),s}),onError:n});return a}const Gg=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ie.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:v,edit:f,like:b,remove:g,unlike:C}}=Jd({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:a})}});ro([m]);const[D,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${D?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!D),children:l.formatMessage({id:`discussion_thread_${D?"hide":"show"}`},{count:d==null?void 0:d.length})}),D&&c.jsx(Xh,{loadMore:{isLoading:m,hasNextPage:p,loadNextPage:()=>h()},form:{parentId:r,content:{type:"reply",slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(E,{body:k})=>v({activityId:e,replyId:a,content:k}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:E,likes:k,data:S,body:$,createdAt:M,userLiked:z,peopleWhoLiked:R,parent:B,user:F,likeId:P})=>c.jsx(ta,{isCommunity:!0,content:{id:E,type:"reply",body:$,canLike:n,createdAt:M,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:gr(F),userLiked:z,likes:k,peopleWhoLiked:R,data:S},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:E}),updateContent:(j,{body:U})=>f({replyId:E,content:U})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>C({replyId:E,reactionId:P}),listLikes:j=>o.list({replyId:E,...j})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:r||""},{scope:lt.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function Qg({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:h,peopleWhoLiked:p,replyId:m,createdAt:v,user:f}=s,{edit:b,like:g,remove:C,unlike:D}=e.mutations;return c.jsx(Gh,{children:c.jsx(ta,{isCommunity:!0,content:{id:m,type:"reply",body:o,canLike:a,createdAt:v,slugs:{question:`${n}/${i}`,answer:t,reply:m},slug:m,author:gr(f),userLiked:d,likes:h,peopleWhoLiked:p,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>C({replyId:m}),updateContent:(A,{body:E})=>b({replyId:m,content:E})},likes:{createLike:()=>g({replyId:m}),deleteLike:()=>D({replyId:m,reactionId:u}),listLikes:A=>e.likes.list({replyId:m,...A})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:i||""},{scope:lt.Platform,area:"all"}]},children:c.jsx(Gg,{basePath:n,parentId:i,activityId:t,replyId:m,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},m)},m)}const Xd=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:h})=>{const{fetchNextPage:p,hasNextPage:m,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:C,like:D,unlike:A}}=Jd({queryKey:[t,n,e,"replies"],queryFns:u}),[E,k]=y.useState(null);ro([v]),Qd();const S={create:($,M)=>{const{body:z}=M;b({activityId:e,content:z})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(Jh,{type:"comment",responses:r,isLoading:v}),h?c.jsxs(c.Fragment,{children:[c.jsx($g,{parentId:n,isMember:a,join:s,leave:o,formFunctions:S}),f==null?void 0:f.map(($,M)=>c.jsx(Qg,{activityId:e,basePath:t,focus:E===M,formFns:{form:i,likes:l,reactions:u,mutations:{remove:g,edit:C,like:D,unlike:A}},isMember:a,parentId:n,reply:$},$.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(Lg,{hasNextPage:m,fetchNextPage:p,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(Et,{children:c.jsx(ie.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(ru,{form:d})]})};function Jg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=yo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function Xg({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=Jg({queryKey:t,queryFn:e});return{likes:n,...r}}function ef({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=Xg({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?gr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Yh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const tf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ie.useIntl();return c.jsx(un,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:K("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(ef,{...i,likeCount:r??0,functions:{likes:n}})})},ev=Object.freeze(Object.defineProperty({__proto__:null,default:tf},Symbol.toStringTag,{value:"Module"})),tv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const nv=3e3,nf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(zr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},nv)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx($n,{className:K({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const Wn="discussion_",rf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ie.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:K("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Wd,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(zr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Wn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${Wn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(zr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(nf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(sf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const rv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(je,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:K("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(je,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(yn,{href:s?void 0:i,...l,children:ir(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const wo=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:K("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),i){i(h);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const af=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ie.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(p=>p.id):[]),h=(p,m)=>{let v=[];u.includes(p)&&!i?v=u.filter(f=>f!==p):p==="all"?v=["all"]:r?v=[...u.filter(f=>f!=="all"),p]:v=[p],d(f=>(a&&typeof a=="function"&&a({current:v,previous:f}),v)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:K("filters",s),children:l.map(({id:p,text:m,disabled:v=!1,callback:f=()=>{}})=>{let b={};return v&&(b={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:K(p,{selected:u.includes(p)}),onClick:g=>{g.preventDefault(),g.stopPropagation(),h(p,f)},"aria-selected":u.includes(p),...b,children:m})},p)})})},av=(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 ua="languageSwitcher_",iv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ie.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(uo),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=h!==e;return c.jsxs("div",{className:K("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${ua}label`})}),c.jsx("ul",{children:v.map(b=>{var D;if(!Aa[b])return null;const g=(D=r[b])==null?void 0:D.post_name;let C={className:b};if(h===b)C["aria-label"]=u.formatMessage({id:`${ua}selected`},{language:Aa[b]});else{const A=av(b,g,i);C={...C,href:typeof A=="string"?A:A.url,onClick:E=>{p(b),d(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof A=="string"?A:A.urlForRouter))}}}return c.jsx("li",{children:c.jsx(yn,{...C,fallbackElement:"span",children:Aa[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ua}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ua}disclaimer`},{email:Gn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const Ii=ie.createIntl({locale:"en",messages:hr}),Jr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ii.formatMessage({id:"loadMore_button"}),endOfFeed:Ii.formatMessage({id:"loadMore_endOfFeed"}),error:Ii.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(v){v instanceof Error?h(v.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:K("load-more",l),children:!d&&e?c.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Eo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:K("logo",e,t,n),...r,children:c.jsx(je,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let la=!1;const sf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ie.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:K("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},v)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{la&&(clearTimeout(la),la=!1)},onBlur:()=>{la=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${v}`)})})]})})},sv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const ov=y.lazy(()=>Promise.resolve().then(()=>cp)),uv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],of=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=y.useContext(at),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[uv.map(({key:i,href:s})=>{const o=sv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:K(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(ov,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},wr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,lv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${wr(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(`${wr(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(`${wr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${wr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:wr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const uv="shareLinks_",lv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ae.useIntl(),l=ov({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const v={};return m&&(v.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${uv}link_${u}`}),...v})},u)})})]})};const cv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),a=In(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){i=g;break}}}const[s,o]=y.useState((v=e[i])!=null&&v.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const w=r(e[g].id,e[g].text,g),E=document.getElementById(`tab-${w}`);E==null||E.focus(),u(w);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:g,href:w,hasCarousel:E,breakpoint:A},D)=>{if(A&&!h(A))return;f=r(f,b,D);const k=s===f,j={};w||(j["aria-controls"]=f,j.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:w||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:K({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:L=>d(L,D),...j,children:b})},`tab-${f}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const dv={"2-1":901,"1-3":769,"1-1":769},of=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=In(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<dv[e]?null:o)})};const Eo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ae.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Oe,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},di=e=>(e==null?void 0:e.toString().length)||0,uf=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{di(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const la="emailHelperTextBox_",lf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ae.useIntl(),[s,o]=y.useState({path:`${la}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${la}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${la}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let v=la,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>d(w),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:f,link:b,mail:g})},[t]);const h={};return["link","mail"].forEach(v=>{h[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(md,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Pt,{element:"span"}),c.jsx(Pt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Qn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:K(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const v=m.target;a.onChange(v.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},fv=500,hv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{v||h(D=>({...D,debouncedInput:l}))},fv);return()=>{clearTimeout(A)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const D=await o(d)||[];f(k=>({...k,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(k=>({...k,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,v]),y.useEffect(()=>{m>=0&&p[m]&&h(A=>({...A,displayInput:p[m].description}))},[m,p]);const g=A=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Vn.DOWN&&m<p.length-1?f(D=>({...D,activePredictionIndex:m+1})):A.key===Vn.UP&&m>0?f(D=>({...D,activePredictionIndex:m-1})):A.key===Vn.ENTER&&m>-1&&(s(p[m].description),h(D=>({...D,input:p[m].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},w=A=>{s(A.target.value),h(D=>({...D,input:A.target.value,displayInput:A.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},E=A=>{s(A.description),h(D=>({...D,input:A.description,displayInput:A.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:g,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((A,D)=>c.jsx("li",{onClick:()=>E(A),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:D})),className:K("predictions-list-item",{active:D===m}),children:A.description},D))})]})};const cf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...p})=>{const m=ae.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:w=>{(w.key==="Enter"||w.code==="Space")&&(w.preventDefault(),w.stopPropagation(),b())},tabIndex:d||!h?0:-1,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:w=>{const E=w.target;E.nodeName.toLowerCase()==="a"||E.parentNode&&E.parentNode.nodeName.toLowerCase()==="a"||(w.preventDefault(),w.stopPropagation(),b())},onKeyDown:h?w=>{var E,A,D;if(w.key!=="Tab")switch(w.code){case"Enter":case"Space":w.stopPropagation(),w.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":w.stopPropagation(),w.preventDefault();const k=w.currentTarget;let j=k==null?void 0:k.nextElementSibling;if(w.key==="ArrowLeft"){const L=k==null?void 0:k.previousElementSibling;L?j=L:j=(E=k==null?void 0:k.parentElement)==null?void 0:E.lastElementChild}else j||(j=(A=k==null?void 0:k.parentElement)==null?void 0:A.firstElementChild);j&&((D=j==null?void 0:j.querySelector("label"))==null||D.focus());break}}:void 0,className:K(a,"checkbox-wrapper",e,{"is-checked":d}),...p,...f},g)};const mv=y.memo(function({direction:t="down"}){return c.jsx(ii,{className:K("rotating-chevron",`direction-${t}`)})});const pv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ae.useIntl(),[h,p]=y.useState(!1),m=r||n,v=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(j=>j.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:w,onMultiSelectSubmit:E,...A}=a,D=j=>{if(o){let L=[];f!=null&&f.includes(j.id)?L=f.filter(M=>M!==j.id):L=[...f,j.id],b([...L]),w&&w([...L])}else b([j]),w&&w(j.id),p(!1)},k=j=>{if(j==="all"){const L=(t==null?void 0:t.map(M=>M.id))||[];b(L),w&&w(L)}else b([]),w&&w([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:j=>{j.preventDefault(),j.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:g.label,c.jsx(mv,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:j=>{j.preventDefault(),j.stopPropagation();const L=t&&t.find(M=>M.id===j.target.value);D(L)},hidden:!h,...A,children:t==null?void 0:t.map(j=>c.jsx("option",{value:j.id,className:"gtm-trackable","data-gtm-event-type":`${j.id}-click`,"data-gtm-event-context":i,children:j.label},j.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(j=>{const L=j.id===g.id||(f==null?void 0:f.includes(j))||(f==null?void 0:f.includes(j.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${j.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),D(j)},role:"menuitem","aria-current":L,"data-testid":L?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:j.label})]})},j.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{E&&E(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const zu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:h,...p})=>{const m=ae.useIntl(),v=i?d:[],f=d;return c.jsx("ul",{...p,className:K("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:b,label:g=!1,value:w=b,disabled:E=!1})=>{const A=`${r}_${b}`,D=()=>{if(E)return;let k;if(i){const j=v==null?void 0:v.indexOf(w);Array.isArray(v)&&j>=0?(k=v,k.splice(j,1)):(!v||v.length===0?k=[]:k=v,k.push(w))}else k=f===w?void 0:w;t.onChange(k)};return c.jsx(cf,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:w,value:i?v==null?void 0:v.includes(w):f===w,functions:{...t,onChange:D},intlPath:n,label:g||m.formatMessage({id:n?`${n}_${b}`:b}),disabled:E,accessibilityOptions:h},A)})})};const gv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Qn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Hn={text:{component:Qn},email:{component:Qn},url:{component:Qn},textarea:{component:Qn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:cf},checkboxes:{component:zu,props:{multiSelect:!0}},radio:{component:zu,props:{multiSelect:!1}},select:{component:pv},password:{component:gv},autocomplete:{component:hv}},vv=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:d,...h})=>{const p=ae.useIntl(),m=l&&l.some(({condition:I})=>I==="required"),v=di(u),f=o&&Hn[o]&&Hn[o].component?Hn[o].component:Qn,b=o&&["checkboxes","radio"].includes(o),g=o&&["autocomplete"].includes(o),w=r&&`error-${e}`,E=`character-limit-${e}`,A={};b?A.element="legend":A.htmlFor=e;let D={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:An(a),value:u};const k=I=>{D["aria-describedby"]?D["aria-describedby"]+=` ${I}`:D["aria-describedby"]=I};if(i>0){const I=uf(i,a.onChange);k(`${E}-info`),D={...D,...I},I.functions&&typeof I.functions=="object"&&(D.functions={...D.functions,...I.functions})}o&&Hn[o]&&Hn[o].props&&(D={...D,...Hn[o].props}),b&&(D.intlPath=`${t}_${e}`),r&&(D["aria-invalid"]=!0,D["aria-errormessage"]=w,k(w));const j=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),L=({...I})=>r?y.createElement(I.as||"p",{id:w,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...D,label:j,className:K("field-wrapper",n)}),c.jsx(L,{as:"p"})]});const M={};b||(M.className="field-label");const q=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:K("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?y.Fragment:"p",M,c.jsxs(q,{...A,children:[j,m&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(b||g?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...D}),c.jsx(Eo,{id:E,limit:i,valueLength:v})]})),c.jsx(L,{})]}))})},bv=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?An(e.errors):{},i=e.values?An(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,h=An(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:v="required",error:f=!1}=p.validation[m];let b=!1;if(typeof v=="function"){const g=v(i);g&&(b=f||g)}else{const g=i[p.id];switch(v){case"required":(!g||typeof g=="string"&&g.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{g&&!/^([^0-9]*)$/.test(g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{g&&!/^(([^<>()[\]\\.,;:\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(g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{g&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Ri=null;const Gt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const{customOnSubmit:m,hideButton:v,...f}=s,b=40,{shouldShowCancelButton:g=!1,shouldReset:w=!0,shouldHide:E=!0,showRequiredLabels:A=!0,showSuccessMessage:D=!1}=l||{},{onSuccess:k=async()=>{},onCancel:j=()=>{},onCatch:L=()=>{},onFailure:M=()=>{}}=h||{},q=ae.useIntl(),I={};t.length&&t.forEach(T=>{const $=T.id||T.name;$&&(I[$]=T.value||"")});const[B,F]=y.useReducer(bv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:P,isSubmitting:O,formSubmitted:U,values:W}=B;y.useEffect(()=>{w&&U&&(Ri=setTimeout(()=>{F({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[U]),y.useEffect(()=>()=>{Ri&&clearTimeout(Ri)},[]),y.useEffect(()=>{const T=$=>{F({type:"updateValue",payload:{key:$.detail.id,value:$.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const ie=y.useRef(null),te=a||ie;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=q.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const X=()=>{if(!O){if(F({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&F({type:"submitForm",payload:{fields:t,dispatch:F,intl:q}});return}F({type:"submitForm",payload:{fields:t,dispatch:F,onSuccess:async T=>{try{await k(T),F({type:w?"formSubmittedAndReset":"formSubmitted"})}catch($){L($),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,$)=>{M(T,$),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:q}})}},ue=T=>{var z;if(T.preventDefault(),T.stopPropagation(),O)return;let $=0;if((z=te==null?void 0:te.current)!=null&&z.id){const Y=document.getElementById(te.current.id);Y&&($=Y.getBoundingClientRect().top+window.scrollY)}const S=document.getElementById("header");S&&($=$-S.offsetHeight-b),$<0&&($=0),window.scrollTo({top:$,behavior:"smooth"}),X()},_=[{...f,icon:U?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",f.className),onClick:ue,disabled:O||U||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[O?"submitting":U?"submitted":"default"]}];return g&&_.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:O||U,onClick:j,children:o.text||q.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:K("form",n),ref:te},c.jsxs(c.Fragment,{children:[P!=null&&P.general?c.jsx(yn,{variant:"error",text:q.formatMessage({id:"form_error_generalError"})}):null,u,(!E||!O&&!U||m)&&t.map((T,$)=>{const{id:S=T.name||$,component:z,functions:Y={onChange:()=>{}},submitOnEnter:G=!1}=T;if(z)return c.jsx(z,{...T.props||{}},`component-${S}-${$}`);const re=(W==null?void 0:W[S])||"",le={...Y,onChange:Q=>{F({type:"updateValue",payload:{key:S,value:Q}}),Y.onChange(Q&&Q.toString(),F)}};return G&&(le.onKeyDown=Q=>{Q.key==="Enter"&&(Q.stopPropagation(),Q.preventDefault(),X()),Y.onKeyDown&&Y.onKeyDown(Q)}),c.jsx(vv,{intlPath:i,...T,showRequiredLabels:A,value:re,error:P==null?void 0:P[S],functions:le},S)}),v?null:(O||U)&&m?m:c.jsx(mr,{className:K("cta",{center:O||U,submitted:U}),buttons:_})]})),D&&U&&c.jsx(or,{className:"success",children:typeof D=="string"?D:q.formatMessage({id:"form_success"})})]})};const ca="passwordRules_",df="isMoreThanEightCharacters",ff="includesNumberAndSymbol",hf="includesLowerAndUppercase",yv={[df]:"8Characters",[ff]:"numberSymbol",[hf]:"lowercaseUppercase"},xv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ca}intro`})}),c.jsx("ul",{children:[df,ff,hf].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(Oe,{children:[n.formatMessage({id:`${ca}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ca}rule_${yv[r]}`})}),!e[r]&&c.jsxs(Oe,{element:"strong",children:[" ",n.formatMessage({id:`${ca}notMet`})]})]},`rule-${r}`))})]})},mf=y.memo(xv);const Dv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(w=>({...w,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(w=>({...w,setUp:!0,disabled:!0})),a(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Pt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!h||m))try{u(w=>({...w,rating:g,disabled:!0})),await r({id:h,value:g})}catch(w){u(E=>({...E,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return c.jsxs("div",{className:K("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const w=g+1;return c.jsx("li",{className:K({selected:p&&w<=p}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:E=>{E.preventDefault(),E.stopPropagation(),b(w)},disabled:m})},`rating-${w}`)})})]})},Cv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},un=y.createContext(Cv);var H=(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.h3="heading_three",e))(H||{}),Vt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Vt||{});const wv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const a=r;return a!=null&&a.name&&a.name===Ir?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Ev=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var _v=Av,pf="֑-߿יִ-﷽ﹰ-ﻼ",gf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",kv=new RegExp("^[^"+gf+"]*["+pf+"]"),Fv=new RegExp("^[^"+pf+"]*["+gf+"]");function Av(e){return e=String(e||""),kv.test(e)?"rtl":Fv.test(e)?"ltr":"neutral"}const vf=Rn(_v);function Bv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var _o=Bv,Tv=typeof ta=="object"&&ta&&ta.Object===Object&&ta,Sv=Tv,jv=Sv,Ov=typeof self=="object"&&self&&self.Object===Object&&self,Pv=jv||Ov||Function("return this")(),bf=Pv,Mv=bf,Nv=function(){return Mv.Date.now()},Rv=Nv,Iv=/\s/;function $v(e){for(var t=e.length;t--&&Iv.test(e.charAt(t)););return t}var Lv=$v,zv=Lv,qv=/^\s+/;function Uv(e){return e&&e.slice(0,zv(e)+1).replace(qv,"")}var Wv=Uv,Vv=bf,Hv=Vv.Symbol,yf=Hv,qu=yf,xf=Object.prototype,Kv=xf.hasOwnProperty,Zv=xf.toString,Er=qu?qu.toStringTag:void 0;function Yv(e){var t=Kv.call(e,Er),n=e[Er];try{e[Er]=void 0;var r=!0}catch{}var a=Zv.call(e);return r&&(t?e[Er]=n:delete e[Er]),a}var Gv=Yv,Qv=Object.prototype,Jv=Qv.toString;function Xv(e){return Jv.call(e)}var eb=Xv,Uu=yf,tb=Gv,nb=eb,rb="[object Null]",ab="[object Undefined]",Wu=Uu?Uu.toStringTag:void 0;function ib(e){return e==null?e===void 0?ab:rb:Wu&&Wu in Object(e)?tb(e):nb(e)}var sb=ib;function ob(e){return e!=null&&typeof e=="object"}var ub=ob,lb=sb,cb=ub,db="[object Symbol]";function fb(e){return typeof e=="symbol"||cb(e)&&lb(e)==db}var hb=fb,mb=Wv,Vu=_o,pb=hb,Hu=0/0,gb=/^[-+]0x[0-9a-f]+$/i,vb=/^0b[01]+$/i,bb=/^0o[0-7]+$/i,yb=parseInt;function xb(e){if(typeof e=="number")return e;if(pb(e))return Hu;if(Vu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Vu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=mb(e);var n=vb.test(e);return n||bb.test(e)?yb(e.slice(2),n?2:8):gb.test(e)?Hu:+e}var Db=xb,Cb=_o,Ii=Rv,Ku=Db,wb="Expected a function",Eb=Math.max,_b=Math.min;function kb(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(wb);t=Ku(t)||0,Cb(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Eb(Ku(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(k){var j=r,L=a;return r=a=void 0,u=k,s=e.apply(L,j),s}function v(k){return u=k,o=setTimeout(g,t),d?m(k):s}function f(k){var j=k-l,L=k-u,M=t-j;return h?_b(M,i-L):M}function b(k){var j=k-l,L=k-u;return l===void 0||j>=t||j<0||h&&L>=i}function g(){var k=Ii();if(b(k))return w(k);o=setTimeout(g,f(k))}function w(k){return o=void 0,p&&r?m(k):(r=a=void 0,s)}function E(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function A(){return o===void 0?s:w(Ii())}function D(){var k=Ii(),j=b(k);if(r=arguments,a=this,l=k,j){if(o===void 0)return v(l);if(h)return clearTimeout(o),o=setTimeout(g,t),m(l)}return o===void 0&&(o=setTimeout(g,t)),s}return D.cancel=E,D.flush=A,D}var Df=kb;const Fb=Rn(Df);var Ab=Df,Bb=_o,Tb="Expected a function";function Sb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Tb);return Bb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Ab(e,t,{leading:r,maxWait:t,trailing:a})}var jb=Sb;const Ob=Rn(jb),Zu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Yu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",$i=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Yu(n.overflowY,t)||Yu(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},da=(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,Pb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Gu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:U=>U!==u;if(!Zu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let v=e;for(;Zu(v)&&h(v);){if(v=Pb(v),v===p){m.push(v);break}v!=null&&v===document.body&&$i(v)&&!$i(document.documentElement)||v!=null&&$i(v,d)&&m.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:g,scrollY:w}=window,{height:E,width:A,top:D,right:k,bottom:j,left:L}=e.getBoundingClientRect(),{top:M,right:q,bottom:I,left:B}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?D-M:o==="end"?j+I:D+E/2-M+I,P=l==="center"?L+A/2-B+q:l==="end"?k+q:L-B;const O=[];for(let U=0;U<m.length;U++){const W=m[U],{height:ie,width:te,top:C,right:X,bottom:ue,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&D>=0&&L>=0&&j<=b&&k<=f&&D>=C&&j<=ue&&L>=_&&k<=X)return O;const T=getComputedStyle(W),$=parseInt(T.borderLeftWidth,10),S=parseInt(T.borderTopWidth,10),z=parseInt(T.borderRightWidth,10),Y=parseInt(T.borderBottomWidth,10);let G=0,re=0;const le="offsetWidth"in W?W.offsetWidth-W.clientWidth-$-z:0,Q="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-Y:0,me="offsetWidth"in W?W.offsetWidth===0?0:te/W.offsetWidth:0,pe="offsetHeight"in W?W.offsetHeight===0?0:ie/W.offsetHeight:0;if(p===W)G=o==="start"?F:o==="end"?F-b:o==="nearest"?da(w,w+b,b,S,Y,w+F,w+F+E,E):F-b/2,re=l==="start"?P:l==="center"?P-f/2:l==="end"?P-f:da(g,g+f,f,$,z,g+P,g+P+A,A),G=Math.max(0,G+w),re=Math.max(0,re+g);else{G=o==="start"?F-C-S:o==="end"?F-ue+Y+Q:o==="nearest"?da(C,ue,ie,S,Y+Q,F,F+E,E):F-(C+ie/2)+Q/2,re=l==="start"?P-_-$:l==="center"?P-(_+te/2)+le/2:l==="end"?P-X+z+le:da(_,X,te,$,z+le,P,P+A,A);const{scrollLeft:ke,scrollTop:je}=W;G=pe===0?0:Math.max(0,Math.min(je+G/pe,W.scrollHeight-ie/pe+Q)),re=me===0?0:Math.max(0,Math.min(ke+re/me,W.scrollWidth-te/me+le)),F+=je-G,P+=ke-re}O.push({el:W,top:G,left:re})}return O},Mb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Nb(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(Gu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Gu(e,Mb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${wr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:wr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const cv="shareLinks_",dv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ie.useIntl(),l=lv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const v={};return m&&(v.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${cv}link_${u}`}),...v})},u)})})]})};const fv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),a=Rn(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){i=g;break}}}const[s,o]=y.useState((v=e[i])!=null&&v.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const C=r(e[g].id,e[g].text,g),D=document.getElementById(`tab-${C}`);D==null||D.focus(),u(C);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:g,href:C,hasCarousel:D,breakpoint:A},E)=>{if(A&&!h(A))return;f=r(f,b,E);const k=s===f,S={};C||(S["aria-controls"]=f,S.onClick=$=>{$.preventDefault(),$.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:C||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:K({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:$=>d($,E),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const hv={"2-1":901,"1-3":769,"1-1":769},uf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Rn(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<hv[e]?null:o)})};const _o=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ie.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(je,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},fi=e=>(e==null?void 0:e.toString().length)||0,lf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{fi(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const ca="emailHelperTextBox_",cf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ie.useIntl(),[s,o]=y.useState({path:`${ca}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${ca}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${ca}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let v=ca,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:C=>d(C),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:f,link:b,mail:g})},[t]);const h={};return["link","mail"].forEach(v=>{h[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(pd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Pt,{element:"span"}),c.jsx(Pt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Qn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,...h})=>{const p=y.useRef(),m=r||p;return y.useEffect(()=>{var v;u&&((v=m.current)==null||v.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:m,...h,type:o,id:n,name:i,className:K(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:v=>{const f=v.target;a.onChange(f.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},mv=500,pv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{v||h(E=>({...E,debouncedInput:l}))},mv);return()=>{clearTimeout(A)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];f(k=>({...k,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(k=>({...k,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,v]),y.useEffect(()=>{m>=0&&p[m]&&h(A=>({...A,displayInput:p[m].description}))},[m,p]);const g=A=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Vn.DOWN&&m<p.length-1?f(E=>({...E,activePredictionIndex:m+1})):A.key===Vn.UP&&m>0?f(E=>({...E,activePredictionIndex:m-1})):A.key===Vn.ENTER&&m>-1&&(s(p[m].description),h(E=>({...E,input:p[m].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},C=A=>{s(A.target.value),h(E=>({...E,input:A.target.value,displayInput:A.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},D=A=>{s(A.description),h(E=>({...E,input:A.description,displayInput:A.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:C,onKeyDown:g,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((A,E)=>c.jsx("li",{onClick:()=>D(A),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:E})),className:K("predictions-list-item",{active:E===m}),children:A.description},E))})]})};const df=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...p})=>{const m=ie.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:C=>{(C.key==="Enter"||C.code==="Space")&&(C.preventDefault(),C.stopPropagation(),b())},tabIndex:d||!h?0:-1,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:C=>{const D=C.target;D.nodeName.toLowerCase()==="a"||D.parentNode&&D.parentNode.nodeName.toLowerCase()==="a"||(C.preventDefault(),C.stopPropagation(),b())},onKeyDown:h?C=>{var D,A,E;if(C.key!=="Tab")switch(C.code){case"Enter":case"Space":C.stopPropagation(),C.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":C.stopPropagation(),C.preventDefault();const k=C.currentTarget;let S=k==null?void 0:k.nextElementSibling;if(C.key==="ArrowLeft"){const $=k==null?void 0:k.previousElementSibling;$?S=$:S=(D=k==null?void 0:k.parentElement)==null?void 0:D.lastElementChild}else S||(S=(A=k==null?void 0:k.parentElement)==null?void 0:A.firstElementChild);S&&((E=S==null?void 0:S.querySelector("label"))==null||E.focus());break}}:void 0,className:K(a,"checkbox-wrapper",e,{"is-checked":d}),...p,...f},g)};const gv=y.memo(function({direction:t="down"}){return c.jsx(si,{className:K("rotating-chevron",`direction-${t}`)})});const vv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ie.useIntl(),[h,p]=y.useState(!1),m=r||n,v=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:C,onMultiSelectSubmit:D,...A}=a,E=S=>{if(o){let $=[];f!=null&&f.includes(S.id)?$=f.filter(M=>M!==S.id):$=[...f,S.id],b([...$]),C&&C([...$])}else b([S]),C&&C(S.id),p(!1)},k=S=>{if(S==="all"){const $=(t==null?void 0:t.map(M=>M.id))||[];b($),C&&C($)}else b([]),C&&C([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:g.label,c.jsx(gv,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const $=t&&t.find(M=>M.id===S.target.value);E($)},hidden:!h,...A,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const $=S.id===g.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),E(S)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{D&&D(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Br=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\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(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};const bv=({id:e,label:t,limit:n,value:r,placeholder:a,functions:i,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...h})=>{const p=ie.useIntl(),[m,v]=y.useState(r?Array.isArray(r)?r:[r]:[""]),f=m.filter(k=>k!=="");y.useEffect(()=>{if(!u)return;const k=It(u.fields).filter(({id:$,name:M})=>($||($=M||""),$!==e&&!$.includes(`${e}-`))),S=[];m.map(($,M)=>{if(C&&M>=C)return;const z=It(l);z&&e&&(z.forEach(R=>{const{condition:B,error:F}=R;if(typeof B=="function")R.condition=P=>{var W;let j=(W=P==null?void 0:P[e])==null?void 0:W[M];j||(P[e]&&!Array.isArray(P[e])?j=P[e]:j="");const U=It(P);return U[e]=j,typeof B=="function"&&B(U)?F:!1};else{const P=B;R.condition=j=>{var W;let U=(W=j==null?void 0:j[e])==null?void 0:W[M];switch(U||(j[e]&&!Array.isArray(j[e])?U=j[e]:U=""),P){case"required":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_required"}));break;case"no-numbers":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_numbers"}));break;case"valid-email":F||(R.error=F||(p==null?void 0:p.formatMessage({id:"form_error_email"})));break;case"valid-url":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Br(P,U)?R.error:!1}}}),S.push({id:`${e}-${M}`,validation:z,value:$}))}),u.setFields(k.concat(S))},[m.length]);const{showCount:b=!1,label:g,maxInputs:C=100,hasButton:D=!1}=o||{},A=()=>{(!C||m.length<C)&&v([...m,""])},E=(k,S)=>k.replace("{number}",S+1);return c.jsxs("fieldset",{className:K("multiple-inputs field-wrapper",{"has-button":D,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",children:[t,b?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":p.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:f.length,total:C}),children:p.formatMessage({id:"form_multipleInputs_filledInCount"},{number:f.length,total:C})})]}):""]}):c.jsx(c.Fragment,{}),m.map((k,S)=>{if(C&&S>=C)return c.jsx(c.Fragment,{});let $=!1;t?$=c.jsx(je,{showOnFocus:!1,children:p.formatMessage({id:"form_multipleInputs_label"},{number:S+1})}):g&&($=E(g,S));const M=`${e}-${S}`;return c.jsx(ff,{id:M,type:"text",label:$,value:k,placeholder:a?E(a,S):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[M]:void 0,functions:{onFocus:()=>{D||S!==m.length-1||A()},onChange:z=>{const R=It(m);R[S]=z,v(R),u==null||u.dispatch({type:"removeError",payload:{key:M}}),i==null||i.onChange(R)}},...h},M)}),D?c.jsx(Ee,{...D,onClick:A,disabled:!!(C&&C<=m.length)}):c.jsx(c.Fragment,{})]})};const qu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:h,styling:{displayOptionsAsPills:p=!1}={},...m})=>{const v=ie.useIntl(),f=i?d:[],b=d;return c.jsx("ul",{...m,className:K("options-wrapper",e,{"with-pills filters":p}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:C=!1,value:D=g,disabled:A=!1})=>{const E=`${r}_${g}`,k=()=>{if(A)return;let S;if(i){const $=f==null?void 0:f.indexOf(D);Array.isArray(f)&&$>=0?(S=f,S.splice($,1)):(!f||f.length===0?S=[]:S=f,S.push(D))}else S=b===D?void 0:D;t.onChange(S)};return c.jsx(df,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:D,value:i?f==null?void 0:f.includes(D):b===D,functions:{...t,onChange:k},intlPath:n,label:C||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:A,accessibilityOptions:h},E)})})};const yv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ie.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Qn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Hn={text:{component:Qn},email:{component:Qn},url:{component:Qn},textarea:{component:Qn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:df},checkboxes:{component:qu,props:{multiSelect:!0}},radio:{component:qu,props:{multiSelect:!1}},select:{component:vv},password:{component:yv},autocomplete:{component:pv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},ff=e=>{const t=ie.useIntl(),{id:n,intlPath:r=!1,className:a="",error:i,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:h,submitOnEnter:p,fieldData:m,...v}=e;if(u&&u==="multiple-inputs")return c.jsx(bv,{...e});const f=d&&d.some(({condition:F})=>F==="required"),b=fi(h),g=u&&Hn[u]&&Hn[u].component?Hn[u].component:Qn,C=u&&["checkboxes","radio"].includes(u),D=u&&["autocomplete"].includes(u),A=i&&`error-${n}`,E=`character-limit-${n}`,k={};C?k.element="legend":k.htmlFor=n;let S={...v,id:n,name:n,className:i?"error":"",type:u,required:f,"aria-required":f,functions:It(s),value:h};const $=F=>{S["aria-describedby"]?S["aria-describedby"]+=` ${F}`:S["aria-describedby"]=F};if(o>0){const F=lf(o,s);$(`${E}-info`),S={...S,...F},F.functions&&typeof F.functions=="object"&&(S.functions={...S.functions,...F.functions})}u&&Hn[u]&&Hn[u].props&&(S={...S,...Hn[u].props}),C&&(S.intlPath=`${r}_${n}`),i&&(S["aria-invalid"]=!0,S["aria-errormessage"]=A,$(A));const M=v.label||t.formatMessage({id:r?`${r}_${n}`:n}),z=({...F})=>i?y.createElement(F.as||"p",{id:A,className:"error text-small",...F},i):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(g,{...S,label:M,className:K("field-wrapper",a)}),c.jsx(z,{as:"p"})]});const R={};C?k.className="legend-as-label text-small":R.className="field-label";const B=({element:F,...P})=>y.createElement(F||"label",{...P,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(C?"fieldset":"div",{className:K("field-wrapper text-medium",a)},c.jsxs(c.Fragment,{children:[v.label===!1?c.jsx(c.Fragment,{}):y.createElement(C?y.Fragment:"p",R,c.jsxs(B,{...k,children:[M,f&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(C||D?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(g,{...S}),c.jsx(_o,{id:E,limit:o,valueLength:b})]})),c.jsx(z,{})]}))})},xv=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?It(e.errors):{},i=e.values?It(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,h=It(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:v="required",error:f=!1}=p.validation[m];let b=!1;if(typeof v=="function"){const g=v(i);g&&(b=f||g)}else{const g=i[p.id],C=v;switch(C){case"required":Br(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Br(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Br(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Br(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Ri=null;const Qt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const[m,v]=y.useState(t);y.useEffect(()=>{v(t)},[t]);const{customOnSubmit:f,hideButton:b,...g}=s,C=40,{shouldShowCancelButton:D=!1,shouldReset:A=!0,shouldHide:E=!0,showRequiredLabels:k=!0,showSuccessMessage:S=!1}=l||{},{onSuccess:$=async()=>{},onCancel:M=()=>{},onCatch:z=()=>{},onFailure:R=()=>{}}=h||{},B=ie.useIntl(),F={};t.length&&t.forEach(T=>{const L=T.id||T.name;L&&(F[L]=T.value||"")});const[P,j]=y.useReducer(xv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:F}),{errors:U,isSubmitting:W,formSubmitted:ne,values:re}=P;y.useEffect(()=>{A&&ne&&(Ri=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[ne]),y.useEffect(()=>()=>{Ri&&clearTimeout(Ri)},[]),y.useEffect(()=>{const T=L=>{j({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const w=y.useRef(null),Q=a||w;if(!t.length)return null;const se={};s.children&&(se.default=s.children),g.text&&typeof g.text=="string"&&(se.default=g.text),["default","submitting","submitted"].forEach(T=>{g.text&&typeof g.text!="string"&&T in g.text?se[T]=g.text[T]:se[T]||(se[T]=B.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete g.text;const _=()=>{if(!W){if(j({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&j({type:"submitForm",payload:{fields:m,dispatch:j,intl:B}});return}j({type:"submitForm",payload:{fields:m,dispatch:j,onSuccess:async T=>{try{await $(T),j({type:A?"formSubmittedAndReset":"formSubmitted"})}catch(L){z(L),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,L)=>{R(T,L),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},O=T=>{var Y;if(T.preventDefault(),T.stopPropagation(),W)return;let L=0;if((Y=Q==null?void 0:Q.current)!=null&&Y.id){const te=document.getElementById(Q.current.id);te&&(L=te.getBoundingClientRect().top+window.scrollY)}const G=document.getElementById("header");G&&(L=L-G.offsetHeight-C),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),_()},q=[{...g,icon:ne?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",g.className),onClick:O,disabled:W||ne||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:se[W?"submitting":ne?"submitted":"default"]}];return D&&q.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:W||ne,onClick:M,children:o.text||B.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:K("form",n),ref:Q},c.jsxs(c.Fragment,{children:[U!=null&&U.general?c.jsx(xn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,u,(!E||!W&&!ne||f)&&t.map((T,L)=>{const{id:G=T.name||L,component:Y,functions:te={onChange:()=>{}},submitOnEnter:le=!1}=T;if(Y)return c.jsx(Y,{...T.props||{}},`component-${G}-${L}`);const X=(re==null?void 0:re[G])||"",pe={...te,onChange:fe=>{j({type:"updateValue",payload:{key:G,value:fe}}),te.onChange(fe&&fe.toString(),j)}};return le&&(pe.onKeyDown=fe=>{fe.key==="Enter"&&(fe.stopPropagation(),fe.preventDefault(),_()),te.onKeyDown&&te.onKeyDown(fe)}),c.jsx(ff,{intlPath:i,...T,showRequiredLabels:k,value:X,error:T.type==="multiple-inputs"?U:U==null?void 0:U[G],functions:pe,fieldData:{fields:m,setFields:v,dispatch:j}},G)}),b?null:(W||ne)&&f?f:c.jsx(mr,{className:K("cta",{center:W||ne,submitted:ne}),buttons:q})]})),S&&ne&&c.jsx(or,{className:"success",children:typeof S=="string"?S:B.formatMessage({id:"form_success"})})]})};const da="passwordRules_",hf="isMoreThanEightCharacters",mf="includesNumberAndSymbol",pf="includesLowerAndUppercase",Cv={[hf]:"8Characters",[mf]:"numberSymbol",[pf]:"lowercaseUppercase"},Dv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${da}intro`})}),c.jsx("ul",{children:[hf,mf,pf].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(je,{children:[n.formatMessage({id:`${da}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${da}rule_${Cv[r]}`})}),!e[r]&&c.jsxs(je,{element:"strong",children:[" ",n.formatMessage({id:`${da}notMet`})]})]},`rule-${r}`))})]})},gf=y.memo(Dv);const wv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(C=>({...C,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(C=>({...C,setUp:!0,disabled:!0})),a(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Pt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!h||m))try{u(C=>({...C,rating:g,disabled:!0})),await r({id:h,value:g})}catch(C){u(D=>({...D,rating:null})),a(C)}finally{u(C=>({...C,disabled:!1}))}};return c.jsxs("div",{className:K("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const C=g+1;return c.jsx("li",{className:K({selected:p&&C<=p}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!p||C>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:C,total:t})}${C===1||C===t?` - ${f[C===1?"low":"high"]}`:""}`,onClick:D=>{D.preventDefault(),D.stopPropagation(),b(C)},disabled:m})},`rating-${C}`)})})]})},Ev={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},ln=y.createContext(Ev);var H=(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.h3="heading_three",e))(H||{}),Ht=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ht||{});const _v=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const a=r;return a!=null&&a.name&&a.name===$r?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},kv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var Fv=Tv,vf="֑-߿יִ-﷽ﹰ-ﻼ",bf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Av=new RegExp("^[^"+bf+"]*["+vf+"]"),Bv=new RegExp("^[^"+vf+"]*["+bf+"]");function Tv(e){return e=String(e||""),Av.test(e)?"rtl":Bv.test(e)?"ltr":"neutral"}const yf=In(Fv);function Sv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ko=Sv,jv=typeof na=="object"&&na&&na.Object===Object&&na,Ov=jv,Pv=Ov,Mv=typeof self=="object"&&self&&self.Object===Object&&self,Nv=Pv||Mv||Function("return this")(),xf=Nv,Iv=xf,Rv=function(){return Iv.Date.now()},$v=Rv,Lv=/\s/;function zv(e){for(var t=e.length;t--&&Lv.test(e.charAt(t)););return t}var qv=zv,Uv=qv,Wv=/^\s+/;function Vv(e){return e&&e.slice(0,Uv(e)+1).replace(Wv,"")}var Hv=Vv,Kv=xf,Zv=Kv.Symbol,Cf=Zv,Uu=Cf,Df=Object.prototype,Yv=Df.hasOwnProperty,Gv=Df.toString,Er=Uu?Uu.toStringTag:void 0;function Qv(e){var t=Yv.call(e,Er),n=e[Er];try{e[Er]=void 0;var r=!0}catch{}var a=Gv.call(e);return r&&(t?e[Er]=n:delete e[Er]),a}var Jv=Qv,Xv=Object.prototype,eb=Xv.toString;function tb(e){return eb.call(e)}var nb=tb,Wu=Cf,rb=Jv,ab=nb,ib="[object Null]",sb="[object Undefined]",Vu=Wu?Wu.toStringTag:void 0;function ob(e){return e==null?e===void 0?sb:ib:Vu&&Vu in Object(e)?rb(e):ab(e)}var ub=ob;function lb(e){return e!=null&&typeof e=="object"}var cb=lb,db=ub,fb=cb,hb="[object Symbol]";function mb(e){return typeof e=="symbol"||fb(e)&&db(e)==hb}var pb=mb,gb=Hv,Hu=ko,vb=pb,Ku=0/0,bb=/^[-+]0x[0-9a-f]+$/i,yb=/^0b[01]+$/i,xb=/^0o[0-7]+$/i,Cb=parseInt;function Db(e){if(typeof e=="number")return e;if(vb(e))return Ku;if(Hu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Hu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=gb(e);var n=yb.test(e);return n||xb.test(e)?Cb(e.slice(2),n?2:8):bb.test(e)?Ku:+e}var wb=Db,Eb=ko,$i=$v,Zu=wb,_b="Expected a function",kb=Math.max,Fb=Math.min;function Ab(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(_b);t=Zu(t)||0,Eb(n)&&(d=!!n.leading,h="maxWait"in n,i=h?kb(Zu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(k){var S=r,$=a;return r=a=void 0,u=k,s=e.apply($,S),s}function v(k){return u=k,o=setTimeout(g,t),d?m(k):s}function f(k){var S=k-l,$=k-u,M=t-S;return h?Fb(M,i-$):M}function b(k){var S=k-l,$=k-u;return l===void 0||S>=t||S<0||h&&$>=i}function g(){var k=$i();if(b(k))return C(k);o=setTimeout(g,f(k))}function C(k){return o=void 0,p&&r?m(k):(r=a=void 0,s)}function D(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function A(){return o===void 0?s:C($i())}function E(){var k=$i(),S=b(k);if(r=arguments,a=this,l=k,S){if(o===void 0)return v(l);if(h)return clearTimeout(o),o=setTimeout(g,t),m(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=D,E.flush=A,E}var wf=Ab;const Bb=In(wf);var Tb=wf,Sb=ko,jb="Expected a function";function Ob(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(jb);return Sb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Tb(e,t,{leading:r,maxWait:t,trailing:a})}var Pb=Ob;const Mb=In(Pb),Yu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Gu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Li=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Gu(n.overflowY,t)||Gu(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},fa=(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,Nb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Qu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:U=>U!==u;if(!Yu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let v=e;for(;Yu(v)&&h(v);){if(v=Nb(v),v===p){m.push(v);break}v!=null&&v===document.body&&Li(v)&&!Li(document.documentElement)||v!=null&&Li(v,d)&&m.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:g,scrollY:C}=window,{height:D,width:A,top:E,right:k,bottom:S,left:$}=e.getBoundingClientRect(),{top:M,right:z,bottom:R,left:B}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-M:o==="end"?S+R:E+D/2-M+R,P=l==="center"?$+A/2-B+z:l==="end"?k+z:$-B;const j=[];for(let U=0;U<m.length;U++){const W=m[U],{height:ne,width:re,top:w,right:Q,bottom:se,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&E>=0&&$>=0&&S<=b&&k<=f&&E>=w&&S<=se&&$>=_&&k<=Q)return j;const O=getComputedStyle(W),q=parseInt(O.borderLeftWidth,10),T=parseInt(O.borderTopWidth,10),L=parseInt(O.borderRightWidth,10),G=parseInt(O.borderBottomWidth,10);let Y=0,te=0;const le="offsetWidth"in W?W.offsetWidth-W.clientWidth-q-L:0,X="offsetHeight"in W?W.offsetHeight-W.clientHeight-T-G:0,pe="offsetWidth"in W?W.offsetWidth===0?0:re/W.offsetWidth:0,fe="offsetHeight"in W?W.offsetHeight===0?0:ne/W.offsetHeight:0;if(p===W)Y=o==="start"?F:o==="end"?F-b:o==="nearest"?fa(C,C+b,b,T,G,C+F,C+F+D,D):F-b/2,te=l==="start"?P:l==="center"?P-f/2:l==="end"?P-f:fa(g,g+f,f,q,L,g+P,g+P+A,A),Y=Math.max(0,Y+C),te=Math.max(0,te+g);else{Y=o==="start"?F-w-T:o==="end"?F-se+G+X:o==="nearest"?fa(w,se,ne,T,G+X,F,F+D,D):F-(w+ne/2)+X/2,te=l==="start"?P-_-q:l==="center"?P-(_+re/2)+le/2:l==="end"?P-Q+L+le:fa(_,Q,re,q,L+le,P,P+A,A);const{scrollLeft:ke,scrollTop:Oe}=W;Y=fe===0?0:Math.max(0,Math.min(Oe+Y/fe,W.scrollHeight-ne/fe+X)),te=pe===0?0:Math.max(0,Math.min(ke+te/pe,W.scrollWidth-re/pe+le)),F+=Oe-Y,P+=ke-te}j.push({el:W,top:Y,left:te})}return j},Ib=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Rb(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(Qu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Qu(e,Ib(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
67
67
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
68
68
  *
69
69
  * Copyright (c) 2014-2017, Jon Schlinkert.
70
70
  * Released under the MIT License.
71
- */function Qu(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return Qu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Qu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Cf=Symbol.for("immer-nothing"),Ju=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),Rb=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Rb[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 cr=Object.getPrototypeOf;function Pn(e){return!!e&&!!e[_t]}function Mn(e){var t;return e?wf(e)||Array.isArray(e)||!!e[Ju]||!!((t=e.constructor)!=null&&t[Ju])||hi(e)||mi(e):!1}var Ib=Object.prototype.constructor.toString();function wf(e){if(!e||typeof e!="object")return!1;const t=cr(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)===Ib}function Ka(e,t){fi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function fi(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:hi(e)?2:mi(e)?3:0}function js(e,t){return fi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ef(e,t,n){const r=fi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function $b(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function hi(e){return e instanceof Map}function mi(e){return e instanceof Set}function _n(e){return e.copy_||e.base_}function Os(e,t){if(hi(e))return new Map(e);if(mi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=wf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[_t];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(cr(e),r)}else{const r=cr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function ko(e,t=!1){return pi(e)||Pn(e)||!Mn(e)||(fi(e)>1&&(e.set=e.add=e.clear=e.delete=Lb),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ko(r,!0))),e}function Lb(){xt(2)}function pi(e){return Object.isFrozen(e)}var zb={};function Nn(e){const t=zb[e];return t||xt(0,e),t}var zr;function _f(){return zr}function qb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xu(e,t){t&&(Nn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ps(e){Ms(e),e.drafts_.forEach(Ub),e.drafts_=null}function Ms(e){e===zr&&(zr=e.parent_)}function el(e){return zr=qb(zr,e)}function Ub(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_t].modified_&&(Ps(t),xt(4)),Mn(e)&&(e=Za(t,e),t.parent_||Ya(t,e)),t.patches_&&Nn("Patches").generateReplacementPatches_(n[_t].base_,e,t.patches_,t.inversePatches_)):e=Za(t,n,[]),Ps(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Cf?e:void 0}function Za(e,t,n){if(pi(t))return t;const r=t[_t];if(!r)return Ka(t,(a,i)=>nl(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ya(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),Ka(i,(o,l)=>nl(e,r,a,o,l,n,s)),Ya(e,a,!1),n&&e.patches_&&Nn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nl(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&xt(5),Pn(a)){const o=i&&t&&t.type_!==3&&!js(t.assigned_,r)?i.concat(r):void 0,l=Za(e,a,o);if(Ef(n,r,l),Pn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Mn(a)&&!pi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Za(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ya(e,a)}}function Ya(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ko(t,n)}function Wb(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:_f(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Fo;n&&(a=[r],i=qr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Fo={get(e,t){if(t===_t)return e;const n=_n(e);if(!js(n,t))return Vb(e,n,t);const r=n[t];return e.finalized_||!Mn(r)?r:r===Li(e.base_,t)?(zi(e),e.copy_[t]=Rs(r,e)):r},has(e,t){return t in _n(e)},ownKeys(e){return Reflect.ownKeys(_n(e))},set(e,t,n){const r=kf(_n(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Li(_n(e),t),i=a==null?void 0:a[_t];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if($b(n,a)&&(n!==void 0||js(e.base_,t)))return!0;zi(e),Ns(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Li(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,zi(e),Ns(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=_n(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return cr(e.base_)},setPrototypeOf(){xt(12)}},qr={};Ka(Fo,(e,t)=>{qr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});qr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),qr.set.call(this,e,t,void 0)};qr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),Fo.set.call(this,e[0],t,n,e[0])};function Li(e,t){const n=e[_t];return(n?_n(n):e)[t]}function Vb(e,t,n){var a;const r=kf(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function kf(e,t){if(!(t in e))return;let n=cr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=cr(n)}}function Ns(e){e.modified_||(e.modified_=!0,e.parent_&&Ns(e.parent_))}function zi(e){e.copy_||(e.copy_=Os(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Hb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let a;if(Mn(t)){const i=el(this),s=Rs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Ps(i):Ms(i)}return Xu(i,r),tl(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Cf&&(a=void 0),this.autoFreeze_&&ko(a,!0),r){const i=[],s=[];Nn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Mn(e)||xt(8),Pn(e)&&(e=Kb(e));const t=el(this),n=Rs(e,void 0);return n[_t].isManual_=!0,Ms(t),n}finishDraft(e,t){const n=e&&e[_t];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Xu(r,t),tl(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=Nn("Patches").applyPatches_;return Pn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Rs(e,t){const n=hi(e)?Nn("MapSet").proxyMap_(e,t):mi(e)?Nn("MapSet").proxySet_(e,t):Wb(e,t);return(t?t.scope_:_f()).drafts_.push(n),n}function Kb(e){return Pn(e)||xt(10,e),Ff(e)}function Ff(e){if(!Mn(e)||pi(e))return e;const t=e[_t];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Os(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Os(e,!0);return Ka(n,(r,a)=>{Ef(n,r,Ff(a))}),t&&(t.finalized_=!1),n}var kt=new Hb,Ao=kt.produce;kt.produceWithPatches.bind(kt);kt.setAutoFreeze.bind(kt);kt.setUseStrictShallowCopy.bind(kt);kt.applyPatches.bind(kt);var rl=kt.createDraft.bind(kt),al=kt.finishDraft.bind(kt),Zb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=R.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Yb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=_e.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Gb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Z.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ga=new WeakMap,Qa=new WeakMap,jr=new WeakMap,Af=new WeakMap,il=new WeakMap,sl=new WeakMap,ol=new WeakMap,R={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=R.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 R.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return R.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 R.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 R.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&R.compare(e,t)===0},isBefore(e,t){return R.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&R.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&R.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&R.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&R.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&&R.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(!R.isAncestor(t,e)&&!R.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;(R.equals(i,r)||R.endsBefore(i,r)||R.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(R.equals(s,r)||R.isAncestor(s,r))return null;R.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;R.equals(o,r)||R.endsBefore(o,r)?r[o.length-1]-=1:R.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(R.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else R.endsBefore(u,r)?r[u.length-1]+=1:R.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(R.equals(h,p))return r;if(R.isAncestor(h,r)||R.equals(h,r)){var m=p.slice();return R.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else R.isSibling(h,p)&&(R.isAncestor(p,r)||R.equals(p,r))?R.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:R.endsBefore(p,r)||R.equals(p,r)||R.isAncestor(p,r)?(R.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):R.endsBefore(h,r)&&(R.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Ur(e){"@babel/helpers - typeof";return Ur=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},Ur(e)}function Qb(e,t){if(Ur(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ur(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jb(e){var t=Qb(e,"string");return Ur(t)==="symbol"?t:String(t)}function pt(e,t,n){return t=Jb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ul(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ul(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xb=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=oe.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 Z.points(t))t[l]=_e.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=oe.leaf(e,u),m=p.text.slice(0,d),v=p.text.slice(d);if(p.text=m+h+v,t)for(var[f,b]of Z.points(t))t[b]=_e.transform(f,n);break}case"merge_node":{var{path:g}=n,w=oe.get(e,g),E=R.previous(g),A=oe.get(e,E),D=oe.parent(e,g),k=g[g.length-1];if(fe.isText(w)&&fe.isText(A))A.text+=w.text;else if(!fe.isText(w)&&!fe.isText(A))A.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(rt.stringify(w)," ").concat(rt.stringify(A)));if(D.children.splice(k,1),t)for(var[j,L]of Z.points(t))t[L]=_e.transform(j,n);break}case"move_node":{var{path:M,newPath:q}=n;if(R.isAncestor(M,q))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(q,"] because the destination is inside itself."));var I=oe.get(e,M),B=oe.parent(e,M),F=M[M.length-1];B.children.splice(F,1);var P=R.transform(M,n),O=oe.get(e,R.parent(P)),U=P[P.length-1];if(O.children.splice(U,0,I),t)for(var[W,ie]of Z.points(t))t[ie]=_e.transform(W,n);break}case"remove_node":{var{path:te}=n,C=te[te.length-1],X=oe.parent(e,te);if(X.children.splice(C,1),t)for(var[ue,_]of Z.points(t)){var T=_e.transform(ue,n);if(t!=null&&T!=null)t[_]=T;else{var $=void 0,S=void 0;for(var[z,Y]of oe.texts(e))if(R.compare(Y,te)===-1)$=[z,Y];else{S=[z,Y];break}var G=!1;$&&S&&(R.equals(S[1],te)?G=!R.hasPrevious(S[1]):G=R.common($[1],te).length<R.common(S[1],te).length),$&&!G?(ue.path=$[1],ue.offset=$[0].text.length):S?(ue.path=S[1],ue.offset=0):t=null}}break}case"remove_text":{var{path:re,offset:le,text:Q}=n;if(Q.length===0)break;var me=oe.leaf(e,re),pe=me.text.slice(0,le),ke=me.text.slice(le+Q.length);if(me.text=pe+ke,t)for(var[je,Te]of Z.points(t))t[Te]=_e.transform(je,n);break}case"set_node":{var{path:Ke,properties:Ne,newProperties:$e}=n;if(Ke.length===0)throw new Error("Cannot set properties on the root node!");var Qe=oe.get(e,Ke);for(var Ae in $e){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var qe=$e[Ae];qe==null?delete Qe[Ae]:Qe[Ae]=qe}for(var be in Ne)$e.hasOwnProperty(be)||delete Qe[be];break}case"set_selection":{var{newProperties:V}=n;if(V==null)t=V;else{if(t==null){if(!Z.isRange(V))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(rt.stringify(V)," when there is no current selection."));t=_r({},V)}for(var ne in V){var he=V[ne];if(he==null){if(ne==="anchor"||ne==="focus")throw new Error('Cannot remove the "'.concat(ne,'" selection property'));delete t[ne]}else t[ne]=he}}break}case"split_node":{var{path:ge,position:we,properties:Ye}=n;if(ge.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ge,"] because the root node cannot be split."));var Ge=oe.get(e,ge),ot=oe.parent(e,ge),Ft=ge[ge.length-1],gt;if(fe.isText(Ge)){var et=Ge.text.slice(0,we),xe=Ge.text.slice(we);Ge.text=et,gt=_r(_r({},Ye),{},{text:xe})}else{var Fe=Ge.children.slice(0,we),Mt=Ge.children.slice(we);Ge.children=Fe,gt=_r(_r({},Ye),{},{children:Mt})}if(ot.children.splice(Ft+1,0,gt),t)for(var[vt,wn]of Z.points(t))t[wn]=_e.transform(vt,n);break}}return t},e0={transform(e,t){e.children=rl(e.children);var n=e.selection&&rl(e.selection);try{n=Xb(e,n,t)}finally{e.children=al(e.children),n?e.selection=Pn(n)?al(n):n:e.selection=null}}},t0={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)}},n0={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)}},Bf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Bf(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 r0(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 rn(e,t){if(e==null)return{};var n=r0(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 a0=["anchor","focus"];function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function i0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Z.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Z.edges(e);return t},equals(e,t){return _e.equals(e.anchor,t.anchor)&&_e.equals(e.focus,t.focus)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[a,i]=Z.edges(t);return _e.isBefore(n,a)&&_e.isAfter(r,i)}var[s,o]=Z.edges(e),l=!1,u=!1;return _e.isPoint(t)?(l=_e.compare(t,s)>=0,u=_e.compare(t,o)<=0):(l=R.compare(t,s.path)>=0,u=R.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=rn(e,a0),[r,a]=Z.edges(e),[i,s]=Z.edges(t),o=_e.isBefore(r,i)?i:r,l=_e.isBefore(a,s)?a:s;return _e.isBefore(l,o)?null:i0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return _e.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return _e.equals(t,n)},isExpanded(e){return!Z.isCollapsed(e)},isForward(e){return!Z.isBackward(e)},isRange(e){return st(e)&&_e.isPoint(e.anchor)&&_e.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ao(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Z.isCollapsed(r);Z.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Z.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=_e.transform(r.anchor,t,{affinity:i}),u=_e.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},cl=e=>st(e)&&oe.isNodeList(e.children)&&!x.isEditor(e),de={isAncestor(e){return st(e)&&oe.isNodeList(e.children)},isElement:cl,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 cl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},s0=["children"],o0=["text"],dl=new WeakMap,oe={ancestor(e,t){var n=oe.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(rt.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of R.ancestors(t,n)){var a=oe.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(rt.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(rt.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=oe.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=oe.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=R.common(t,n),a=oe.get(e,r);return[a,r]},descendant(e,t){var n=oe.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(rt.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.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 oe.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=rn(e,s0);return t}else{var t=rn(e,o0);return t}},first(e,t){for(var n=t.slice(),r=oe.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(rt.stringify(e)));var n=Ao({children:e.children},r=>{var[a,i]=Z.edges(t),s=oe.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!Z.includes(t,m)}});for(var[,o]of s){if(!Z.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(R.equals(o,i.path)){var d=oe.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(R.equals(o,a.path)){var h=oe.leaf(r,o);h.text=h.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(rt.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=dl.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return dl.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.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=oe.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(rt.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of R.levels(t,n)){var a=oe.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?R.isBefore(o,i):R.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;R.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=oe.get(e,o);continue}if(o.length===0)break;if(!r){var d=R.next(o);if(oe.has(e,d)){o=d,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=R.previous(o);o=h,l=oe.get(e,o);continue}o=R.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=R.parent(t),r=oe.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(oe.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pn={isNodeOperation(e){return pn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!st(e))return!1;switch(e.type){case"insert_node":return R.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&R.isPath(e.path);case"merge_node":return typeof e.position=="number"&&R.isPath(e.path)&&st(e.properties);case"move_node":return R.isPath(e.path)&&R.isPath(e.newPath);case"remove_node":return R.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&R.isPath(e.path);case"set_node":return R.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&Z.isRange(e.newProperties)||e.newProperties===null&&Z.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return R.isPath(e.path)&&typeof e.position=="number"&&st(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>pn.isOperation(t))},isSelectionOperation(e){return pn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return pn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ve(Ve({},e),{},{type:"remove_node"});case"insert_text":return Ve(Ve({},e),{},{type:"remove_text"});case"merge_node":return Ve(Ve({},e),{},{type:"split_node",path:R.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(R.equals(t,n))return e;if(R.isSibling(n,t))return Ve(Ve({},e),{},{path:t,newPath:n});var r=R.transform(n,e),a=R.transform(R.next(n),e);return Ve(Ve({},e),{},{path:r,newPath:a})}case"remove_node":return Ve(Ve({},e),{},{type:"insert_node"});case"remove_text":return Ve(Ve({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ve(Ve({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ve(Ve({},e),{},{properties:l,newProperties:null}):l==null?Ve(Ve({},e),{},{properties:null,newProperties:o}):Ve(Ve({},e),{},{properties:l,newProperties:o})}case"split_node":return Ve(Ve({},e),{},{type:"merge_node",path:R.next(e.path)})}}},hl=new WeakMap,u0=e=>{var t=hl.get(e);if(t!==void 0)return t;if(!st(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||st(e.marks))&&(e.selection===null||Z.isRange(e.selection))&&oe.isNodeList(e.children)&&pn.isOperationList(e.operations);return hl.set(e,n),n},x={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return u0(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)}},l0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(R.isPath)}};function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function pl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ml(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _e={compare(e,t){var n=R.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return _e.compare(e,t)===1},isBefore(e,t){return _e.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&R.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&R.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ao(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=R.transform(i,t,n);break}case"insert_text":{R.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{R.equals(t.path,i)&&(r.offset+=t.position),r.path=R.transform(i,t,n);break}case"remove_text":{R.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(R.equals(t.path,i)||R.isAncestor(t.path,i))return null;r.path=R.transform(i,t,n);break}case"split_node":{if(R.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=R.transform(i,t,pl(pl({},n),{},{affinity:"forward"})))}else r.path=R.transform(i,t,n);break}}})}},gl=void 0,rt={setScrubber(e){gl=e},stringify(e){return JSON.stringify(e,gl)}},c0=["text"],d0=["anchor","focus"];function vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=rn(i,c0);return s}return Bf(r?a(e):e,r?a(t):t)},isText(e){return st(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=[Xt({},e)];for(var r of t){var a=rn(r,d0),[i,s]=Z.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var v=h,f=void 0,b=void 0;if(d<l){var g=d-m;b=Xt(Xt({},v),{},{text:v.text.slice(g)}),v=Xt(Xt({},v),{},{text:v.text.slice(0,g)})}if(u>m){var w=u-m;f=Xt(Xt({},v),{},{text:v.text.slice(0,w)}),v=Xt(Xt({},v),{},{text:v.text.slice(w)})}Object.assign(v,a),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},Bo=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],vr=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},To=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?v0(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=B0(d,h);if([i,s]=r?[s,p]:[p,i],Jn(i,Ce.ZWJ)&&Jn(s,Ce.ExtPict)&&(r?l=bl(t.substring(0,o)):l=bl(t.substring(0,t.length-o)),!l)||Jn(i,Ce.RI)&&Jn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=P0(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&S0(i,s))break;o+=d.length}return o||1},f0=/\s/,h0=/[\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]/,m0=/['\u2018\u2019]/,p0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=To(t,n),[s,o]=So(t,i,n);if(g0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},So=(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)]},g0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(f0.test(t))return!1;if(m0.test(t)){var a=To(n,r),[i,s]=So(n,a,r);if(e(i,s,r))return!0}return!h0.test(t)},v0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(y0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(b0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},b0=e=>e>=55296&&e<=56319,y0=e=>e>=56320&&e<=57343,Ce;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(Ce||(Ce={}));var x0=/^(?:[\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])$/,D0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,C0=/^(?:[\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])$/,w0=/^[\u1100-\u115F\uA960-\uA97C]$/,E0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,_0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,k0=/^[\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]$/,F0=/^[\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]$/,A0=/^(?:[\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])$/,B0=(e,t)=>{var n=Ce.Any;return e.search(x0)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(D0)!==-1&&(n|=Ce.Prepend),e.search(C0)!==-1&&(n|=Ce.SpacingMark),e.search(w0)!==-1&&(n|=Ce.L),e.search(E0)!==-1&&(n|=Ce.V),e.search(_0)!==-1&&(n|=Ce.T),e.search(k0)!==-1&&(n|=Ce.LV),e.search(F0)!==-1&&(n|=Ce.LVT),e.search(A0)!==-1&&(n|=Ce.ExtPict),n};function Jn(e,t){return(e&t)!==0}var T0=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function S0(e,t){return T0.findIndex(n=>Jn(e,n[0])&&Jn(t,n[1]))===-1}var j0=/(?:[\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$/,bl=e=>e.search(j0)!==-1,O0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,P0=e=>{var t=e.match(O0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},M0={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Bo(e)}=n;if(R.isPath(a)&&(a=x.range(e,a)),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var i=Z.end(a);if(!r&&x.void(e,{at:i}))return;var s=Z.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J=fa(fa(fa(fa({},e0),t0),n0),M0),Ba=new WeakMap,N0=e=>Ba.get(e)||!1,R0=(e,t,n)=>{var r=Ba.get(e)||!1;Ba.set(e,!0);try{t(),n()}finally{Ba.set(e,r)}};function Tf(e,t,n){var r=Ga.get(e)||[],a=Qa.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Ga.set(e,i),Qa.set(e,s)}var I0=(e,t)=>{for(var n of x.pathRefs(e))Zb.transform(n,t);for(var r of x.pointRefs(e))Yb.transform(r,t);for(var a of x.rangeRefs(e))Gb.transform(a,t);if(!N0(e)){var i=R.operationCanTransformPath(t)?s=>R.transform(s,t):void 0;Tf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),jr.get(e)||(jr.set(e,!0),Promise.resolve().then(()=>{jr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},$0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return R.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=R.levels(a),s=fe.isText(r)?[]:Array.from(oe.nodes(r),q=>{var[,I]=q;return a.concat(I)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=R.ancestors(o),u=R.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(R.equals(d,h))return[];var p=[],m=[];for(var v of R.ancestors(d)){var f=R.transform(v,t);p.push(f)}for(var b of R.ancestors(h)){var g=R.transform(b,t);m.push(g)}var w=m[m.length-1],E=h[h.length-1],A=w.concat(E);return[...p,...m,A]}case"remove_node":{var{path:D}=t,k=R.ancestors(D);return[...k]}case"split_node":{var{path:j}=t,L=R.levels(j),M=R.next(j);return[...L,M]}default:return[]}},L0=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},z0=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=oe.get(e,r);if(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var m={text:""};J.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var v={text:""};J.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},q0=(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},U0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(Z.isRange(i)){if(R.isAncestor(d,i.anchor.path)&&R.isAncestor(d,i.focus.path))return[u,d]}else if(!R.equals(o,d))return[u,d]}}};function xl(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 Dl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W0=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!fe.isText(h))return!1;var[m,v]=x.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=Z.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=Dl(Dl({},x.marks(e)||{}),{},{[t]:n});e.marks=d,jr.get(e)||e.onChange()}}};function Cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,wl(wl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};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 _l(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){pt(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 H0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,_l(_l({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},K0=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},Z0=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&J.delete(e,{unit:t})},Y0=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Z.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},G0=(e,t)=>[x.start(e,t),x.end(e,t)];function kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Fl(Fl({},n),{},{match:r=>de.isElement(r)&&x.isElementReadOnly(t,r)}))},J0=(e,t)=>x.point(e,t,{edge:"end"}),X0=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},ey=(e,t)=>{var n=x.range(e,t);return oe.fragment(e,n)};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 Bl(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){pt(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 ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Bl(Bl({},n),{},{match:r=>de.isElement(r)&&x.isVoid(t,r)}))},ny=(e,t)=>t.children.some(n=>de.isElement(n)&&x.isBlock(e,n)),ry=(e,t)=>t.children.some(n=>fe.isText(n)||x.isInline(e,n)),ay=(e,t)=>oe.has(e,t),iy=(e,t)=>t.children.every(n=>fe.isText(n)),sy=e=>{J.splitNodes(e,{always:!0})},oy=(e,t,n)=>{J.insertNodes(e,t,n)},uy=e=>{J.splitNodes(e,{always:!0})};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 ly(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){pt(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 cy=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=ly({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},dy=(e,t)=>!e.isInline(t),fy=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),hy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},my=(e,t,n)=>{var r=x.end(e,n);return _e.equals(t,r)},py=e=>{var t=Af.get(e);return t===void 0?!0:t},gy=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return _e.equals(t,r)},vy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},by=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=oe.leaf(t,a);return[i,a]};function yy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of oe.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var xy=["text"],Dy=["text"],Cy=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Z.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=rn(u,xy);return d}else return{}}var{path:h}=a,[p]=x.leaf(t,h);if(a.offset===0){var m=x.previous(t,{at:h,match:fe.isText}),v=x.above(t,{match:A=>de.isElement(A)&&x.isVoid(t,A)&&t.markableVoid(A)});if(!v){var f=x.above(t,{match:A=>de.isElement(A)&&x.isBlock(t,A)});if(m&&f){var[b,g]=m,[,w]=f;R.isAncestor(w,g)&&(p=b)}}}var E=rn(p,Dy);return E},wy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(R.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(R.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},Ey=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=oe.get(t,a);return[i,a]};function _y(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(l0.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),p=x.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=oe.nodes(e,{reverse:i,from:u,to:d,pass:A=>{var[D]=A;return de.isElement(D)?!!(!s&&(x.isVoid(e,D)||x.isElementReadOnly(e,D))||o&&!x.isSelectable(e,D)):!1}}),v=[],f;for(var[b,g]of m)if(!(o&&de.isElement(b)&&!x.isSelectable(e,b))){var w=f&&R.compare(g,f[1])===0;if(!(r==="highest"&&w)){if(!l(b,g)){if(a&&!w&&fe.isText(b))return;continue}if(r==="lowest"&&w){f=[b,g];continue}var E=r==="lowest"?f:[b,g];E&&(a?v.push(E):yield E),f=[b,g]}}r==="lowest"&&f&&(a?v.push(f):yield f),a&&(yield*v)}}()}var ky=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Ga.get(d)||[],s=d=>Qa.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(x.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));Ga.set(t,l),Qa.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(oe.has(t,d)){var h=x.node(t,d),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var v=i(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var g=o(t);if(oe.has(t,g)){var w=x.node(t,g);t.normalizeNode(w,{operation:a})}b++,v=i(t)}})}},Fy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=R.parent(a),s=x.node(t,i);return s},Ay=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},By=e=>{var t=il.get(e);return t||(t=new Set,il.set(e,t)),t},Ty=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(R.isPath(n)){if(i==="start"){var[,s]=oe.first(t,n);n=s}else if(i==="end"){var[,o]=oe.last(t,n);n=o}}return Z.isRange(n)&&(i==="start"?n=Z.start(n):i==="end"?n=Z.end(n):n=R.common(n.anchor.path,n.focus.path)),_e.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},jy=e=>{var t=sl.get(e);return t||(t=new Set,sl.set(e,t)),t},Oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(R.isPath(n)){var i;if(a==="end"){var[,s]=oe.last(t,n);i=s}else{var[,o]=oe.first(t,n);i=o}var l=oe.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(Z.isRange(n)){var[u,d]=Z.edges(n);return a==="start"?u:d}return n};function Py(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=Z.edges(o),d=a?u:l,h=!1,p="",m=0,v=0,f=0;for(var[b,g]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,g);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var w=R.isAncestor(g,u.path)?u:x.end(e,g),E=R.isAncestor(g,l.path)?l:x.start(e,g);p=x.string(e,{anchor:E,focus:w},{voids:i}),h=!0}}if(fe.isText(b)){var A=R.equals(g,d.path);for(A?(v=a?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=a?v:0),(A||h||r==="offset")&&(yield{path:g,offset:f},h=!1);;){if(m===0){if(p==="")break;m=D(p,r,a),p=So(p,m,a)[1]}if(f=a?f-m:f+m,v=v-m,v<0){m=-v;break}m=0,yield{path:g,offset:f}}}}function D(k,j,L){return j==="character"?To(k,L):j==="word"?p0(k,L):j==="line"||j==="block"?k.length:1}}()}var My=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(R.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(R.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Ny=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},Ry=e=>{var t=ol.get(e);return t||(t=new Set,ol.set(e,t)),t},Iy=(e,t,n)=>{if(Z.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};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 $y(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){pt(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 Ly=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!fe.isText(d))return!1;var[p,m]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=Z.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=$y({},x.marks(e)||{});delete u[t],e.marks=u,jr.get(e)||e.onChange()}}},zy=(e,t)=>{Af.set(e,t)},qy=(e,t)=>x.point(e,t,{edge:"start"}),Uy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Z.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;R.equals(d,o.path)&&(h=h.slice(0,o.offset)),R.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Wy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Z.edges(n);if(i.offset!==0||s.offset!==0||Z.isCollapsed(n)||R.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:v=>de.isElement(v)&&x.isBlock(t,v),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of x.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||R.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},Vy=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},Hy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(Z.isRange(u)&&Z.isCollapsed(u)&&(h=!0,u=u.anchor),_e.isPoint(u)){var p=x.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var v={unit:s,distance:o},f=i?x.before(t,u,v)||x.start(t,[]):x.after(t,u,v)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(R.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!Z.isCollapsed(u)){if(!d){var[,b]=Z.edges(u),g=x.end(t,[]);_e.equals(b,g)||(u=x.unhangRange(t,u,{voids:l}))}var[w,E]=Z.edges(u),A=x.above(t,{match:pe=>de.isElement(pe)&&x.isBlock(t,pe),at:w,voids:l}),D=x.above(t,{match:pe=>de.isElement(pe)&&x.isBlock(t,pe),at:E,voids:l}),k=A&&D&&!R.equals(A[1],D[1]),j=R.equals(w.path,E.path),L=l?null:(r=x.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:w,mode:"highest"}),M=l?null:(a=x.void(t,{at:E,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:E,mode:"highest"});if(L){var q=x.before(t,w);q&&A&&R.isAncestor(A[1],q.path)&&(w=q)}if(M){var I=x.after(t,E);I&&D&&R.isAncestor(D[1],I.path)&&(E=I)}var B=[],F;for(var P of x.nodes(t,{at:u,voids:l})){var[O,U]=P;F&&R.compare(U,F)===0||(!l&&de.isElement(O)&&(x.isVoid(t,O)||x.isElementReadOnly(t,O))||!R.isCommon(U,w.path)&&!R.isCommon(U,E.path))&&(B.push(P),F=U)}var W=Array.from(B,pe=>{var[,ke]=pe;return x.pathRef(t,ke)}),ie=x.pointRef(t,w),te=x.pointRef(t,E),C="";if(!j&&!L){var X=ie.current,[ue]=x.leaf(t,X),{path:_}=X,{offset:T}=w,$=ue.text.slice(T);$.length>0&&(t.apply({type:"remove_text",path:_,offset:T,text:$}),C=$)}if(W.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>J.removeNodes(t,{at:pe,voids:l})),!M){var S=te.current,[z]=x.leaf(t,S),{path:Y}=S,G=j?w.offset:0,re=z.text.slice(G,E.offset);re.length>0&&(t.apply({type:"remove_text",path:Y,offset:G,text:re}),C=re)}!j&&k&&te.current&&ie.current&&J.mergeNodes(t,{at:te.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,C.slice(0,C.length-o));var le=ie.unref(),Q=te.unref(),me=i?le||Q:Q||le;n.at==null&&me&&J.select(t,me)}}})},Ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Bo(t),batchDirty:o=!0}=r;if(n.length){if(Z.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Z.isCollapsed(s))s=s.anchor;else{var[,l]=Z.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else R.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:$=>de.isElement($)&&x.isInline(t,$),mode:"highest",voids:i});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var p=x.after(t,h);s=p}else if(x.isStart(t,s,h)){var m=x.before(t,h);s=m}}var v=x.above(t,{match:$=>de.isElement($)&&x.isBlock(t,$),at:s,voids:i}),[,f]=v,b=x.isStart(t,s,f),g=x.isEnd(t,s,f),w=b&&g,E=!b||b&&g,A=!g,[,D]=oe.first({children:n},[]),[,k]=oe.last({children:n},[]),j=[],L=$=>{var[S,z]=$,Y=z.length===0;return Y?!1:w?!0:!(E&&R.isAncestor(z,D)&&de.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||A&&R.isAncestor(z,k)&&de.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var M of oe.nodes({children:n},{pass:L}))L(M)&&j.push(M);var q=[],I=[],B=[],F=!0,P=!1;for(var[O]of j)de.isElement(O)&&!t.isInline(O)?(F=!1,P=!0,I.push(O)):F?q.push(O):B.push(O);var[U]=x.nodes(t,{at:s,match:$=>fe.isText($)||x.isInline(t,$),mode:"highest",voids:i}),[,W]=U,ie=x.isStart(t,s,W),te=x.isEnd(t,s,W),C=x.pathRef(t,g&&!B.length?R.next(f):f),X=x.pathRef(t,te?R.next(W):W);J.splitNodes(t,{at:s,match:$=>P?de.isElement($)&&x.isBlock(t,$):fe.isText($)||x.isInline(t,$),mode:P?"lowest":"highest",always:P&&(!b||q.length>0)&&(!g||B.length>0),voids:i});var ue=x.pathRef(t,!ie||ie&&te?R.next(W):W);if(J.insertNodes(t,q,{at:ue.current,match:$=>fe.isText($)||x.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),w&&!q.length&&I.length&&!B.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,I,{at:C.current,match:$=>de.isElement($)&&x.isBlock(t,$),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,B,{at:X.current,match:$=>fe.isText($)||x.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(B.length>0&&X.current?_=R.previous(X.current):I.length>0&&C.current?_=R.previous(C.current):ue.current&&(_=R.previous(ue.current)),_){var T=x.end(t,_);J.select(t,T)}}ue.unref(),C.unref(),X.unref()}}})},Zy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=Z.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=Z.edges(a);J.select(t,s)}}else return},Yy=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Gy=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=Z.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Z.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?x.before(t,l,d):x.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?x.before(t,u,d):x.after(t,u,d);m&&(h.focus=m)}J.setSelection(t,h)}},Qy=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){J.setSelection(e,t);return}if(!Z.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(rt.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jy=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=Z.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Z.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Ol(Ol({},l),n)})}},Xy=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!_e.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!_e.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},ex=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=Bo(t),d!==!1&&(d=!0)),d==null&&(d=!1),Z.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Z.isCollapsed(l))l=l.anchor;else{var[,p]=Z.edges(l),m=x.pointRef(t,p);J.delete(t,{at:l}),l=m.unref()}if(_e.isPoint(l)){u==null&&(fe.isText(h)?u=q=>fe.isText(q):t.isInline(h)?u=q=>fe.isText(q)||x.isInline(t,q):u=q=>de.isElement(q)&&x.isBlock(t,q));var[v]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(v){var[,f]=v,b=x.pathRef(t,f),g=x.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=b.unref();l=g?R.next(w):w}else return}var E=R.parent(l),A=l[l.length-1];if(!(!i&&x.void(t,{at:E}))){if(o){var D=[],k=R.levels(E);R0(t,()=>{var q=function(){var F=E.concat(A);A++;var P={type:"insert_node",path:F,node:I};t.apply(P),l=R.next(l),D.push(P),fe.isText?k.push(...Array.from(oe.nodes(I),O=>{var[,U]=O;return F.concat(U)})):k.push(F)};for(var I of n)q()},()=>{Tf(t,k,q=>{var I=q;for(var B of D)if(R.operationCanTransformPath(B)&&(I=R.transform(I,B),!I))return null;return I})})}else for(var j of n){var L=E.concat(A);A++,t.apply({type:"insert_node",path:L,node:j}),l=R.next(l)}if(l=R.previous(l),d){var M=x.end(t,l);M&&J.select(t,M)}}}})},tx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=R.isPath(r)?vr(t,r):A=>de.isElement(A)&&x.isBlock(t,A)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,A=>{var[,D]=A;return x.pathRef(t,D)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=x.node(t,R.parent(d)),[p,m]=h,v=d[d.length-1],{length:f}=p.children;if(f===1){var b=R.next(m);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:m,voids:i})}else if(v===0)J.moveNodes(t,{at:d,to:m,voids:i});else if(v===f-1){var g=R.next(m);J.moveNodes(t,{at:d,to:g,voids:i})}else{var w=R.next(d),E=R.next(m);J.splitNodes(t,{at:w,voids:i}),J.moveNodes(t,{at:d,to:E,voids:i})}}}})},nx=["text"],rx=["children"],Sf=(e,t)=>{if(de.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?Sf(e,n.children[0]):!1}else return!x.isEditor(t)},ax=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(R.isPath(a)){var[l]=x.parent(t,a);r=q=>l.children.includes(q)}else r=q=>de.isElement(q)&&x.isBlock(t,q);if(!i&&Z.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var[,u]=Z.edges(a),d=x.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[h]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),p=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,v]=h,[f,b]=p;if(!(v.length===0||b.length===0)){var g=R.next(b),w=R.common(v,b),E=R.isSibling(v,b),A=Array.from(x.levels(t,{at:v}),q=>{var[I]=q;return I}).slice(w.length).slice(0,-1),D=x.above(t,{at:v,mode:"highest",match:q=>A.includes(q)&&Sf(t,q)}),k=D&&x.pathRef(t,D[1]),j,L;if(fe.isText(m)&&fe.isText(f)){var M=rn(m,nx);L=f.text.length,j=M}else if(de.isElement(m)&&de.isElement(f)){var M=rn(m,rx);L=f.children.length,j=M}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(rt.stringify(m)," ").concat(rt.stringify(f)));E||J.moveNodes(t,{at:v,to:g,voids:s}),k&&J.removeNodes(t,{at:k.current,voids:s}),de.isElement(f)&&x.isEmpty(t,f)||fe.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:L,properties:j}),k&&k.unref()}}}})},ix=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=R.isPath(r)?vr(e,r):m=>de.isElement(m)&&x.isBlock(e,m));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(e,v)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&R.isSibling(p,h)&&R.isAfter(p,h)&&(o.current=R.next(o.current))}o.unref()}})},sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=R.isPath(s)?vr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),!r&&Z.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(t,v)});for(var d of u){var h=d.unref();if(h){var[p]=x.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},ox=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=R.isPath(i)?vr(t,i):L=>de.isElement(L)&&x.isBlock(t,L)),!l&&Z.isRange(i)&&(i=x.unhangRange(t,i,{voids:h})),d&&Z.isRange(i)){if(Z.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var p=x.rangeRef(t,i,{affinity:"inward"}),[m,v]=Z.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,v,v.path);J.splitNodes(t,{at:v,match:a,mode:f,voids:h,always:!b});var g=x.isStart(t,m,m.path);J.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!g}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=(L,M)=>L!==M);for(var[w,E]of x.nodes(t,{at:i,match:a,mode:u,voids:h})){var A={},D={};if(E.length!==0){var k=!1;for(var j in n)j==="children"||j==="text"||s(n[j],w[j])&&(k=!0,w.hasOwnProperty(j)&&(A[j]=w[j]),o?n[j]!=null&&(D[j]=o(w[j],n[j])):n[j]!=null&&(D[j]=n[j]));k&&t.apply({type:"set_node",path:E,properties:A,newProperties:D})}}}})},ux=(e,t)=>{if(Z.isCollapsed(t))return t.anchor;var[,n]=Z.edges(t),r=x.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},lx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=te=>de.isElement(te)&&x.isBlock(t,te)),Z.isRange(s)&&(s=ux(t,s)),R.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);i=te=>te===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=x.pointRef(t,s,{affinity:"backward"}),m;try{var[v]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!v)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[g,w]=f;if(de.isElement(g)&&t.isInline(g)){var E=x.after(t,w);if(!E){var A={text:""},D=R.next(w);J.insertNodes(t,A,{at:D,voids:a}),E=x.point(t,D)}s=E,l=!0}var k=s.path.length-w.length;o=k+1,l=!0}m=x.pointRef(t,s);var j=s.path.length-o,[,L]=v,M=s.path.slice(0,j),q=o===0?s.offset:s.path[j]+b;for(var[I,B]of x.levels(t,{at:M,reverse:!0,voids:a})){var F=!1;if(B.length<L.length||B.length===0||!a&&de.isElement(I)&&x.isVoid(t,I))break;var P=p.current,O=x.isEnd(t,P,B);if(l||!p||!x.isEdge(t,P,B)){F=!0;var U=oe.extractProps(I);t.apply({type:"split_node",path:B,position:q,properties:U})}q=B[B.length-1]+(F||O?1:0)}if(n.at==null){var W=m.current||x.end(t,[]);J.select(t,W)}}finally{var ie;p.unref(),(ie=m)===null||ie===void 0||ie.unref()}}})},cx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;J.setNodes(t,a,r)},dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=R.isPath(s)?vr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),R.isPath(s)&&(s=x.range(t,s));var l=Z.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,v]=m;return x.pathRef(t,v)}).reverse(),h=function(){var v=p.unref(),[f]=x.node(t,v),b=x.range(t,v);a&&l&&(b=Z.intersection(l.current,b)),J.liftNodes(t,{at:b,match:g=>de.isAncestor(f)&&f.children.includes(g),voids:i})};for(var p of d)h();l&&l.unref()}})};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(R.isPath(l)?o=vr(t,l):t.isInline(n)?o=b=>de.isElement(b)&&x.isInline(t,b)||fe.isText(b):o=b=>de.isElement(b)&&x.isBlock(t,b)),i&&Z.isRange(l)){var[u,d]=Z.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&J.select(t,l)}var p=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),m=function(){var g=Z.isRange(l)?Z.intersection(l,x.range(t,f)):l;if(!g)return 0;var w=Array.from(x.nodes(t,{at:g,match:o,mode:a,voids:s}));if(w.length>0){var[E]=w,A=w[w.length-1],[,D]=E,[,k]=A;if(D.length===0&&k.length===0)return 0;var j=R.equals(D,k)?R.parent(D):R.common(D,k),L=x.range(t,D,k),M=x.node(t,j),[q]=M,I=j.length+1,B=R.next(k.slice(0,I)),F=Ml(Ml({},n),{},{children:[]});J.insertNodes(t,F,{at:B,voids:s}),J.moveNodes(t,{at:L,match:P=>de.isAncestor(q)&&q.children.includes(P),to:B.concat(0),voids:s})}},v;for(var[,f]of p)v=m()}})},hx=()=>{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 I0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hy(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return my(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return py(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gy(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ax(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ix(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wy(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ey(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _y(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ky(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fy(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ay(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Py(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return My(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ox(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zy(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xy(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uy(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vy(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fx(e,...r)}};return e},Bn=[],mx=function(){return Bn.some(function(e){return e.activeTargets.length>0})},px=function(){return Bn.some(function(e){return e.skippedTargets.length>0})},Nl="ResizeObserver loop completed with undelivered notifications.",gx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Nl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Nl),window.dispatchEvent(e)},Wr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Wr||(Wr={}));var Tn=function(e){return Object.freeze(e)},vx=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Tn(this)}return e}(),jf=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,Tn(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}(),jo=function(e){return e instanceof SVGElement&&"getBBox"in e},Of=function(e){if(jo(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)},Rl=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)},bx=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},Or=typeof window<"u"?window:{},ha=new WeakMap,Il=/auto|scroll/,yx=/^tb|vertical/,xx=/msie|trident/i.test(Or.navigator&&Or.navigator.userAgent),zt=function(e){return parseFloat(e||"0")},rr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new vx((n?t:e)||0,(n?e:t)||0)},$l=Tn({devicePixelContentBoxSize:rr(),borderBoxSize:rr(),contentBoxSize:rr(),contentRect:new jf(0,0,0,0)}),Pf=function(e,t){if(t===void 0&&(t=!1),ha.has(e)&&!t)return ha.get(e);if(Of(e))return ha.set(e,$l),$l;var n=getComputedStyle(e),r=jo(e)&&e.ownerSVGElement&&e.getBBox(),a=!xx&&n.boxSizing==="border-box",i=yx.test(n.writingMode||""),s=!r&&Il.test(n.overflowY||""),o=!r&&Il.test(n.overflowX||""),l=r?0:zt(n.paddingTop),u=r?0:zt(n.paddingRight),d=r?0:zt(n.paddingBottom),h=r?0:zt(n.paddingLeft),p=r?0:zt(n.borderTopWidth),m=r?0:zt(n.borderRightWidth),v=r?0:zt(n.borderBottomWidth),f=r?0:zt(n.borderLeftWidth),b=h+u,g=l+d,w=f+m,E=p+v,A=o?e.offsetHeight-E-e.clientHeight:0,D=s?e.offsetWidth-w-e.clientWidth:0,k=a?b+w:0,j=a?g+E:0,L=r?r.width:zt(n.width)-k-D,M=r?r.height:zt(n.height)-j-A,q=L+b+D+w,I=M+g+A+E,B=Tn({devicePixelContentBoxSize:rr(Math.round(L*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:rr(q,I,i),contentBoxSize:rr(L,M,i),contentRect:new jf(h,l,L,M)});return ha.set(e,B),B},Mf=function(e,t,n){var r=Pf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Wr.DEVICE_PIXEL_CONTENT_BOX:return s;case Wr.BORDER_BOX:return a;default:return i}},Dx=function(){function e(t){var n=Pf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Tn([n.borderBoxSize]),this.contentBoxSize=Tn([n.contentBoxSize]),this.devicePixelContentBoxSize=Tn([n.devicePixelContentBoxSize])}return e}(),Nf=function(e){if(Of(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Cx=function(){var e=1/0,t=[];Bn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Dx(u.target),h=Nf(u.target);o.push(d),u.lastReportedSize=Mf(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Ll=function(e){Bn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Nf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},wx=function(){var e=0;for(Ll(e);mx();)e=Cx(),Ll(e);return px()&&gx(),e>0},qi,Rf=[],Ex=function(){return Rf.splice(0).forEach(function(e){return e()})},_x=function(e){if(!qi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Ex()}).observe(n,r),qi=function(){n.textContent="".concat(t?t--:t++)}}Rf.push(e),qi()},kx=function(e){_x(function(){requestAnimationFrame(e)})},Ta=0,Fx=function(){return!!Ta},Ax=250,Bx={attributes:!0,characterData:!0,childList:!0,subtree:!0},zl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ql=function(e){return e===void 0&&(e=0),Date.now()+e},Ui=!1,Tx=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=Ax),!Ui){Ui=!0;var r=ql(t);kx(function(){var a=!1;try{a=wx()}finally{if(Ui=!1,t=r-ql(),!Fx())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,Bx)};document.body?n():Or.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),zl.forEach(function(n){return Or.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),zl.forEach(function(n){return Or.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Is=new Tx,Ul=function(e){!Ta&&e>0&&Is.start(),Ta+=e,!Ta&&Is.stop()},Sx=function(e){return!jo(e)&&!bx(e)&&getComputedStyle(e).display==="inline"},jx=function(){function e(t,n){this.target=t,this.observedBox=n||Wr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Mf(this.target,this.observedBox,!0);return Sx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Ox=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ma=new WeakMap,Wl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},pa=function(){function e(){}return e.connect=function(t,n){var r=new Ox(t,n);ma.set(t,r)},e.observe=function(t,n,r){var a=ma.get(t),i=a.observationTargets.length===0;Wl(a.observationTargets,n)<0&&(i&&Bn.push(a),a.observationTargets.push(new jx(n,r&&r.box)),Ul(1),Is.schedule())},e.unobserve=function(t,n){var r=ma.get(t),a=Wl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Bn.splice(Bn.indexOf(r),1),r.observationTargets.splice(a,1),Ul(-1))},e.disconnect=function(t){var n=this,r=ma.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Px=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.");pa.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(!Rl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");pa.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(!Rl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");pa.unobserve(this,t)},e.prototype.disconnect=function(){pa.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),ln={};Object.defineProperty(ln,"__esModule",{value:!0});var Mx=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Wi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},If={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Mx?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Oo={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 ga=1;ga<20;ga++)Oo["f"+ga]=111+ga;function gi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return $f(s,t)}),a=function(o){return r.some(function(l){return Lf(l,o)})},i=n==null?a:a(n);return i}function Nx(e,t){return gi(e,t)}function Rx(e,t){return gi(e,{byKey:!0},t)}function $f(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Wi)r[Wi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var v=Po(p),f=Wi[v];if(p.length>1&&!f&&!If[p]&&!Oo[v])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=v:r.which=zf(p)),f&&(r[f]=m?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Lf(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 zf(e){e=Po(e);var t=Oo[e]||e.toUpperCase().charCodeAt(0);return t}function Po(e){return e=e.toLowerCase(),e=If[e]||e,e}var Ix=ln.default=gi,Vi=ln.isHotkey=gi;ln.isCodeHotkey=Nx;ln.isKeyHotkey=Rx;ln.parseHotkey=$f;ln.compareHotkey=Lf;ln.toKeyCode=zf;ln.toKeyName=Po;function $x(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 dr(e,t){if(e==null)return{};var n=$x(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 Vr(e){"@babel/helpers - typeof";return Vr=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},Vr(e)}function Lx(e,t){if(Vr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zx(e){var t=Lx(e,"string");return Vr(t)==="symbol"?t:String(t)}function Ot(e,t,n){return t=zx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mo=y.createContext(null),xn=()=>{var e=y.useContext(Mo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},qf=parseInt(y.version.split(".")[0],10),qx=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Vl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),mt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Xn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Br=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Ux=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Uf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Wx=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Vx=mt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Hx=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Kx=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Zx=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Sa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cn=(!Wx||!Vx)&&!Ux&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",No=new WeakMap,Ro=new WeakMap,Wf=new WeakMap,ja=new WeakMap,$s=new WeakMap,Hr=new WeakMap,Sn=new WeakMap,Ja=new WeakMap,vi=new WeakMap,Ls=new WeakMap,gn=new WeakMap,Fn=new WeakMap,Pr=new WeakMap,zs=new WeakMap,Io=new WeakMap,Rt=new WeakMap,tn=new WeakMap,yt=new WeakMap,fn=new WeakMap,hn=new WeakMap,Vf=new WeakMap,fr=Symbol("placeholder"),Hf=Symbol("mark-placeholder"),Yx=globalThis.Text,$o=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Gx=e=>vn(e)&&e.nodeType===8,jt=e=>vn(e)&&e.nodeType===1,vn=e=>{var t=$o(e);return!!t&&e instanceof t.Node},qs=e=>{var t=e&&e.anchorNode&&$o(e.anchorNode);return!!t&&e instanceof t.Selection},Kf=e=>vn(e)&&e.nodeType===3,Qx=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Jx=e=>{var[t,n]=e;if(jt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Zf(t,a,r?"backward":"forward"),r=a<n;jt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=e1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Xx=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Zf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Gx(a)||jt(a)&&a.childNodes.length===0||jt(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},e1=(e,t,n)=>{var[r]=Zf(e,t,n);return r},Yf=e=>{var t="";if(Kf(e)&&e.nodeValue)return e.nodeValue;if(jt(e)){for(var n of Array.from(e.childNodes))t+=Yf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
- `)}return t},t1=/data-slate-fragment="(.+?)"/m,n1=e=>{var t=e.getData("text/html"),[,n]=t.match(t1)||[];return n},Lo=(e,t,n)=>{var{target:r}=t;if(jt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:Lo(e,i,n)},r1=0;class a1{constructor(){Ot(this,"id",void 0),this.id="".concat(r1++)}}var ee={androidPendingDiffs:e=>yt.get(e),androidScheduleFlush:e=>{var t;(t=Io.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);gn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&J.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var h=x.range(e,d);return h}}var p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var v=m.caretPositionFromPoint(n,r);v&&(p=m.createRange(),p.setStart(v.offsetNode,v.offset),p.setEnd(v.offsetNode,v.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Ja.get(t);return n||(n=new a1,Ja.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Ro.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=No.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(rt.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!gn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(J.select(t,x.start(t,[])),t.onChange()),gn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Wf.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=ee.toDOMNode(t,t),s;try{s=jt(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)=>vn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>vn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Fn.get(e),isFocused:e=>!!gn.get(e),isReadOnly:e=>!!Ls.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ls.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=vi.get(e),r=x.isEditor(t)?ja.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(rt.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=ee.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),v=o+m,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];a=[g instanceof Yx?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var w=Math.min(h,Math.max(0,t.offset-o));a=[d,w];break}o=v}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(rt.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Z.isBackward(t),i=ee.toDOMPoint(e,n),s=Z.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,p]=a?i:s,m=jt(u)?u:u.parentElement,v=!!m.getAttribute("data-slate-zero-width"),f=jt(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(h,b?1:p),l},toSlateNode:(e,t)=>{var n=jt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Hr.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:Jx(t),o=i.parentNode,l=null,u=0;if(o){var d,h,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),v=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var g=ee.getWindow(e),w=g.document.createRange();w.setStart(l,0),w.setEnd(i,s);var E=w.cloneContents(),A=[...Array.prototype.slice.call(E.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(E.querySelectorAll("[contenteditable=false]"))];A.forEach(P=>{if(mt&&!r&&P.hasAttribute("data-slate-zero-width")&&P.textContent.length>0&&P.textContext!=="\uFEFF"){P.textContent.startsWith("\uFEFF")&&(P.textContent=P.textContent.slice(1));return}P.parentNode.removeChild(P)}),u=E.textContent.length,b=l}}else if(v){for(var D=v.querySelectorAll("[data-slate-leaf]"),k=0;k<D.length;k++){var j=D[k];if(ee.hasDOMNode(e,j)){f=j;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(P=>{u-=P.textContent.length})):u=1}b&&u===b.textContent.length&&mt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Xn&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
71
+ */function Ju(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return Ju(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Ju(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Ef=Symbol.for("immer-nothing"),Xu=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),$b=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=$b[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 cr=Object.getPrototypeOf;function Pn(e){return!!e&&!!e[_t]}function Mn(e){var t;return e?_f(e)||Array.isArray(e)||!!e[Xu]||!!((t=e.constructor)!=null&&t[Xu])||mi(e)||pi(e):!1}var Lb=Object.prototype.constructor.toString();function _f(e){if(!e||typeof e!="object")return!1;const t=cr(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)===Lb}function Za(e,t){hi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function hi(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:mi(e)?2:pi(e)?3:0}function Os(e,t){return hi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function kf(e,t,n){const r=hi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function zb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function mi(e){return e instanceof Map}function pi(e){return e instanceof Set}function kn(e){return e.copy_||e.base_}function Ps(e,t){if(mi(e))return new Map(e);if(pi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=_f(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[_t];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(cr(e),r)}else{const r=cr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function Fo(e,t=!1){return gi(e)||Pn(e)||!Mn(e)||(hi(e)>1&&(e.set=e.add=e.clear=e.delete=qb),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Fo(r,!0))),e}function qb(){xt(2)}function gi(e){return Object.isFrozen(e)}var Ub={};function Nn(e){const t=Ub[e];return t||xt(0,e),t}var qr;function Ff(){return qr}function Wb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function el(e,t){t&&(Nn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ms(e){Ns(e),e.drafts_.forEach(Vb),e.drafts_=null}function Ns(e){e===qr&&(qr=e.parent_)}function tl(e){return qr=Wb(qr,e)}function Vb(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function nl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_t].modified_&&(Ms(t),xt(4)),Mn(e)&&(e=Ya(t,e),t.parent_||Ga(t,e)),t.patches_&&Nn("Patches").generateReplacementPatches_(n[_t].base_,e,t.patches_,t.inversePatches_)):e=Ya(t,n,[]),Ms(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ef?e:void 0}function Ya(e,t,n){if(gi(t))return t;const r=t[_t];if(!r)return Za(t,(a,i)=>rl(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ga(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Za(i,(o,l)=>rl(e,r,a,o,l,n,s)),Ga(e,a,!1),n&&e.patches_&&Nn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function rl(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&xt(5),Pn(a)){const o=i&&t&&t.type_!==3&&!Os(t.assigned_,r)?i.concat(r):void 0,l=Ya(e,a,o);if(kf(n,r,l),Pn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Mn(a)&&!gi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ya(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ga(e,a)}}function Ga(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fo(t,n)}function Hb(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ff(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Ao;n&&(a=[r],i=Ur);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Ao={get(e,t){if(t===_t)return e;const n=kn(e);if(!Os(n,t))return Kb(e,n,t);const r=n[t];return e.finalized_||!Mn(r)?r:r===zi(e.base_,t)?(qi(e),e.copy_[t]=Rs(r,e)):r},has(e,t){return t in kn(e)},ownKeys(e){return Reflect.ownKeys(kn(e))},set(e,t,n){const r=Af(kn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=zi(kn(e),t),i=a==null?void 0:a[_t];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(zb(n,a)&&(n!==void 0||Os(e.base_,t)))return!0;qi(e),Is(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return zi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,qi(e),Is(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=kn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return cr(e.base_)},setPrototypeOf(){xt(12)}},Ur={};Za(Ao,(e,t)=>{Ur[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ur.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),Ur.set.call(this,e,t,void 0)};Ur.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),Ao.set.call(this,e[0],t,n,e[0])};function zi(e,t){const n=e[_t];return(n?kn(n):e)[t]}function Kb(e,t,n){var a;const r=Af(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Af(e,t){if(!(t in e))return;let n=cr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=cr(n)}}function Is(e){e.modified_||(e.modified_=!0,e.parent_&&Is(e.parent_))}function qi(e){e.copy_||(e.copy_=Ps(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Zb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let a;if(Mn(t)){const i=tl(this),s=Rs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Ms(i):Ns(i)}return el(i,r),nl(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Ef&&(a=void 0),this.autoFreeze_&&Fo(a,!0),r){const i=[],s=[];Nn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Mn(e)||xt(8),Pn(e)&&(e=Yb(e));const t=tl(this),n=Rs(e,void 0);return n[_t].isManual_=!0,Ns(t),n}finishDraft(e,t){const n=e&&e[_t];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return el(r,t),nl(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=Nn("Patches").applyPatches_;return Pn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Rs(e,t){const n=mi(e)?Nn("MapSet").proxyMap_(e,t):pi(e)?Nn("MapSet").proxySet_(e,t):Hb(e,t);return(t?t.scope_:Ff()).drafts_.push(n),n}function Yb(e){return Pn(e)||xt(10,e),Bf(e)}function Bf(e){if(!Mn(e)||gi(e))return e;const t=e[_t];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ps(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ps(e,!0);return Za(n,(r,a)=>{kf(n,r,Bf(a))}),t&&(t.finalized_=!1),n}var kt=new Zb,Bo=kt.produce;kt.produceWithPatches.bind(kt);kt.setAutoFreeze.bind(kt);kt.setUseStrictShallowCopy.bind(kt);kt.applyPatches.bind(kt);var al=kt.createDraft.bind(kt),il=kt.finishDraft.bind(kt),Gb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Qb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=_e.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Jb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Z.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Qa=new WeakMap,Ja=new WeakMap,Or=new WeakMap,Tf=new WeakMap,sl=new WeakMap,ol=new WeakMap,ul=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!I.isAncestor(t,e)&&!I.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(I.equals(h,p))return r;if(I.isAncestor(h,r)||I.equals(h,r)){var m=p.slice();return I.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else I.isSibling(h,p)&&(I.isAncestor(p,r)||I.equals(p,r))?I.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:I.endsBefore(p,r)||I.equals(p,r)||I.isAncestor(p,r)?(I.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):I.endsBefore(h,r)&&(I.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function Xb(e,t){if(Wr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Wr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function e0(e){var t=Xb(e,"string");return Wr(t)==="symbol"?t:String(t)}function pt(e,t,n){return t=e0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var t0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of Z.points(t))t[l]=_e.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=ue.leaf(e,u),m=p.text.slice(0,d),v=p.text.slice(d);if(p.text=m+h+v,t)for(var[f,b]of Z.points(t))t[b]=_e.transform(f,n);break}case"merge_node":{var{path:g}=n,C=ue.get(e,g),D=I.previous(g),A=ue.get(e,D),E=ue.parent(e,g),k=g[g.length-1];if(he.isText(C)&&he.isText(A))A.text+=C.text;else if(!he.isText(C)&&!he.isText(A))A.children.push(...C.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(rt.stringify(C)," ").concat(rt.stringify(A)));if(E.children.splice(k,1),t)for(var[S,$]of Z.points(t))t[$]=_e.transform(S,n);break}case"move_node":{var{path:M,newPath:z}=n;if(I.isAncestor(M,z))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(z,"] because the destination is inside itself."));var R=ue.get(e,M),B=ue.parent(e,M),F=M[M.length-1];B.children.splice(F,1);var P=I.transform(M,n),j=ue.get(e,I.parent(P)),U=P[P.length-1];if(j.children.splice(U,0,R),t)for(var[W,ne]of Z.points(t))t[ne]=_e.transform(W,n);break}case"remove_node":{var{path:re}=n,w=re[re.length-1],Q=ue.parent(e,re);if(Q.children.splice(w,1),t)for(var[se,_]of Z.points(t)){var O=_e.transform(se,n);if(t!=null&&O!=null)t[_]=O;else{var q=void 0,T=void 0;for(var[L,G]of ue.texts(e))if(I.compare(G,re)===-1)q=[L,G];else{T=[L,G];break}var Y=!1;q&&T&&(I.equals(T[1],re)?Y=!I.hasPrevious(T[1]):Y=I.common(q[1],re).length<I.common(T[1],re).length),q&&!Y?(se.path=q[1],se.offset=q[0].text.length):T?(se.path=T[1],se.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:le,text:X}=n;if(X.length===0)break;var pe=ue.leaf(e,te),fe=pe.text.slice(0,le),ke=pe.text.slice(le+X.length);if(pe.text=fe+ke,t)for(var[Oe,Te]of Z.points(t))t[Te]=_e.transform(Oe,n);break}case"set_node":{var{path:Ke,properties:Ne,newProperties:$e}=n;if(Ke.length===0)throw new Error("Cannot set properties on the root node!");var Qe=ue.get(e,Ke);for(var Ae in $e){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var qe=$e[Ae];qe==null?delete Qe[Ae]:Qe[Ae]=qe}for(var be in Ne)$e.hasOwnProperty(be)||delete Qe[be];break}case"set_selection":{var{newProperties:V}=n;if(V==null)t=V;else{if(t==null){if(!Z.isRange(V))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(rt.stringify(V)," when there is no current selection."));t=_r({},V)}for(var ae in V){var me=V[ae];if(me==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=me}}break}case"split_node":{var{path:ge,position:we,properties:Ye}=n;if(ge.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ge,"] because the root node cannot be split."));var Ge=ue.get(e,ge),ot=ue.parent(e,ge),Ft=ge[ge.length-1],gt;if(he.isText(Ge)){var et=Ge.text.slice(0,we),xe=Ge.text.slice(we);Ge.text=et,gt=_r(_r({},Ye),{},{text:xe})}else{var Fe=Ge.children.slice(0,we),Mt=Ge.children.slice(we);Ge.children=Fe,gt=_r(_r({},Ye),{},{children:Mt})}if(ot.children.splice(Ft+1,0,gt),t)for(var[vt,En]of Z.points(t))t[En]=_e.transform(vt,n);break}}return t},n0={transform(e,t){e.children=al(e.children);var n=e.selection&&al(e.selection);try{n=t0(e,n,t)}finally{e.children=il(e.children),n?e.selection=Pn(n)?il(n):n:e.selection=null}}},r0={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)}},a0={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)}},Sf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Sf(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 i0(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 an(e,t){if(e==null)return{};var n=i0(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 s0=["anchor","focus"];function cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function o0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Z.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Z.edges(e);return t},equals(e,t){return _e.equals(e.anchor,t.anchor)&&_e.equals(e.focus,t.focus)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[a,i]=Z.edges(t);return _e.isBefore(n,a)&&_e.isAfter(r,i)}var[s,o]=Z.edges(e),l=!1,u=!1;return _e.isPoint(t)?(l=_e.compare(t,s)>=0,u=_e.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=an(e,s0),[r,a]=Z.edges(e),[i,s]=Z.edges(t),o=_e.isBefore(r,i)?i:r,l=_e.isBefore(a,s)?a:s;return _e.isBefore(l,o)?null:o0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return _e.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return _e.equals(t,n)},isExpanded(e){return!Z.isCollapsed(e)},isForward(e){return!Z.isBackward(e)},isRange(e){return st(e)&&_e.isPoint(e.anchor)&&_e.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Bo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Z.isCollapsed(r);Z.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Z.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=_e.transform(r.anchor,t,{affinity:i}),u=_e.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},dl=e=>st(e)&&ue.isNodeList(e.children)&&!x.isEditor(e),de={isAncestor(e){return st(e)&&ue.isNodeList(e.children)},isElement:dl,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 dl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},u0=["children"],l0=["text"],fl=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(he.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(rt.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.isText(e))throw new Error("Cannot get the child of a text node: ".concat(rt.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(rt.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(rt.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=an(e,u0);return t}else{var t=an(e,l0);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(rt.stringify(e)));var n=Bo({children:e.children},r=>{var[a,i]=Z.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!Z.includes(t,m)}});for(var[,o]of s){if(!Z.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(rt.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||de.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=fl.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return fl.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ue.get(e,t);if(!he.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(rt.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=I.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=I.previous(o);o=h,l=ue.get(e,o);continue}o=I.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=ue.get(e,n);if(he.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return he.isText(e)?e.text:e.children.map(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))he.isText(n)&&(yield[n,r])}()}};function hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gn={isNodeOperation(e){return gn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!st(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&st(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&Z.isRange(e.newProperties)||e.newProperties===null&&Z.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&st(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>gn.isOperation(t))},isSelectionOperation(e){return gn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return gn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ve(Ve({},e),{},{type:"remove_node"});case"insert_text":return Ve(Ve({},e),{},{type:"remove_text"});case"merge_node":return Ve(Ve({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return Ve(Ve({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return Ve(Ve({},e),{},{path:r,newPath:a})}case"remove_node":return Ve(Ve({},e),{},{type:"insert_node"});case"remove_text":return Ve(Ve({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ve(Ve({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ve(Ve({},e),{},{properties:l,newProperties:null}):l==null?Ve(Ve({},e),{},{properties:null,newProperties:o}):Ve(Ve({},e),{},{properties:l,newProperties:o})}case"split_node":return Ve(Ve({},e),{},{type:"merge_node",path:I.next(e.path)})}}},ml=new WeakMap,c0=e=>{var t=ml.get(e);if(t!==void 0)return t;if(!st(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||st(e.marks))&&(e.selection===null||Z.isRange(e.selection))&&ue.isNodeList(e.children)&&gn.isOperationList(e.operations);return ml.set(e,n),n},x={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return c0(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)}},d0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _e={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return _e.compare(e,t)===1},isBefore(e,t){return _e.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Bo(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=I.transform(i,t,gl(gl({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},vl=void 0,rt={setScrubber(e){vl=e},stringify(e){return JSON.stringify(e,vl)}},f0=["text"],h0=["anchor","focus"];function bl(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 en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=an(i,f0);return s}return Sf(r?a(e):e,r?a(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[en({},e)];for(var r of t){var a=an(r,h0),[i,s]=Z.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var v=h,f=void 0,b=void 0;if(d<l){var g=d-m;b=en(en({},v),{},{text:v.text.slice(g)}),v=en(en({},v),{},{text:v.text.slice(0,g)})}if(u>m){var C=u-m;f=en(en({},v),{},{text:v.text.slice(0,C)}),v=en(en({},v),{},{text:v.text.slice(C)})}Object.assign(v,a),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},To=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],vr=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},So=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?y0(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=S0(d,h);if([i,s]=r?[s,p]:[p,i],Jn(i,De.ZWJ)&&Jn(s,De.ExtPict)&&(r?l=yl(t.substring(0,o)):l=yl(t.substring(0,t.length-o)),!l)||Jn(i,De.RI)&&Jn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=N0(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&O0(i,s))break;o+=d.length}return o||1},m0=/\s/,p0=/[\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]/,g0=/['\u2018\u2019]/,v0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=So(t,n),[s,o]=jo(t,i,n);if(b0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},jo=(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)]},b0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(m0.test(t))return!1;if(g0.test(t)){var a=So(n,r),[i,s]=jo(n,a,r);if(e(i,s,r))return!0}return!p0.test(t)},y0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(C0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(x0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},x0=e=>e>=55296&&e<=56319,C0=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 D0=/^(?:[\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])$/,w0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,E0=/^(?:[\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])$/,_0=/^[\u1100-\u115F\uA960-\uA97C]$/,k0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,F0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,A0=/^[\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]$/,B0=/^[\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]$/,T0=/^(?:[\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])$/,S0=(e,t)=>{var n=De.Any;return e.search(D0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(w0)!==-1&&(n|=De.Prepend),e.search(E0)!==-1&&(n|=De.SpacingMark),e.search(_0)!==-1&&(n|=De.L),e.search(k0)!==-1&&(n|=De.V),e.search(F0)!==-1&&(n|=De.T),e.search(A0)!==-1&&(n|=De.LV),e.search(B0)!==-1&&(n|=De.LVT),e.search(T0)!==-1&&(n|=De.ExtPict),n};function Jn(e,t){return(e&t)!==0}var j0=[[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 O0(e,t){return j0.findIndex(n=>Jn(e,n[0])&&Jn(t,n[1]))===-1}var P0=/(?:[\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$/,yl=e=>e.search(P0)!==-1,M0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,N0=e=>{var t=e.match(M0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},I0={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=To(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var i=Z.end(a);if(!r&&x.void(e,{at:i}))return;var s=Z.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J=ha(ha(ha(ha({},n0),r0),a0),I0),Ta=new WeakMap,R0=e=>Ta.get(e)||!1,$0=(e,t,n)=>{var r=Ta.get(e)||!1;Ta.set(e,!0);try{t(),n()}finally{Ta.set(e,r)}};function jf(e,t,n){var r=Qa.get(e)||[],a=Ja.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Qa.set(e,i),Ja.set(e,s)}var L0=(e,t)=>{for(var n of x.pathRefs(e))Gb.transform(n,t);for(var r of x.pointRefs(e))Qb.transform(r,t);for(var a of x.rangeRefs(e))Jb.transform(a,t);if(!R0(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;jf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Or.get(e)||(Or.set(e,!0),Promise.resolve().then(()=>{Or.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},z0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=he.isText(r)?[]:Array.from(ue.nodes(r),z=>{var[,R]=z;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(I.equals(d,h))return[];var p=[],m=[];for(var v of I.ancestors(d)){var f=I.transform(v,t);p.push(f)}for(var b of I.ancestors(h)){var g=I.transform(b,t);m.push(g)}var C=m[m.length-1],D=h[h.length-1],A=C.concat(D);return[...p,...m,A]}case"remove_node":{var{path:E}=t,k=I.ancestors(E);return[...k]}case"split_node":{var{path:S}=t,$=I.levels(S),M=I.next(S);return[...$,M]}default:return[]}},q0=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},U0=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ue.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=he.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!he.isText(d)){var m={text:""};J.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var v={text:""};J.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&he.isText(d)&&(he.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},W0=(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},V0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(Z.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function Cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var H0=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!he.isText(h))return!1;var[m,v]=x.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=Z.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=Dl(Dl({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Or.get(e)||e.onChange()}}};function wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function El(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,El(El({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_l(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,kl(kl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Y0=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},G0=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&J.delete(e,{unit:t})},Q0=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Z.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},J0=(e,t)=>[x.start(e,t),x.end(e,t)];function Fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Al(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Al(Al({},n),{},{match:r=>de.isElement(r)&&x.isElementReadOnly(t,r)}))},ey=(e,t)=>x.point(e,t,{edge:"end"}),ty=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},ny=(e,t)=>{var n=x.range(e,t);return ue.fragment(e,n)};function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ry=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Tl(Tl({},n),{},{match:r=>de.isElement(r)&&x.isVoid(t,r)}))},ay=(e,t)=>t.children.some(n=>de.isElement(n)&&x.isBlock(e,n)),iy=(e,t)=>t.children.some(n=>he.isText(n)||x.isInline(e,n)),sy=(e,t)=>ue.has(e,t),oy=(e,t)=>t.children.every(n=>he.isText(n)),uy=e=>{J.splitNodes(e,{always:!0})},ly=(e,t,n)=>{J.insertNodes(e,t,n)},cy=e=>{J.splitNodes(e,{always:!0})};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 dy(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){pt(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 fy=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=dy({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},hy=(e,t)=>!e.isInline(t),my=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),py=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},gy=(e,t,n)=>{var r=x.end(e,n);return _e.equals(t,r)},vy=e=>{var t=Tf.get(e);return t===void 0?!0:t},by=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return _e.equals(t,r)},yy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},xy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function Cy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Dy=["text"],wy=["text"],Ey=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Z.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=an(u,Dy);return d}else return{}}var{path:h}=a,[p]=x.leaf(t,h);if(a.offset===0){var m=x.previous(t,{at:h,match:he.isText}),v=x.above(t,{match:A=>de.isElement(A)&&x.isVoid(t,A)&&t.markableVoid(A)});if(!v){var f=x.above(t,{match:A=>de.isElement(A)&&x.isBlock(t,A)});if(m&&f){var[b,g]=m,[,C]=f;I.isAncestor(C,g)&&(p=b)}}}var D=an(p,wy);return D},_y=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.get(t,a);return[i,a]};function Fy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(d0.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),p=x.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=ue.nodes(e,{reverse:i,from:u,to:d,pass:A=>{var[E]=A;return de.isElement(E)?!!(!s&&(x.isVoid(e,E)||x.isElementReadOnly(e,E))||o&&!x.isSelectable(e,E)):!1}}),v=[],f;for(var[b,g]of m)if(!(o&&de.isElement(b)&&!x.isSelectable(e,b))){var C=f&&I.compare(g,f[1])===0;if(!(r==="highest"&&C)){if(!l(b,g)){if(a&&!C&&he.isText(b))return;continue}if(r==="lowest"&&C){f=[b,g];continue}var D=r==="lowest"?f:[b,g];D&&(a?v.push(D):yield D),f=[b,g]}}r==="lowest"&&f&&(a?v.push(f):yield f),a&&(yield*v)}}()}var Ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Qa.get(d)||[],s=d=>Ja.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(x.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));Qa.set(t,l),Ja.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=x.node(t,d),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var v=i(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var g=o(t);if(ue.has(t,g)){var C=x.node(t,g);t.normalizeNode(C,{operation:a})}b++,v=i(t)}})}},By=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},Ty=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},Sy=e=>{var t=sl.get(e);return t||(t=new Set,sl.set(e,t)),t},jy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return Z.isRange(n)&&(i==="start"?n=Z.start(n):i==="end"?n=Z.end(n):n=I.common(n.anchor.path,n.focus.path)),_e.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},Py=e=>{var t=ol.get(e);return t||(t=new Set,ol.set(e,t)),t},My=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!he.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(Z.isRange(n)){var[u,d]=Z.edges(n);return a==="start"?u:d}return n};function Ny(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=Z.edges(o),d=a?u:l,h=!1,p="",m=0,v=0,f=0;for(var[b,g]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,g);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var C=I.isAncestor(g,u.path)?u:x.end(e,g),D=I.isAncestor(g,l.path)?l:x.start(e,g);p=x.string(e,{anchor:D,focus:C},{voids:i}),h=!0}}if(he.isText(b)){var A=I.equals(g,d.path);for(A?(v=a?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=a?v:0),(A||h||r==="offset")&&(yield{path:g,offset:f},h=!1);;){if(m===0){if(p==="")break;m=E(p,r,a),p=jo(p,m,a)[1]}if(f=a?f-m:f+m,v=v-m,v<0){m=-v;break}m=0,yield{path:g,offset:f}}}}function E(k,S,$){return S==="character"?So(k,$):S==="word"?v0(k,$):S==="line"||S==="block"?k.length:1}}()}var Iy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Ry=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},$y=e=>{var t=ul.get(e);return t||(t=new Set,ul.set(e,t)),t},Ly=(e,t,n)=>{if(Z.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};function jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var qy=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!he.isText(d))return!1;var[p,m]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=Z.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=zy({},x.marks(e)||{});delete u[t],e.marks=u,Or.get(e)||e.onChange()}}},Uy=(e,t)=>{Tf.set(e,t)},Wy=(e,t)=>x.point(e,t,{edge:"start"}),Vy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Z.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:he.isText,voids:a})){var h=u.text;I.equals(d,o.path)&&(h=h.slice(0,o.offset)),I.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Hy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Z.edges(n);if(i.offset!==0||s.offset!==0||Z.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:v=>de.isElement(v)&&x.isBlock(t,v),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of x.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||I.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},Ky=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},Zy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(Z.isRange(u)&&Z.isCollapsed(u)&&(h=!0,u=u.anchor),_e.isPoint(u)){var p=x.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var v={unit:s,distance:o},f=i?x.before(t,u,v)||x.start(t,[]):x.after(t,u,v)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!Z.isCollapsed(u)){if(!d){var[,b]=Z.edges(u),g=x.end(t,[]);_e.equals(b,g)||(u=x.unhangRange(t,u,{voids:l}))}var[C,D]=Z.edges(u),A=x.above(t,{match:fe=>de.isElement(fe)&&x.isBlock(t,fe),at:C,voids:l}),E=x.above(t,{match:fe=>de.isElement(fe)&&x.isBlock(t,fe),at:D,voids:l}),k=A&&E&&!I.equals(A[1],E[1]),S=I.equals(C.path,D.path),$=l?null:(r=x.void(t,{at:C,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:C,mode:"highest"}),M=l?null:(a=x.void(t,{at:D,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:D,mode:"highest"});if($){var z=x.before(t,C);z&&A&&I.isAncestor(A[1],z.path)&&(C=z)}if(M){var R=x.after(t,D);R&&E&&I.isAncestor(E[1],R.path)&&(D=R)}var B=[],F;for(var P of x.nodes(t,{at:u,voids:l})){var[j,U]=P;F&&I.compare(U,F)===0||(!l&&de.isElement(j)&&(x.isVoid(t,j)||x.isElementReadOnly(t,j))||!I.isCommon(U,C.path)&&!I.isCommon(U,D.path))&&(B.push(P),F=U)}var W=Array.from(B,fe=>{var[,ke]=fe;return x.pathRef(t,ke)}),ne=x.pointRef(t,C),re=x.pointRef(t,D),w="";if(!S&&!$){var Q=ne.current,[se]=x.leaf(t,Q),{path:_}=Q,{offset:O}=C,q=se.text.slice(O);q.length>0&&(t.apply({type:"remove_text",path:_,offset:O,text:q}),w=q)}if(W.reverse().map(fe=>fe.unref()).filter(fe=>fe!==null).forEach(fe=>J.removeNodes(t,{at:fe,voids:l})),!M){var T=re.current,[L]=x.leaf(t,T),{path:G}=T,Y=S?C.offset:0,te=L.text.slice(Y,D.offset);te.length>0&&(t.apply({type:"remove_text",path:G,offset:Y,text:te}),w=te)}!S&&k&&re.current&&ne.current&&J.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),h&&i&&s==="character"&&w.length>1&&w.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,w.slice(0,w.length-o));var le=ne.unref(),X=re.unref(),pe=i?le||X:X||le;n.at==null&&pe&&J.select(t,pe)}}})},Yy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=To(t),batchDirty:o=!0}=r;if(n.length){if(Z.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Z.isCollapsed(s))s=s.anchor;else{var[,l]=Z.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:q=>de.isElement(q)&&x.isInline(t,q),mode:"highest",voids:i});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var p=x.after(t,h);s=p}else if(x.isStart(t,s,h)){var m=x.before(t,h);s=m}}var v=x.above(t,{match:q=>de.isElement(q)&&x.isBlock(t,q),at:s,voids:i}),[,f]=v,b=x.isStart(t,s,f),g=x.isEnd(t,s,f),C=b&&g,D=!b||b&&g,A=!g,[,E]=ue.first({children:n},[]),[,k]=ue.last({children:n},[]),S=[],$=q=>{var[T,L]=q,G=L.length===0;return G?!1:C?!0:!(D&&I.isAncestor(L,E)&&de.isElement(T)&&!t.isVoid(T)&&!t.isInline(T)||A&&I.isAncestor(L,k)&&de.isElement(T)&&!t.isVoid(T)&&!t.isInline(T))};for(var M of ue.nodes({children:n},{pass:$}))$(M)&&S.push(M);var z=[],R=[],B=[],F=!0,P=!1;for(var[j]of S)de.isElement(j)&&!t.isInline(j)?(F=!1,P=!0,R.push(j)):F?z.push(j):B.push(j);var[U]=x.nodes(t,{at:s,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i}),[,W]=U,ne=x.isStart(t,s,W),re=x.isEnd(t,s,W),w=x.pathRef(t,g&&!B.length?I.next(f):f),Q=x.pathRef(t,re?I.next(W):W);J.splitNodes(t,{at:s,match:q=>P?de.isElement(q)&&x.isBlock(t,q):he.isText(q)||x.isInline(t,q),mode:P?"lowest":"highest",always:P&&(!b||z.length>0)&&(!g||B.length>0),voids:i});var se=x.pathRef(t,!ne||ne&&re?I.next(W):W);if(J.insertNodes(t,z,{at:se.current,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),C&&!z.length&&R.length&&!B.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,R,{at:w.current,match:q=>de.isElement(q)&&x.isBlock(t,q),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,B,{at:Q.current,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(B.length>0&&Q.current?_=I.previous(Q.current):R.length>0&&w.current?_=I.previous(w.current):se.current&&(_=I.previous(se.current)),_){var O=x.end(t,_);J.select(t,O)}}se.unref(),w.unref(),Q.unref()}}})},Gy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=Z.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=Z.edges(a);J.select(t,s)}}else return},Qy=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Jy=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=Z.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Z.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?x.before(t,l,d):x.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?x.before(t,u,d):x.after(t,u,d);m&&(h.focus=m)}J.setSelection(t,h)}},Xy=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){J.setSelection(e,t);return}if(!Z.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(rt.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};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 Pl(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){pt(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 ex=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=Z.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Z.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Pl(Pl({},l),n)})}},tx=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!_e.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!_e.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},nx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=To(t),d!==!1&&(d=!0)),d==null&&(d=!1),Z.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Z.isCollapsed(l))l=l.anchor;else{var[,p]=Z.edges(l),m=x.pointRef(t,p);J.delete(t,{at:l}),l=m.unref()}if(_e.isPoint(l)){u==null&&(he.isText(h)?u=z=>he.isText(z):t.isInline(h)?u=z=>he.isText(z)||x.isInline(t,z):u=z=>de.isElement(z)&&x.isBlock(t,z));var[v]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(v){var[,f]=v,b=x.pathRef(t,f),g=x.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var C=b.unref();l=g?I.next(C):C}else return}var D=I.parent(l),A=l[l.length-1];if(!(!i&&x.void(t,{at:D}))){if(o){var E=[],k=I.levels(D);$0(t,()=>{var z=function(){var F=D.concat(A);A++;var P={type:"insert_node",path:F,node:R};t.apply(P),l=I.next(l),E.push(P),he.isText?k.push(...Array.from(ue.nodes(R),j=>{var[,U]=j;return F.concat(U)})):k.push(F)};for(var R of n)z()},()=>{jf(t,k,z=>{var R=z;for(var B of E)if(I.operationCanTransformPath(B)&&(R=I.transform(R,B),!R))return null;return R})})}else for(var S of n){var $=D.concat(A);A++,t.apply({type:"insert_node",path:$,node:S}),l=I.next(l)}if(l=I.previous(l),d){var M=x.end(t,l);M&&J.select(t,M)}}}})},rx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?vr(t,r):A=>de.isElement(A)&&x.isBlock(t,A)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,A=>{var[,E]=A;return x.pathRef(t,E)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=x.node(t,I.parent(d)),[p,m]=h,v=d[d.length-1],{length:f}=p.children;if(f===1){var b=I.next(m);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:m,voids:i})}else if(v===0)J.moveNodes(t,{at:d,to:m,voids:i});else if(v===f-1){var g=I.next(m);J.moveNodes(t,{at:d,to:g,voids:i})}else{var C=I.next(d),D=I.next(m);J.splitNodes(t,{at:C,voids:i}),J.moveNodes(t,{at:d,to:D,voids:i})}}}})},ax=["text"],ix=["children"],Of=(e,t)=>{if(de.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?Of(e,n.children[0]):!1}else return!x.isEditor(t)},sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(I.isPath(a)){var[l]=x.parent(t,a);r=z=>l.children.includes(z)}else r=z=>de.isElement(z)&&x.isBlock(t,z);if(!i&&Z.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var[,u]=Z.edges(a),d=x.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[h]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),p=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,v]=h,[f,b]=p;if(!(v.length===0||b.length===0)){var g=I.next(b),C=I.common(v,b),D=I.isSibling(v,b),A=Array.from(x.levels(t,{at:v}),z=>{var[R]=z;return R}).slice(C.length).slice(0,-1),E=x.above(t,{at:v,mode:"highest",match:z=>A.includes(z)&&Of(t,z)}),k=E&&x.pathRef(t,E[1]),S,$;if(he.isText(m)&&he.isText(f)){var M=an(m,ax);$=f.text.length,S=M}else if(de.isElement(m)&&de.isElement(f)){var M=an(m,ix);$=f.children.length,S=M}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(rt.stringify(m)," ").concat(rt.stringify(f)));D||J.moveNodes(t,{at:v,to:g,voids:s}),k&&J.removeNodes(t,{at:k.current,voids:s}),de.isElement(f)&&x.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:$,properties:S}),k&&k.unref()}}}})},ox=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?vr(e,r):m=>de.isElement(m)&&x.isBlock(e,m));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(e,v)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&I.isSibling(p,h)&&I.isAfter(p,h)&&(o.current=I.next(o.current))}o.unref()}})},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?vr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),!r&&Z.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(t,v)});for(var d of u){var h=d.unref();if(h){var[p]=x.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},lx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=I.isPath(i)?vr(t,i):$=>de.isElement($)&&x.isBlock(t,$)),!l&&Z.isRange(i)&&(i=x.unhangRange(t,i,{voids:h})),d&&Z.isRange(i)){if(Z.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var p=x.rangeRef(t,i,{affinity:"inward"}),[m,v]=Z.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,v,v.path);J.splitNodes(t,{at:v,match:a,mode:f,voids:h,always:!b});var g=x.isStart(t,m,m.path);J.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!g}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=($,M)=>$!==M);for(var[C,D]of x.nodes(t,{at:i,match:a,mode:u,voids:h})){var A={},E={};if(D.length!==0){var k=!1;for(var S in n)S==="children"||S==="text"||s(n[S],C[S])&&(k=!0,C.hasOwnProperty(S)&&(A[S]=C[S]),o?n[S]!=null&&(E[S]=o(C[S],n[S])):n[S]!=null&&(E[S]=n[S]));k&&t.apply({type:"set_node",path:D,properties:A,newProperties:E})}}}})},cx=(e,t)=>{if(Z.isCollapsed(t))return t.anchor;var[,n]=Z.edges(t),r=x.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=re=>de.isElement(re)&&x.isBlock(t,re)),Z.isRange(s)&&(s=cx(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);i=re=>re===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=x.pointRef(t,s,{affinity:"backward"}),m;try{var[v]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!v)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[g,C]=f;if(de.isElement(g)&&t.isInline(g)){var D=x.after(t,C);if(!D){var A={text:""},E=I.next(C);J.insertNodes(t,A,{at:E,voids:a}),D=x.point(t,E)}s=D,l=!0}var k=s.path.length-C.length;o=k+1,l=!0}m=x.pointRef(t,s);var S=s.path.length-o,[,$]=v,M=s.path.slice(0,S),z=o===0?s.offset:s.path[S]+b;for(var[R,B]of x.levels(t,{at:M,reverse:!0,voids:a})){var F=!1;if(B.length<$.length||B.length===0||!a&&de.isElement(R)&&x.isVoid(t,R))break;var P=p.current,j=x.isEnd(t,P,B);if(l||!p||!x.isEdge(t,P,B)){F=!0;var U=ue.extractProps(R);t.apply({type:"split_node",path:B,position:z,properties:U})}z=B[B.length-1]+(F||j?1:0)}if(n.at==null){var W=m.current||x.end(t,[]);J.select(t,W)}}finally{var ne;p.unref(),(ne=m)===null||ne===void 0||ne.unref()}}})},fx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;J.setNodes(t,a,r)},hx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?vr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),I.isPath(s)&&(s=x.range(t,s));var l=Z.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,v]=m;return x.pathRef(t,v)}).reverse(),h=function(){var v=p.unref(),[f]=x.node(t,v),b=x.range(t,v);a&&l&&(b=Z.intersection(l.current,b)),J.liftNodes(t,{at:b,match:g=>de.isAncestor(f)&&f.children.includes(g),voids:i})};for(var p of d)h();l&&l.unref()}})};function Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ml(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=vr(t,l):t.isInline(n)?o=b=>de.isElement(b)&&x.isInline(t,b)||he.isText(b):o=b=>de.isElement(b)&&x.isBlock(t,b)),i&&Z.isRange(l)){var[u,d]=Z.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&J.select(t,l)}var p=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),m=function(){var g=Z.isRange(l)?Z.intersection(l,x.range(t,f)):l;if(!g)return 0;var C=Array.from(x.nodes(t,{at:g,match:o,mode:a,voids:s}));if(C.length>0){var[D]=C,A=C[C.length-1],[,E]=D,[,k]=A;if(E.length===0&&k.length===0)return 0;var S=I.equals(E,k)?I.parent(E):I.common(E,k),$=x.range(t,E,k),M=x.node(t,S),[z]=M,R=S.length+1,B=I.next(k.slice(0,R)),F=Nl(Nl({},n),{},{children:[]});J.insertNodes(t,F,{at:B,voids:s}),J.moveNodes(t,{at:$,match:P=>de.isAncestor(z)&&z.children.includes(P),to:B.concat(0),voids:s})}},v;for(var[,f]of p)v=m()}})},px=()=>{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 L0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ey(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nx(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return my(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return py(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xy(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sx(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ox(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _y(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ky(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fy(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ay(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return My(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Py(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $y(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ux(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xy(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uy(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vy(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hy(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mx(e,...r)}};return e},Bn=[],gx=function(){return Bn.some(function(e){return e.activeTargets.length>0})},vx=function(){return Bn.some(function(e){return e.skippedTargets.length>0})},Il="ResizeObserver loop completed with undelivered notifications.",bx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Il}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Il),window.dispatchEvent(e)},Vr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Vr||(Vr={}));var Tn=function(e){return Object.freeze(e)},yx=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Tn(this)}return e}(),Pf=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,Tn(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}(),Oo=function(e){return e instanceof SVGElement&&"getBBox"in e},Mf=function(e){if(Oo(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)},Rl=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)},xx=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},Pr=typeof window<"u"?window:{},ma=new WeakMap,$l=/auto|scroll/,Cx=/^tb|vertical/,Dx=/msie|trident/i.test(Pr.navigator&&Pr.navigator.userAgent),qt=function(e){return parseFloat(e||"0")},rr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new yx((n?t:e)||0,(n?e:t)||0)},Ll=Tn({devicePixelContentBoxSize:rr(),borderBoxSize:rr(),contentBoxSize:rr(),contentRect:new Pf(0,0,0,0)}),Nf=function(e,t){if(t===void 0&&(t=!1),ma.has(e)&&!t)return ma.get(e);if(Mf(e))return ma.set(e,Ll),Ll;var n=getComputedStyle(e),r=Oo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Dx&&n.boxSizing==="border-box",i=Cx.test(n.writingMode||""),s=!r&&$l.test(n.overflowY||""),o=!r&&$l.test(n.overflowX||""),l=r?0:qt(n.paddingTop),u=r?0:qt(n.paddingRight),d=r?0:qt(n.paddingBottom),h=r?0:qt(n.paddingLeft),p=r?0:qt(n.borderTopWidth),m=r?0:qt(n.borderRightWidth),v=r?0:qt(n.borderBottomWidth),f=r?0:qt(n.borderLeftWidth),b=h+u,g=l+d,C=f+m,D=p+v,A=o?e.offsetHeight-D-e.clientHeight:0,E=s?e.offsetWidth-C-e.clientWidth:0,k=a?b+C:0,S=a?g+D:0,$=r?r.width:qt(n.width)-k-E,M=r?r.height:qt(n.height)-S-A,z=$+b+E+C,R=M+g+A+D,B=Tn({devicePixelContentBoxSize:rr(Math.round($*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:rr(z,R,i),contentBoxSize:rr($,M,i),contentRect:new Pf(h,l,$,M)});return ma.set(e,B),B},If=function(e,t,n){var r=Nf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Vr.DEVICE_PIXEL_CONTENT_BOX:return s;case Vr.BORDER_BOX:return a;default:return i}},wx=function(){function e(t){var n=Nf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Tn([n.borderBoxSize]),this.contentBoxSize=Tn([n.contentBoxSize]),this.devicePixelContentBoxSize=Tn([n.devicePixelContentBoxSize])}return e}(),Rf=function(e){if(Mf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Ex=function(){var e=1/0,t=[];Bn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new wx(u.target),h=Rf(u.target);o.push(d),u.lastReportedSize=If(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},zl=function(e){Bn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Rf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},_x=function(){var e=0;for(zl(e);gx();)e=Ex(),zl(e);return vx()&&bx(),e>0},Ui,$f=[],kx=function(){return $f.splice(0).forEach(function(e){return e()})},Fx=function(e){if(!Ui){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return kx()}).observe(n,r),Ui=function(){n.textContent="".concat(t?t--:t++)}}$f.push(e),Ui()},Ax=function(e){Fx(function(){requestAnimationFrame(e)})},Sa=0,Bx=function(){return!!Sa},Tx=250,Sx={attributes:!0,characterData:!0,childList:!0,subtree:!0},ql=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ul=function(e){return e===void 0&&(e=0),Date.now()+e},Wi=!1,jx=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=Tx),!Wi){Wi=!0;var r=Ul(t);Ax(function(){var a=!1;try{a=_x()}finally{if(Wi=!1,t=r-Ul(),!Bx())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,Sx)};document.body?n():Pr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ql.forEach(function(n){return Pr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),ql.forEach(function(n){return Pr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),$s=new jx,Wl=function(e){!Sa&&e>0&&$s.start(),Sa+=e,!Sa&&$s.stop()},Ox=function(e){return!Oo(e)&&!xx(e)&&getComputedStyle(e).display==="inline"},Px=function(){function e(t,n){this.target=t,this.observedBox=n||Vr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=If(this.target,this.observedBox,!0);return Ox(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Mx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),pa=new WeakMap,Vl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ga=function(){function e(){}return e.connect=function(t,n){var r=new Mx(t,n);pa.set(t,r)},e.observe=function(t,n,r){var a=pa.get(t),i=a.observationTargets.length===0;Vl(a.observationTargets,n)<0&&(i&&Bn.push(a),a.observationTargets.push(new Px(n,r&&r.box)),Wl(1),$s.schedule())},e.unobserve=function(t,n){var r=pa.get(t),a=Vl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Bn.splice(Bn.indexOf(r),1),r.observationTargets.splice(a,1),Wl(-1))},e.disconnect=function(t){var n=this,r=pa.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Nx=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.");ga.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(!Rl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ga.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(!Rl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ga.unobserve(this,t)},e.prototype.disconnect=function(){ga.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),cn={};Object.defineProperty(cn,"__esModule",{value:!0});var Ix=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Vi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Lf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Ix?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Po={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 va=1;va<20;va++)Po["f"+va]=111+va;function vi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return zf(s,t)}),a=function(o){return r.some(function(l){return qf(l,o)})},i=n==null?a:a(n);return i}function Rx(e,t){return vi(e,t)}function $x(e,t){return vi(e,{byKey:!0},t)}function zf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Vi)r[Vi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var v=Mo(p),f=Vi[v];if(p.length>1&&!f&&!Lf[p]&&!Po[v])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=v:r.which=Uf(p)),f&&(r[f]=m?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function qf(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 Uf(e){e=Mo(e);var t=Po[e]||e.toUpperCase().charCodeAt(0);return t}function Mo(e){return e=e.toLowerCase(),e=Lf[e]||e,e}var Lx=cn.default=vi,Hi=cn.isHotkey=vi;cn.isCodeHotkey=Rx;cn.isKeyHotkey=$x;cn.parseHotkey=zf;cn.compareHotkey=qf;cn.toKeyCode=Uf;cn.toKeyName=Mo;function zx(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 dr(e,t){if(e==null)return{};var n=zx(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 Hr(e){"@babel/helpers - typeof";return Hr=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},Hr(e)}function qx(e,t){if(Hr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Hr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ux(e){var t=qx(e,"string");return Hr(t)==="symbol"?t:String(t)}function Ot(e,t,n){return t=Ux(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var No=y.createContext(null),Cn=()=>{var e=y.useContext(No);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Wf=parseInt(y.version.split(".")[0],10),Wx=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Hl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),mt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Xn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Tr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Vx=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Vf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Hx=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Kx=mt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Zx=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Yx=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Gx=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ja=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dn=(!Hx||!Kx)&&!Vx&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Io=new WeakMap,Ro=new WeakMap,Hf=new WeakMap,Oa=new WeakMap,Ls=new WeakMap,Kr=new WeakMap,Sn=new WeakMap,Xa=new WeakMap,bi=new WeakMap,zs=new WeakMap,vn=new WeakMap,An=new WeakMap,Mr=new WeakMap,qs=new WeakMap,$o=new WeakMap,Rt=new WeakMap,nn=new WeakMap,yt=new WeakMap,hn=new WeakMap,mn=new WeakMap,Kf=new WeakMap,fr=Symbol("placeholder"),Zf=Symbol("mark-placeholder"),Qx=globalThis.Text,Lo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Jx=e=>bn(e)&&e.nodeType===8,jt=e=>bn(e)&&e.nodeType===1,bn=e=>{var t=Lo(e);return!!t&&e instanceof t.Node},Us=e=>{var t=e&&e.anchorNode&&Lo(e.anchorNode);return!!t&&e instanceof t.Selection},Yf=e=>bn(e)&&e.nodeType===3,Xx=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,e1=e=>{var[t,n]=e;if(jt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Gf(t,a,r?"backward":"forward"),r=a<n;jt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=n1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},t1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Gf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Jx(a)||jt(a)&&a.childNodes.length===0||jt(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]},n1=(e,t,n)=>{var[r]=Gf(e,t,n);return r},Qf=e=>{var t="";if(Yf(e)&&e.nodeValue)return e.nodeValue;if(jt(e)){for(var n of Array.from(e.childNodes))t+=Qf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
+ `)}return t},r1=/data-slate-fragment="(.+?)"/m,a1=e=>{var t=e.getData("text/html"),[,n]=t.match(r1)||[];return n},zo=(e,t,n)=>{var{target:r}=t;if(jt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:zo(e,i,n)},i1=0;class s1{constructor(){Ot(this,"id",void 0),this.id="".concat(i1++)}}var ee={androidPendingDiffs:e=>yt.get(e),androidScheduleFlush:e=>{var t;(t=$o.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);vn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&J.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var h=x.range(e,d);return h}}var p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var v=m.caretPositionFromPoint(n,r);v&&(p=m.createRange(),p.setStart(v.offsetNode,v.offset),p.setEnd(v.offsetNode,v.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Xa.get(t);return n||(n=new s1,Xa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Ro.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=Io.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(rt.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!vn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(J.select(t,x.start(t,[])),t.onChange()),vn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Hf.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=ee.toDOMNode(t,t),s;try{s=jt(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)=>bn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>bn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!An.get(e),isFocused:e=>!!vn.get(e),isReadOnly:e=>!!zs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(zs.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=bi.get(e),r=x.isEditor(t)?Oa.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(rt.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=ee.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),v=o+m,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];a=[g instanceof Qx?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var C=Math.min(h,Math.max(0,t.offset-o));a=[d,C];break}o=v}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(rt.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Z.isBackward(t),i=ee.toDOMPoint(e,n),s=Z.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,p]=a?i:s,m=jt(u)?u:u.parentElement,v=!!m.getAttribute("data-slate-zero-width"),f=jt(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(h,b?1:p),l},toSlateNode:(e,t)=>{var n=jt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Kr.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:e1(t),o=i.parentNode,l=null,u=0;if(o){var d,h,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),v=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var g=ee.getWindow(e),C=g.document.createRange();C.setStart(l,0),C.setEnd(i,s);var D=C.cloneContents(),A=[...Array.prototype.slice.call(D.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(D.querySelectorAll("[contenteditable=false]"))];A.forEach(P=>{if(mt&&!r&&P.hasAttribute("data-slate-zero-width")&&P.textContent.length>0&&P.textContext!=="\uFEFF"){P.textContent.startsWith("\uFEFF")&&(P.textContent=P.textContent.slice(1));return}P.parentNode.removeChild(P)}),u=D.textContent.length,b=l}}else if(v){for(var E=v.querySelectorAll("[data-slate-leaf]"),k=0;k<E.length;k++){var S=E[k];if(ee.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(P=>{u-=P.textContent.length})):u=1}b&&u===b.textContent.length&&mt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Xn&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
73
73
 
74
- `))&&u--}if(mt&&!l&&!r){var L=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(L&&ee.hasDOMNode(e,L,{editable:!0})){var M=ee.toSlateNode(e,L),{path:q,offset:I}=x.start(e,ee.findPath(e,M));return L.querySelector("[data-slate-leaf]")||(I=s),{path:q,offset:I}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=ee.toSlateNode(e,l),F=ee.findPath(e,B);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=qs(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if(qs(t)){if(Xn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let k=function(j){return j.childElementCount>0?k(j.children[0]):j};var v=p.startContainer,f=m.startContainer,b=k(v.children[p.startOffset]),g=k(f.children[m.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Uf&&Xx(o)||Xn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Xn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
74
+ `))&&u--}if(mt&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&ee.hasDOMNode(e,$,{editable:!0})){var M=ee.toSlateNode(e,$),{path:z,offset:R}=x.start(e,ee.findPath(e,M));return $.querySelector("[data-slate-leaf]")||(R=s),{path:z,offset:R}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=ee.toSlateNode(e,l),F=ee.findPath(e,B);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Us(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if(Us(t)){if(Xn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let k=function(S){return S.childElementCount>0?k(S.children[0]):S};var v=p.startContainer,f=m.startContainer,b=k(v.children[p.startOffset]),g=k(f.children[m.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Vf&&t1(o)||Xn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Xn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
75
75
 
76
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,d=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var E=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!E)return null;var A=h?E:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!A)return null;var D={anchor:E,focus:A};return Z.isExpanded(D)&&Z.isForward(D)&&jt(u)&&x.void(e,{at:D.focus,mode:"highest"})&&(D=x.unhangRange(e,D,{voids:!0})),D}};function i1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=oe.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=R.next(n);if(!x.hasPath(e,i))return!1;var s=oe.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Gf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function s1(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function o1(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function Qf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=s1(i,a),o=Math.min(i.length-s,a.length-s),l=o1(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function u1(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=Gf(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 Qf(e,{start:r,end:l,text:o})}function l1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Us(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=oe.get(e,n);if(!fe.isText(a))return null;var i=x.above(e,{match:o=>de.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:fe.isText});if(!s||!R.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Hl(e,t){var n=Us(e,t.anchor);if(!n)return null;if(Z.isCollapsed(t))return{anchor:n,focus:n};var r=Us(e,t.focus);return r?{anchor:n,focus:r}:null}function Ws(e,t,n){var r=yt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return R.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return _e.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=_e.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=_e.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&R.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 Kl(e,t,n){var r=Ws(e,t.anchor,n);if(!r)return null;if(Z.isCollapsed(t))return{anchor:r,focus:r};var a=Ws(e,t.focus,n);return a?{anchor:r,focus:a}:null}function c1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!R.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!R.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!R.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:R.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:R.transform(n,t,{affinity:"forward"})};case"merge_node":return R.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:R.transform(n,t)}:{diff:r,id:a,path:R.transform(n,t)}}var i=R.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function va(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var d1=25,f1=200,h1=function(){},m1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function p1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=hn.get(t);if(hn.delete(t),B){var{selection:F}=t,P=Hl(t,B);P&&(!F||!Z.equals(P,F))&&J.select(t,P)}},h=()=>{var B=fn.get(t);if(fn.delete(t),!!B){if(B.at){var F=_e.isPoint(B.at)?Us(t,B.at):Hl(t,B.at);if(!F)return;var P=x.range(t,F);(!t.selection||!Z.equals(t.selection,P))&&J.select(t,F)}B.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!A()&&!E()){d();return}a||(a=!0,setTimeout(()=>a=!1)),E()&&(a="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});tn.set(t,t.marks),h1("flush",fn.get(t),yt.get(t));for(var F=A(),P;P=(O=yt.get(t))===null||O===void 0?void 0:O[0];){var O,U,W=Rt.get(t);W!==void 0&&(Rt.delete(t),t.marks=W),W&&u===!1&&(u=null);var ie=l1(P);(!t.selection||!Z.equals(t.selection,ie))&&J.select(t,ie),P.diff.text?x.insertText(t,P.diff.text):x.deleteFragment(t),yt.set(t,(U=yt.get(t))===null||U===void 0?void 0:U.filter(X=>{var{id:ue}=X;return ue!==P.id})),i1(t,P)||(F=!1,fn.delete(t),tn.delete(t),a="action",hn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var te=B==null?void 0:B.unref();if(te&&!hn.get(t)&&(!t.selection||!Z.equals(te,t.selection))&&J.select(t,te),E()){h();return}F&&n(),n.flush(),r.flush(),d();var C=tn.get(t);tn.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=B=>{i&&clearTimeout(i),i=setTimeout(()=>{Fn.set(t,!1),p()},d1)},v=B=>{Fn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=$s.get(t);if(P){if(A()||F){P.style.display="none";return}P.style.removeProperty("display")}},b=(B,F)=>{var P,O=(P=yt.get(t))!==null&&P!==void 0?P:[];yt.set(t,O);var U=oe.leaf(t,B),W=O.findIndex(C=>R.equals(C.path,B));if(W<0){var ie=Qf(U.text,F);ie&&O.push({path:B,diff:F,id:l++}),f();return}var te=u1(U.text,O[W].diff,F);if(!te){O.splice(W,1),f();return}O[W]=va(va({},O[W]),{},{diff:te})},g=function(F){var{at:P}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,hn.delete(t),n.cancel(),r.cancel(),E()&&p(),fn.set(t,{at:P,run:F}),o=setTimeout(p)},w=B=>{var F;s&&(clearTimeout(s),s=null);var{inputType:P}=B,O=null,U=B.dataTransfer||B.data||void 0;u!==!1&&P!=="insertText"&&P!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(O=ee.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ie=ee.getWindow(t),te=ie.getSelection();if(!O&&te&&(W=te,O=ee.toSlateRange(t,te,{exactMatch:!1,suppressThrow:!0})),O=(F=O)!==null&&F!==void 0?F:t.selection,!!O){var C=!0;if(P.startsWith("delete")){if(Z.isExpanded(O)){var[X,ue]=Z.edges(O),_=oe.leaf(t,X.path);if(_.text.length===X.offset&&ue.offset===0){var T=x.next(t,{at:X.path,match:fe.isText});T&&R.equals(T[1],ue.path)&&(O={anchor:ue,focus:ue})}}var $=P.endsWith("Backward")?"backward":"forward",[S,z]=Z.edges(O),[Y,G]=x.leaf(t,S.path),re={text:"",start:S.offset,end:z.offset},le=yt.get(t),Q=le==null?void 0:le.find(ge=>R.equals(ge.path,G)),me=Q?[Q.diff,re]:[re],pe=Gf(Y.text,...me);if(pe.length===0&&(C=!1),Z.isExpanded(O)){if(C&&R.equals(O.anchor.path,O.focus.path)){var ke={path:O.anchor.path,offset:S.offset},je=x.range(t,ke,ke);return j(je),b(O.anchor.path,{text:"",end:z.offset,start:S.offset})}return g(()=>x.deleteFragment(t,{direction:$}),{at:O})}}switch(P){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>x.deleteFragment(t),{at:O});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=O;if(C&&Z.isCollapsed(O)){var Ke=oe.leaf(t,Te.path);if(Te.offset<Ke.text.length)return b(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return g(()=>x.deleteForward(t),{at:O})}case"deleteContentBackward":{var Ne,{anchor:$e}=O,Qe=qs(W)?W.isCollapsed:!!((Ne=W)!==null&&Ne!==void 0&&Ne.collapsed);return C&&Qe&&Z.isCollapsed(O)&&$e.offset>0?b($e.path,{text:"",start:$e.offset-1,end:$e.offset}):g(()=>x.deleteBackward(t),{at:O})}case"deleteEntireSoftLine":return g(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:O});case"deleteHardLineBackward":return g(()=>x.deleteBackward(t,{unit:"block"}),{at:O});case"deleteSoftLineBackward":return g(()=>x.deleteBackward(t,{unit:"line"}),{at:O});case"deleteHardLineForward":return g(()=>x.deleteForward(t,{unit:"block"}),{at:O});case"deleteSoftLineForward":return g(()=>x.deleteForward(t,{unit:"line"}),{at:O});case"deleteWordBackward":return g(()=>x.deleteBackward(t,{unit:"word"}),{at:O});case"deleteWordForward":return g(()=>x.deleteForward(t,{unit:"word"}),{at:O});case"insertLineBreak":return g(()=>x.insertSoftBreak(t),{at:O});case"insertParagraph":return g(()=>x.insertBreak(t),{at:O});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(m1(U))return g(()=>ee.insertData(t,U),{at:O});var Ae=U??"";if(Rt.get(t)&&(Ae=Ae.replace("\uFEFF","")),P==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
76
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var C;u=o,d=((C=o.textContent)===null||C===void 0?void 0:C.length)||0}var D=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!D)return null;var A=h?D:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!A)return null;var E={anchor:D,focus:A};return Z.isExpanded(E)&&Z.isForward(E)&&jt(u)&&x.void(e,{at:E.focus,mode:"highest"})&&(E=x.unhangRange(e,E,{voids:!0})),E}};function o1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=ue.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=I.next(n);if(!x.hasPath(e,i))return!1;var s=ue.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function Jf(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 u1(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 l1(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 Xf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=u1(i,a),o=Math.min(i.length-s,a.length-s),l=l1(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 c1(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=Jf(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 Xf(e,{start:r,end:l,text:o})}function d1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ws(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=ue.get(e,n);if(!he.isText(a))return null;var i=x.above(e,{match:o=>de.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:he.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Kl(e,t){var n=Ws(e,t.anchor);if(!n)return null;if(Z.isCollapsed(t))return{anchor:n,focus:n};var r=Ws(e,t.focus);return r?{anchor:n,focus:r}:null}function Vs(e,t,n){var r=yt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return I.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return _e.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=_e.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=_e.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Zl(e,t,n){var r=Vs(e,t.anchor,n);if(!r)return null;if(Z.isCollapsed(t))return{anchor:r,focus:r};var a=Vs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function f1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!I.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ba(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var h1=25,m1=200,p1=function(){},g1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function v1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=mn.get(t);if(mn.delete(t),B){var{selection:F}=t,P=Kl(t,B);P&&(!F||!Z.equals(P,F))&&J.select(t,P)}},h=()=>{var B=hn.get(t);if(hn.delete(t),!!B){if(B.at){var F=_e.isPoint(B.at)?Ws(t,B.at):Kl(t,B.at);if(!F)return;var P=x.range(t,F);(!t.selection||!Z.equals(t.selection,P))&&J.select(t,F)}B.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!A()&&!D()){d();return}a||(a=!0,setTimeout(()=>a=!1)),D()&&(a="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});nn.set(t,t.marks),p1("flush",hn.get(t),yt.get(t));for(var F=A(),P;P=(j=yt.get(t))===null||j===void 0?void 0:j[0];){var j,U,W=Rt.get(t);W!==void 0&&(Rt.delete(t),t.marks=W),W&&u===!1&&(u=null);var ne=d1(P);(!t.selection||!Z.equals(t.selection,ne))&&J.select(t,ne),P.diff.text?x.insertText(t,P.diff.text):x.deleteFragment(t),yt.set(t,(U=yt.get(t))===null||U===void 0?void 0:U.filter(Q=>{var{id:se}=Q;return se!==P.id})),o1(t,P)||(F=!1,hn.delete(t),nn.delete(t),a="action",mn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var re=B==null?void 0:B.unref();if(re&&!mn.get(t)&&(!t.selection||!Z.equals(re,t.selection))&&J.select(t,re),D()){h();return}F&&n(),n.flush(),r.flush(),d();var w=nn.get(t);nn.delete(t),w!==void 0&&(t.marks=w,t.onChange())},m=B=>{i&&clearTimeout(i),i=setTimeout(()=>{An.set(t,!1),p()},h1)},v=B=>{An.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=Ls.get(t);if(P){if(A()||F){P.style.display="none";return}P.style.removeProperty("display")}},b=(B,F)=>{var P,j=(P=yt.get(t))!==null&&P!==void 0?P:[];yt.set(t,j);var U=ue.leaf(t,B),W=j.findIndex(w=>I.equals(w.path,B));if(W<0){var ne=Xf(U.text,F);ne&&j.push({path:B,diff:F,id:l++}),f();return}var re=c1(U.text,j[W].diff,F);if(!re){j.splice(W,1),f();return}j[W]=ba(ba({},j[W]),{},{diff:re})},g=function(F){var{at:P}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,mn.delete(t),n.cancel(),r.cancel(),D()&&p(),hn.set(t,{at:P,run:F}),o=setTimeout(p)},C=B=>{var F;s&&(clearTimeout(s),s=null);var{inputType:P}=B,j=null,U=B.dataTransfer||B.data||void 0;u!==!1&&P!=="insertText"&&P!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(j=ee.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ne=ee.getWindow(t),re=ne.getSelection();if(!j&&re&&(W=re,j=ee.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),j=(F=j)!==null&&F!==void 0?F:t.selection,!!j){var w=!0;if(P.startsWith("delete")){if(Z.isExpanded(j)){var[Q,se]=Z.edges(j),_=ue.leaf(t,Q.path);if(_.text.length===Q.offset&&se.offset===0){var O=x.next(t,{at:Q.path,match:he.isText});O&&I.equals(O[1],se.path)&&(j={anchor:se,focus:se})}}var q=P.endsWith("Backward")?"backward":"forward",[T,L]=Z.edges(j),[G,Y]=x.leaf(t,T.path),te={text:"",start:T.offset,end:L.offset},le=yt.get(t),X=le==null?void 0:le.find(ge=>I.equals(ge.path,Y)),pe=X?[X.diff,te]:[te],fe=Jf(G.text,...pe);if(fe.length===0&&(w=!1),Z.isExpanded(j)){if(w&&I.equals(j.anchor.path,j.focus.path)){var ke={path:j.anchor.path,offset:T.offset},Oe=x.range(t,ke,ke);return S(Oe),b(j.anchor.path,{text:"",end:L.offset,start:T.offset})}return g(()=>x.deleteFragment(t,{direction:q}),{at:j})}}switch(P){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>x.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=j;if(w&&Z.isCollapsed(j)){var Ke=ue.leaf(t,Te.path);if(Te.offset<Ke.text.length)return b(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return g(()=>x.deleteForward(t),{at:j})}case"deleteContentBackward":{var Ne,{anchor:$e}=j,Qe=Us(W)?W.isCollapsed:!!((Ne=W)!==null&&Ne!==void 0&&Ne.collapsed);return w&&Qe&&Z.isCollapsed(j)&&$e.offset>0?b($e.path,{text:"",start:$e.offset-1,end:$e.offset}):g(()=>x.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return g(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return g(()=>x.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return g(()=>x.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return g(()=>x.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return g(()=>x.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return g(()=>x.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return g(()=>x.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return g(()=>x.insertSoftBreak(t),{at:j});case"insertParagraph":return g(()=>x.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(g1(U))return g(()=>ee.insertData(t,U),{at:j});var Ae=U??"";if(Rt.get(t)&&(Ae=Ae.replace("\uFEFF","")),P==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
77
77
  `))return g(()=>{var ge=Ae.split(`
78
- `);ge.forEach((we,Ye)=>{we&&x.insertText(t,we),Ye!==ge.length-1&&x.insertSoftBreak(t)})},{at:O});if(R.equals(O.anchor.path,O.focus.path)){var[qe,be]=Z.edges(O),V={start:qe.offset,end:be.offset,text:Ae};if(Ae&&u&&P==="insertCompositionText"){var ne=u.start+u.text.search(/\S|$/),he=V.start+V.text.search(/\S|$/);he===ne+1&&V.end===u.start+u.text.length?(V.start-=1,u=null,q()):u=!1}else P==="insertText"?u===null?u=V:u&&Z.isCollapsed(O)&&u.end+u.text.length===qe.offset?u=va(va({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(C){b(qe.path,V);return}}return g(()=>x.insertText(t,Ae),{at:O})}}}},E=()=>!!fn.get(t),A=()=>{var B;return!!((B=yt.get(t))!==null&&B!==void 0&&B.length)},D=()=>E()||A(),k=()=>a,j=B=>{hn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(B){var P=!F||!R.equals(F.anchor.path,B.anchor.path),O=!F||!R.equals(F.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(P&&u||O)&&(u=!1),(P||A())&&(s=setTimeout(p,f1))}},L=()=>{(E()||!A())&&p()},M=B=>{A()||(f(!0),setTimeout(f))},q=()=>{E()||(o=setTimeout(p))},I=B=>{if(!(A()||E())&&B.some(P=>Lo(t,P,B))){var F;(F=Vf.get(t))===null||F===void 0||F()}};return{flush:p,scheduleFlush:q,hasPendingDiffs:A,hasPendingAction:E,hasPendingChanges:D,isFlushing:k,handleUserSelect:j,handleCompositionEnd:m,handleCompositionStart:v,handleDOMBeforeInput:w,handleKeyDown:M,handleDomMutations:I,handleInput:L}}function g1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Kr=Sa?y.useLayoutEffect:y.useEffect;function v1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Kr(()=>{r.takeRecords()}),y.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var b1=["node"];function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function y1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var x1={subtree:!0,childList:!0,characterData:!0},D1=mt?e=>{var{node:t}=e,n=dr(e,b1);if(!mt)return null;var r=xn(),a=g1(),[i]=y.useState(()=>p1(y1({editor:r},n)));return v1(t,i.handleDomMutations,x1),Io.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,C1=["anchor","focus"],w1=["anchor","focus"],E1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Jf=(e,t)=>{var n=dr(e,C1),r=dr(t,w1);return e[fr]===t[fr]&&E1(n,r)},_1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!Z.equals(r,a)||!Jf(r,a))return!1}return!0},k1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!Jf(r,a))return!1}return!0};function Gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function F1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var A1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=xn(),s=ee.findPath(i,a),o=R.parent(s),l=!!n[Hf];return i.isVoid(r)?y.createElement(Hi,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Hi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Hi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
- `?y.createElement(Ql,{isTrailing:!0,text:n.text}):y.createElement(Ql,{text:n.text})},Ql=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
80
- `:""),[i]=y.useState(a);return Kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(B1,{ref:r},i)},B1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Hi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",F1({},a),!mt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var T1=mt?300:0;function S1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Xl(e){e.current&&(clearTimeout(e.current),e.current=null)}var j1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>y.createElement(P1,Xf({},w))}=e,o=xn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(w=>{if(S1(l,w==null),w==null){var E;$s.delete(o),(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,null)}else{if($s.set(o,w),!l.current){var A=window.ResizeObserver||Px;l.current=new A(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),v=y.createElement(A1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[fr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},T1)):(Xl(p),h(!1)),()=>Xl(p)),[f,h]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Br?"inherit":void 0},contentEditable:!1,ref:m}};v=y.createElement(y.Fragment,null,i(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},O1=y.memo(j1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&fe.equals(t.leaf,e.leaf)&&t.leaf[fr]===e.leaf[fr]),P1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Xf({},t),n)},M1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=xn(),l=y.useRef(null),u=fe.decorations(s,t),d=ee.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(O1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var v=y.useCallback(f=>{var b=vi.get(o);f?(b==null||b.set(d,f),Sn.set(s,f),Hr.set(f,s)):(b==null||b.delete(d),Sn.delete(s),l.current&&Hr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},h)},eh=y.memo(M1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&k1(t.decorations,e.decorations));function 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 Vs(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){Ot(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}var N1=e=>{var{decorations:t,element:n,renderElement:r=w=>y.createElement(I1,Vs({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=xn(),l=z1(),u=o.isInline(n),d=ee.findKey(o,n),h=y.useCallback(w=>{var E=vi.get(o);w?(E==null||E.set(d,w),Sn.set(n,w),Hr.set(w,n)):(E==null||E.delete(d),Sn.delete(n))},[o,d,n]),p=nh({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var v=oe.string(n),f=vf(v);f==="rtl"&&(m.dir=f)}if(x.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[g]]=oe.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(eh,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:g})),No.set(g,0),Ro.set(g,n)}return r({attributes:m,children:p,element:n})},R1=y.memo(N1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&_1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Z.equals(e.selection,t.selection))),I1=e=>{var{attributes:t,children:n,element:r}=e,a=xn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Vs(Vs({},t),{},{style:{position:"relative"}}),n)},th=y.createContext(()=>[]),$1=()=>y.useContext(th),L1=y.createContext(!1),nh=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=$1(),l=xn(),u=ee.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),v=n.children[p],f=ee.findKey(l,v),b=x.range(l,m),g=s&&Z.intersection(b,s),w=o([v,m]);for(var E of t){var A=Z.intersection(E,b);A&&w.push(A)}de.isElement(v)?d.push(y.createElement(L1.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement(R1,{decorations:w,element:v,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:g}))):d.push(y.createElement(eh,{decorations:w,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:v})),No.set(v,p),Ro.set(v,n)}return d},rh=y.createContext(!1),z1=()=>y.useContext(rh),ah=y.createContext(null),zn=()=>{var e=y.useContext(ah);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function q1(){var e=xn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var U1=3,W1={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},V1={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"},H1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=W1[e],n=V1[e],r=H1[e],a=t&&Vi(t),i=n&&Vi(n),s=r&&Vi(r);return o=>!!(a&&a(o)||Vl&&i&&i(o)||!Vl&&s&&s(o))},Ze={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},K1=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Lo(e,l,s));n.push(...o)}};function i(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:a,restoreDOM:i,clear:r}},Z1={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class ih extends y.Component{constructor(){super(...arguments),Ot(this,"context",null),Ot(this,"manager",null),Ot(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,Z1)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=K1(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Ot(ih,"contextType",Mo);var Y1=mt?ih:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},G1=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Q1=["text"];function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tc(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J1=e=>y.createElement(y.Fragment,null,nh(e)),X1=e=>{var t=y.useCallback(T=>y.createElement(eD,qt({},T)),[]),{autoFocus:n,decorate:r=tD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=nD,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,v=dr(e,G1),f=zn(),[b,g]=y.useState(!1),w=y.useRef(null),E=y.useRef([]),[A,D]=y.useState(),{onUserInput:k,receivedUserInput:j}=q1(),[,L]=y.useReducer(T=>T+1,0);Vf.set(f,L),Ls.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var q=y.useRef(),I=y.useMemo(()=>Ob(()=>{var T=q.current;if((mt||!ee.isComposing(f))&&(!M.isUpdatingSelection||T!=null&&T.isFlushing())&&!M.isDraggingInternally){var $=ee.findDocumentOrShadowRoot(f),{activeElement:S}=$,z=ee.toDOMNode(f,f),Y=$.getSelection();if(S===z?(M.latestElement=S,gn.set(f,!0)):gn.delete(f),!Y)return J.deselect(f);var{anchorNode:G,focusNode:re}=Y,le=ee.hasEditableTarget(f,G)||ee.isTargetInsideNonReadonlyVoid(f,G),Q=ee.hasEditableTarget(f,re)||ee.isTargetInsideNonReadonlyVoid(f,re);if(le&&Q){var me=ee.toSlateRange(f,Y,{exactMatch:!1,suppressThrow:!0});me&&(!ee.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?J.select(f,me):T==null||T.handleUserSelect(me))}s&&(!le||!Q)&&J.deselect(f)}},100),[f,s,M]),B=y.useMemo(()=>Fb(I,0),[I]);q.current=D1({node:w,onDOMSelectionChange:I,scheduleOnDOMSelectionChange:B}),Kr(()=>{var T,$,S;w.current&&(S=$o(w.current))?(Wf.set(f,S),ja.set(f,w.current),Sn.set(f,w.current),Hr.set(w.current,f)):Sn.delete(f);var{selection:z}=f,Y=ee.findDocumentOrShadowRoot(f),G=Y.getSelection();if(!(!G||!ee.isFocused(f)||(T=q.current)!==null&&T!==void 0&&T.hasPendingAction())){var re=pe=>{var ke=G.type!=="None";if(!(!z&&!ke)){var je=G.focusNode,Te;if(Xn&&G.rangeCount>1){var Ke=G.getRangeAt(0),Ne=G.getRangeAt(G.rangeCount-1);Ke.startContainer===je?Te=Ne.endContainer:Te=Ke.startContainer}else Te=G.anchorNode;var $e=ja.get(f),Qe=!1;if($e.contains(Te)&&$e.contains(je)&&(Qe=!0),ke&&Qe&&z&&!pe){var Ae=ee.toSlateRange(f,G,{exactMatch:!0,suppressThrow:!0});if(Ae&&Z.equals(Ae,z)){var qe;if(!M.hasMarkPlaceholder||(qe=Te)!==null&&qe!==void 0&&(qe=qe.parentElement)!==null&&qe!==void 0&&qe.hasAttribute("data-slate-mark-placeholder"))return}}if(z&&!ee.hasRange(f,z)){f.selection=ee.toSlateRange(f,G,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var be=z&&ee.toDOMRange(f,z);return be?(ee.isComposing(f)&&!mt?G.collapseToEnd():Z.isBackward(z)?G.setBaseAndExtent(be.endContainer,be.endOffset,be.startContainer,be.startOffset):G.setBaseAndExtent(be.startContainer,be.startOffset,be.endContainer,be.endOffset),d(f,be)):G.removeAllRanges(),be}};G.rangeCount<=1&&re();var le=(($=q.current)===null||$===void 0?void 0:$.isFlushing())==="action";if(!mt||!le){setTimeout(()=>{M.isUpdatingSelection=!1});return}var Q=null,me=requestAnimationFrame(()=>{if(le){var pe=ke=>{try{var je=ee.toDOMNode(f,f);je.focus(),re(ke)}catch{}};pe(),Q=setTimeout(()=>{pe(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(me),Q&&clearTimeout(Q)}}});var F=y.useCallback(T=>{if(k(),!s&&ee.hasEditableTarget(f,T.target)&&!rD(T,a)){var $;if(q.current)return q.current.handleDOMBeforeInput(T);B.flush(),I.flush();var{selection:S}=f,{inputType:z}=T,Y=T.dataTransfer||T.data||void 0,G=z==="insertCompositionText"||z==="deleteCompositionText";if(G&&ee.isComposing(f))return;var re=!1;if(z==="insertText"&&S&&Z.isCollapsed(S)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&S.anchor.offset!==0){var le,Q;re=!0,f.marks&&(re=!1);var{anchor:me}=S,[pe,ke]=ee.toDOMPoint(f,me),je=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Te=ee.getWindow(f);if(re&&je&&ee.hasDOMNode(f,je)){var Ke,Ne=Te==null?void 0:Te.document.createTreeWalker(je,NodeFilter.SHOW_TEXT).lastChild();Ne===pe&&((Ke=Ne.textContent)===null||Ke===void 0?void 0:Ke.length)===ke&&(re=!1)}if(re&&pe.parentElement&&(Te==null||(Q=Te.getComputedStyle(pe.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var $e=x.above(f,{at:me.path,match:ne=>de.isElement(ne)&&x.isBlock(f,ne)});$e&&oe.string($e[0]).includes(" ")&&(re=!1)}}if(!z.startsWith("delete")||z.startsWith("deleteBy")){var[Qe]=T.getTargetRanges();if(Qe){var Ae=ee.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!S||!Z.equals(S,Ae)){re=!1;var qe=!G&&f.selection&&x.rangeRef(f,f.selection);J.select(f,Ae),qe&&Pr.set(f,qe)}}}if(G)return;if(re||T.preventDefault(),S&&Z.isExpanded(S)&&z.startsWith("delete")){var be=z.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:be});return}switch(z){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{z==="insertFromComposition"&&ee.isComposing(f)&&(g(!1),Fn.set(f,!1)),(Y==null?void 0:Y.constructor.name)==="DataTransfer"?ee.insertData(f,Y):typeof Y=="string"&&(re?E.current.push(()=>x.insertText(f,Y)):x.insertText(f,Y));break}}var V=($=Pr.get(f))===null||$===void 0?void 0:$.unref();Pr.delete(f),V&&(!f.selection||!Z.equals(f.selection,V))&&J.select(f,V)}},[f,I,k,a,s,B]),P=y.useCallback(T=>{T==null?(I.cancel(),B.cancel(),ja.delete(f),Sn.delete(f),w.current&&cn&&w.current.removeEventListener("beforeinput",F)):cn&&T.addEventListener("beforeinput",F),w.current=T},[I,B,f,F]);Kr(()=>{var T=ee.getWindow(f);return T.document.addEventListener("selectionchange",B),()=>{T.document.removeEventListener("selectionchange",B)}},[B]);var O=r([f,[]]),U=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!b,W=y.useCallback(T=>{if(T&&U){var $;D(($=T.getBoundingClientRect())===null||$===void 0?void 0:$.height)}else D(void 0)},[U]);if(U){var ie=x.start(f,[]);O.push({[fr]:!0,placeholder:i,onPlaceholderResize:W,anchor:ie,focus:ie})}var{marks:te}=f;if(M.hasMarkPlaceholder=!1,f.selection&&Z.isCollapsed(f.selection)&&te){var{anchor:C}=f.selection,X=oe.leaf(f,C.path),ue=dr(X,Q1);if(!fe.equals(X,te,{loose:!0})){M.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(ue).map(T=>[T,null]));O.push(qt(qt(qt({[Hf]:!0},_),te),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:$}=T,S=oe.leaf(f,$.path);if(te&&!fe.equals(S,te,{loose:!0})){Rt.set(f,te);return}}Rt.delete(f)})}),y.createElement(rh.Provider,{value:s},y.createElement(th.Provider,{value:r},y.createElement(Y1,{node:w,receivedUserInput:j},y.createElement(p,qt(qt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:cn||!Sa?v.spellCheck:!1,autoCorrect:cn||!Sa?v.autoCorrect:"false",autoCapitalize:cn||!Sa?v.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:P,style:qt(qt({},m?{}:qt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},A?{minHeight:A}:{})),h),onBeforeInput:y.useCallback(T=>{if(!cn&&!s&&!ft(T,v.onBeforeInput)&&ee.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!ee.isComposing(f))){var $=T.data;x.insertText(f,$)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(T=>{if(!ft(T,v.onInput)){if(q.current){q.current.handleInput();return}for(var $ of E.current)$();E.current=[]}},[v.onInput]),onBlur:y.useCallback(T=>{if(!(s||M.isUpdatingSelection||!ee.hasSelectableTarget(f,T.target)||ft(T,v.onBlur))){var $=ee.findDocumentOrShadowRoot(f);if(M.latestElement!==$.activeElement){var{relatedTarget:S}=T,z=ee.toDOMNode(f,f);if(S!==z&&!(jt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&vn(S)&&ee.hasDOMNode(f,S)){var Y=ee.toSlateNode(f,S);if(de.isElement(Y)&&!f.isVoid(Y))return}if(Br){var G=$.getSelection();G==null||G.removeAllRanges()}gn.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,v.onBlur]),onClick:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!ft(T,v.onClick)&&vn(T.target)){var $=ee.toSlateNode(f,T.target),S=ee.findPath(f,$);if(!x.hasPath(f,S)||oe.get(f,S)!==$)return;if(T.detail===U1&&S.length>=1){var z=S;if(!(de.isElement($)&&x.isBlock(f,$))){var Y,G=x.above(f,{match:je=>de.isElement(je)&&x.isBlock(f,je),at:S});z=(Y=G==null?void 0:G[1])!==null&&Y!==void 0?Y:S.slice(0,1)}var re=x.range(f,z);J.select(f,re);return}if(s)return;var le=x.start(f,S),Q=x.end(f,S),me=x.void(f,{at:le}),pe=x.void(f,{at:Q});if(me&&pe&&R.equals(me[1],pe[1])){var ke=x.range(f,le);J.select(f,ke)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var $;if(ee.isComposing(f)&&Promise.resolve().then(()=>{g(!1),Fn.set(f,!1)}),($=q.current)===null||$===void 0||$.handleCompositionEnd(T),ft(T,v.onCompositionEnd)||mt)return;if(!Br&&!Hx&&!qx&&!Zx&&!Kx&&T.data){var S=Rt.get(f);Rt.delete(f),S!==void 0&&(tn.set(f,f.marks),f.marks=S),x.insertText(f,T.data);var z=tn.get(f);tn.delete(f),z!==void 0&&(f.marks=z)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!ft(T,v.onCompositionUpdate)&&(ee.isComposing(f)||(g(!0),Fn.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(T=>{if(ee.hasSelectableTarget(f,T.target)){var $;if(($=q.current)===null||$===void 0||$.handleCompositionStart(T),ft(T,v.onCompositionStart)||mt)return;g(!0);var{selection:S}=f;if(S&&Z.isExpanded(S)){x.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(T=>{ee.hasSelectableTarget(f,T.target)&&!ft(T,v.onCopy)&&!nc(T)&&(T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(T=>{if(!s&&ee.hasSelectableTarget(f,T.target)&&!ft(T,v.onCut)&&!nc(T)){T.preventDefault(),ee.setFragmentData(f,T.clipboardData,"cut");var{selection:$}=f;if($)if(Z.isExpanded($))x.deleteFragment(f);else{var S=oe.parent(f,$.anchor.path);x.isVoid(f,S)&&J.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(T=>{if(ee.hasTarget(f,T.target)&&!ft(T,v.onDragOver)){var $=ee.toSlateNode(f,T.target);de.isElement($)&&x.isVoid(f,$)&&T.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!ft(T,v.onDragStart)){var $=ee.toSlateNode(f,T.target),S=ee.findPath(f,$),z=de.isElement($)&&x.isVoid(f,$)||x.void(f,{at:S,voids:!0});if(z){var Y=x.range(f,S);J.select(f,Y)}M.isDraggingInternally=!0,ee.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,v.onDragStart,M]),onDrop:y.useCallback(T=>{if(!s&&ee.hasTarget(f,T.target)&&!ft(T,v.onDrop)){T.preventDefault();var $=f.selection,S=ee.findEventRange(f,T),z=T.dataTransfer;J.select(f,S),M.isDraggingInternally&&$&&!Z.equals($,S)&&!x.void(f,{at:S,voids:!0})&&J.delete(f,{at:$}),ee.insertData(f,z),ee.isFocused(f)||ee.focus(f)}M.isDraggingInternally=!1},[s,f,v.onDrop,M]),onDragEnd:y.useCallback(T=>{!s&&M.isDraggingInternally&&v.onDragEnd&&ee.hasTarget(f,T.target)&&v.onDragEnd(T),M.isDraggingInternally=!1},[s,M,v,f]),onFocus:y.useCallback(T=>{if(!s&&!M.isUpdatingSelection&&ee.hasEditableTarget(f,T.target)&&!ft(T,v.onFocus)){var $=ee.toDOMNode(f,f),S=ee.findDocumentOrShadowRoot(f);if(M.latestElement=S.activeElement,Xn&&T.target!==$){$.focus();return}gn.set(f,!0)}},[s,M,f,v.onFocus]),onKeyDown:y.useCallback(T=>{if(!s&&ee.hasEditableTarget(f,T.target)){var $;($=q.current)===null||$===void 0||$.handleKeyDown(T);var{nativeEvent:S}=T;if(ee.isComposing(f)&&S.isComposing===!1&&(Fn.set(f,!1),g(!1)),ft(T,v.onKeyDown)||ee.isComposing(f))return;var{selection:z}=f,Y=f.children[z!==null?z.focus.path[0]:0],G=vf(oe.string(Y))==="rtl";if(Ze.isRedo(S)){T.preventDefault();var re=f;typeof re.redo=="function"&&re.redo();return}if(Ze.isUndo(S)){T.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ze.isMoveLineBackward(S)){T.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ze.isMoveLineForward(S)){T.preventDefault(),J.move(f,{unit:"line"});return}if(Ze.isExtendLineBackward(S)){T.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ze.isExtendLineForward(S)){T.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ze.isMoveBackward(S)){T.preventDefault(),z&&Z.isCollapsed(z)?J.move(f,{reverse:!G}):J.collapse(f,{edge:G?"end":"start"});return}if(Ze.isMoveForward(S)){T.preventDefault(),z&&Z.isCollapsed(z)?J.move(f,{reverse:G}):J.collapse(f,{edge:G?"start":"end"});return}if(Ze.isMoveWordBackward(S)){T.preventDefault(),z&&Z.isExpanded(z)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!G});return}if(Ze.isMoveWordForward(S)){T.preventDefault(),z&&Z.isExpanded(z)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:G});return}if(cn){if((Uf||Br)&&z&&(Ze.isDeleteBackward(S)||Ze.isDeleteForward(S))&&Z.isCollapsed(z)){var Q=oe.parent(f,z.anchor.path);if(de.isElement(Q)&&x.isVoid(f,Q)&&(x.isInline(f,Q)||x.isBlock(f,Q))){T.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ze.isBold(S)||Ze.isItalic(S)||Ze.isTransposeCharacter(S)){T.preventDefault();return}if(Ze.isSoftBreak(S)){T.preventDefault(),x.insertSoftBreak(f);return}if(Ze.isSplitBlock(S)){T.preventDefault(),x.insertBreak(f);return}if(Ze.isDeleteBackward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ze.isDeleteForward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ze.isDeleteLineBackward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ze.isDeleteLineForward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ze.isDeleteWordBackward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ze.isDeleteWordForward(S)){T.preventDefault(),z&&Z.isExpanded(z)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(T=>{!s&&ee.hasEditableTarget(f,T.target)&&!ft(T,v.onPaste)&&(!cn||Qx(T.nativeEvent)||Br)&&(T.preventDefault(),ee.insertData(f,T.clipboardData))},[s,f,v.onPaste])}),y.createElement(J1,{decorations:O,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},eD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",qt({},t),n,mt&&y.createElement("br",null))},tD=()=>[],nD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Z.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Nb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ft=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},nc=e=>vn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),rD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},aD=y.createContext(!1),iD=y.createContext({});function sD(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var oD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],uD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=dr(e,oD),[l,u]=y.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(rt.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(rt.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=sD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(g=>({v:g.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(zs.set(t,p),()=>{zs.set(t,()=>{})}),[t,p]);var[m,v]=y.useState(ee.isFocused(t));return y.useEffect(()=>{v(ee.isFocused(t))},[t]),Kr(()=>{var f=()=>v(ee.isFocused(t));return qf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(iD.Provider,{value:d},y.createElement(ah.Provider,{value:l},y.createElement(Mo.Provider,{value:l.editor},y.createElement(aD.Provider,{value:m},n))))},rc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},ac=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return rc(r,a)&&rc(a,r)},lD=(e,t)=>{var n=x.range(e,Z.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(ac(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)ac(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function ic(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 sc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ic(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ic(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cD=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 vi.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=Io.get(r))===null||h===void 0||h(),!Rt.get(r)&&(p=yt.get(r))!==null&&p!==void 0&&p.length&&Rt.set(r,null),tn.delete(r),o(u,d)},r.removeMark=u=>{var d;!Rt.get(r)&&(d=yt.get(r))!==null&&d!==void 0&&d.length&&Rt.set(r,null),tn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Z.isCollapsed(r.selection)){var d=x.above(r,{match:v=>de.isElement(v)&&x.isBlock(r,v),at:r.selection});if(d){var[,h]=d,p=x.range(r,h,r.selection.anchor),m=lD(r,p);Z.isCollapsed(m)||J.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=yt.get(r);if(p!=null&&p.length){var m=p.map(P=>c1(P,u)).filter(Boolean);yt.set(r,m)}var v=hn.get(r);v&&hn.set(r,Kl(r,v,u));var f=fn.get(r);if(f!=null&&f.at){var b=_e.isPoint(f==null?void 0:f.at)?Ws(r,f.at,u):Kl(r,f.at,u);fn.set(r,b?sc(sc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Kn(r,u.path));break}case"set_selection":{var g;(g=Pr.get(r))===null||g===void 0||g.unref(),Pr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Kn(r,R.parent(u.path)));break}case"merge_node":{var w=R.previous(u.path);d.push(...Kn(r,w));break}case"move_node":{var E=R.common(R.parent(u.path),R.parent(u.newPath));d.push(...Kn(r,E));var A;R.isBefore(u.path,u.newPath)?(d.push(...Kn(r,R.parent(u.path))),A=u.newPath):(d.push(...Kn(r,R.parent(u.newPath))),A=u.path);var D=oe.get(t,R.parent(A)),k=ee.findKey(r,D),j=x.pathRef(r,R.parent(A));h.push([j,k]);break}}a(u);for(var[L,M]of d){var[q]=x.node(r,L);Ja.set(q,M)}for(var[I,B]of h)if(I.current){var[F]=x.node(r,I.current);Ja.set(F,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=Z.edges(d),m=x.void(r,{at:h.path}),v=x.void(r,{at:p.path});if(!(Z.isCollapsed(d)&&!m)){var f=ee.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(q=>{q.textContent&&q.textContent.trim()!==""&&(g=q)}),v){var[w]=v,E=f.cloneRange(),A=ee.toDOMNode(r,w);E.setEndAfter(A),b=E.cloneContents()}if(m&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(q=>{var I=q.getAttribute("data-slate-zero-width")==="n";q.textContent=I?`
81
- `:""}),Kf(g)){var D=g.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(g),b.appendChild(D),g=D}var k=r.getFragment(),j=JSON.stringify(k),L=window.btoa(encodeURIComponent(j));g.setAttribute("data-slate-fragment",L),u.setData("application/".concat(n),L);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",Yf(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||n1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&J.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=qf<18?Hc.unstable_batchedUpdates:h=>h();d(()=>{var h=zs.get(r);h&&h(u),i(u)})},r},Kn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const Hs="MENTION: ",sh={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},oc={"mention-popover":35,default:-52},Ki=16,oh=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(un),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,v;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=E=>{if(!x.hasPath(e,E.path))return!1;const A=oe.get(e,E.path);return x.isEditor(A)||de.isElement(A)?E.offset<=A.children.length:fe.isText(A)?E.offset<=A.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||sh).getBoundingClientRect();const w=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/Ki}rem`),d=(w==null?void 0:w.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const h=oc[t]||oc.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Ki}rem`,l.style.left=`${d/Ki}rem`},o),r},dD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===H.link});if(a){const i=a[0],s=io(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 ht=(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.h3="heading_three",e))(ht||{});const er={[H.paragraph]:H.paragraph,[H.blockquote]:H.blockquote,[H.codeblock]:H.codeblock,[H.link]:H.link,[H.ul]:H.ul,[H.ol]:H.ol,[H.li]:H.li,[H.mention]:H.mention,[H.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Vt.emphasis]:H.italic,[Vt.strong]:H.bold,[Vt.delete]:H.strikethrough,[Vt.code]:H.code,[H.hr]:H.hr,[H.image]:H.image,[H.h3]:H.h3};function uc(e){if(e)throw e}var Oa=Object.prototype.hasOwnProperty,uh=Object.prototype.toString,lc=Object.defineProperty,cc=Object.getOwnPropertyDescriptor,dc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):uh.call(t)==="[object Array]"},fc=function(t){if(!t||uh.call(t)!=="[object Object]")return!1;var n=Oa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Oa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Oa.call(t,a)},hc=function(t,n){lc&&n.name==="__proto__"?lc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},mc=function(t,n){if(n==="__proto__")if(Oa.call(t,n)){if(cc)return cc(t,n).value}else return;return t[n]},fD=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=mc(o,n),a=mc(t,n),o!==a&&(d&&a&&(fc(a)||(i=dc(a)))?(i?(i=!1,s=r&&dc(r)?r:[]):s=r&&fc(r)?r:{},hc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&hc(o,{name:n,newValue:a}));return o};const Zi=Rn(fD);function Ks(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 hD(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?mD(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function mD(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Mr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pc(e.position):"start"in e||"end"in e?pc(e):"line"in e||"column"in e?Zs(e):""}function Zs(e){return gc(e&&e.line)+":"+gc(e&&e.column)}function pc(e){return Zs(e&&e.start)+"-"+Zs(e&&e.end)}function gc(e){return e&&typeof e=="number"?e:1}class Ct extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Mr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Ut={basename:pD,dirname:gD,extname:vD,join:bD,sep:"/"};function pD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Jr(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 gD(e){if(Jr(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 vD(e){Jr(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 bD(...e){let t=-1,n;for(;++t<e.length;)Jr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yD(n)}function yD(e){Jr(e);const t=e.codePointAt(0)===47;let n=xD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xD(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 Jr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const DD={cwd:CD};function CD(){return"/"}function Ys(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wD(e){if(typeof e=="string")e=new URL(e);else if(!Ys(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 ED(e)}function ED(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Yi=["history","path","basename","stem","extname","dirname"];class _D{constructor(t){let n;t?Ys(t)?n={path:t}:typeof t=="string"||kD(t)?n={value:t}:n=t:n={},this.cwd=DD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yi.length;){const i=Yi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Yi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ut.basename(this.path):void 0}set basename(t){Qi(t,"basename"),Gi(t,"basename"),this.path=Ut.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ut.dirname(this.path):void 0}set dirname(t){vc(this.basename,"dirname"),this.path=Ut.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ut.extname(this.path):void 0}set extname(t){if(Gi(t,"extname"),vc(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=Ut.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ys(t)&&(t=wD(t)),Qi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ut.basename(this.path,this.extname):void 0}set stem(t){Qi(t,"stem"),Gi(t,"stem"),this.path=Ut.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Ct(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gi(e,t){if(e&&e.includes(Ut.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ut.sep+"`")}function Qi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function vc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const FD=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},AD={}.hasOwnProperty;class zo extends FD{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=hD()}copy(){const t=new zo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Zi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(es("data",this.frozen),this.namespace[t]=n,this):AD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(es("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=ba(t),r=this.parser||this.Parser;return Ji("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ji("process",this.parser||this.Parser),Xi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ba(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,v=r.stringify(m,p);SD(v)?p.value=v:p.result=v,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ji("processSync",this.parser||this.Parser),Xi("processSync",this.compiler||this.Compiler),this.process(t,a),yc("processSync","process",n),r;function a(i,s){n=!0,uc(i),r=s}}run(t,n,r){bc(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=ba(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),yc("runSync","run",r),a;function i(s,o){uc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ba(n),a=this.compiler||this.Compiler;return Xi("stringify",a),bc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(es("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Zi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...v]=d;const f=r[p][1];Ks(f)&&Ks(m)&&(m=Zi(!0,f,m)),r[p]=[u,m,...v]}}}}const BD=new zo().freeze();function Ji(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function es(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 bc(e){if(!Ks(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function yc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ba(e){return TD(e)?e:new _D(e)}function TD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function SD(e){return typeof e=="string"||jD(e)}function jD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OD={};function PD(e,t){const n=t||OD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lh(e,r,a)}function lh(e,t,n){if(MD(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 xc(e.children,t,n)}return Array.isArray(e)?xc(e,t,n):""}function xc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=lh(e[a],t,n);return r.join("")}function MD(e){return!!(e&&typeof e=="object")}const Dc=document.createElement("i");function qo(e){const t="&"+e+";";Dc.innerHTML=t;const n=Dc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function an(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 St(e,t){return e.length>0?(an(e,e.length,0,t),e):t}const Cc={}.hasOwnProperty;function ND(e){const t={};let n=-1;for(;++n<e.length;)RD(t,e[n]);return t}function RD(e,t){let n;for(n in t){const a=(Cc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Cc.call(a,s)||(a[s]=[]);const o=i[s];ID(a[s],Array.isArray(o)?o:o?[o]:[])}}}function ID(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);an(e,0,0,r)}function ch(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 ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wt=Dn(/[A-Za-z]/),It=Dn(/[\dA-Za-z]/),$D=Dn(/[#-'*+\--9=?A-Z^-~]/);function Gs(e){return e!==null&&(e<32||e===127)}const Qs=Dn(/\d/),LD=Dn(/[\dA-Fa-f]/),zD=Dn(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const qD=Dn(/\p{P}|\p{S}/u),UD=Dn(/\s/);function Dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ue(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Me(l)?(e.enter(n),o(l)):t(l)}function o(l){return Me(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const WD={tokenize:VD};function VD(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"),Ue(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const HD={tokenize:KD},wc={tokenize:ZD};function KD(e){const t=this,n=[];let r=0,a,i,s;return o;function o(E){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const A=t.events.length;let D=A,k;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){k=t.events[D][1].end;break}g(r);let j=A;for(;j<t.events.length;)t.events[j][1].end=Object.assign({},k),j++;return an(t.events,D+1,0,t.events.slice(A)),t.events.length=j,u(E)}return o(E)}function u(E){if(r===n.length){if(!a)return p(E);if(a.currentConstruct&&a.currentConstruct.concrete)return v(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(wc,d,h)(E)}function d(E){return a&&w(),g(r),p(E)}function h(E){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(E)}function p(E){return t.containerState={},e.attempt(wc,m,v)(E)}function m(E){return r++,n.push([t.currentConstruct,t.containerState]),p(E)}function v(E){if(E===null){a&&w(),g(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(E)}function f(E){if(E===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(E);return}return ye(E)?(e.consume(E),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(E),f)}function b(E,A){const D=t.sliceStream(E);if(A&&D.push(null),E.previous=i,i&&(i.next=E),i=E,a.defineSkip(E.start),a.write(D),t.parser.lazy[E.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const j=t.events.length;let L=j,M,q;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(M){q=t.events[L][1].end;break}M=!0}for(g(r),k=j;k<t.events.length;)t.events[k][1].end=Object.assign({},q),k++;an(t.events,L+1,0,t.events.slice(j)),t.events.length=k}}function g(E){let A=n.length;for(;A-- >E;){const D=n[A];t.containerState=D[1],D[0].exit.call(t,e)}n.length=E}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function ZD(e,t,n){return Ue(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ec(e){if(e===null||Dt(e)||UD(e))return 1;if(qD(e))return 2}function Uo(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 Js={name:"attention",tokenize:GD,resolveAll:YD};function YD(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);_c(h,-l),_c(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=St(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=St(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=St(u,Uo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=St(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=St(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,an(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function GD(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ec(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Ec(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function _c(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const QD={name:"autolink",tokenize:JD};function JD(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Wt(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||It(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||It(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Gs(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):$D(m)?(e.consume(m),u):n(m)}function d(m){return It(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||It(m))&&r++<63){const v=m===45?p:h;return e.consume(m),v}return n(m)}}const bi={tokenize:XD,partial:!0};function XD(e,t,n){return r;function r(i){return Me(i)?Ue(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const dh={name:"blockQuote",tokenize:eC,continuation:{tokenize:tC},exit:nC};function eC(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 Me(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function tC(e,t,n){const r=this;return a;function a(s){return Me(s)?Ue(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(dh,t,n)(s)}}function nC(e){e.exit("blockQuote")}const fh={name:"characterEscape",tokenize:rC};function rC(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 zD(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const hh={name:"characterReference",tokenize:aC};function aC(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=It,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=LD,d):(e.enter("characterReferenceValue"),i=7,s=Qs,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===It&&!qo(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const kc={tokenize:sC,partial:!0},Fc={name:"codeFenced",tokenize:iC,concrete:!0};function iC(e,t,n){const r=this,a={tokenize:D,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===o?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Me(k)?Ue(e,h,"whitespace")(k):h(k))}function h(k){return k===null||ye(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(kc,f,A)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||ye(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):Me(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ue(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),p)}function m(k){return k===null||ye(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===null||ye(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===o?n(k):(e.consume(k),v)}function f(k){return e.attempt(a,A,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),g}function g(k){return i>0&&Me(k)?Ue(e,w,"linePrefix",i+1)(k):w(k)}function w(k){return k===null||ye(k)?e.check(kc,f,A)(k):(e.enter("codeFlowValue"),E(k))}function E(k){return k===null||ye(k)?(e.exit("codeFlowValue"),w(k)):(e.consume(k),E)}function A(k){return e.exit("codeFenced"),t(k)}function D(k,j,L){let M=0;return q;function q(O){return k.enter("lineEnding"),k.consume(O),k.exit("lineEnding"),I}function I(O){return k.enter("codeFencedFence"),Me(O)?Ue(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):B(O)}function B(O){return O===o?(k.enter("codeFencedFenceSequence"),F(O)):L(O)}function F(O){return O===o?(M++,k.consume(O),F):M>=s?(k.exit("codeFencedFenceSequence"),Me(O)?Ue(k,P,"whitespace")(O):P(O)):L(O)}function P(O){return O===null||ye(O)?(k.exit("codeFencedFence"),j(O)):L(O)}}}function sC(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 ts={name:"codeIndented",tokenize:uC},oC={tokenize:lC,partial:!0};function uC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ue(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(oC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function lC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ue(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const cC={name:"codeText",tokenize:hC,resolve:dC,previous:fC};function dC(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 fC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hC(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ye(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class mC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&kr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),kr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),kr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);kr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);kr(this.left,n.reverse())}}}function kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mh(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new mC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,pC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return an(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function pC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,v=0,f=0;const b=[f];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const g=o.slice(b[p],b[p+1]),w=i.pop();l.push([w,w+g.length-1]),e.splice(w,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[v+l[p][0]]=v+l[p][1],v+=l[p][1]-l[p][0]-1;return u}const gC={tokenize:yC,resolve:bC},vC={tokenize:xC,partial:!0};function bC(e){return mh(e),e}function yC(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(vC,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 xC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ue(e,i,"linePrefix")}function i(s){if(s===null||ye(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function ph(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(g){return g===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||Gs(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||ye(g)?n(g):(e.consume(g),g===92?v:m)}function v(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function f(g){return!d&&(g===null||g===41||Dt(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||Gs(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function gh(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||ye(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Me(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function vh(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ue(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||ye(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Nr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Me(a)?Ue(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const DC={name:"definition",tokenize:wC},CC={tokenize:EC,partial:!0};function wC(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return gh.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return Dt(m)?Nr(e,u)(m):u(m)}function u(m){return ph(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(CC,h,h)(m)}function h(m){return Me(m)?Ue(e,p,"whitespace")(m):p(m)}function p(m){return m===null||ye(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function EC(e,t,n){return r;function r(o){return Dt(o)?Nr(e,a)(o):n(o)}function a(o){return vh(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Me(o)?Ue(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const _C={name:"hardBreakEscape",tokenize:kC};function kC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const FC={name:"headingAtx",tokenize:BC,resolve:AC};function AC(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"},an(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function BC(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ye(d)?(e.exit("atxHeading"),t(d)):Me(d)?Ue(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const TC=["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"],Ac=["pre","script","style","textarea"],SC={name:"htmlFlow",tokenize:MC,resolveTo:PC,concrete:!0},jC={tokenize:RC,partial:!0},OC={tokenize:NC,partial:!0};function PC(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 MC(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:C):Wt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,m):_===91?(e.consume(_),a=5,o=0,v):Wt(_)?(e.consume(_),a=4,r.interrupt?t:C):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:C):n(_)}function v(_){const T="CDATA[";return _===T.charCodeAt(o++)?(e.consume(_),o===T.length?r.interrupt?t:B:v):n(_)}function f(_){return Wt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||Dt(_)){const T=_===47,$=s.toLowerCase();return!T&&!i&&Ac.includes($)?(a=1,r.interrupt?t(_):B(_)):TC.includes(s.toLowerCase())?(a=6,T?(e.consume(_),g):r.interrupt?t(_):B(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?w(_):E(_))}return _===45||It(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:B):n(_)}function w(_){return Me(_)?(e.consume(_),w):q(_)}function E(_){return _===47?(e.consume(_),q):_===58||_===95||Wt(_)?(e.consume(_),A):Me(_)?(e.consume(_),E):q(_)}function A(_){return _===45||_===46||_===58||_===95||It(_)?(e.consume(_),A):D(_)}function D(_){return _===61?(e.consume(_),k):Me(_)?(e.consume(_),D):E(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,j):Me(_)?(e.consume(_),k):L(_)}function j(_){return _===l?(e.consume(_),l=null,M):_===null||ye(_)?n(_):(e.consume(_),j)}function L(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Dt(_)?D(_):(e.consume(_),L)}function M(_){return _===47||_===62||Me(_)?E(_):n(_)}function q(_){return _===62?(e.consume(_),I):n(_)}function I(_){return _===null||ye(_)?B(_):Me(_)?(e.consume(_),I):n(_)}function B(_){return _===45&&a===2?(e.consume(_),U):_===60&&a===1?(e.consume(_),W):_===62&&a===4?(e.consume(_),X):_===63&&a===3?(e.consume(_),C):_===93&&a===5?(e.consume(_),te):ye(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(jC,ue,F)(_)):_===null||ye(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),B)}function F(_){return e.check(OC,P,ue)(_)}function P(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),O}function O(_){return _===null||ye(_)?F(_):(e.enter("htmlFlowData"),B(_))}function U(_){return _===45?(e.consume(_),C):B(_)}function W(_){return _===47?(e.consume(_),s="",ie):B(_)}function ie(_){if(_===62){const T=s.toLowerCase();return Ac.includes(T)?(e.consume(_),X):B(_)}return Wt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):B(_)}function te(_){return _===93?(e.consume(_),C):B(_)}function C(_){return _===62?(e.consume(_),X):_===45&&a===2?(e.consume(_),C):B(_)}function X(_){return _===null||ye(_)?(e.exit("htmlFlowData"),ue(_)):(e.consume(_),X)}function ue(_){return e.exit("htmlFlow"),t(_)}}function NC(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function RC(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(bi,t,n)}}const IC={name:"htmlText",tokenize:$C};function $C(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),D):C===63?(e.consume(C),E):Wt(C)?(e.consume(C),L):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,v):Wt(C)?(e.consume(C),w):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):ye(C)?(s=h,W(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?U(C):C===45?p(C):h(C)}function v(C){const X="CDATA[";return C===X.charCodeAt(i++)?(e.consume(C),i===X.length?f:v):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):ye(C)?(s=f,W(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),g):f(C)}function g(C){return C===62?U(C):C===93?(e.consume(C),g):f(C)}function w(C){return C===null||C===62?U(C):ye(C)?(s=w,W(C)):(e.consume(C),w)}function E(C){return C===null?n(C):C===63?(e.consume(C),A):ye(C)?(s=E,W(C)):(e.consume(C),E)}function A(C){return C===62?U(C):E(C)}function D(C){return Wt(C)?(e.consume(C),k):n(C)}function k(C){return C===45||It(C)?(e.consume(C),k):j(C)}function j(C){return ye(C)?(s=j,W(C)):Me(C)?(e.consume(C),j):U(C)}function L(C){return C===45||It(C)?(e.consume(C),L):C===47||C===62||Dt(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),U):C===58||C===95||Wt(C)?(e.consume(C),q):ye(C)?(s=M,W(C)):Me(C)?(e.consume(C),M):U(C)}function q(C){return C===45||C===46||C===58||C===95||It(C)?(e.consume(C),q):I(C)}function I(C){return C===61?(e.consume(C),B):ye(C)?(s=I,W(C)):Me(C)?(e.consume(C),I):M(C)}function B(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,F):ye(C)?(s=B,W(C)):Me(C)?(e.consume(C),B):(e.consume(C),P)}function F(C){return C===a?(e.consume(C),a=void 0,O):C===null?n(C):ye(C)?(s=F,W(C)):(e.consume(C),F)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Dt(C)?M(C):(e.consume(C),P)}function O(C){return C===47||C===62||Dt(C)?M(C):n(C)}function U(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function W(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),ie}function ie(C){return Me(C)?Ue(e,te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):te(C)}function te(C){return e.enter("htmlTextData"),s(C)}}const Wo={name:"labelEnd",tokenize:VC,resolveTo:WC,resolveAll:UC},LC={tokenize:HC},zC={tokenize:KC},qC={tokenize:ZC};function UC(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 WC(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=St(o,e.slice(i+1,i+r+3)),o=St(o,[["enter",d,t]]),o=St(o,Uo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=St(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=St(o,e.slice(s+1)),o=St(o,[["exit",l,t]]),an(e,i,e.length,o),e}function VC(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(ar(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(LC,d,s?d:h)(p):p===91?e.attempt(zC,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(qC,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function HC(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return Dt(h)?Nr(e,i)(h):i(h)}function i(h){return h===41?d(h):ph(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Dt(h)?Nr(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?vh(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Dt(h)?Nr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function KC(e,t,n){const r=this;return a;function a(o){return gh.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function ZC(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 YC={name:"labelStartImage",tokenize:GC,resolveAll:Wo.resolveAll};function GC(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 QC={name:"labelStartLink",tokenize:JC,resolveAll:Wo.resolveAll};function JC(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 ns={name:"lineEnding",tokenize:XC};function XC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ue(e,t,"linePrefix")}}const Pa={name:"thematicBreak",tokenize:ew};function ew(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Me(u)?Ue(e,o,"whitespace")(u):o(u))}}const bt={name:"list",tokenize:rw,continuation:{tokenize:aw},exit:sw},tw={tokenize:ow,partial:!0},nw={tokenize:iw,partial:!0};function rw(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(m){const v=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Qs(m)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Pa,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Qs(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(bi,r.interrupt?n:d,e.attempt(tw,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Me(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function aw(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(bi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ue(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Me(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(nw,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ue(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function iw(e,t,n){const r=this;return Ue(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 sw(e){e.exit(this.containerState.type)}function ow(e,t,n){const r=this;return Ue(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!Me(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Bc={name:"setextUnderline",tokenize:lw,resolveTo:uw};function uw(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 lw(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Me(u)?Ue(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const cw={tokenize:dw};function dw(e){const t=this,n=e.attempt(bi,r,e.attempt(this.parser.constructs.flowInitial,a,Ue(e,e.attempt(this.parser.constructs.flow,a,e.attempt(gC,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 fw={resolveAll:yh()},hw=bh("string"),mw=bh("text");function bh(e){return{tokenize:t,resolveAll:yh(e==="text"?pw:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function yh(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 pw(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 gw(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:E,exit:A,attempt:j(D),check:j(k),interrupt:j(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:v,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(I){return s=St(s,I),b(),s[s.length-1]!==null?[]:(L(t,0),u.events=Uo(i,u.events,u),u.events)}function p(I,B){return bw(m(I),B)}function m(I){return vw(s,I)}function v(){const{line:I,column:B,offset:F,_index:P,_bufferIndex:O}=r;return{line:I,column:B,offset:F,_index:P,_bufferIndex:O}}function f(I){a[I.line]=I.column,q()}function b(){let I;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<B.length;)g(B.charCodeAt(r._bufferIndex));else g(B)}}function g(I){d=d(I)}function w(I){ye(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,q()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=I}function E(I,B){const F=B||{};return F.type=I,F.start=v(),u.events.push(["enter",F,u]),o.push(F),F}function A(I){const B=o.pop();return B.end=v(),u.events.push(["exit",B,u]),B}function D(I,B){L(I,B.from)}function k(I,B){B.restore()}function j(I,B){return F;function F(P,O,U){let W,ie,te,C;return Array.isArray(P)?ue(P):"tokenize"in P?ue([P]):X(P);function X(S){return z;function z(Y){const G=Y!==null&&S[Y],re=Y!==null&&S.null,le=[...Array.isArray(G)?G:G?[G]:[],...Array.isArray(re)?re:re?[re]:[]];return ue(le)(Y)}}function ue(S){return W=S,ie=0,S.length===0?U:_(S[ie])}function _(S){return z;function z(Y){return C=M(),te=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?$():S.tokenize.call(B?Object.assign(Object.create(u),B):u,l,T,$)(Y)}}function T(S){return I(te,C),O}function $(S){return C.restore(),++ie<W.length?_(W[ie]):U}}}function L(I,B){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&an(u.events,B,u.events.length-B,I.resolve(u.events.slice(B),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function M(){const I=v(),B=u.previous,F=u.currentConstruct,P=u.events.length,O=Array.from(o);return{restore:U,from:P};function U(){r=I,u.previous=B,u.currentConstruct=F,u.events.length=P,o=O,q()}}function q(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function vw(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 bw(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
78
+ `);ge.forEach((we,Ye)=>{we&&x.insertText(t,we),Ye!==ge.length-1&&x.insertSoftBreak(t)})},{at:j});if(I.equals(j.anchor.path,j.focus.path)){var[qe,be]=Z.edges(j),V={start:qe.offset,end:be.offset,text:Ae};if(Ae&&u&&P==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),me=V.start+V.text.search(/\S|$/);me===ae+1&&V.end===u.start+u.text.length?(V.start-=1,u=null,z()):u=!1}else P==="insertText"?u===null?u=V:u&&Z.isCollapsed(j)&&u.end+u.text.length===qe.offset?u=ba(ba({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(w){b(qe.path,V);return}}return g(()=>x.insertText(t,Ae),{at:j})}}}},D=()=>!!hn.get(t),A=()=>{var B;return!!((B=yt.get(t))!==null&&B!==void 0&&B.length)},E=()=>D()||A(),k=()=>a,S=B=>{mn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(B){var P=!F||!I.equals(F.anchor.path,B.anchor.path),j=!F||!I.equals(F.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(P&&u||j)&&(u=!1),(P||A())&&(s=setTimeout(p,m1))}},$=()=>{(D()||!A())&&p()},M=B=>{A()||(f(!0),setTimeout(f))},z=()=>{D()||(o=setTimeout(p))},R=B=>{if(!(A()||D())&&B.some(P=>zo(t,P,B))){var F;(F=Kf.get(t))===null||F===void 0||F()}};return{flush:p,scheduleFlush:z,hasPendingDiffs:A,hasPendingAction:D,hasPendingChanges:E,isFlushing:k,handleUserSelect:S,handleCompositionEnd:m,handleCompositionStart:v,handleDOMBeforeInput:C,handleKeyDown:M,handleDomMutations:R,handleInput:$}}function b1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Zr=ja?y.useLayoutEffect:y.useEffect;function y1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Zr(()=>{r.takeRecords()}),y.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var x1=["node"];function Gl(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 C1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var D1={subtree:!0,childList:!0,characterData:!0},w1=mt?e=>{var{node:t}=e,n=dr(e,x1);if(!mt)return null;var r=Cn(),a=b1(),[i]=y.useState(()=>v1(C1({editor:r},n)));return y1(t,i.handleDomMutations,D1),$o.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,E1=["anchor","focus"],_1=["anchor","focus"],k1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),eh=(e,t)=>{var n=dr(e,E1),r=dr(t,_1);return e[fr]===t[fr]&&k1(n,r)},F1=(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(!Z.equals(r,a)||!eh(r,a))return!1}return!0},A1=(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||!eh(r,a))return!1}return!0};function Ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function B1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ql(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var T1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=Cn(),s=ee.findPath(i,a),o=I.parent(s),l=!!n[Zf];return i.isVoid(r)?y.createElement(Ki,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Ki,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Ki,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
+ `?y.createElement(Jl,{isTrailing:!0,text:n.text}):y.createElement(Jl,{text:n.text})},Jl=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
80
+ `:""),[i]=y.useState(a);return Zr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(S1,{ref:r},i)},S1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ki=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",B1({},a),!mt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function Xl(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 th(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xl(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var j1=mt?300:0;function O1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function ec(e){e.current&&(clearTimeout(e.current),e.current=null)}var P1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=C=>y.createElement(N1,th({},C))}=e,o=Cn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(C=>{if(O1(l,C==null),C==null){var D;Ls.delete(o),(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,null)}else{if(Ls.set(o,C),!l.current){var A=window.ResizeObserver||Nx;l.current=new A(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,C)})}l.current.observe(C),u.current=C}},[u,t,o]),v=y.createElement(T1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[fr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},j1)):(ec(p),h(!1)),()=>ec(p)),[f,h]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Tr?"inherit":void 0},contentEditable:!1,ref:m}};v=y.createElement(y.Fragment,null,i(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},M1=y.memo(P1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[fr]===e.leaf[fr]),N1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",th({},t),n)},I1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=Cn(),l=y.useRef(null),u=he.decorations(s,t),d=ee.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(M1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var v=y.useCallback(f=>{var b=bi.get(o);f?(b==null||b.set(d,f),Sn.set(s,f),Kr.set(f,s)):(b==null||b.delete(d),Sn.delete(s),l.current&&Kr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},h)},nh=y.memo(I1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&A1(t.decorations,e.decorations));function tc(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 Hs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tc(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var R1=e=>{var{decorations:t,element:n,renderElement:r=C=>y.createElement(L1,Hs({},C)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Cn(),l=U1(),u=o.isInline(n),d=ee.findKey(o,n),h=y.useCallback(C=>{var D=bi.get(o);C?(D==null||D.set(d,C),Sn.set(n,C),Kr.set(C,n)):(D==null||D.delete(d),Sn.delete(n))},[o,d,n]),p=ah({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var v=ue.string(n),f=yf(v);f==="rtl"&&(m.dir=f)}if(x.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[g]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(nh,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:g})),Io.set(g,0),Ro.set(g,n)}return r({attributes:m,children:p,element:n})},$1=y.memo(R1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&F1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Z.equals(e.selection,t.selection))),L1=e=>{var{attributes:t,children:n,element:r}=e,a=Cn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Hs(Hs({},t),{},{style:{position:"relative"}}),n)},rh=y.createContext(()=>[]),z1=()=>y.useContext(rh),q1=y.createContext(!1),ah=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=z1(),l=Cn(),u=ee.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),v=n.children[p],f=ee.findKey(l,v),b=x.range(l,m),g=s&&Z.intersection(b,s),C=o([v,m]);for(var D of t){var A=Z.intersection(D,b);A&&C.push(A)}de.isElement(v)?d.push(y.createElement(q1.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement($1,{decorations:C,element:v,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:g}))):d.push(y.createElement(nh,{decorations:C,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:v})),Io.set(v,p),Ro.set(v,n)}return d},ih=y.createContext(!1),U1=()=>y.useContext(ih),sh=y.createContext(null),zn=()=>{var e=y.useContext(sh);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function W1(){var e=Cn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var V1=3,H1={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"},K1={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"},Z1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=H1[e],n=K1[e],r=Z1[e],a=t&&Hi(t),i=n&&Hi(n),s=r&&Hi(r);return o=>!!(a&&a(o)||Hl&&i&&i(o)||!Hl&&s&&s(o))},Ze={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},Y1=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>zo(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}},G1={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class oh extends y.Component{constructor(){super(...arguments),Ot(this,"context",null),Ot(this,"manager",null),Ot(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,G1)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Y1(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}}Ot(oh,"contextType",No);var Q1=mt?oh:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},J1=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],X1=["text"];function nc(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 Ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eC=e=>y.createElement(y.Fragment,null,ah(e)),tC=e=>{var t=y.useCallback(O=>y.createElement(nC,Ut({},O)),[]),{autoFocus:n,decorate:r=rC,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=aC,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,v=dr(e,J1),f=zn(),[b,g]=y.useState(!1),C=y.useRef(null),D=y.useRef([]),[A,E]=y.useState(),{onUserInput:k,receivedUserInput:S}=W1(),[,$]=y.useReducer(O=>O+1,0);Kf.set(f,$),zs.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{C.current&&n&&C.current.focus()},[n]);var z=y.useRef(),R=y.useMemo(()=>Mb(()=>{var O=z.current;if((mt||!ee.isComposing(f))&&(!M.isUpdatingSelection||O!=null&&O.isFlushing())&&!M.isDraggingInternally){var q=ee.findDocumentOrShadowRoot(f),{activeElement:T}=q,L=ee.toDOMNode(f,f),G=q.getSelection();if(T===L?(M.latestElement=T,vn.set(f,!0)):vn.delete(f),!G)return J.deselect(f);var{anchorNode:Y,focusNode:te}=G,le=ee.hasEditableTarget(f,Y)||ee.isTargetInsideNonReadonlyVoid(f,Y),X=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te);if(le&&X){var pe=ee.toSlateRange(f,G,{exactMatch:!1,suppressThrow:!0});pe&&(!ee.isComposing(f)&&!(O!=null&&O.hasPendingChanges())&&!(O!=null&&O.isFlushing())?J.select(f,pe):O==null||O.handleUserSelect(pe))}s&&(!le||!X)&&J.deselect(f)}},100),[f,s,M]),B=y.useMemo(()=>Bb(R,0),[R]);z.current=w1({node:C,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:B}),Zr(()=>{var O,q,T;C.current&&(T=Lo(C.current))?(Hf.set(f,T),Oa.set(f,C.current),Sn.set(f,C.current),Kr.set(C.current,f)):Sn.delete(f);var{selection:L}=f,G=ee.findDocumentOrShadowRoot(f),Y=G.getSelection();if(!(!Y||!ee.isFocused(f)||(O=z.current)!==null&&O!==void 0&&O.hasPendingAction())){var te=fe=>{var ke=Y.type!=="None";if(!(!L&&!ke)){var Oe=Y.focusNode,Te;if(Xn&&Y.rangeCount>1){var Ke=Y.getRangeAt(0),Ne=Y.getRangeAt(Y.rangeCount-1);Ke.startContainer===Oe?Te=Ne.endContainer:Te=Ke.startContainer}else Te=Y.anchorNode;var $e=Oa.get(f),Qe=!1;if($e.contains(Te)&&$e.contains(Oe)&&(Qe=!0),ke&&Qe&&L&&!fe){var Ae=ee.toSlateRange(f,Y,{exactMatch:!0,suppressThrow:!0});if(Ae&&Z.equals(Ae,L)){var qe;if(!M.hasMarkPlaceholder||(qe=Te)!==null&&qe!==void 0&&(qe=qe.parentElement)!==null&&qe!==void 0&&qe.hasAttribute("data-slate-mark-placeholder"))return}}if(L&&!ee.hasRange(f,L)){f.selection=ee.toSlateRange(f,Y,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var be=L&&ee.toDOMRange(f,L);return be?(ee.isComposing(f)&&!mt?Y.collapseToEnd():Z.isBackward(L)?Y.setBaseAndExtent(be.endContainer,be.endOffset,be.startContainer,be.startOffset):Y.setBaseAndExtent(be.startContainer,be.startOffset,be.endContainer,be.endOffset),d(f,be)):Y.removeAllRanges(),be}};Y.rangeCount<=1&&te();var le=((q=z.current)===null||q===void 0?void 0:q.isFlushing())==="action";if(!mt||!le){setTimeout(()=>{M.isUpdatingSelection=!1});return}var X=null,pe=requestAnimationFrame(()=>{if(le){var fe=ke=>{try{var Oe=ee.toDOMNode(f,f);Oe.focus(),te(ke)}catch{}};fe(),X=setTimeout(()=>{fe(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),X&&clearTimeout(X)}}});var F=y.useCallback(O=>{if(k(),!s&&ee.hasEditableTarget(f,O.target)&&!iC(O,a)){var q;if(z.current)return z.current.handleDOMBeforeInput(O);B.flush(),R.flush();var{selection:T}=f,{inputType:L}=O,G=O.dataTransfer||O.data||void 0,Y=L==="insertCompositionText"||L==="deleteCompositionText";if(Y&&ee.isComposing(f))return;var te=!1;if(L==="insertText"&&T&&Z.isCollapsed(T)&&O.data&&O.data.length===1&&/[a-z ]/i.test(O.data)&&T.anchor.offset!==0){var le,X;te=!0,f.marks&&(te=!1);var{anchor:pe}=T,[fe,ke]=ee.toDOMPoint(f,pe),Oe=(le=fe.parentElement)===null||le===void 0?void 0:le.closest("a"),Te=ee.getWindow(f);if(te&&Oe&&ee.hasDOMNode(f,Oe)){var Ke,Ne=Te==null?void 0:Te.document.createTreeWalker(Oe,NodeFilter.SHOW_TEXT).lastChild();Ne===fe&&((Ke=Ne.textContent)===null||Ke===void 0?void 0:Ke.length)===ke&&(te=!1)}if(te&&fe.parentElement&&(Te==null||(X=Te.getComputedStyle(fe.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var $e=x.above(f,{at:pe.path,match:ae=>de.isElement(ae)&&x.isBlock(f,ae)});$e&&ue.string($e[0]).includes(" ")&&(te=!1)}}if(!L.startsWith("delete")||L.startsWith("deleteBy")){var[Qe]=O.getTargetRanges();if(Qe){var Ae=ee.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!T||!Z.equals(T,Ae)){te=!1;var qe=!Y&&f.selection&&x.rangeRef(f,f.selection);J.select(f,Ae),qe&&Mr.set(f,qe)}}}if(Y)return;if(te||O.preventDefault(),T&&Z.isExpanded(T)&&L.startsWith("delete")){var be=L.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:be});return}switch(L){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{L==="insertFromComposition"&&ee.isComposing(f)&&(g(!1),An.set(f,!1)),(G==null?void 0:G.constructor.name)==="DataTransfer"?ee.insertData(f,G):typeof G=="string"&&(te?D.current.push(()=>x.insertText(f,G)):x.insertText(f,G));break}}var V=(q=Mr.get(f))===null||q===void 0?void 0:q.unref();Mr.delete(f),V&&(!f.selection||!Z.equals(f.selection,V))&&J.select(f,V)}},[f,R,k,a,s,B]),P=y.useCallback(O=>{O==null?(R.cancel(),B.cancel(),Oa.delete(f),Sn.delete(f),C.current&&dn&&C.current.removeEventListener("beforeinput",F)):dn&&O.addEventListener("beforeinput",F),C.current=O},[R,B,f,F]);Zr(()=>{var O=ee.getWindow(f);return O.document.addEventListener("selectionchange",B),()=>{O.document.removeEventListener("selectionchange",B)}},[B]);var j=r([f,[]]),U=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,W=y.useCallback(O=>{if(O&&U){var q;E((q=O.getBoundingClientRect())===null||q===void 0?void 0:q.height)}else E(void 0)},[U]);if(U){var ne=x.start(f,[]);j.push({[fr]:!0,placeholder:i,onPlaceholderResize:W,anchor:ne,focus:ne})}var{marks:re}=f;if(M.hasMarkPlaceholder=!1,f.selection&&Z.isCollapsed(f.selection)&&re){var{anchor:w}=f.selection,Q=ue.leaf(f,w.path),se=dr(Q,X1);if(!he.equals(Q,re,{loose:!0})){M.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(se).map(O=>[O,null]));j.push(Ut(Ut(Ut({[Zf]:!0},_),re),{},{anchor:w,focus:w}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:O}=f;if(O){var{anchor:q}=O,T=ue.leaf(f,q.path);if(re&&!he.equals(T,re,{loose:!0})){Rt.set(f,re);return}}Rt.delete(f)})}),y.createElement(ih.Provider,{value:s},y.createElement(rh.Provider,{value:r},y.createElement(Q1,{node:C,receivedUserInput:S},y.createElement(p,Ut(Ut({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:dn||!ja?v.spellCheck:!1,autoCorrect:dn||!ja?v.autoCorrect:"false",autoCapitalize:dn||!ja?v.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:P,style:Ut(Ut({},m?{}:Ut({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},A?{minHeight:A}:{})),h),onBeforeInput:y.useCallback(O=>{if(!dn&&!s&&!ft(O,v.onBeforeInput)&&ee.hasSelectableTarget(f,O.target)&&(O.preventDefault(),!ee.isComposing(f))){var q=O.data;x.insertText(f,q)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(O=>{if(!ft(O,v.onInput)){if(z.current){z.current.handleInput();return}for(var q of D.current)q();D.current=[]}},[v.onInput]),onBlur:y.useCallback(O=>{if(!(s||M.isUpdatingSelection||!ee.hasSelectableTarget(f,O.target)||ft(O,v.onBlur))){var q=ee.findDocumentOrShadowRoot(f);if(M.latestElement!==q.activeElement){var{relatedTarget:T}=O,L=ee.toDOMNode(f,f);if(T!==L&&!(jt(T)&&T.hasAttribute("data-slate-spacer"))){if(T!=null&&bn(T)&&ee.hasDOMNode(f,T)){var G=ee.toSlateNode(f,T);if(de.isElement(G)&&!f.isVoid(G))return}if(Tr){var Y=q.getSelection();Y==null||Y.removeAllRanges()}vn.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,v.onBlur]),onClick:y.useCallback(O=>{if(ee.hasTarget(f,O.target)&&!ft(O,v.onClick)&&bn(O.target)){var q=ee.toSlateNode(f,O.target),T=ee.findPath(f,q);if(!x.hasPath(f,T)||ue.get(f,T)!==q)return;if(O.detail===V1&&T.length>=1){var L=T;if(!(de.isElement(q)&&x.isBlock(f,q))){var G,Y=x.above(f,{match:Oe=>de.isElement(Oe)&&x.isBlock(f,Oe),at:T});L=(G=Y==null?void 0:Y[1])!==null&&G!==void 0?G:T.slice(0,1)}var te=x.range(f,L);J.select(f,te);return}if(s)return;var le=x.start(f,T),X=x.end(f,T),pe=x.void(f,{at:le}),fe=x.void(f,{at:X});if(pe&&fe&&I.equals(pe[1],fe[1])){var ke=x.range(f,le);J.select(f,ke)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(O=>{if(ee.hasSelectableTarget(f,O.target)){var q;if(ee.isComposing(f)&&Promise.resolve().then(()=>{g(!1),An.set(f,!1)}),(q=z.current)===null||q===void 0||q.handleCompositionEnd(O),ft(O,v.onCompositionEnd)||mt)return;if(!Tr&&!Zx&&!Wx&&!Gx&&!Yx&&O.data){var T=Rt.get(f);Rt.delete(f),T!==void 0&&(nn.set(f,f.marks),f.marks=T),x.insertText(f,O.data);var L=nn.get(f);nn.delete(f),L!==void 0&&(f.marks=L)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(O=>{ee.hasSelectableTarget(f,O.target)&&!ft(O,v.onCompositionUpdate)&&(ee.isComposing(f)||(g(!0),An.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(O=>{if(ee.hasSelectableTarget(f,O.target)){var q;if((q=z.current)===null||q===void 0||q.handleCompositionStart(O),ft(O,v.onCompositionStart)||mt)return;g(!0);var{selection:T}=f;if(T&&Z.isExpanded(T)){x.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(O=>{ee.hasSelectableTarget(f,O.target)&&!ft(O,v.onCopy)&&!rc(O)&&(O.preventDefault(),ee.setFragmentData(f,O.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(O=>{if(!s&&ee.hasSelectableTarget(f,O.target)&&!ft(O,v.onCut)&&!rc(O)){O.preventDefault(),ee.setFragmentData(f,O.clipboardData,"cut");var{selection:q}=f;if(q)if(Z.isExpanded(q))x.deleteFragment(f);else{var T=ue.parent(f,q.anchor.path);x.isVoid(f,T)&&J.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(O=>{if(ee.hasTarget(f,O.target)&&!ft(O,v.onDragOver)){var q=ee.toSlateNode(f,O.target);de.isElement(q)&&x.isVoid(f,q)&&O.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(O=>{if(!s&&ee.hasTarget(f,O.target)&&!ft(O,v.onDragStart)){var q=ee.toSlateNode(f,O.target),T=ee.findPath(f,q),L=de.isElement(q)&&x.isVoid(f,q)||x.void(f,{at:T,voids:!0});if(L){var G=x.range(f,T);J.select(f,G)}M.isDraggingInternally=!0,ee.setFragmentData(f,O.dataTransfer,"drag")}},[s,f,v.onDragStart,M]),onDrop:y.useCallback(O=>{if(!s&&ee.hasTarget(f,O.target)&&!ft(O,v.onDrop)){O.preventDefault();var q=f.selection,T=ee.findEventRange(f,O),L=O.dataTransfer;J.select(f,T),M.isDraggingInternally&&q&&!Z.equals(q,T)&&!x.void(f,{at:T,voids:!0})&&J.delete(f,{at:q}),ee.insertData(f,L),ee.isFocused(f)||ee.focus(f)}M.isDraggingInternally=!1},[s,f,v.onDrop,M]),onDragEnd:y.useCallback(O=>{!s&&M.isDraggingInternally&&v.onDragEnd&&ee.hasTarget(f,O.target)&&v.onDragEnd(O),M.isDraggingInternally=!1},[s,M,v,f]),onFocus:y.useCallback(O=>{if(!s&&!M.isUpdatingSelection&&ee.hasEditableTarget(f,O.target)&&!ft(O,v.onFocus)){var q=ee.toDOMNode(f,f),T=ee.findDocumentOrShadowRoot(f);if(M.latestElement=T.activeElement,Xn&&O.target!==q){q.focus();return}vn.set(f,!0)}},[s,M,f,v.onFocus]),onKeyDown:y.useCallback(O=>{if(!s&&ee.hasEditableTarget(f,O.target)){var q;(q=z.current)===null||q===void 0||q.handleKeyDown(O);var{nativeEvent:T}=O;if(ee.isComposing(f)&&T.isComposing===!1&&(An.set(f,!1),g(!1)),ft(O,v.onKeyDown)||ee.isComposing(f))return;var{selection:L}=f,G=f.children[L!==null?L.focus.path[0]:0],Y=yf(ue.string(G))==="rtl";if(Ze.isRedo(T)){O.preventDefault();var te=f;typeof te.redo=="function"&&te.redo();return}if(Ze.isUndo(T)){O.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ze.isMoveLineBackward(T)){O.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ze.isMoveLineForward(T)){O.preventDefault(),J.move(f,{unit:"line"});return}if(Ze.isExtendLineBackward(T)){O.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ze.isExtendLineForward(T)){O.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ze.isMoveBackward(T)){O.preventDefault(),L&&Z.isCollapsed(L)?J.move(f,{reverse:!Y}):J.collapse(f,{edge:Y?"end":"start"});return}if(Ze.isMoveForward(T)){O.preventDefault(),L&&Z.isCollapsed(L)?J.move(f,{reverse:Y}):J.collapse(f,{edge:Y?"start":"end"});return}if(Ze.isMoveWordBackward(T)){O.preventDefault(),L&&Z.isExpanded(L)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!Y});return}if(Ze.isMoveWordForward(T)){O.preventDefault(),L&&Z.isExpanded(L)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:Y});return}if(dn){if((Vf||Tr)&&L&&(Ze.isDeleteBackward(T)||Ze.isDeleteForward(T))&&Z.isCollapsed(L)){var X=ue.parent(f,L.anchor.path);if(de.isElement(X)&&x.isVoid(f,X)&&(x.isInline(f,X)||x.isBlock(f,X))){O.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ze.isBold(T)||Ze.isItalic(T)||Ze.isTransposeCharacter(T)){O.preventDefault();return}if(Ze.isSoftBreak(T)){O.preventDefault(),x.insertSoftBreak(f);return}if(Ze.isSplitBlock(T)){O.preventDefault(),x.insertBreak(f);return}if(Ze.isDeleteBackward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ze.isDeleteForward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ze.isDeleteLineBackward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ze.isDeleteLineForward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ze.isDeleteWordBackward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ze.isDeleteWordForward(T)){O.preventDefault(),L&&Z.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(O=>{!s&&ee.hasEditableTarget(f,O.target)&&!ft(O,v.onPaste)&&(!dn||Xx(O.nativeEvent)||Tr)&&(O.preventDefault(),ee.insertData(f,O.clipboardData))},[s,f,v.onPaste])}),y.createElement(eC,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},nC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Ut({},t),n,mt&&y.createElement("br",null))},rC=()=>[],aC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Z.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Rb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ft=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},rc=e=>bn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),iC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},sC=y.createContext(!1),oC=y.createContext({});function uC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var lC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],cC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=dr(e,lC),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(rt.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(rt.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=uC(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(g=>({v:g.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(qs.set(t,p),()=>{qs.set(t,()=>{})}),[t,p]);var[m,v]=y.useState(ee.isFocused(t));return y.useEffect(()=>{v(ee.isFocused(t))},[t]),Zr(()=>{var f=()=>v(ee.isFocused(t));return Wf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(oC.Provider,{value:d},y.createElement(sh.Provider,{value:l},y.createElement(No.Provider,{value:l.editor},y.createElement(sC.Provider,{value:m},n))))},ac=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},ic=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return ac(r,a)&&ac(a,r)},dC=(e,t)=>{var n=x.range(e,Z.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(ic(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)ic(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function sc(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 oc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sc(Object(n),!0).forEach(function(r){Ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fC=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 bi.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=$o.get(r))===null||h===void 0||h(),!Rt.get(r)&&(p=yt.get(r))!==null&&p!==void 0&&p.length&&Rt.set(r,null),nn.delete(r),o(u,d)},r.removeMark=u=>{var d;!Rt.get(r)&&(d=yt.get(r))!==null&&d!==void 0&&d.length&&Rt.set(r,null),nn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Z.isCollapsed(r.selection)){var d=x.above(r,{match:v=>de.isElement(v)&&x.isBlock(r,v),at:r.selection});if(d){var[,h]=d,p=x.range(r,h,r.selection.anchor),m=dC(r,p);Z.isCollapsed(m)||J.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=yt.get(r);if(p!=null&&p.length){var m=p.map(P=>f1(P,u)).filter(Boolean);yt.set(r,m)}var v=mn.get(r);v&&mn.set(r,Zl(r,v,u));var f=hn.get(r);if(f!=null&&f.at){var b=_e.isPoint(f==null?void 0:f.at)?Vs(r,f.at,u):Zl(r,f.at,u);hn.set(r,b?oc(oc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Kn(r,u.path));break}case"set_selection":{var g;(g=Mr.get(r))===null||g===void 0||g.unref(),Mr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Kn(r,I.parent(u.path)));break}case"merge_node":{var C=I.previous(u.path);d.push(...Kn(r,C));break}case"move_node":{var D=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Kn(r,D));var A;I.isBefore(u.path,u.newPath)?(d.push(...Kn(r,I.parent(u.path))),A=u.newPath):(d.push(...Kn(r,I.parent(u.newPath))),A=u.path);var E=ue.get(t,I.parent(A)),k=ee.findKey(r,E),S=x.pathRef(r,I.parent(A));h.push([S,k]);break}}a(u);for(var[$,M]of d){var[z]=x.node(r,$);Xa.set(z,M)}for(var[R,B]of h)if(R.current){var[F]=x.node(r,R.current);Xa.set(F,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=Z.edges(d),m=x.void(r,{at:h.path}),v=x.void(r,{at:p.path});if(!(Z.isCollapsed(d)&&!m)){var f=ee.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(g=z)}),v){var[C]=v,D=f.cloneRange(),A=ee.toDOMNode(r,C);D.setEndAfter(A),b=D.cloneContents()}if(m&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var R=z.getAttribute("data-slate-zero-width")==="n";z.textContent=R?`
81
+ `:""}),Yf(g)){var E=g.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(g),b.appendChild(E),g=E}var k=r.getFragment(),S=JSON.stringify(k),$=window.btoa(encodeURIComponent(S));g.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",Qf(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||a1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&J.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=Wf<18?Kc.unstable_batchedUpdates:h=>h();d(()=>{var h=qs.get(r);h&&h(u),i(u)})},r},Kn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const Ks="MENTION: ",uh={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},uc={"mention-popover":35,default:-52},Zi=16,lh=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(ln),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,v;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=D=>{if(!x.hasPath(e,D.path))return!1;const A=ue.get(e,D.path);return x.isEditor(A)||de.isElement(A)?D.offset<=A.children.length:he.isText(A)?D.offset<=A.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||uh).getBoundingClientRect();const C=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((C==null?void 0:C.width)||0)/Zi}rem`),d=(C==null?void 0:C.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const h=uc[t]||uc.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Zi}rem`,l.style.left=`${d/Zi}rem`},o),r},hC=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===H.link});if(a){const i=a[0],s=so(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 ht=(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.h3="heading_three",e))(ht||{});const er={[H.paragraph]:H.paragraph,[H.blockquote]:H.blockquote,[H.codeblock]:H.codeblock,[H.link]:H.link,[H.ul]:H.ul,[H.ol]:H.ol,[H.li]:H.li,[H.mention]:H.mention,[H.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ht.emphasis]:H.italic,[Ht.strong]:H.bold,[Ht.delete]:H.strikethrough,[Ht.code]:H.code,[H.hr]:H.hr,[H.image]:H.image,[H.h3]:H.h3};function lc(e){if(e)throw e}var Pa=Object.prototype.hasOwnProperty,ch=Object.prototype.toString,cc=Object.defineProperty,dc=Object.getOwnPropertyDescriptor,fc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ch.call(t)==="[object Array]"},hc=function(t){if(!t||ch.call(t)!=="[object Object]")return!1;var n=Pa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Pa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Pa.call(t,a)},mc=function(t,n){cc&&n.name==="__proto__"?cc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},pc=function(t,n){if(n==="__proto__")if(Pa.call(t,n)){if(dc)return dc(t,n).value}else return;return t[n]},mC=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=pc(o,n),a=pc(t,n),o!==a&&(d&&a&&(hc(a)||(i=fc(a)))?(i?(i=!1,s=r&&fc(r)?r:[]):s=r&&hc(r)?r:{},mc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&mc(o,{name:n,newValue:a}));return o};const Yi=In(mC);function Zs(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 pC(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?gC(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function gC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Nr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gc(e.position):"start"in e||"end"in e?gc(e):"line"in e||"column"in e?Ys(e):""}function Ys(e){return vc(e&&e.line)+":"+vc(e&&e.column)}function gc(e){return Ys(e&&e.start)+"-"+Ys(e&&e.end)}function vc(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Nr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const Wt={basename:vC,dirname:bC,extname:yC,join:xC,sep:"/"};function vC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xr(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 bC(e){if(Xr(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 yC(e){Xr(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 xC(...e){let t=-1,n;for(;++t<e.length;)Xr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":CC(n)}function CC(e){Xr(e);const t=e.codePointAt(0)===47;let n=DC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function DC(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 Xr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wC={cwd:EC};function EC(){return"/"}function Gs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _C(e){if(typeof e=="string")e=new URL(e);else if(!Gs(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 kC(e)}function kC(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 Gi=["history","path","basename","stem","extname","dirname"];class FC{constructor(t){let n;t?Gs(t)?n={path:t}:typeof t=="string"||AC(t)?n={value:t}:n=t:n={},this.cwd=wC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Gi.length;){const i=Gi[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)Gi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Wt.basename(this.path):void 0}set basename(t){Ji(t,"basename"),Qi(t,"basename"),this.path=Wt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wt.dirname(this.path):void 0}set dirname(t){bc(this.basename,"dirname"),this.path=Wt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wt.extname(this.path):void 0}set extname(t){if(Qi(t,"extname"),bc(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=Wt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Gs(t)&&(t=_C(t)),Ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wt.basename(this.path,this.extname):void 0}set stem(t){Ji(t,"stem"),Qi(t,"stem"),this.path=Wt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Dt(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Qi(e,t){if(e&&e.includes(Wt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wt.sep+"`")}function Ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function AC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const BC=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},TC={}.hasOwnProperty;class qo extends BC{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=pC()}copy(){const t=new qo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Yi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ts("data",this.frozen),this.namespace[t]=n,this):TC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ts("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=ya(t),r=this.parser||this.Parser;return Xi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Xi("process",this.parser||this.Parser),es("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ya(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,v=r.stringify(m,p);OC(v)?p.value=v:p.result=v,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Xi("processSync",this.parser||this.Parser),es("processSync",this.compiler||this.Compiler),this.process(t,a),xc("processSync","process",n),r;function a(i,s){n=!0,lc(i),r=s}}run(t,n,r){yc(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=ya(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),xc("runSync","run",r),a;function i(s,o){lc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ya(n),a=this.compiler||this.Compiler;return es("stringify",a),yc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(ts("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Yi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...v]=d;const f=r[p][1];Zs(f)&&Zs(m)&&(m=Yi(!0,f,m)),r[p]=[u,m,...v]}}}}const SC=new qo().freeze();function Xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function es(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ts(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 yc(e){if(!Zs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function xc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ya(e){return jC(e)?e:new FC(e)}function jC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function OC(e){return typeof e=="string"||PC(e)}function PC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const MC={};function NC(e,t){const n=t||MC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return dh(e,r,a)}function dh(e,t,n){if(IC(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 Cc(e.children,t,n)}return Array.isArray(e)?Cc(e,t,n):""}function Cc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=dh(e[a],t,n);return r.join("")}function IC(e){return!!(e&&typeof e=="object")}const Dc=document.createElement("i");function Uo(e){const t="&"+e+";";Dc.innerHTML=t;const n=Dc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sn(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 St(e,t){return e.length>0?(sn(e,e.length,0,t),e):t}const wc={}.hasOwnProperty;function RC(e){const t={};let n=-1;for(;++n<e.length;)$C(t,e[n]);return t}function $C(e,t){let n;for(n in t){const a=(wc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){wc.call(a,s)||(a[s]=[]);const o=i[s];LC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function LC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sn(e,0,0,r)}function fh(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 ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vt=Dn(/[A-Za-z]/),$t=Dn(/[\dA-Za-z]/),zC=Dn(/[#-'*+\--9=?A-Z^-~]/);function Qs(e){return e!==null&&(e<32||e===127)}const Js=Dn(/\d/),qC=Dn(/[\dA-Fa-f]/),UC=Dn(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const WC=Dn(/\p{P}|\p{S}/u),VC=Dn(/\s/);function Dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ue(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Me(l)?(e.enter(n),o(l)):t(l)}function o(l){return Me(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const HC={tokenize:KC};function KC(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"),Ue(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const ZC={tokenize:YC},Ec={tokenize:GC};function YC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(D){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,u)(D)}return u(D)}function l(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const A=t.events.length;let E=A,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}g(r);let S=A;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},k),S++;return sn(t.events,E+1,0,t.events.slice(A)),t.events.length=S,u(D)}return o(D)}function u(D){if(r===n.length){if(!a)return p(D);if(a.currentConstruct&&a.currentConstruct.concrete)return v(D);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ec,d,h)(D)}function d(D){return a&&C(),g(r),p(D)}function h(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(D)}function p(D){return t.containerState={},e.attempt(Ec,m,v)(D)}function m(D){return r++,n.push([t.currentConstruct,t.containerState]),p(D)}function v(D){if(D===null){a&&C(),g(0),e.consume(D);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(D)}function f(D){if(D===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(D);return}return ye(D)?(e.consume(D),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(D),f)}function b(D,A){const E=t.sliceStream(D);if(A&&E.push(null),D.previous=i,i&&(i.next=D),i=D,a.defineSkip(D.start),a.write(E),t.parser.lazy[D.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const S=t.events.length;let $=S,M,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(M){z=t.events[$][1].end;break}M=!0}for(g(r),k=S;k<t.events.length;)t.events[k][1].end=Object.assign({},z),k++;sn(t.events,$+1,0,t.events.slice(S)),t.events.length=k}}function g(D){let A=n.length;for(;A-- >D;){const E=n[A];t.containerState=E[1],E[0].exit.call(t,e)}n.length=D}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function GC(e,t,n){return Ue(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _c(e){if(e===null||Ct(e)||VC(e))return 1;if(WC(e))return 2}function Wo(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 Xs={name:"attention",tokenize:JC,resolveAll:QC};function QC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);kc(h,-l),kc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=St(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=St(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=St(u,Wo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=St(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=St(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,sn(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function JC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=_c(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=_c(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function kc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const XC={name:"autolink",tokenize:eD};function eD(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Vt(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||$t(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||$t(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Qs(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):zC(m)?(e.consume(m),u):n(m)}function d(m){return $t(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||$t(m))&&r++<63){const v=m===45?p:h;return e.consume(m),v}return n(m)}}const yi={tokenize:tD,partial:!0};function tD(e,t,n){return r;function r(i){return Me(i)?Ue(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const hh={name:"blockQuote",tokenize:nD,continuation:{tokenize:rD},exit:aD};function nD(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 Me(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function rD(e,t,n){const r=this;return a;function a(s){return Me(s)?Ue(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(hh,t,n)(s)}}function aD(e){e.exit("blockQuote")}const mh={name:"characterEscape",tokenize:iD};function iD(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 UC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const ph={name:"characterReference",tokenize:sD};function sD(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=$t,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=qC,d):(e.enter("characterReferenceValue"),i=7,s=Js,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===$t&&!Uo(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const Fc={tokenize:uD,partial:!0},Ac={name:"codeFenced",tokenize:oD,concrete:!0};function oD(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===o?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Me(k)?Ue(e,h,"whitespace")(k):h(k))}function h(k){return k===null||ye(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Fc,f,A)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||ye(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):Me(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ue(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),p)}function m(k){return k===null||ye(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===null||ye(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===o?n(k):(e.consume(k),v)}function f(k){return e.attempt(a,A,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),g}function g(k){return i>0&&Me(k)?Ue(e,C,"linePrefix",i+1)(k):C(k)}function C(k){return k===null||ye(k)?e.check(Fc,f,A)(k):(e.enter("codeFlowValue"),D(k))}function D(k){return k===null||ye(k)?(e.exit("codeFlowValue"),C(k)):(e.consume(k),D)}function A(k){return e.exit("codeFenced"),t(k)}function E(k,S,$){let M=0;return z;function z(j){return k.enter("lineEnding"),k.consume(j),k.exit("lineEnding"),R}function R(j){return k.enter("codeFencedFence"),Me(j)?Ue(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):B(j)}function B(j){return j===o?(k.enter("codeFencedFenceSequence"),F(j)):$(j)}function F(j){return j===o?(M++,k.consume(j),F):M>=s?(k.exit("codeFencedFenceSequence"),Me(j)?Ue(k,P,"whitespace")(j):P(j)):$(j)}function P(j){return j===null||ye(j)?(k.exit("codeFencedFence"),S(j)):$(j)}}}function uD(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 ns={name:"codeIndented",tokenize:cD},lD={tokenize:dD,partial:!0};function cD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ue(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(lD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function dD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ue(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const fD={name:"codeText",tokenize:pD,resolve:hD,previous:mD};function hD(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 mD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pD(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ye(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class gD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&kr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),kr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),kr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);kr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);kr(this.left,n.reverse())}}}function kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gh(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new gD(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,vD(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return sn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function vD(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,v=0,f=0;const b=[f];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const g=o.slice(b[p],b[p+1]),C=i.pop();l.push([C,C+g.length-1]),e.splice(C,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[v+l[p][0]]=v+l[p][1],v+=l[p][1]-l[p][0]-1;return u}const bD={tokenize:CD,resolve:xD},yD={tokenize:DD,partial:!0};function xD(e){return gh(e),e}function CD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(yD,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 DD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ue(e,i,"linePrefix")}function i(s){if(s===null||ye(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function vh(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(g){return g===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||Qs(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||ye(g)?n(g):(e.consume(g),g===92?v:m)}function v(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function f(g){return!d&&(g===null||g===41||Ct(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||Qs(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function bh(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||ye(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Me(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function yh(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ue(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||ye(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Ir(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Me(a)?Ue(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const wD={name:"definition",tokenize:_D},ED={tokenize:kD,partial:!0};function _D(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return bh.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return Ct(m)?Ir(e,u)(m):u(m)}function u(m){return vh(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(ED,h,h)(m)}function h(m){return Me(m)?Ue(e,p,"whitespace")(m):p(m)}function p(m){return m===null||ye(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function kD(e,t,n){return r;function r(o){return Ct(o)?Ir(e,a)(o):n(o)}function a(o){return yh(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Me(o)?Ue(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const FD={name:"hardBreakEscape",tokenize:AD};function AD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const BD={name:"headingAtx",tokenize:SD,resolve:TD};function TD(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"},sn(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function SD(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Ct(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ye(d)?(e.exit("atxHeading"),t(d)):Me(d)?Ue(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Ct(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const jD=["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"],Bc=["pre","script","style","textarea"],OD={name:"htmlFlow",tokenize:ID,resolveTo:ND,concrete:!0},PD={tokenize:$D,partial:!0},MD={tokenize:RD,partial:!0};function ND(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 ID(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:w):Vt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,m):_===91?(e.consume(_),a=5,o=0,v):Vt(_)?(e.consume(_),a=4,r.interrupt?t:w):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:w):n(_)}function v(_){const O="CDATA[";return _===O.charCodeAt(o++)?(e.consume(_),o===O.length?r.interrupt?t:B:v):n(_)}function f(_){return Vt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||Ct(_)){const O=_===47,q=s.toLowerCase();return!O&&!i&&Bc.includes(q)?(a=1,r.interrupt?t(_):B(_)):jD.includes(s.toLowerCase())?(a=6,O?(e.consume(_),g):r.interrupt?t(_):B(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?C(_):D(_))}return _===45||$t(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:B):n(_)}function C(_){return Me(_)?(e.consume(_),C):z(_)}function D(_){return _===47?(e.consume(_),z):_===58||_===95||Vt(_)?(e.consume(_),A):Me(_)?(e.consume(_),D):z(_)}function A(_){return _===45||_===46||_===58||_===95||$t(_)?(e.consume(_),A):E(_)}function E(_){return _===61?(e.consume(_),k):Me(_)?(e.consume(_),E):D(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,S):Me(_)?(e.consume(_),k):$(_)}function S(_){return _===l?(e.consume(_),l=null,M):_===null||ye(_)?n(_):(e.consume(_),S)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Ct(_)?E(_):(e.consume(_),$)}function M(_){return _===47||_===62||Me(_)?D(_):n(_)}function z(_){return _===62?(e.consume(_),R):n(_)}function R(_){return _===null||ye(_)?B(_):Me(_)?(e.consume(_),R):n(_)}function B(_){return _===45&&a===2?(e.consume(_),U):_===60&&a===1?(e.consume(_),W):_===62&&a===4?(e.consume(_),Q):_===63&&a===3?(e.consume(_),w):_===93&&a===5?(e.consume(_),re):ye(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(PD,se,F)(_)):_===null||ye(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),B)}function F(_){return e.check(MD,P,se)(_)}function P(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),j}function j(_){return _===null||ye(_)?F(_):(e.enter("htmlFlowData"),B(_))}function U(_){return _===45?(e.consume(_),w):B(_)}function W(_){return _===47?(e.consume(_),s="",ne):B(_)}function ne(_){if(_===62){const O=s.toLowerCase();return Bc.includes(O)?(e.consume(_),Q):B(_)}return Vt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ne):B(_)}function re(_){return _===93?(e.consume(_),w):B(_)}function w(_){return _===62?(e.consume(_),Q):_===45&&a===2?(e.consume(_),w):B(_)}function Q(_){return _===null||ye(_)?(e.exit("htmlFlowData"),se(_)):(e.consume(_),Q)}function se(_){return e.exit("htmlFlow"),t(_)}}function RD(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function $D(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(yi,t,n)}}const LD={name:"htmlText",tokenize:zD};function zD(e,t,n){const r=this;let a,i,s;return o;function o(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),l}function l(w){return w===33?(e.consume(w),u):w===47?(e.consume(w),E):w===63?(e.consume(w),D):Vt(w)?(e.consume(w),$):n(w)}function u(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),i=0,v):Vt(w)?(e.consume(w),C):n(w)}function d(w){return w===45?(e.consume(w),m):n(w)}function h(w){return w===null?n(w):w===45?(e.consume(w),p):ye(w)?(s=h,W(w)):(e.consume(w),h)}function p(w){return w===45?(e.consume(w),m):h(w)}function m(w){return w===62?U(w):w===45?p(w):h(w)}function v(w){const Q="CDATA[";return w===Q.charCodeAt(i++)?(e.consume(w),i===Q.length?f:v):n(w)}function f(w){return w===null?n(w):w===93?(e.consume(w),b):ye(w)?(s=f,W(w)):(e.consume(w),f)}function b(w){return w===93?(e.consume(w),g):f(w)}function g(w){return w===62?U(w):w===93?(e.consume(w),g):f(w)}function C(w){return w===null||w===62?U(w):ye(w)?(s=C,W(w)):(e.consume(w),C)}function D(w){return w===null?n(w):w===63?(e.consume(w),A):ye(w)?(s=D,W(w)):(e.consume(w),D)}function A(w){return w===62?U(w):D(w)}function E(w){return Vt(w)?(e.consume(w),k):n(w)}function k(w){return w===45||$t(w)?(e.consume(w),k):S(w)}function S(w){return ye(w)?(s=S,W(w)):Me(w)?(e.consume(w),S):U(w)}function $(w){return w===45||$t(w)?(e.consume(w),$):w===47||w===62||Ct(w)?M(w):n(w)}function M(w){return w===47?(e.consume(w),U):w===58||w===95||Vt(w)?(e.consume(w),z):ye(w)?(s=M,W(w)):Me(w)?(e.consume(w),M):U(w)}function z(w){return w===45||w===46||w===58||w===95||$t(w)?(e.consume(w),z):R(w)}function R(w){return w===61?(e.consume(w),B):ye(w)?(s=R,W(w)):Me(w)?(e.consume(w),R):M(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,F):ye(w)?(s=B,W(w)):Me(w)?(e.consume(w),B):(e.consume(w),P)}function F(w){return w===a?(e.consume(w),a=void 0,j):w===null?n(w):ye(w)?(s=F,W(w)):(e.consume(w),F)}function P(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||Ct(w)?M(w):(e.consume(w),P)}function j(w){return w===47||w===62||Ct(w)?M(w):n(w)}function U(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function W(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),ne}function ne(w){return Me(w)?Ue(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):re(w)}function re(w){return e.enter("htmlTextData"),s(w)}}const Vo={name:"labelEnd",tokenize:KD,resolveTo:HD,resolveAll:VD},qD={tokenize:ZD},UD={tokenize:YD},WD={tokenize:GD};function VD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function HD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=St(o,e.slice(i+1,i+r+3)),o=St(o,[["enter",d,t]]),o=St(o,Wo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=St(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=St(o,e.slice(s+1)),o=St(o,[["exit",l,t]]),sn(e,i,e.length,o),e}function KD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(ar(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(qD,d,s?d:h)(p):p===91?e.attempt(UD,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(WD,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function ZD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return Ct(h)?Ir(e,i)(h):i(h)}function i(h){return h===41?d(h):vh(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Ct(h)?Ir(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?yh(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Ct(h)?Ir(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function YD(e,t,n){const r=this;return a;function a(o){return bh.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function GD(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 QD={name:"labelStartImage",tokenize:JD,resolveAll:Vo.resolveAll};function JD(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 XD={name:"labelStartLink",tokenize:ew,resolveAll:Vo.resolveAll};function ew(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 rs={name:"lineEnding",tokenize:tw};function tw(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ue(e,t,"linePrefix")}}const Ma={name:"thematicBreak",tokenize:nw};function nw(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Me(u)?Ue(e,o,"whitespace")(u):o(u))}}const bt={name:"list",tokenize:iw,continuation:{tokenize:sw},exit:uw},rw={tokenize:lw,partial:!0},aw={tokenize:ow,partial:!0};function iw(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(m){const v=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Js(m)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ma,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Js(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(yi,r.interrupt?n:d,e.attempt(rw,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Me(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function sw(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(yi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ue(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Me(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(aw,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ue(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function ow(e,t,n){const r=this;return Ue(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 uw(e){e.exit(this.containerState.type)}function lw(e,t,n){const r=this;return Ue(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!Me(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Tc={name:"setextUnderline",tokenize:dw,resolveTo:cw};function cw(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 dw(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Me(u)?Ue(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const fw={tokenize:hw};function hw(e){const t=this,n=e.attempt(yi,r,e.attempt(this.parser.constructs.flowInitial,a,Ue(e,e.attempt(this.parser.constructs.flow,a,e.attempt(bD,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 mw={resolveAll:Ch()},pw=xh("string"),gw=xh("text");function xh(e){return{tokenize:t,resolveAll:Ch(e==="text"?vw:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Ch(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 vw(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 bw(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:C,enter:D,exit:A,attempt:S(E),check:S(k),interrupt:S(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:v,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(R){return s=St(s,R),b(),s[s.length-1]!==null?[]:($(t,0),u.events=Wo(i,u.events,u),u.events)}function p(R,B){return xw(m(R),B)}function m(R){return yw(s,R)}function v(){const{line:R,column:B,offset:F,_index:P,_bufferIndex:j}=r;return{line:R,column:B,offset:F,_index:P,_bufferIndex:j}}function f(R){a[R.line]=R.column,z()}function b(){let R;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<B.length;)g(B.charCodeAt(r._bufferIndex));else g(B)}}function g(R){d=d(R)}function C(R){ye(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,z()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=R}function D(R,B){const F=B||{};return F.type=R,F.start=v(),u.events.push(["enter",F,u]),o.push(F),F}function A(R){const B=o.pop();return B.end=v(),u.events.push(["exit",B,u]),B}function E(R,B){$(R,B.from)}function k(R,B){B.restore()}function S(R,B){return F;function F(P,j,U){let W,ne,re,w;return Array.isArray(P)?se(P):"tokenize"in P?se([P]):Q(P);function Q(T){return L;function L(G){const Y=G!==null&&T[G],te=G!==null&&T.null,le=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(te)?te:te?[te]:[]];return se(le)(G)}}function se(T){return W=T,ne=0,T.length===0?U:_(T[ne])}function _(T){return L;function L(G){return w=M(),re=T,T.partial||(u.currentConstruct=T),T.name&&u.parser.constructs.disable.null.includes(T.name)?q():T.tokenize.call(B?Object.assign(Object.create(u),B):u,l,O,q)(G)}}function O(T){return R(re,w),j}function q(T){return w.restore(),++ne<W.length?_(W[ne]):U}}}function $(R,B){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&sn(u.events,B,u.events.length-B,R.resolve(u.events.slice(B),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function M(){const R=v(),B=u.previous,F=u.currentConstruct,P=u.events.length,j=Array.from(o);return{restore:U,from:P};function U(){r=R,u.previous=B,u.currentConstruct=F,u.events.length=P,o=j,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function yw(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 xw(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=`
82
82
  `;break}case-3:{s=`\r
83
- `;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 yw={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:dh},xw={91:DC},Dw={[-2]:ts,[-1]:ts,32:ts},Cw={35:FC,42:Pa,45:[Bc,Pa],60:SC,61:Bc,95:Pa,96:Fc,126:Fc},ww={38:hh,92:fh},Ew={[-5]:ns,[-4]:ns,[-3]:ns,33:YC,38:hh,42:Js,60:[QD,IC],91:QC,92:[_C,fh],93:Wo,95:Js,96:cC},_w={null:[Js,fw]},kw={null:[42,95]},Fw={null:[]},Aw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kw,contentInitial:xw,disable:Fw,document:yw,flow:Cw,flowInitial:Dw,insideSpan:_w,string:ww,text:Ew},Symbol.toStringTag,{value:"Module"}));function Bw(e){const n=ND([Aw,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(WD),document:a(HD),flow:a(cw),string:a(hw),text:a(mw)};return r;function a(i){return s;function s(o){return gw(r,i,o)}}}function Tw(e){for(;!mh(e););return e}const Tc=/[\0\t\n\r]/g;function Sw(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Tc.lastIndex=h,u=Tc.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const jw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ow(e){return e.replace(jw,Pw)}function Pw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return ch(n.slice(i?2:1),i?16:10)}return qo(n)||e}const xh={}.hasOwnProperty;function Mw(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Nw(n)(Tw(Bw(n).document().write(Sw()(e,t,!0))))}function Nw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ke),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(pe),blockQuote:i(G),characterEscape:M,characterReference:M,codeFenced:i(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(re,s),codeText:i(le,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(me),hardBreakEscape:i(ke),hardBreakTrailing:i(ke),htmlFlow:i(je,s),htmlFlowData:M,htmlText:i(je,s),htmlTextData:M,image:i(Te),label:s,link:i(Ke),listItem:i($e),listItemValue:p,listOrdered:i(Ne,h),listUnordered:i(Ne),paragraph:i(Qe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Ae),thematicBreak:i(be)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Y,autolinkProtocol:z,blockQuote:l(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:v,codeFlowValue:q,codeIndented:l(g),codeText:l(O),codeTextData:q,data:q,definition:l(),definitionDestinationString:A,definitionLabelString:w,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(F),htmlFlowData:q,htmlText:l(P),htmlTextData:q,image:l(W),label:te,labelText:ie,lineEnding:I,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:C,resourceTitleString:X,resource:ue,setextHeading:l(L),setextHeadingLineSequence:j,setextHeadingText:k,strong:l(),thematicBreak:l()}};Dh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(V){let ne={type:"root",children:[]};const he={stack:[ne],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ge=[];let we=-1;for(;++we<V.length;)if(V[we][1].type==="listOrdered"||V[we][1].type==="listUnordered")if(V[we][0]==="enter")ge.push(we);else{const Ye=ge.pop();we=a(V,Ye,we)}for(we=-1;++we<V.length;){const Ye=t[V[we][0]];xh.call(Ye,V[we][1].type)&&Ye[V[we][1].type].call(Object.assign({sliceSerialize:V[we][2].sliceSerialize},he),V[we][1])}if(he.tokenStack.length>0){const Ye=he.tokenStack[he.tokenStack.length-1];(Ye[1]||Sc).call(he,void 0,Ye[0])}for(ne.position={start:dn(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:dn(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ne=t.transforms[we](ne)||ne;return ne}function a(V,ne,he){let ge=ne-1,we=-1,Ye=!1,Ge,ot,Ft,gt;for(;++ge<=he;){const et=V[ge];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?we++:we--,gt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Ge&&!gt&&!we&&!Ft&&(Ft=ge),gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gt=void 0}if(!we&&et[0]==="enter"&&et[1].type==="listItemPrefix"||we===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Ge){let xe=ge;for(ot=void 0;xe--;){const Fe=V[xe];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;ot&&(V[ot][1].type="lineEndingBlank",Ye=!0),Fe[1].type="lineEnding",ot=xe}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}Ft&&(!ot||Ft<ot)&&(Ge._spread=!0),Ge.end=Object.assign({},ot?V[ot][1].start:et[1].end),V.splice(ot||ge,0,["exit",Ge,et[2]]),ge++,he++}if(et[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Ge=xe,V.splice(ge,0,["enter",xe,et[2]]),ge++,he++,Ft=void 0,gt=!0}}}return V[ne][1]._spread=Ye,he}function i(V,ne){return he;function he(ge){o.call(this,V(ge),ge),ne&&ne.call(this,ge)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(V,ne,he){this.stack[this.stack.length-1].children.push(V),this.stack.push(V),this.tokenStack.push([ne,he]),V.position={start:dn(ne.start),end:void 0}}function l(V){return ne;function ne(he){V&&V.call(this,he),u.call(this,he)}}function u(V,ne){const he=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==V.type&&(ne?ne.call(this,V,ge[0]):(ge[1]||Sc).call(this,V,ge[0]));else throw new Error("Cannot close `"+V.type+"` ("+Mr({start:V.start,end:V.end})+"): it’s not open");he.position.end=dn(V.end)}function d(){return PD(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(V){if(this.data.expectingFirstListItemValue){const ne=this.stack[this.stack.length-2];ne.start=Number.parseInt(this.sliceSerialize(V),10),this.data.expectingFirstListItemValue=void 0}}function m(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.lang=V}function v(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.meta=V}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.value=V.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.value=V.replace(/(\r?\n|\r)$/g,"")}function w(V){const ne=this.resume(),he=this.stack[this.stack.length-1];he.label=ne,he.identifier=ar(this.sliceSerialize(V)).toLowerCase()}function E(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.title=V}function A(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.url=V}function D(V){const ne=this.stack[this.stack.length-1];if(!ne.depth){const he=this.sliceSerialize(V).length;ne.depth=he}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function j(V){const ne=this.stack[this.stack.length-1];ne.depth=this.sliceSerialize(V).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function M(V){const he=this.stack[this.stack.length-1].children;let ge=he[he.length-1];(!ge||ge.type!=="text")&&(ge=qe(),ge.position={start:dn(V.start),end:void 0},he.push(ge)),this.stack.push(ge)}function q(V){const ne=this.stack.pop();ne.value+=this.sliceSerialize(V),ne.position.end=dn(V.end)}function I(V){const ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ne.children[ne.children.length-1];he.position.end=dn(V.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ne.type)&&(M.call(this,V),q.call(this,V))}function B(){this.data.atHardBreak=!0}function F(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.value=V}function P(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.value=V}function O(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.value=V}function U(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=ne,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function W(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=ne,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function ie(V){const ne=this.sliceSerialize(V),he=this.stack[this.stack.length-2];he.label=Ow(ne),he.identifier=ar(ne).toLowerCase()}function te(){const V=this.stack[this.stack.length-1],ne=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const ge=V.children;he.children=ge}else he.alt=ne}function C(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.url=V}function X(){const V=this.resume(),ne=this.stack[this.stack.length-1];ne.title=V}function ue(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function T(V){const ne=this.resume(),he=this.stack[this.stack.length-1];he.label=ne,he.identifier=ar(this.sliceSerialize(V)).toLowerCase(),this.data.referenceType="full"}function $(V){this.data.characterReferenceType=V.type}function S(V){const ne=this.sliceSerialize(V),he=this.data.characterReferenceType;let ge;he?(ge=ch(ne,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=qo(ne);const we=this.stack.pop();we.value+=ge,we.position.end=dn(V.end)}function z(V){q.call(this,V);const ne=this.stack[this.stack.length-1];ne.url=this.sliceSerialize(V)}function Y(V){q.call(this,V);const ne=this.stack[this.stack.length-1];ne.url="mailto:"+this.sliceSerialize(V)}function G(){return{type:"blockquote",children:[]}}function re(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function je(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Ke(){return{type:"link",title:null,url:"",children:[]}}function Ne(V){return{type:"list",ordered:V.type==="listOrdered",start:null,spread:V._spread,children:[]}}function $e(V){return{type:"listItem",spread:V._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function be(){return{type:"thematicBreak"}}}function dn(e){return{line:e.line,column:e.column,offset:e.offset}}function Dh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Dh(e,r):Rw(e,r)}}function Rw(e,t){let n;for(n in t)if(xh.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 Sc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is still open")}function Iw(e){const t=this;t.parser=n;function n(r){return Mw(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ch(e,t){var l,u,d;const n={...er,...t==null?void 0:t.nodeTypes,[H.heading]:{...er[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Ch({...h,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(h=>({...h,[n[H.heading][e.depth||1]]:!0}))};case ht.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case ht.listItem:return{type:n[H.li],children:s};case ht.paragraph:return{type:n[H.paragraph],children:s};case ht.link:return{type:n[H.link],[r]:e.url,children:s};case ht.image:return{type:n[H.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ht.blockquote:return{type:n[H.blockquote],children:s};case ht.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case ht.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[H.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:H.paragraph,children:[{text:e.value||""}]};case ht.emphasis:return{[n[Vt.emphasis]]:!0,...rs(s),...ya(s)};case ht.strong:return{[n[Vt.strong]]:!0,...rs(s),...ya(s)};case ht.delete:return{[n[Vt.delete]]:!0,...rs(s),...ya(s)};case ht.inlineCode:return{[n[Vt.code]]:!0,text:e.value,...ya(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const rs=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function ya(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const $w=function(t){const n=r=>r.children.map(a=>Ch(a,t));this.Compiler=n},Lw=(e,t=n=>{})=>{BD().use(Iw).use($w).process(e).then(n=>{const r=An(n.result),a=s=>{const o=s;[H.li,H.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===H.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===H.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Hs)){const h=u,p=d.text.replace(Hs,""),m="link"in h&&h.link?h.link:"";h.type=H.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),v=o.text.substring(p+d.length),f=[{text:m},{text:h,[H.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Vo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},zw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=R.parent(a),r=oe.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},qw=e=>{const{selection:t}=e;return t?x.string(e,t):null},jc=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Uw=e=>{for(const[t]of oe.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Oc={"mod+b":H.bold,"mod+i":H.italic,"mod+shift+x":H.strikethrough,"mod+k":H.link,"mod+shift+7":H.ol,"mod+shift+8":H.ul,"mod+shift+9":H.blockquote},Ww=(e,t,n,r)=>{for(const a in Oc)if(Ix(a,e)){e.stopPropagation(),e.preventDefault();const i=Oc[a];if(i===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(eE(i)){Th(t,i,r);return}Fh(t,i,r)}},wh=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:H.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||sh),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),Vo(r)},Vw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Z.isCollapsed(i)){const[s]=Z.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(sd);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},v=x.range(e,p,m),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const E=d[1];let A=[];r&&(A=await r({name:E})),a([{type:"mentionPopover",value:{show:A.length>0?!0:n!==null,selectedUser:0,possibleUsers:A,position:A.length>0?v:null,numberOfUsers:A.length>0?A.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Eh=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Zn=e=>typeof e.text=="string",Hw=[H.hr,H.image,H.mention],Pc="<br>";function _h(e,t={nodeTypes:er}){const{nodeTypes:n=er,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...er,...n,heading:{...er[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=i;if(!Zn(e)&&s!==H.mention&&(u=e.children.map(d=>{const h=Zn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!Zn(e)&&Array.isArray(e.children)&&(m=e.children.some(v=>!Zn(v)&&v.type===o.link)),_h({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(i===""||i===`
84
- `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Pc),!(u===""&&!Hw.find(d=>o[d]===s)))switch(u!==Pc&&Zn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Yn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Yn(u,"***"):(e[H.bold]&&(u=Yn(u,"**")),e[H.italic]&&(u=Yn(u,"_")),e[H.strikethrough]&&(u=Yn(u,"~~")),e[H.code]&&(u=Yn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
83
+ `;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 Cw={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:hh},Dw={91:wD},ww={[-2]:ns,[-1]:ns,32:ns},Ew={35:BD,42:Ma,45:[Tc,Ma],60:OD,61:Tc,95:Ma,96:Ac,126:Ac},_w={38:ph,92:mh},kw={[-5]:rs,[-4]:rs,[-3]:rs,33:QD,38:ph,42:Xs,60:[XC,LD],91:XD,92:[FD,mh],93:Vo,95:Xs,96:fD},Fw={null:[Xs,mw]},Aw={null:[42,95]},Bw={null:[]},Tw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Aw,contentInitial:Dw,disable:Bw,document:Cw,flow:Ew,flowInitial:ww,insideSpan:Fw,string:_w,text:kw},Symbol.toStringTag,{value:"Module"}));function Sw(e){const n=RC([Tw,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(HC),document:a(ZC),flow:a(fw),string:a(pw),text:a(gw)};return r;function a(i){return s;function s(o){return bw(r,i,o)}}}function jw(e){for(;!gh(e););return e}const Sc=/[\0\t\n\r]/g;function Ow(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Sc.lastIndex=h,u=Sc.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Pw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Mw(e){return e.replace(Pw,Nw)}function Nw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return fh(n.slice(i?2:1),i?16:10)}return Uo(n)||e}const Dh={}.hasOwnProperty;function Iw(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Rw(n)(jw(Sw(n).document().write(Ow()(e,t,!0))))}function Rw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ke),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(fe),blockQuote:i(Y),characterEscape:M,characterReference:M,codeFenced:i(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(te,s),codeText:i(le,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ke),hardBreakTrailing:i(ke),htmlFlow:i(Oe,s),htmlFlowData:M,htmlText:i(Oe,s),htmlTextData:M,image:i(Te),label:s,link:i(Ke),listItem:i($e),listItemValue:p,listOrdered:i(Ne,h),listUnordered:i(Ne),paragraph:i(Qe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(fe),strong:i(Ae),thematicBreak:i(be)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:G,autolinkProtocol:L,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:T,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:l(g),codeText:l(j),codeTextData:z,data:z,definition:l(),definitionDestinationString:A,definitionLabelString:C,definitionTitleString:D,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(F),htmlFlowData:z,htmlText:l(P),htmlTextData:z,image:l(W),label:re,labelText:ne,lineEnding:R,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:O,resourceDestinationString:w,resourceTitleString:Q,resource:se,setextHeading:l($),setextHeadingLineSequence:S,setextHeadingText:k,strong:l(),thematicBreak:l()}};wh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(V){let ae={type:"root",children:[]};const me={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ge=[];let we=-1;for(;++we<V.length;)if(V[we][1].type==="listOrdered"||V[we][1].type==="listUnordered")if(V[we][0]==="enter")ge.push(we);else{const Ye=ge.pop();we=a(V,Ye,we)}for(we=-1;++we<V.length;){const Ye=t[V[we][0]];Dh.call(Ye,V[we][1].type)&&Ye[V[we][1].type].call(Object.assign({sliceSerialize:V[we][2].sliceSerialize},me),V[we][1])}if(me.tokenStack.length>0){const Ye=me.tokenStack[me.tokenStack.length-1];(Ye[1]||jc).call(me,void 0,Ye[0])}for(ae.position={start:fn(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:fn(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ae=t.transforms[we](ae)||ae;return ae}function a(V,ae,me){let ge=ae-1,we=-1,Ye=!1,Ge,ot,Ft,gt;for(;++ge<=me;){const et=V[ge];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?we++:we--,gt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Ge&&!gt&&!we&&!Ft&&(Ft=ge),gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gt=void 0}if(!we&&et[0]==="enter"&&et[1].type==="listItemPrefix"||we===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Ge){let xe=ge;for(ot=void 0;xe--;){const Fe=V[xe];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;ot&&(V[ot][1].type="lineEndingBlank",Ye=!0),Fe[1].type="lineEnding",ot=xe}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}Ft&&(!ot||Ft<ot)&&(Ge._spread=!0),Ge.end=Object.assign({},ot?V[ot][1].start:et[1].end),V.splice(ot||ge,0,["exit",Ge,et[2]]),ge++,me++}if(et[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Ge=xe,V.splice(ge,0,["enter",xe,et[2]]),ge++,me++,Ft=void 0,gt=!0}}}return V[ae][1]._spread=Ye,me}function i(V,ae){return me;function me(ge){o.call(this,V(ge),ge),ae&&ae.call(this,ge)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(V,ae,me){this.stack[this.stack.length-1].children.push(V),this.stack.push(V),this.tokenStack.push([ae,me]),V.position={start:fn(ae.start),end:void 0}}function l(V){return ae;function ae(me){V&&V.call(this,me),u.call(this,me)}}function u(V,ae){const me=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==V.type&&(ae?ae.call(this,V,ge[0]):(ge[1]||jc).call(this,V,ge[0]));else throw new Error("Cannot close `"+V.type+"` ("+Nr({start:V.start,end:V.end})+"): it’s not open");me.position.end=fn(V.end)}function d(){return NC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(V){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(V),10),this.data.expectingFirstListItemValue=void 0}}function m(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=V}function v(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=V}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.value=V.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.value=V.replace(/(\r?\n|\r)$/g,"")}function C(V){const ae=this.resume(),me=this.stack[this.stack.length-1];me.label=ae,me.identifier=ar(this.sliceSerialize(V)).toLowerCase()}function D(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.title=V}function A(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.url=V}function E(V){const ae=this.stack[this.stack.length-1];if(!ae.depth){const me=this.sliceSerialize(V).length;ae.depth=me}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function S(V){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(V).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function M(V){const me=this.stack[this.stack.length-1].children;let ge=me[me.length-1];(!ge||ge.type!=="text")&&(ge=qe(),ge.position={start:fn(V.start),end:void 0},me.push(ge)),this.stack.push(ge)}function z(V){const ae=this.stack.pop();ae.value+=this.sliceSerialize(V),ae.position.end=fn(V.end)}function R(V){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ae.children[ae.children.length-1];me.position.end=fn(V.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(M.call(this,V),z.call(this,V))}function B(){this.data.atHardBreak=!0}function F(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.value=V}function P(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.value=V}function j(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.value=V}function U(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=ae,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function W(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=ae,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function ne(V){const ae=this.sliceSerialize(V),me=this.stack[this.stack.length-2];me.label=Mw(ae),me.identifier=ar(ae).toLowerCase()}function re(){const V=this.stack[this.stack.length-1],ae=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ge=V.children;me.children=ge}else me.alt=ae}function w(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.url=V}function Q(){const V=this.resume(),ae=this.stack[this.stack.length-1];ae.title=V}function se(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function O(V){const ae=this.resume(),me=this.stack[this.stack.length-1];me.label=ae,me.identifier=ar(this.sliceSerialize(V)).toLowerCase(),this.data.referenceType="full"}function q(V){this.data.characterReferenceType=V.type}function T(V){const ae=this.sliceSerialize(V),me=this.data.characterReferenceType;let ge;me?(ge=fh(ae,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=Uo(ae);const we=this.stack.pop();we.value+=ge,we.position.end=fn(V.end)}function L(V){z.call(this,V);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(V)}function G(V){z.call(this,V);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(V)}function Y(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function fe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Ke(){return{type:"link",title:null,url:"",children:[]}}function Ne(V){return{type:"list",ordered:V.type==="listOrdered",start:null,spread:V._spread,children:[]}}function $e(V){return{type:"listItem",spread:V._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function be(){return{type:"thematicBreak"}}}function fn(e){return{line:e.line,column:e.column,offset:e.offset}}function wh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wh(e,r):$w(e,r)}}function $w(e,t){let n;for(n in t)if(Dh.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 jc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Nr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Nr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Nr({start:t.start,end:t.end})+") is still open")}function Lw(e){const t=this;t.parser=n;function n(r){return Iw(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Eh(e,t){var l,u,d;const n={...er,...t==null?void 0:t.nodeTypes,[H.heading]:{...er[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Eh({...h,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(h=>({...h,[n[H.heading][e.depth||1]]:!0}))};case ht.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case ht.listItem:return{type:n[H.li],children:s};case ht.paragraph:return{type:n[H.paragraph],children:s};case ht.link:return{type:n[H.link],[r]:e.url,children:s};case ht.image:return{type:n[H.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ht.blockquote:return{type:n[H.blockquote],children:s};case ht.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case ht.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[H.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:H.paragraph,children:[{text:e.value||""}]};case ht.emphasis:return{[n[Ht.emphasis]]:!0,...as(s),...xa(s)};case ht.strong:return{[n[Ht.strong]]:!0,...as(s),...xa(s)};case ht.delete:return{[n[Ht.delete]]:!0,...as(s),...xa(s)};case ht.inlineCode:return{[n[Ht.code]]:!0,text:e.value,...xa(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const as=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function xa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const zw=function(t){const n=r=>r.children.map(a=>Eh(a,t));this.Compiler=n},qw=(e,t=n=>{})=>{SC().use(Lw).use(zw).process(e).then(n=>{const r=It(n.result),a=s=>{const o=s;[H.li,H.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===H.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===H.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Ks)){const h=u,p=d.text.replace(Ks,""),m="link"in h&&h.link?h.link:"";h.type=H.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),v=o.text.substring(p+d.length),f=[{text:m},{text:h,[H.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Ho=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Uw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},Ww=e=>{const{selection:t}=e;return t?x.string(e,t):null},Oc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Vw=e=>{for(const[t]of ue.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Pc={"mod+b":H.bold,"mod+i":H.italic,"mod+shift+x":H.strikethrough,"mod+k":H.link,"mod+shift+7":H.ol,"mod+shift+8":H.ul,"mod+shift+9":H.blockquote},Hw=(e,t,n,r)=>{for(const a in Pc)if(Lx(a,e)){e.stopPropagation(),e.preventDefault();const i=Pc[a];if(i===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(nE(i)){jh(t,i,r);return}Bh(t,i,r)}},_h=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:H.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||uh),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),Ho(r)},Kw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Z.isCollapsed(i)){const[s]=Z.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(od);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},v=x.range(e,p,m),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const D=d[1];let A=[];r&&(A=await r({name:D})),a([{type:"mentionPopover",value:{show:A.length>0?!0:n!==null,selectedUser:0,possibleUsers:A,position:A.length>0?v:null,numberOfUsers:A.length>0?A.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},kh=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Zn=e=>typeof e.text=="string",Zw=[H.hr,H.image,H.mention],Mc="<br>";function Fh(e,t={nodeTypes:er}){const{nodeTypes:n=er,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...er,...n,heading:{...er[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=i;if(!Zn(e)&&s!==H.mention&&(u=e.children.map(d=>{const h=Zn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!Zn(e)&&Array.isArray(e.children)&&(m=e.children.some(v=>!Zn(v)&&v.type===o.link)),Fh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(i===""||i===`
84
+ `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Mc),!(u===""&&!Zw.find(d=>o[d]===s)))switch(u!==Mc&&Zn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Yn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Yn(u,"***"):(e[H.bold]&&(u=Yn(u,"**")),e[H.italic]&&(u=Yn(u,"_")),e[H.strikethrough]&&(u=Yn(u,"~~")),e[H.code]&&(u=Yn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
85
85
  `;case o[H.heading][2]:return`## ${u}
86
86
  `;case o[H.heading][3]:return`### ${u}
87
87
  `;case o[H.heading][4]:return`#### ${u}
@@ -100,20 +100,20 @@ ${m}${h?"1.":"-"} ${u}${p?`
100
100
  `:""}`;case o[H.paragraph]:return`${u}
101
101
 
102
102
  `;case o[H.hr]:return`---
103
- `;default:return u}}function Yn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Mc(t)}`;if(r.length===e.length)return a;const i=t+r+Mc(t);return e.replace(n,i)}const Mc=e=>e.split("").reverse().join(""),Kw=e=>e.map(t=>_h(t)).join("").trim();const Zw=({onFallbackClick:e=()=>{}})=>{const t=ae.useIntl(),n=zn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(un),{show:l,selectedUser:u,possibleUsers:d}=i,h=oh(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Eh(a);return c.jsx(pr,{parent:p,children:c.jsx(dd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:v},f)=>c.jsx(nn,{element:"li",className:K({selected:f===u}),member:{id:m,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...i,selectedUser:f};r([{type:"mentionPopover",value:g}]),wh(n,g,r,s),o&&o({id:m||"",name:v.name||""})}}},m)),c.jsx(nn,{element:"li",className:K("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Zt}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Ho=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Oe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Ko=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ae.useIntl(),u=zn(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:v}=y.useContext(un),f={};return e!==h&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:K(e,{"has-divider":n}),onMouseEnter:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:K(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,w,E,A;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const D=b.currentTarget.closest("li");let k=D==null?void 0:D.nextElementSibling;if(b.key==="ArrowLeft"){const M=D==null?void 0:D.previousElementSibling;M?k=M:k=(g=D==null?void 0:D.parentElement)==null?void 0:g.lastElementChild}else k||(k=(w=D==null?void 0:D.parentElement)==null?void 0:w.firstElementChild);const j=k==null?void 0:k.className.split(" ")[0];j&&(p(j),(E=k==null?void 0:k.querySelector("button"))==null||E.focus());break;default:const L=b.currentTarget.closest("fieldset");if(L){(A=L==null?void 0:L.previousElementSibling)==null||A.focus();break}}},children:[c.jsx(Oe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx($n,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Nc=[H.ol,H.ul],kh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},Yw=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Fh=(e,t,n)=>{try{const r=Yw(e),a=kh(e,t),i=Nc.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&de.isElement(u)&&Nc.includes(u.type)},split:!0});const o={type:a?H.paragraph:i?H.li:t};if(J.setNodes(e,o),t===H.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),J.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:p=>{const m=p;return!x.isEditor(p)&&de.isElement(p)&&m.type===H.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:H.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Rc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(un),a=zn(),i=kh(a,e);return c.jsx(Ko,{id:e,active:i,hasDivider:t,callback:()=>{Fh(a,e,r),n(i?null:e)}})},Rr=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&de.isElement(n)&&r.type===H.link}});return!!t},Gw=(e,t,n,r)=>{e.selection&&Zo(e,t,n,r)},Qw=(e,t,n,r)=>{const{selection:a}=e;if(a&&Z.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&de.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),Vo(n)}}else Zo(e,t,n,r)},Zo=(e,t,n,r=a=>{console.error(a)})=>{try{Rr(e)&&Ah(e);const{selection:a}=e,i=a&&Z.isCollapsed(a),s={type:H.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),Vo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Ah=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&de.isElement(t)&&n.type===H.link}})};let as=null;const Jw=()=>{const e=ae.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(un),u=zn(),d=dD(u),h=(d==null?void 0:d.text)||qw(u),p=i!==!1,[m,v]=y.useState(Rr(u)),f=oh(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var D;!m&&r&&((D=b.current)==null||D.focus())},[m]),y.useEffect(()=>{as&&clearTimeout(as),as=setTimeout(()=>{v(Rr(u))},500)},[u.selection]);const g=[],w=["open","edit","remove"].map(D=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(g.push({className:D}),D){case"open":k.href=(d==null?void 0:d.full)||"",k.onClick=j=>{j.preventDefault(),j.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Oe,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":k.onClick=()=>{v(!1)};break;case"remove":k.onClick=()=>{const j=[{type:"showLinkEditor",value:!1}];Rr(u)&&(Ah(u),j.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&j.push({type:"enrichedUrl",value:!1})),s(j)};break}return k}),E=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!u)return;D.preventDefault(),D.stopPropagation();const k=x.end(u,[]);J.select(u,k),ee.focus(u)}}}}];h&&E.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const A=Eh(a);return c.jsx(pr,{parent:A,children:c.jsx($n,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!m},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=b.current)==null?void 0:D.focus()})}},children:m?c.jsx(mr,{wrappers:g,buttons:w}):c.jsx(Gt,{element:"fieldset",id:`${n}-link-editor`,className:K({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{const k=[{type:"showLinkEditor",value:!1}];let j=D.url;if(D.url){const{full:L}=io(D.url);j=L,d!=null&&d.full?Qw(u,j,n,l):Gw(u,j,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),D.url&&o&&(!p||i&&(d==null?void 0:d.full)===i.url)){const L=await o(j);L.url&&s([{type:"enrichedUrl",value:L}])}})}},fields:E,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},Xw=()=>{const e=zn(),{setFocus:t,dispatch:n}=y.useContext(un),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Rr(e))},[e.selection]),c.jsx(Ko,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},eE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Bh=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Th=(e,t,n)=>{try{Bh(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},tE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(un),a=zn(),i=Bh(a,e);return c.jsx(Ko,{id:e,active:i,hasDivider:t,callback:()=>{Th(a,e,r),n(i?null:e)}})},Xa=[H.bold,H.italic,H.strikethrough],nE=[H.ol,H.ul,H.blockquote];const rE=({styling:e={showHeadingOption:!1},...t})=>{const n=ae.useIntl(),{id:r}=y.useContext(un);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Oe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(Rc,{format:H.h3,hasDivider:!0},H.h3),Xa.map((a,i)=>c.jsx(tE,{format:a,hasDivider:i===Xa.length-1},a)),c.jsx(Xw,{}),nE.map((a,i)=>c.jsx(Rc,{format:a,hasDivider:i===1},a))]})]}),c.jsx(Jw,{})]})};function aE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function Xs(e,t){return Array(t+1).join(e)}function iE(e){return e.replace(/^\n*/,"")}function sE(e){for(var t=e.length;t>0&&e[t-1]===`
104
- `;)t--;return e.substring(0,t)}var oE=["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 Yo(e){return Go(e,oE)}var Sh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function jh(e){return Go(e,Sh)}function uE(e){return Ph(e,Sh)}var Oh=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function lE(e){return Go(e,Oh)}function cE(e){return Ph(e,Oh)}function Go(e,t){return t.indexOf(e.nodeName)>=0}function Ph(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var ct={};ct.paragraph={filter:"p",replacement:function(e){return`
103
+ `;default:return u}}function Yn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Nc(t)}`;if(r.length===e.length)return a;const i=t+r+Nc(t);return e.replace(n,i)}const Nc=e=>e.split("").reverse().join(""),Yw=e=>e.map(t=>Fh(t)).join("").trim();const Gw=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=zn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(ln),{show:l,selectedUser:u,possibleUsers:d}=i,h=lh(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=kh(a);return c.jsx(pr,{parent:p,children:c.jsx(fd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:v},f)=>c.jsx(rn,{element:"li",className:K({selected:f===u}),member:{id:m,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...i,selectedUser:f};r([{type:"mentionPopover",value:g}]),_h(n,g,r,s),o&&o({id:m||"",name:v.name||""})}}},m)),c.jsx(rn,{element:"li",className:K("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Yt}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Ko=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(je,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Zo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ie.useIntl(),u=zn(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:v}=y.useContext(ln),f={};return e!==h&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:K(e,{"has-divider":n}),onMouseEnter:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:K(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,C,D,A;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const E=b.currentTarget.closest("li");let k=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const M=E==null?void 0:E.previousElementSibling;M?k=M:k=(g=E==null?void 0:E.parentElement)==null?void 0:g.lastElementChild}else k||(k=(C=E==null?void 0:E.parentElement)==null?void 0:C.firstElementChild);const S=k==null?void 0:k.className.split(" ")[0];S&&(p(S),(D=k==null?void 0:k.querySelector("button"))==null||D.focus());break;default:const $=b.currentTarget.closest("fieldset");if($){(A=$==null?void 0:$.previousElementSibling)==null||A.focus();break}}},children:[c.jsx(je,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx($n,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ic=[H.ol,H.ul],Ah=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},Qw=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Bh=(e,t,n)=>{try{const r=Qw(e),a=Ah(e,t),i=Ic.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&de.isElement(u)&&Ic.includes(u.type)},split:!0});const o={type:a?H.paragraph:i?H.li:t};if(J.setNodes(e,o),t===H.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),J.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:p=>{const m=p;return!x.isEditor(p)&&de.isElement(p)&&m.type===H.li}})).forEach(([p,m])=>{ue.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:H.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Rc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),a=zn(),i=Ah(a,e);return c.jsx(Zo,{id:e,active:i,hasDivider:t,callback:()=>{Bh(a,e,r),n(i?null:e)}})},Rr=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&de.isElement(n)&&r.type===H.link}});return!!t},Jw=(e,t,n,r)=>{e.selection&&Yo(e,t,n,r)},Xw=(e,t,n,r)=>{const{selection:a}=e;if(a&&Z.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&de.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),Ho(n)}}else Yo(e,t,n,r)},Yo=(e,t,n,r=a=>{console.error(a)})=>{try{Rr(e)&&Th(e);const{selection:a}=e,i=a&&Z.isCollapsed(a),s={type:H.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),Ho(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Th=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&de.isElement(t)&&n.type===H.link}})};let is=null;const eE=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(ln),u=zn(),d=hC(u),h=(d==null?void 0:d.text)||Ww(u),p=i!==!1,[m,v]=y.useState(Rr(u)),f=lh(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var E;!m&&r&&((E=b.current)==null||E.focus())},[m]),y.useEffect(()=>{is&&clearTimeout(is),is=setTimeout(()=>{v(Rr(u))},500)},[u.selection]);const g=[],C=["open","edit","remove"].map(E=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${E}`},{link:d==null?void 0:d.pretty})};switch(g.push({className:E}),E){case"open":k.href=(d==null?void 0:d.full)||"",k.onClick=S=>{S.preventDefault(),S.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(je,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":k.onClick=()=>{v(!1)};break;case"remove":k.onClick=()=>{const S=[{type:"showLinkEditor",value:!1}];Rr(u)&&(Th(u),S.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&S.push({type:"enrichedUrl",value:!1})),s(S)};break}return k}),D=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:E=>{if(E.key==="Tab"){if(!u)return;E.preventDefault(),E.stopPropagation();const k=x.end(u,[]);J.select(u,k),ee.focus(u)}}}}];h&&D.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const A=kh(a);return c.jsx(pr,{parent:A,children:c.jsx($n,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!m},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=b.current)==null?void 0:E.focus()})}},children:m?c.jsx(mr,{wrappers:g,buttons:C}):c.jsx(Qt,{element:"fieldset",id:`${n}-link-editor`,className:K({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async E=>{setTimeout(async()=>{const k=[{type:"showLinkEditor",value:!1}];let S=E.url;if(E.url){const{full:$}=so(E.url);S=$,d!=null&&d.full?Xw(u,S,n,l):Jw(u,S,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),E.url&&o&&(!p||i&&(d==null?void 0:d.full)===i.url)){const $=await o(S);$.url&&s([{type:"enrichedUrl",value:$}])}})}},fields:D,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},tE=()=>{const e=zn(),{setFocus:t,dispatch:n}=y.useContext(ln),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Rr(e))},[e.selection]),c.jsx(Zo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},nE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Sh=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},jh=(e,t,n)=>{try{Sh(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},rE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),a=zn(),i=Sh(a,e);return c.jsx(Zo,{id:e,active:i,hasDivider:t,callback:()=>{jh(a,e,r),n(i?null:e)}})},ei=[H.bold,H.italic,H.strikethrough],aE=[H.ol,H.ul,H.blockquote];const iE=({styling:e={showHeadingOption:!1},...t})=>{const n=ie.useIntl(),{id:r}=y.useContext(ln);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(je,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(Rc,{format:H.h3,hasDivider:!0},H.h3),ei.map((a,i)=>c.jsx(rE,{format:a,hasDivider:i===ei.length-1},a)),c.jsx(tE,{}),aE.map((a,i)=>c.jsx(Rc,{format:a,hasDivider:i===1},a))]})]}),c.jsx(eE,{})]})};function sE(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 eo(e,t){return Array(t+1).join(e)}function oE(e){return e.replace(/^\n*/,"")}function uE(e){for(var t=e.length;t>0&&e[t-1]===`
104
+ `;)t--;return e.substring(0,t)}var lE=["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 Go(e){return Qo(e,lE)}var Oh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Ph(e){return Qo(e,Oh)}function cE(e){return Nh(e,Oh)}var Mh=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function dE(e){return Qo(e,Mh)}function fE(e){return Nh(e,Mh)}function Qo(e,t){return t.indexOf(e.nodeName)>=0}function Nh(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var ct={};ct.paragraph={filter:"p",replacement:function(e){return`
105
105
 
106
106
  `+e+`
107
107
 
108
108
  `}};ct.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
109
- `}};ct.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=Xs(r===1?"=":"-",e.length);return`
109
+ `}};ct.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=eo(r===1?"=":"-",e.length);return`
110
110
 
111
111
  `+e+`
112
112
  `+a+`
113
113
 
114
114
  `}else return`
115
115
 
116
- `+Xs("#",r)+" "+e+`
116
+ `+eo("#",r)+" "+e+`
117
117
 
118
118
  `}};ct.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
119
119
 
@@ -132,7 +132,7 @@ ${m}${h?"1.":"-"} ${u}${p?`
132
132
  `+t.firstChild.textContent.replace(/\n/g,`
133
133
  `)+`
134
134
 
135
- `}};ct.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=Xs(s,o);return`
135
+ `}};ct.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=eo(s,o);return`
136
136
 
137
137
  `+d+a+`
138
138
  `+i.replace(/\n$/,"")+`
@@ -142,13 +142,13 @@ ${m}${h?"1.":"-"} ${u}${p?`
142
142
 
143
143
  `+n.hr+`
144
144
 
145
- `}};ct.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ei(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};ct.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ei(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
145
+ `}};ct.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ti(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};ct.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ti(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
146
146
 
147
147
  `+this.references.join(`
148
148
  `)+`
149
149
 
150
- `,this.references=[]),t}};ct.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};ct.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};ct.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};ct.image={filter:"img",replacement:function(e,t){var n=ei(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ei(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ei(e){return e?e.replace(/(\n+\s*)+/g,`
151
- `):""}function Mh(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}Mh.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=is(this.array,e,this.options))||(t=is(this._keep,e,this.options))||(t=is(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function is(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(dE(a,t,n))return a}}function dE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function fE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Ic(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ss(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=ss(l);continue}var d=Ic(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||ss(i))}}function ss(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Ic(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Qo=typeof window<"u"?window:{};function hE(){var e=Qo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function mE(){var e=function(){};return pE()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function pE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Qo.ActiveXObject&&(e=!0)}return e}var gE=hE()?Qo.DOMParser:mE();function vE(e,t){var n;if(typeof e=="string"){var r=bE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return fE({element:n,isBlock:Yo,isVoid:jh,isPre:t.preformattedCode?yE:null}),n}var os;function bE(){return os=os||new gE,os}function yE(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function xE(e,t){return e.isBlock=Yo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=DE(e),e.flankingWhitespace=CE(e,t),e}function DE(e){return!jh(e)&&!lE(e)&&/^\s*$/i.test(e.textContent)&&!uE(e)&&!cE(e)}function CE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=wE(e.textContent);return n.leadingAscii&&$c("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&$c("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function wE(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function $c(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Yo(r)&&(i=a.test(r.textContent))),i}var EE=Array.prototype.reduce,_E=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Zr(e){if(!(this instanceof Zr))return new Zr(e);var t={rules:ct,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
150
+ `,this.references=[]),t}};ct.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};ct.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};ct.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};ct.image={filter:"img",replacement:function(e,t){var n=ti(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ti(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ti(e){return e?e.replace(/(\n+\s*)+/g,`
151
+ `):""}function Ih(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}Ih.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ss(this.array,e,this.options))||(t=ss(this._keep,e,this.options))||(t=ss(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ss(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(hE(a,t,n))return a}}function hE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function mE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=$c(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=os(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=os(l);continue}var d=$c(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||os(i))}}function os(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function $c(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Jo=typeof window<"u"?window:{};function pE(){var e=Jo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function gE(){var e=function(){};return vE()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function vE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Jo.ActiveXObject&&(e=!0)}return e}var bE=pE()?Jo.DOMParser:gE();function yE(e,t){var n;if(typeof e=="string"){var r=xE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return mE({element:n,isBlock:Go,isVoid:Ph,isPre:t.preformattedCode?CE:null}),n}var us;function xE(){return us=us||new bE,us}function CE(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function DE(e,t){return e.isBlock=Go(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=wE(e),e.flankingWhitespace=EE(e,t),e}function wE(e){return!Ph(e)&&!dE(e)&&/^\s*$/i.test(e.textContent)&&!cE(e)&&!fE(e)}function EE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=_E(e.textContent);return n.leadingAscii&&Lc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Lc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function _E(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Lc(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Go(r)&&(i=a.test(r.textContent))),i}var kE=Array.prototype.reduce,FE=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Yr(e){if(!(this instanceof Yr))return new Yr(e);var t={rules:ct,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
152
152
 
153
153
  `:""},keepReplacement:function(n,r){return r.isBlock?`
154
154
 
@@ -158,8 +158,8 @@ ${m}${h?"1.":"-"} ${u}${p?`
158
158
 
159
159
  `+n+`
160
160
 
161
- `:n}};this.options=aE({},t,e),this.rules=new Mh(this.options)}Zr.prototype={turndown:function(e){if(!AE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Nh.call(this,new vE(e,this.options));return kE.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return _E.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Nh(e){var t=this;return EE.call(e.childNodes,function(n,r){r=new xE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=FE.call(t,r)),Rh(n,a)},"")}function kE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Rh(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function FE(e){var t=this.rules.forNode(e),n=Nh.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function Rh(e,t){var n=sE(e),r=iE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
161
+ `:n}};this.options=sE({},t,e),this.rules=new Ih(this.options)}Yr.prototype={turndown:function(e){if(!TE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Rh.call(this,new yE(e,this.options));return AE.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return FE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Rh(e){var t=this;return kE.call(e.childNodes,function(n,r){r=new DE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=BE.call(t,r)),$h(n,a)},"")}function AE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=$h(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function BE(e){var t=this.rules.forNode(e),n=Rh.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function $h(e,t){var n=uE(e),r=oE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
162
162
 
163
- `.substring(0,a);return n+i+r}function AE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var BE={isHistory(e){return st(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||pn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||pn.isOperationList(e.undos[0].operations))}},us=new WeakMap,ls=new WeakMap,tr={isHistoryEditor(e){return BE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return ls.get(e)},isSaving(e){return us.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=tr.isMerging(e);ls.set(e,!1),t(),ls.set(e,n)},withoutSaving(e,t){var n=tr.isSaving(e);us.set(e,!1),t(),us.set(e,n)}},TE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&J.setSelection(t,i.selectionBefore),tr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];tr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(pn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=tr.isSaving(t),d=tr.isMerging(t);if(u==null&&(u=jE(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=SE(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},SE=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&R.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&R.equals(e.path,t.path)),jE=(e,t)=>e.type!=="set_selection";const OE=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var PE=IE,ME=/^(?:\w+:)?\/\/(\S+)$/,NE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,RE=/^[^\s\.]+\.\S{2,}$/;function IE(e){if(typeof e!="string")return!1;var t=e.match(ME);if(!t)return!1;var n=t[1];return n?!!(NE.test(n)||RE.test(n)):!1}const $E=Rn(PE),LE=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[H.link].includes(s.type)||a(i)},e.insertText=i=>{i&&$E(i)?Zo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},zE=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===H.mention?!0:n(i),e.isVoid=i=>i.type===H.mention?!0:r(i),e.markableVoid=i=>i.type===H.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},qE=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===H.link&&oe.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Jo=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ae.useIntl(),h=km();typeof s>"u"&&(s=!0);const{isInOverlay:p=!1}=a||{},{listMembers:m,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:w=()=>{},reportError:E=S=>{console.error(S)}}=i||{},A=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const D={editorKey:null,originalValue:t||"",initialValue:t?null:A,tabbableOption:Xa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[k,j]=y.useReducer(Gr,D),{editorKey:L,originalValue:M,initialValue:q,stringValue:I,lastAnchor:B,lastKey:F,hasInteracted:P,hasLoaded:O,enrichedUrl:U,mentionPopover:W}=k,ie=S=>{S&&j([{type:"tabbableOption",value:S||Xa[0]}])},te=async S=>{const z=await g(S);z.url&&j([{type:"enrichedUrl",value:z}])},C=`rte-${e}`,X=y.useCallback(S=>c.jsx(wv,{...S}),[]),ue=y.useCallback(S=>c.jsx(Ev,{...S}),[]),_=y.useMemo(()=>OE(LE(zE(qE(TE(cD(hx())),E),E),C,E),E),[]),T=S=>{if(!_||S!==C)return;const z=x.end(_,[]);J.select(_,z),ee.focus(_)};y.useEffect(()=>{const S=z=>{var re;const Y=z,G=((re=Y==null?void 0:Y.detail)==null?void 0:re.id)||null;G&&T(G)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(_.children.length>0&&!O){if(j([{type:"hasLoaded",value:!0}]),!s)return;T(C)}},[_.children.length,q]),y.useEffect(()=>{M&&(async()=>{let z=An(M);if(z.includes("<")){Zr.prototype.escape=G=>G;const Y=new Zr;Y.addRule("br",{filter:["br"],replacement:G=>G+`
163
+ `.substring(0,a);return n+i+r}function TE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var SE={isHistory(e){return st(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||gn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||gn.isOperationList(e.undos[0].operations))}},ls=new WeakMap,cs=new WeakMap,tr={isHistoryEditor(e){return SE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return cs.get(e)},isSaving(e){return ls.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=tr.isMerging(e);cs.set(e,!1),t(),cs.set(e,n)},withoutSaving(e,t){var n=tr.isSaving(e);ls.set(e,!1),t(),ls.set(e,n)}},jE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&J.setSelection(t,i.selectionBefore),tr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];tr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(gn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=tr.isSaving(t),d=tr.isMerging(t);if(u==null&&(u=PE(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=OE(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},OE=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),PE=(e,t)=>e.type!=="set_selection";const ME=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var NE=LE,IE=/^(?:\w+:)?\/\/(\S+)$/,RE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,$E=/^[^\s\.]+\.\S{2,}$/;function LE(e){if(typeof e!="string")return!1;var t=e.match(IE);if(!t)return!1;var n=t[1];return n?!!(RE.test(n)||$E.test(n)):!1}const zE=In(NE),qE=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[H.link].includes(s.type)||a(i)},e.insertText=i=>{i&&zE(i)?Yo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},UE=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===H.mention?!0:n(i),e.isVoid=i=>i.type===H.mention?!0:r(i),e.markableVoid=i=>i.type===H.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},WE=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===H.link&&ue.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Xo=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ie.useIntl(),h=Am();typeof s>"u"&&(s=!0);const{isInOverlay:p=!1}=a||{},{listMembers:m,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:C=()=>{},reportError:D=T=>{console.error(T)}}=i||{},A=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:A,tabbableOption:ei[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[k,S]=y.useReducer(Qr,E),{editorKey:$,originalValue:M,initialValue:z,stringValue:R,lastAnchor:B,lastKey:F,hasInteracted:P,hasLoaded:j,enrichedUrl:U,mentionPopover:W}=k,ne=T=>{T&&S([{type:"tabbableOption",value:T||ei[0]}])},re=async T=>{const L=await g(T);L.url&&S([{type:"enrichedUrl",value:L}])},w=`rte-${e}`,Q=y.useCallback(T=>c.jsx(_v,{...T}),[]),se=y.useCallback(T=>c.jsx(kv,{...T}),[]),_=y.useMemo(()=>ME(qE(UE(WE(jE(fC(px())),D),D),w,D),D),[]),O=T=>{if(!_||T!==w)return;const L=x.end(_,[]);J.select(_,L),ee.focus(_)};y.useEffect(()=>{const T=L=>{var te;const G=L,Y=((te=G==null?void 0:G.detail)==null?void 0:te.id)||null;Y&&O(Y)};return window.addEventListener("focusEditor",T),()=>{window.removeEventListener("focusEditor",T)}},[]),y.useEffect(()=>{if(_.children.length>0&&!j){if(S([{type:"hasLoaded",value:!0}]),!s)return;O(w)}},[_.children.length,z]),y.useEffect(()=>{M&&(async()=>{let L=It(M);if(L.includes("<")){Yr.prototype.escape=Y=>Y;const G=new Yr;G.addRule("br",{filter:["br"],replacement:Y=>Y+`
164
164
 
165
- `}),z=Y.turndown(z)}o&&o.mentions&&(z=await ld({text:z,template:`[${Hs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),Lw(z,Y=>{const G=[{type:"initialValue",value:Y},{type:"editorKey",value:M.toString()}];o!=null&&o.link&&(G.push({type:"enrichedUrl",value:o.link}),o.link.url&&te(o.link.url)),j(G),setTimeout(()=>{j([{type:"stringValue",value:jc(_)}])},150)})})()},[M]),y.useEffect(()=>{if(U===void 0&&_){const z=Uw(_);z&&te(z)}const S=z=>{var re;const Y=z,G=((re=Y==null?void 0:Y.detail)==null?void 0:re.url)||null;G&&U&&U.url===G&&j([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[U]),y.useEffect(()=>{if(t){$r.lastIndex=0;const S=t.match($r);S&&S.length===1&&S[0].length===t.length&&!P&&j([{type:"originalValue",value:t}])}t!==""||!_||Na(M,t)&&!P||(x.withoutNormalizing(_,()=>{J.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),J.deselect(_),_.children.length!==0&&J.unwrapNodes(_,{at:[0]}),J.insertNodes(_,A,{at:[0]})}),j([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{I===""&&U&&j([{type:"enrichedUrl",value:void 0}])},[I]);const $=Qc(()=>{Vw({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:j})},100);return q?c.jsx("div",{id:C,className:"rich-text-editor",children:c.jsxs(un.Provider,{value:{...k,id:C,isInOverlay:p,setFocus:ie,dispatch:j,getLinkPreview:g,onMention:w,reportError:E},children:[c.jsxs(uD,{editor:_,initialValue:q,onChange:S=>{if(_.operations.some(Y=>Y.type!=="set_selection")){let Y=Kw(S);Y==="<br>"&&(Y=""),f(Y,U),j([{type:"stringValue",value:jc(_)}]),P||j([{type:"hasInteracted",value:!0}]),$(),h&&console.log({serialized:Y,json:S})}},...u,children:[c.jsx(X1,{className:"input",renderElement:X,renderLeaf:ue,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const z=U!==!1,Y=S.clipboardData.getData("text");if((re=>{try{return new URL(re),!0}catch{return!1}})(Y)){let re=Y;if(Y){const{full:le}=io(Y);re=le}if(Y&&g&&!z){const le=await g(re);le.url&&j([{type:"enrichedUrl",value:le}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),wh(_,W,j,C));const{selection:z}=_;if(z){const Y=Z.isCollapsed(z),[G,re]=x.node(_,z,{depth:1});let le=G,Q=le.type;const me=le.children[0];if(me&&(me==null?void 0:me[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),J.insertNodes(_,A)),me&&[H.ol,H.ul].includes(me.type)&&(le=me,Q=me.type),le&&de.isElement(le)&&Q!==H.paragraph){if(Q===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),J.insertNodes(_,A);return}if(Y){const[pe,ke]=x.parent(_,z,{edge:"end"}),Te=pe.type;if([H.ul,H.ol].includes(Q))if(S.stopPropagation(),S.preventDefault(),Te===H.li&&F==="Enter"){pe.children.length===1&&"text"in pe.children[0]&&pe.children[0].text===""&&J.removeNodes(_,{at:ke}),J.insertNodes(_,A,{at:R.next(re)}),J.select(_,x.end(_,R.next(re)));return}else{const[Ke,Ne]=zw(_,H.li),$e={type:H.li,children:[{text:""}]};J.insertNodes(_,$e,{at:R.next(Ne)}),J.select(_,x.end(_,R.next(Ne)))}}}}}else if(S.key==="Escape"){if(W.show){S.preventDefault(),S.stopPropagation(),j([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(S.key)&&W.show){S.preventDefault(),S.stopPropagation();const{selectedUser:z,possibleUsers:Y}=W;let G=S.key==="ArrowUp"?z-1:z+1;G<0&&(G=Y.length-1),G>=Y.length+1&&(G=0),j([{type:"mentionPopover",value:{...W,selectedUser:G}}])}j([{type:"lastKey",value:S.key}]),Ww(S,_,j,E)},onBlur:()=>{_.selection&&j([{type:"lastAnchor",value:_.selection.anchor}])},onFocus:()=>{if(B){if(!R.isPath(B.path)||!oe.has(_,B.path))return;const S=oe.get(_,B.path);let z=0;if(fe.isText(S)?z=S.text.length:S.children&&(z=S.children.length),B.offset>z)return;try{J.select(_,{anchor:B,focus:B})}catch(Y){const G=Y.message;E(`Error focusing editor: ${G}`)}}}}),U?c.jsx(Co,{data:U,variant:"condensed",onClick:()=>{j([{type:"enrichedUrl",value:!1}]);const S=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(S)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(rE,{styling:l==null?void 0:l.toolbar}),m?c.jsx(Zw,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},L),c.jsx(Eo,{id:`character-limit-${e}`,limit:r,valueLength:di(I)})]})}):c.jsx(c.Fragment,{})};const UE=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function Ih({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,v]=y.useState(!1),f=y.useRef(null),b=async A=>{p(!0),v(!1);try{const D=A.target.files&&A.target.files[0];if(!D||!t)throw p(!1),new Error("Image file or userID is missing");const k=await a({fileObject:D,userId:t}),j={thumbnail:k.thumbnailURL,full:k.originalURL};d(j),s(j)}catch{v(!0)}finally{p(!1)}p(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:w=o.formatMessage({id:`${l}cta_change`}),uploading:E=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(sn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?E:u?w:g})]})}const $h=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Gt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const WE=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(hm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Lh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,p]=y.useState([]),[m,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ae.useIntl(),w=async D=>{try{await u(h,D.message),p([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},E=D=>{D.preventDefault(),b("NOT_SUBMITTED"),v(!0),p([])},A=D=>{D.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx($t,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:E,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:A,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:E,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Gt,{id:"invite-form",fields:[{component:WE,props:{emails:h,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:m}})]})},Ma=e=>e.map(t=>({condition:t})),Bt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},VE=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Bt.NEW_PASSWORD]!==m[Bt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!Es(m[Bt.NEW_PASSWORD]).isValid,h=[{"data-testid":Bt.NEW_PASSWORD,id:Bt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ma(["required",d]),functions:{onChange:m=>l(Es(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Bt.CONFIRMED_PASSWORD,id:Bt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ma(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Bt.CURRENT_PASSWORD,id:Bt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ma(["required"])}),i&&h.push({component:mf,props:{matchingRules:o}});const p={id:Bt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,v)=>{(v.includes(Bt.NEW_PASSWORD)||v.includes(Bt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Gt,{...p}),r&&c.jsx(yn,{variant:"error",text:r})]})};const zh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var L;const s=ae.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[h,p]=y.useState(!1),{uploadImage:m=()=>{},onSuccess:v=async M=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:w,predictPlaces:E}=t.useMaps(),{context:A="ProfileForm",event:D="profile-form-submit-click"}=a||{},k=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(L=l.location)==null?void 0:L.en,validation:[{condition:"required"},{condition:({location:M})=>M&&!h?!1:!w(M),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{h||p(!0)},onKeyInput:E}}],j=[{component:Ih,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},...k,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:$t}];return c.jsx(Gt,{id:"profile-details-form",fields:e?k:j,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:D},functions:{onSuccess:async M=>{try{const q={...M,image:u||null,location:h?await g(M==null?void 0:M.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(I=>({...I,...q})),await v(q)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...i})},HE=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Ad,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let cs=null;const it="publishArticleForm_",Lc={},zc=10,KE=({id:e="publish-article-form",values:t=Lc,functions:n,meta:r,gtm:a})=>{const i=ae.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,p]=y.useState(!1),[m,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,w]=y.useState("");y.useEffect(()=>{Na(t,Lc)||Ia(t.body)&&t.body!==m&&t.body!==void 0&&v(t.body)},[t.body]);const E=()=>{!s||!s.id?b(i.formatMessage({id:`${it}error_loggedOut`})):f&&b(!1)},A=L=>({condition:M=>{const q=M[L];return!q||typeof q!="string"?!0:q.length<zc},error:i.formatMessage({id:`${it}error_underMinLength`},{length:zc})}),D=!m||!Ia(m),k=()=>c.jsxs(c.Fragment,{children:[c.jsx($t,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${it}disclaimer`})})]}),j=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${it}title_label`}),placeholder:i.formatMessage({id:`${it}title_placeholder`}),functions:{onChange:E},validation:[{condition:"required"},A("title"),{condition:()=>D,error:i.formatMessage({id:`${it}title_error`})}]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${it}subtitle_label`}),placeholder:i.formatMessage({id:`${it}subtitle_placeholder`}),functions:{onChange:E},validation:[{condition:"required"},A("subtitle")]},{component:Ho,props:{formID:e,label:{visible:i.formatMessage({id:`${it}body_label`})},showLabel:!0}},{component:Jo,props:{id:`${e}-input`,value:m,placeholder:i.formatMessage({id:`${it}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:L=>{v(L),E()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return h?j.push({component:$t}):j.push({component:k}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Gt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async L=>{if(!s||!s.id||D)return;cs&&clearTimeout(cs),p(!0);const M={...L,body:m};try{o&&await o(M),cs=setTimeout(()=>{w(i.formatMessage({id:`${it}aria_success`})),l(M)},500)}catch{b(i.formatMessage({id:`${it}error`})),w(""),u()}},onFailure:u},fields:j,intlPath:it,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||D,text:{default:i.formatMessage({id:`${it}cta_submit`}),submitting:i.formatMessage({id:`${it}cta_submitting`}),submitted:i.formatMessage({id:`${it}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(HE,{})},gtm:a}),f&&c.jsx(or,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${it}error`})}),g&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const qh=({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=ae.useIntl(),u=y.useRef(null);sr(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Oe,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Oe,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Oe,{children:l.formatMessage({id:"search_cta"})})})]})})})},qc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},ZE=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"]}},YE=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=ZE(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}])},GE=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,v)=>{m.current&&s.validFields[v]!==m.current.validity.valid&&o([{type:`validFields.${v}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{qc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({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:lf,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const v=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&qc({ref:i.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const QE=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const JE={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},XE=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ae.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,v={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Gr,JE),{validFields:g,emailDetails:w,shouldManuallyApprove:E,shouldDisableButton:A,showSuccessMessage:D,showError:k}=f,[j,L]=to.useCookies(["signup-this-session","functional-cookie-consent"]),M={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{E===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[E]),y.useEffect(()=>{j["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[j]),y.useEffect(()=>{D&&j["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[D]);const q=y.useMemo(()=>GE({placeholders:n,labels:t,shouldShow:v,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,v,f]),I=A?!0:E?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(w.boxType);return v.successMessage&&D?c.jsx(QE,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(yn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Gt,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:q,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:I?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await YE({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const Cn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const e_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(Cn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(mr,{buttons:r})]})})};const eo="editSection_";function Uh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const t_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(Et,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${eo}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Uh({href:r,setShowModal:i}),children:n||s({id:`${eo}placeholder_cta`})})})]})},n_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ae.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),v=!!n||!!r,f=typeof a=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:K("edit-section",t),children:[v&&c.jsx(on,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:K("edit-section-modal"),children:b||(n?c.jsx(Gt,{...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 g=>{var w,E;(w=n==null?void 0:n.functions)!=null&&w.onSuccess&&await((E=n==null?void 0:n.functions)==null?void 0:E.onSuccess(g)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Uh({href:a,setShowModal:p}),children:d({id:`${eo}edit`})})]}),e||c.jsx(t_,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx($t,{})]})};const r_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:K("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${v}`))})})]})};let ds;const fs="contactFooter_",a_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ds),ds=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ds),window.removeEventListener("resize",l)}),[]),c.jsx(Cn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${fs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ae.FormattedMessage,{id:`${fs}text`})}),c.jsx(bn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${fs}email`})})]}),c.jsx($h,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},i_=({activeLink:e,profile:t,...n})=>c.jsx(Cn,{children:c.jsx(of,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(sf,{activeLink:e,profile:t}),c.jsx(gd,{...n})]})})});const hs="cookieBanner_",ms=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ps=new Date(Date.now()+12*30*24*60*60*1e3),Wh=()=>{const e=ae.useIntl(),[t,n,r]=to.useCookies(ms),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ms.forEach(d=>{n(d,!0,{path:"/",expires:ps,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ps}),ms.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:ps});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${hs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${hs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${hs}text`})}),c.jsx(mr,{buttons:u})]})},en={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Gn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Gn["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:Gn.support,gtmType:"concierge-email-click"},business:{email:Gn.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 nr="footer_",ti="SiteFooter",Uc=({group:e})=>{const t=en[e].order||[];let n=!1;return"text"in en[e]&&(n=en[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.FormattedMessage,{id:`${nr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=en[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ti,"data-gtm-event-type":i,...s,children:c.jsx(ae.FormattedMessage,{id:`${nr}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${nr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.FormattedMessage,{id:`${nr}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":ti,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Xo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(ii,{element:"hr"}),c.jsx(wo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ti,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Uc,{group:e}),Object.keys(en[e]).includes("child")&&c.jsx(Uc,{group:en[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(en.social.order)&&en.social.order.map(e=>{const t=en.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":ti,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${nr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${nr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Le={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===wt.ACCOUNT&&t===!1&&n[wt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Le.handlerCalled[e]&&i-Le.handlerCalled[e]<500)return;Le.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case wt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case wt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case wt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Kc(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?Le.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case wt.SITE:if(n){const u=Le.findFirstChild(t.current.children,"className","has-submenu parent"),d=Le.findFirstChild(u.children,"id",wt.SITE);s=Le.findFirstChild(d.children,"href")}else s=Le.findFirstChild(t.current.children,"href");break;case wt.ACCOUNT:if(o=Le.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Le.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(Le.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Le.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Le.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Le.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Yr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ni=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ae.useIntl(),o=Kc(Yr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let E=o.gtmType||`${e}-click`;if(E.includes(".")){const A=E.split("."),D=A[A.length-2];E=`${D==="topics"?`${D}-`:""}${A[A.length-1]}`}p={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":E,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],v=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},g={},w={};if(f&&(b={...b,"aria-current":"page"}),m){const E=o.menuId||e,A={onClick:D=>Le.events.onClick(D,{id:E,callback:a,isOpen:r[E]}),onFocus:()=>Le.events.onFocus({id:E}),onBlur:()=>Le.events.onBlur({id:E,callback:a}),onMouseLeave:()=>Le.events.onBlur({id:E,callback:a}),onMouseEnter:()=>Le.events.onMouseEnter({id:E,callback:a})};g={...A,id:E===wt.SITE?wt.SITE:wt.ACCOUNT},n&&(v&&(w={...A,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&Le.events.onClick(D,{id:E,callback:a,isOpen:r[E]})},"aria-haspopup":!0,"aria-expanded":r[E],"aria-controls":E}),g={...g,hidden:E in r?!r[E]:!0}),v||(g={...g})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":m,parent:v,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:h})):n&&o.order&&v?c.jsxs("button",{...w,children:[s.formatMessage({id:h}),c.jsx(Oe,{children:s.formatMessage({id:`header_menu_${r[wt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...g,children:o.order.map(E=>{if(!o[E])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[E].order?c.jsxs("li",{className:K({[o[E].className]:o[E].className}),children:[s.formatMessage({id:`${h}_${E}`}),c.jsx("ul",{children:o[E].order.map(D=>c.jsx(ni,{id:`${e}.${E}.${D}`,...A},D))})]},E):c.jsx(ni,{id:`${e}.${E}`,...A},E)})})]},e)};const s_={height:67,height_desktop:83};var wt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(wt||{});const eu=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(at),r=In(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Le.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Gr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),Xc({scrollPosition:s_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=h.current.menus;!i&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=h.current.menus;!i&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!1,g,o)}}});const p=(g,w,E=!1)=>{Le.handleMenus({id:g,value:w,menus:h.current.menus,dispatch:o,forceHandle:E})},m=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(w=>{h.current.menus[w]&&p(w,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var w;(w=document.getElementById("header"))==null||w.removeEventListener("keydown",v)}},[]),sr(()=>{u["site-navigation"]&&Le.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),sr(()=>{u["account-navigation"]&&Le.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Oe,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(qh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Oe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Yr.order.map(g=>c.jsx(ni,{id:g,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Oe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(wo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:g=>Le.events.onClick(g,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Le.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Le.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Oe,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Yr.buttons.order.map(g=>c.jsx(ni,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const o_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(eu,{}),c.jsx("div",{id:"content",children:c.jsx(yn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Xo,{})]})},Vh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,v=Gc(),[f,b]=y.useState(""),g=k=>{const{detail:{message:j}}=k;b(j)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const w=ka(e,{locale:o}),E=ka(t,{locale:o}),A=ka(n,{locale:o}),D={};return d!=="default"&&(D[d]=!0),h!=="default"&&(D[h]=!0),p!=="default"&&(D[p]=!0),c.jsx(fm.ErrorBoundary,{onError:r,fallback:c.jsx(o_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,D,{"has-footer":u}),children:[c.jsx(eu,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[E&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":m==="large"}),children:E}),y.createElement(d==="bold"?fo:"div",{id:"content",children:w,className:K({"large-modal":m==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(Xo,{}),c.jsx(Wh,{})]}),f&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Wc={default:"tags_",headerTopics:"header_topics_topics_"},gs={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"},u_={getTagDetails:e=>{if(e.includes("topic_")){if(e=gs.topic[e.replace("topic_","")],e){const t=Yr.topics.topics[e].href;return t?{id:e,href:t,text:`${Wc.headerTopics}${e}`}:null}return null}return gs[e]?(e=gs[e],{id:e,text:`${Wc.default}${e}`}):null}};const l_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=u_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:K("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Hh=25,c_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const p=ae.useIntl(),m="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",h),children:[u?c.jsxs("h1",{children:[p.formatMessage({id:m}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(nn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),c.jsx(bn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:p.formatMessage({id:`${m}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,w)=>c.jsxs("li",{children:[c.jsx(nn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Kt,{children:p.formatMessage({id:`${m}_admin`})})]},w)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Hh))].map((g,w)=>c.jsx("li",{children:c.jsx(li,{layout:"member"})},w)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Qr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(xi,{form:s,showModal:f,content:{title:p.formatMessage({id:`${m}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Kh=c_,d_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ae.useIntl();return t?c.jsx("small",{children:Nt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},f_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(Ho,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Nt(r.formatMessage,`${e}label_action`,t,"action")},...n})};let xa=null;const Xe="discussion_form_",Xr=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Qe,Ae,qe;const m=ae.useIntl(),v=y.useContext(at),[f,b]=y.useState(""),{isLoading:g=!1,isInWrapper:w=!1,isInOverlay:E=!1,isAutoFocused:A=!1,isEditing:D=!1,hasTitleField:k=!1,isPrepopulated:j=!1,showTitle:L=!1,showGuidelines:M=!0,showDivider:q=!1,showSuccessMessage:I=!0,showPostType:B=!1,postCategories:F=[]}=a||{},{onChange:P=()=>{},create:O=()=>{},handleSaveEdit:U=()=>{},handleCancel:W=()=>{},callback:ie=()=>{},onMention:te=()=>{},listMembers:C=()=>Promise.resolve([]),clickMentionFallback:X=()=>{},getLinkPreview:ue=()=>Promise.resolve({}),props:_={create:{projectNames:["questions-answers"]}}}=d,[T,$]=y.useState({title:k&&k.text||"",body:D&&D.text||j&&j.text||"",categories:D&&D.categories?D.categories:"",data:h!=null&&h.link?{link:h==null?void 0:h.link}:{}}),[S,z]=y.useState(l.error||!1),[Y,G]=y.useState(!1);if(y.useEffect(()=>{u&&!D&&j&&j!==T.body&&$(be=>({...be,body:j.text||""}))},[j]),g)return c.jsx(Pt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const re=(be,V)=>{$(he=>({...he,body:be,data:{link:V}})),P({body:be});let ne;!v||!v.id?ne=Nt(m.formatMessage,`${Xe}error_loggedOut`,n.type,"action"):r?s>0&&be.length>=s&&(ne=`${Xe}error_tooLong`):ne=Nt(m.formatMessage,`${Xe}error_noPermission`,n.type,"action"),ne?z(ne):S&&z(!1)};let le=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const be=((Qe=n.slugs)==null?void 0:Qe.reply)||((Ae=n.slugs)==null?void 0:Ae.answer)||((qe=n.slugs)==null?void 0:qe.question)||"";be&&(le=`${le}-${be.slice(-15)}`)}e&&(le=`${e}-${le}`);const Q=async()=>{if(!v||!v.id||!r||Te)return;xa&&clearTimeout(xa),G("submitting");const be=window.location.pathname;try{let V;switch(n.type){case"post":V=await O({title:T.title,content:T.body,categories:T.categories,data:T.data});break;case"question":V=await O({title:T.body,authorId:v&&v.id,data:T.data,..._==null?void 0:_.create});break;case"response":V=await O({questionSlug:n.slugs.question},{body:T.body,authorId:v&&v.id,contentPath:be,data:T.data});break;case"reply":V=await O({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:T.body,authorId:v&&v.id,contentPath:be,data:T.data});break;default:break}await _m(1e3),ie&&await ie(V),xa=setTimeout(()=>{$({title:"",body:"",categories:"",data:{}}),G("submitted"),b(Nt(m.formatMessage,`${Xe}success`,n.type,"action"));const ne=new Event(nt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ne),me()},500)}catch(V){const ne=V;let he=`${Xe}error`;ne!=null&&ne.message.includes("entry already exists")&&(he=Nt(m.formatMessage,`${Xe}error_alreadyExists`,n.type,"action")),ne!=null&&ne.message.includes("429")?he=Nt(m.formatMessage,`${Xe}error_tooMany`,n.type,"action"):ne!=null&&ne.message.includes("400")&&(he=`${Xe}error`),z(he),me()}},me=()=>{xa=setTimeout(()=>{z(!1),G(!1),b("")},5e3)},pe=be=>{$(V=>({...V,data:be}))},ke=!T.title||!Ia(T.title),je=!T.body||!Ia(T.body);let Te=je;k&&(Te=ke&&je);const Ke=Y==="submitting",Ne=[{component:f_,props:{formID:le,intlPath:Xe,showLabel:k!==!1,type:n.type}},{component:Jo,props:{id:`${le}-input`,value:Y==="submitting"&&!S?"":T.body,placeholder:i||Nt(m.formatMessage,`${Xe}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:E},functions:{onChange:re,onChangeData:pe,onMention:te,listMembers:C,clickMentionFallback:X,getLinkPreview:ue},data:h,autoFocus:D!==!1||A&&!k,"aria-invalid":!!S,"aria-errormessage":"error-message"}},{component:d_,props:{intlPath:Xe,showGuidelines:M,type:n.type,gtmContext:p}}];q&&Ne.push({component:$t}),k&&Ne.unshift({id:"title",type:"text",value:k.text,limit:250,label:m.formatMessage({id:`${Xe}titleField_label`}),placeholder:m.formatMessage({id:`${Xe}titleField_placeholder`}),functions:{onChange:be=>{$({...T,title:be}),P({title:be})}},validation:[{condition:()=>Te,error:m.formatMessage({id:`${Xe}titleField_error`})}]}),B&&Ne.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},className:"post-type filters",label:m.formatMessage({id:`${Xe}postType_label`}),options:F.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{$(V=>({...V,categories:be})),P({postType:be})}}});let $e=!v||!v.id||!r||Te||Ke;return D&&(k?$e=$e||T.body===D.text&&T.title===k.text:$e=$e||T.body===D.text),c.jsxs(c.Fragment,{children:[c.jsxs(Gt,{id:le,className:K("discussion-card discussion-form",{"no-styling":w&&D}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:D&&!Ke||l.cancel},functions:{onSuccess:async be=>{if(D){G("submitting"),U(T);return}await Q()},onCancel:W},fields:Ne,intlPath:Xe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`${D?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:$e,text:{default:!D&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Xe}${D?"save":"post"}`}),submitting:m.formatMessage({id:`${Xe}${D?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!v||!v.id||!T.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Xe}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[L&&!D&&["question"].includes(n.type)&&c.jsx("h2",{children:Nt(m.formatMessage,`${Xe}title`,n.type,"action")}),c.jsx(nn,{member:v?{...v,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]}})]}),Y==="submitted"&&I&&c.jsx(or,{className:"success","data-testid":"success",children:Nt(m.formatMessage,`${Xe}success`,n.type,"action")}),S&&c.jsx(or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof S=="string"?S.includes(" ")?S:m.formatMessage({id:S},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):S}),f&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:f})]})},h_=Object.freeze(Object.defineProperty({__proto__:null,default:Xr},Symbol.toStringTag,{value:"Module"})),vs=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};const m_={showForm:!1},yi=y.createContext(m_),Zh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(yi.Provider,{value:{...t,updateConversation:n},children:e})},Da="discussion_",p_=195;let Ca=null;const ea=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,setFocus:m=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g})=>{var $e,Qe,Ae,qe,be,V,ne,he,ge,we,Ye,Ge,ot,Ft,gt,et;const w=ae.useIntl(),E=y.useContext(yi),A=y.useContext(at),{createContent:D=async()=>{},deleteContent:k=async()=>{},updateContent:j=async()=>{}}=o.content||{},{createLike:L=()=>{},deleteLike:M=()=>{},listLikes:q=async()=>({})}=o.likes||{},{openComments:I=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:F=()=>{}}=o.form||{},{author:P,canLike:O,createdAt:U,id:W,likes:ie=0,userLiked:te,comments:C=0,data:X}=t,ue=A&&A.id&&typeof P!="string"&&P.id&&P.id===A.id||!1,_=typeof O=="boolean"?O:!0,T=ue&&(!t.createdAt||wm(t.createdAt,10,"seconds")),$=y.useRef(null),[S,z]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[Y,G]=y.useState(!1),[re,le]=y.useState(T?"highlighted":"default"),[Q,me]=y.useState("");y.useEffect(()=>{const xe=$.current;if(!(!xe||re==="default"))return document.addEventListener(nt.DISCUSSION_FORM_SUBMITTED,pe),xe.addEventListener("transitionend",ke),()=>{document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,pe),xe.removeEventListener("transitionend",ke)}},[]),y.useEffect(()=>{z(xe=>({...xe,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Fe=await xo(S.body,p,X==null?void 0:X.mentions,B);z(Mt=>({...Mt,postBody:Fe}))})()},[S.body,X==null?void 0:X.mentions]);const pe=()=>{setTimeout(()=>{le("fading")},1e3)},ke=({propertyName:xe})=>{xe==="background-color"&&le(Fe=>(Fe==="default"&&(document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,pe),$.current&&$.current.removeEventListener("transitionend",ke)),Fe==="fading"?"default":Fe))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||S.postBody===""&&t.title==="")return c.jsx(Pt,{className:"discussion-card"});const je=async({title:xe,body:Fe,data:Mt})=>{xe||(xe=""),Fe||(Fe=""),me("");try{if(!Na(xe,S.title)||!Na(Fe,S.body)){const vt=t.type==="question"?{title:Fe}:{title:xe,body:Fe,data:Mt};await j(Ss(t.slugs),vt)}z(vt=>({...vt,title:xe||"",body:Fe||"",data:{...vt.data,...Mt},isEditing:!1,didEdit:!0}))}catch{me(`${Da}form_error`)}},Te=()=>{if(E&&E.updateConversation){const xe={showForm:!0},Fe=t.author;Fe&&Fe.id&&(v&&(xe.prepopulateForm=`@{{${Fe.id}}}`),xe.mentionData={id:Fe.id,name:Fe.name}),E.updateConversation(xe)}setTimeout(()=>{var wn,Qt,qn;const Fe=`reply-form-${(t.type==="answer"?t.slug:((wn=t.slugs)==null?void 0:wn.reply)||((Qt=t.slugs)==null?void 0:Qt.answer)||((qn=t.slugs)==null?void 0:qn.question)||"").toLowerCase().slice(-15)}`,Mt=document.getElementById(Fe),vt=document.getElementById(`${Fe}-input`);vt&&vt.focus(),Mt&&Mt.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{G(!1);try{await k(Ss(t.slugs))}catch{me("delete-error")}},Ne=[];return n&&ue&&Ne.push({text:w.formatMessage({id:`${Da}moreMenu_edit`}),onClick:()=>z(xe=>({...xe,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${Da}moreMenu_delete`}),onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),G(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...qd(`delete-${t.slug}-modal`,Y)}),r&&o.pins&&Ne.push({text:w.formatMessage({id:`${Da}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),m&&(($e=$==null?void 0:$.current)==null||$e.focus(),(Qe=$==null?void 0:$.current)==null||Qe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:K("discussion-post",u,{[re]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!S.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:$,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:xe=>{if(!l.post||S.isEditing)return;xe.preventDefault(),xe.stopPropagation(),Ca&&clearTimeout(Ca),Ca=setTimeout(()=>{window.location.href=l.post},150);const Fe=new CustomEvent(nt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ca}});document.dispatchEvent(Fe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:K("discussion-card",t.type,{editing:S.isEditing,"has-link":l.post&&!S.isEditing}),children:[!S.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(nn,{member:P,additionalContent:{createdAt:U,didEdit:S.didEdit,customMessage:(Ae=t.componentProps)!=null&&Ae.member.additionalContent?(V=(be=(qe=t.componentProps)==null?void 0:qe.member)==null?void 0:be.additionalContent)==null?void 0:V.customMessage:{}},className:typeof P!="string"&&P.id===i?"highlighted":"",styling:{additionalContentNewLine:!!((ne=t.componentProps)!=null&&ne.member.additionalContent&&((we=(ge=(he=t.componentProps)==null?void 0:he.member)==null?void 0:ge.additionalContent)!=null&&we.customMessage))},gtmContext:d,gtmType:"profile-click",badges:f}),t.pinned&&c.jsx(Kt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Oe,{children:"Pinned Post"})})]}),S.isEditing?c.jsx(Xr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:S.title!==""?{text:S.title}:!1,isEditing:{text:S.body,categories:[]},isPrepopulated:!1},isCommunity:v,maxLength:t.type==="question"?250:5e4,forceShow:{error:Q!==""&&Q!=="delete-error"?w.formatMessage({id:Q},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:D,handleSaveEdit:je,handleCancel:()=>{me(""),z(xe=>({...xe,isEditing:!1}))},listMembers:B,clickMentionFallback:F},gtmContext:`${d}Form`,data:X}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),S.postBody.length>p_?c.jsx(pd,{text:S.postBody,markdownOptions:{overrides:{a:ks,blockquote:{component:vs}}}}):c.jsx(jn,{options:{overrides:{a:ks,blockquote:{component:vs}}},children:S.postBody})]}):c.jsxs(c.Fragment,{children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),c.jsx(jn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:vs}}},children:S.postBody})]}),(Ye=S.data)!=null&&Ye.link?c.jsx(Co,{data:S.data.link}):c.jsx(c.Fragment,{}),(Ge=t.categories)!=null&&Ge.length?c.jsx("ul",{className:"categories-list",children:t.categories.map(xe=>c.jsx(Kt,{size:"small",element:"li",children:xe.name},xe.slug))}):c.jsx(c.Fragment,{})]}),!S.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(nf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:ie||0,userLiked:te||!1,canLike:_,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:L,deleteLike:M,listLikes:q},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&(["question","post"].includes(t.type)||l.comments)?{count:C||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof I=="function"&&I()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:Te}}:!1,shareLink:{url:`${window.location.origin}${(ot=t.slugs)==null?void 0:ot.question}/${(Ft=t.slugs)==null?void 0:Ft.answer}${(gt=t.slugs)!=null&&gt.reply?`#${(et=t.slugs)==null?void 0:et.reply}`:""}`},moreMenu:{options:Ne,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),h,c.jsx(on,{id:`delete-${t.slug}-modal`,isOpen:Y,functions:{onOpen:()=>{},onClose:()=>G(!1)},forceShow:{error:Q==="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:()=>G(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Ke,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:xe=>c.jsx("p",{children:xe}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const g_=y.lazy(()=>Promise.resolve().then(()=>A_)),v_=65,Yh=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(at)||"community",l=ci(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||cd("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const g=await xo(p.title||p.body||"",v_,p.mentions);m(w=>({...w,prettifiedText:g}))})()},[p.showCachedText,p.title,p.body]);const v=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const w=b;w.preventDefault(),w.stopPropagation();const A=w.target.closest("a");g=A&&A.getAttribute("href")}h(w=>({...w,warning:g||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(nt.DISCUSSION_POST_CLICKED,v),document.addEventListener(nt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[p.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!p.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(sn,{name:l.name,src:l.image,alt:""}),c.jsx(jn,{className:K("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Tt,blockquote:Tt,br:Tt,em:Tt,li:Tt,ol:Tt,p:Tt,s:Tt,span:Tt,strong:Tt,ul:Tt}},children:f})]}),c.jsxs(pr,{children:[c.jsx(g_,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(on,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},b_=y.lazy(()=>Promise.resolve().then(()=>h_)),tu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(yn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(po,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...p}=t,m={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(Yh,{form:m}):c.jsx(b_,{...m})},nu=({form:e})=>{const t=y.useContext(at),n=ae.useIntl(),[r,a]=y.useState(!1),i=()=>{jm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(xi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const bs="discussion_responses_",Gh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${bs}title`},{action:r.formatMessage({id:`${bs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Nt(r.formatMessage,`${bs}empty`,e,e)})]})};const Qh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ae.useIntl(),s=y.useContext(yi),o=ka(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Qr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(Xr,{...r})]})};function y_(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function x_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function D_({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 C_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=We.useQueryClient(),l=ui(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},h=x_({...d,mutationFn:t}),p=w_({...d,mutationFn:n}),m=E_({...d,mutationFn:r}),v=__({...d,mutationFn:a}),f=k_({...d,mutationFn:i}),{activity:b,...g}=D_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:v,unpin:f},user:l,...g}}function w_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Wa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Wa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function E_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Hd({activity:s,user:r}),s)),onError:n});return a}function __({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function k_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Kd({activity:s,user:r}),s))),onError:n});return a}const F_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:p,categories:m})=>{var W,ie,te,C,X,ue;const v=ae.useIntl(),{activity:f,error:b,isLoading:g,mutations:{edit:w,like:E,unlike:A,pin:D,unpin:k}}=C_({queryFns:s,queryKey:[e,t,n]});if(g)return c.jsx(Pt,{style:{height:"400px"}});if(b||!f)return c.jsx(yn,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:j,verb:L,latest_reactions:M,mentioned_users:q,additional_data:I}=f,B=(((W=M==null?void 0:M.like)==null?void 0:W.length)||0)>0,F=(((ie=j==null?void 0:j.like)==null?void 0:ie.length)||0)>0,P=F?j==null?void 0:j.like[0].id:"",O=B?(te=M==null?void 0:M.like)==null?void 0:te.map(_=>{var T,$,S;return{id:(T=_==null?void 0:_.user)==null?void 0:T.id,name:(S=($=_==null?void 0:_.user)==null?void 0:$.data)==null?void 0:S.name}}):!1,U=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ea,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:Do((f==null?void 0:f.categories)||[],m||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:gr(U),userLiked:F,likes:((C=f==null?void 0:f.reaction_counts)==null?void 0:C.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:O,data:{mentions:q,...I||{}},pinned:((X=f==null?void 0:f.reaction_counts)==null?void 0:X.pin)&&((ue=f==null?void 0:f.reaction_counts)==null?void 0:ue.pin)>0||!1},originalAuthorId:U==null?void 0:U.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(_,{title:T,body:$})=>w({title:T,content:$})},likes:{createLike:()=>E({activityId:n}),deleteLike:()=>A({activityId:n,reactionId:P}),listLikes:_=>o.list({activityId:n,..._})},comments:{openComments:()=>{}},pins:{createPin:()=>D({activityId:n}),deletePin:()=>{var _;return k({activityId:n,reactionId:(_=M==null?void 0:M.pin)==null?void 0:_[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(Jd,{basePath:e,parentId:t,activityId:n,showReplies:y_(L,M),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:p})]})};const Jh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(on,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",a),children:c.jsx(Xr,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const w=v||{};w[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(E=>({...E,mentions:w}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},A_=Object.freeze(Object.defineProperty({__proto__:null,default:Jh},Symbol.toStringTag,{value:"Module"}));const B_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=ae.useIntl();return a||(a=h.formatMessage({id:"inviteModal_formTitle"})),i||(i=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(on,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:K("invite-modal",e,{success:!!n}),children:c.jsx(Lh,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const T_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(cd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(on,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:K("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(zh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},xi=T_,S_=Object.freeze(Object.defineProperty({__proto__:null,default:xi},Symbol.toStringTag,{value:"Module"}));const j_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(sn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(on,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(jn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const O_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:K("testimonial-block",a),children:[c.jsx(Ht,{className:"testimonial",children:n}),r?c.jsx(nn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),P_=y.memo(O_);const M_=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Et,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Di=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ae.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,v=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&v>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${v>0?i.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:K("time-to-complete",a),"aria-label":u,children:l})};const N_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(Ln,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const R_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],I_=({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 v,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:g,element:w}=t[b];if(w&&R_.includes(w.toLowerCase()))return;p[b]={text:g,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(Cn,{className:K("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:g,element:w=""}=p[b];return b==="text"?c.jsx(jn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(w,{key:b,className:b},g)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Ln,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},$_=y.memo(I_);const L_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(Cn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const z_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(jn,{children:n}):n;return c.jsxs(Cn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Ln,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},q_=y.memo(z_);const U_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),W_=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&ws(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ao(d)});if(o)return c.jsx(Kt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&ws(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},V_={title:66,text:3e3,secondaryText:1e3,partner:34},ri={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"}},H_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ae.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=ri[p])!=null&&f.gtmEvent&&(m=ri[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(p)&&d!=="premium"){const g=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),w=async E=>{if(E.preventDefault(),E.stopPropagation(),!(g||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):D=>({...D,loading:!1}))}catch{s(D=>({...D,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${g?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function K_({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(at),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Kt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const ru=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,P;const u=ae.useIntl(),d=y.useContext(at),h=!!(d!=null&&d.id),{isTabbable:p=!0,setFocus:m=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(O=>{b({data:O,isLoading:!1})}).catch(()=>b(O=>({...O,isLoading:!1})))},[a,h,n]);const{data:g,isLoading:w}=f;if(w||!g)return c.jsx(Pt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:E}=g;if(!E||!ri[E])return c.jsx(Pt,{element:"li",className:"card-wrapper"});const{basePath:A="",className:D,length:k,gtmEvent:j}=ri[E];let L=p&&g.slug?`${A}${g.slug}`:!1;p&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(L=g.slug);const M=O=>{L&&(O.preventDefault(),O.stopPropagation(),window.location.href=L)},q={...V_,...k};let I={className:"card"},B={};return L&&(B={href:L,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${j}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),I={onClick:M,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${j}-click`}),m&&(I={...I,tabIndex:"0"},(F=v==null?void 0:v.current)==null||F.focus(),(P=v==null?void 0:v.current)==null||P.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",D,t,{"has-link":L,"no-link":!L,"has-image":g.banner}),"data-testid":`${E}-card`,children:c.jsxs("div",{...I,ref:v,children:[c.jsx(fd,{className:"card-label",contentType:E,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),E==="communityPage"&&(g==null?void 0:g.createdAt)&&Em(g==null?void 0:g.createdAt,60)&&c.jsx(Kt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Kt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):od(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Kt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Ln,{image:{...g.banner,description:""}})]}):D==="people"?c.jsx(sn,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(co,{contributors:{data:g.contributors},styling:{size:"small",showGap:D!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(E)?u.formatMessage({id:`card_contributors_${E}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):ir(g.partner[0],q.partner)}),["title","text","secondaryText"].map(O=>{const U=g[O];if(!U)return null;const W=nd(O),ie={key:O,className:W,"data-testid":W},te={wrapper:"p",forceWrapper:!0,forceInline:!0},C=ir(U,q[O]);return["title","text"].includes(O)&&L?(te.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Ht,{options:te,...B,children:C})})):c.jsx(Ht,{options:te,...ie,children:C})}),a.contentType==="communityPage"&&(a.slug||g.slug)&&r&&c.jsx(K_,{communitySlug:a.slug||g.slug,buildMemberData:r}),c.jsx(W_,{type:D||"",data:g}),c.jsx(H_,{data:g,cta:i,link:L||"",gtmContext:s})]})})};const Xh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(ru,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Z_=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},Y_=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:K("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const ys={fourCards:1024,threeCards:769,twoCards:480};let wa=null,xs=null;const G_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[w,E]=y.useState(""),A=t.length,D=Math.ceil(A/p),k=y.useRef(null),j=In(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let F=1;j&&(j>=ys.fourCards?F=4:j>=ys.threeCards?F=3:j>=ys.twoCards&&(F=2),F>A&&(F=A)),h(P=>({...P,cardsPerPage:F,isLoading:!1}))},[j,A]);const L=(F="next")=>{xs&&clearTimeout(xs);let P=b;if(typeof F=="string")if(F==="next")if(b<D-1)P=b+1;else return;else if(b>0)P=b-1;else return;else P=F;E(""),f(U=>({...U,currentPage:P,loadedPages:[...new Set([...g,P])]}));const O=()=>{const U=P*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};xs=setTimeout(()=>{E(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:O()}))},500)},M=F=>{wa=F.touches[0].clientX},q=F=>{if(wa===null)return;const P=F.touches[0].clientX,O=wa-P;O>5?L("next"):O<-5&&L("previous"),wa=null},I={"--width":`${j||0}px`,"--total-cards":A,"--cards-per-page":p,"--page":b};if(m)return c.jsx(li,{layout:`carousel${a?"-with-title":""}`});const B=(F,P)=>{var U;let O=null;return(U=F==null?void 0:F.sys)!=null&&U.id?O=`card-${F.sys.id}`:F!=null&&F.slug?O=`card-${F.slug}`:[n[P],F.contentType].includes("customCard")&&(O=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${P}`),O};return c.jsxs("section",{ref:k,className:K("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(Y_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:M,onTouchMove:q,style:I,"data-testid":"carousel-list",children:t.map((F,P)=>{let O=B(F,P);const{inView:U,isLoaded:W}=Z_(P,p,b,g);return O&&(U||W)?c.jsx(ru,{id:O,card:{...F,contentType:n[P]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},O):(O=O||`${e}-card-${P}`,c.jsx(Pt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},O))})}),D<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(D)].map((F,P)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:P===b}),onClick:O=>{O.preventDefault(),O.stopPropagation(),L(P)},children:c.jsx(Oe,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:P+1,total:D})})})},`page-indicator-${P}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=D-1})})]}),c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:w})]})]})},Q_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(li,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx($t,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(G_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx($t,{})]},`carousel-${d}`)});const J_=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:K("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!a}),children:a&&c.jsx(Ln,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const X_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(Di,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(lo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const em=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:K("lesson-name",a),"data-number":`${t}.${n}`,children:r});const tm=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ae.useIntl(),o=si(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):ad(a||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Di,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const ek=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ae.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(oi,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(Di,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:f,contentType:b,icon:g,image:w,isIntroduction:E,optional:A,slug:D,subsectionId:k,title:j,type:L})=>{const M=a&&t||E,q={};return w&&(q.style={"--image":`url(${w})`}),c.jsx("li",{className:K({article:b===Fr.ARTICLE,discussion:b===Fr.DISCUSSION,quiz:b===Fr.QUIZ,completed:v&&b===Fr.ARTICLE,locked:!M}),...q,children:c.jsx(bn,{href:M?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${rd(j)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(em,{sectionId:i,subsectionId:k,title:j,className:"course-title"})," ",c.jsx(tm,{completionTime:f,icon:g,optional:A,type:L,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const tk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},nk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Vc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const Ea="notFoundError_",rk=()=>{const e=ae.useIntl(),t=[];return Vc.forEach((n,r)=>{n.title=e.formatMessage({id:`${Ea}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Vh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(Cn,{children:[c.jsx(Xh,{cards:Vc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${Ea}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Ea}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Ea}text`})})]})};var ai=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(ai||{});const ak=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,ik=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const sk=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let h=0,p={};const m=(a||!s)&&!t.hasUserVoted;i&&(h=Math.round(t.numVotes/r*100)||0,p={"--vote-perc":`${h}%`});const v=g=>{g.stopPropagation(),m&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:K({"can-vote":m}),tabIndex:o&&m?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var w;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const E=g.code==="ArrowUp"?"prev":"next",{nextElement:A,nextIndex:D}=ik(g.currentTarget.parentElement,"selected",E,n);A&&((w=A.querySelector("label"))==null||w.focus(),l==null||l.setTabbableOption(D));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:p,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(sn,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[h,"%"]})]}),c.jsx("input",{type:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const ok=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ae.useIntl(),s=y.useContext(at),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=ai.AfterVoting}=n||{},[d,h]=y.useState(ak(t,l,s==null?void 0:s.id)),{createVote:p=async()=>{},removeVote:m=()=>{}}=r||{},v=t.reduce((E,A)=>E+A.numVotes,0),f=t.filter(E=>E.hasUserVoted).length,b=t.filter(E=>E.hasUserVoted),g=y.useCallback(async E=>{await p(E.id)},[]),w=y.useCallback(async()=>{t.forEach(async E=>{E.hasUserVoted&&E.userVote&&await m(E.userVote.id)})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:i.formatMessage({id:`${a}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:v})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ee,{variant:"tertiary",onClick:w,"data-testid":"remove-votes-button",disabled:f===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:f})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll",children:t==null?void 0:t.map((E,A)=>c.jsx(sk,{isTabbable:d===A,user:s,option:E,optionIndex:A,totalPollVotes:v,showResults:u==ai.Always||!!f,allowMultipleVotes:l,hasVotedOnPoll:!!f,functions:{createVote:g,setTabbableOption:h}},E.id))})})}),c.jsxs(Oe,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:f}),!!f&&c.jsx("ul",{children:b.map(E=>c.jsx("li",{children:E.label}))})]})]})};exports.ASSETS_BUCKET=Zt;exports.ActionBar=nf;exports.ActionButton=Lr;exports.ActivitiesFeed=Mg;exports.ActivitySection=F_;exports.AddPost=tu;exports.Badge=kd;exports.BadgeScope=lt;exports.Badges=Fd;exports.BadgesContext=so;exports.BadgesProvider=bd;exports.Banner=N_;exports.BannerSection=$_;exports.Breadcrumbs=tv;exports.Buckets=Lm;exports.Button=Ee;exports.ButtonWrapper=mr;exports.COURSE_CONTENT_TYPES=Fr;exports.CacheProvider=yd;exports.Card=ru;exports.CardBlock=Xh;exports.Carousel=Q_;exports.CharacterLimit=Eo;exports.CollapsibleSection=oi;exports.Columns=of;exports.CommunityDetails=sg;exports.ContactFooter=a_;exports.ContactForm=$h;exports.ContentTypeLabel=fd;exports.Contributors=co;exports.ConversationContext=yi;exports.CookieBanner=Wh;exports.CourseProgression=X_;exports.CourseStructure=ek;exports.CustomContentBanner=L_;exports.CustomEvents=nt;exports.DELETED_USER_ID=Ir;exports.Directory=j_;exports.DiscussionConversation=Zh;exports.DiscussionForm=Xr;exports.DiscussionFormCard=Yh;exports.DiscussionFormModal=Jh;exports.DiscussionPost=ea;exports.DiscussionThread=Qh;exports.Divider=$t;exports.DownloadSection=e_;exports.EMAILS=Gn;exports.EditSection=n_;exports.EmailHelperTextBox=lf;exports.EmptyStateBox=yn;exports.EnrichedUrl=Co;exports.FeatureFlags=Dd;exports.Filters=rf;exports.FlagsProvider=xd;exports.Footer=Xo;exports.Form=Gt;exports.Formatting=H;exports.Fragment=Tt;exports.FullWidthSection=Cn;exports.GET_STREAM_USER_PREFIX=Cs;exports.GlobalProviders=ep;exports.Header=eu;exports.HelperTextBox=md;exports.HiddenFromScreenReaders=ii;exports.HideShowTextBox=pd;exports.HighlightSection=q_;exports.HighlightedTextBox=Et;exports.INVALID_TOKEN=id;exports.IconBulletedList=Um;exports.ImageContainer=Nm;exports.IntlProvider=Cd;exports.InviteForm=Lh;exports.InviteModal=B_;exports.JoinButton=po;exports.Label=Ho;exports.LanguageContext=oo;exports.LanguageSwitcher=rv;exports.LessonName=em;exports.LessonType=tm;exports.LikesButton=Ud;exports.LikesFeed=Xd;exports.LikesModal=ef;exports.Link=bn;exports.LoadMore=Qr;exports.LoadingBlock=Ad;exports.LoadingPlaceholder=Pt;exports.LoadingState=li;exports.Logo=wo;exports.LogoSection=r_;exports.MEMBERS_PER_PAGE=Hh;exports.MENTION_REGEX=sd;exports.MarkCompleteButton=tk;exports.MarkdownText=jn;exports.MarketingBlock=U_;exports.Marks=Vt;exports.Member=nn;exports.MembersList=Kh;exports.Modal=fo;exports.MoreMenu=af;exports.NUMBER_OF_COUNTRIES=Dm;exports.NUMBER_OF_USERS=xm;exports.NarrowCard=J_;exports.NavigationMenu=sf;exports.NotFoundError=rk;exports.Overlay=on;exports.OverlayContext=uo;exports.OverlayProvider=_d;exports.PageHeading=gd;exports.PageLayout=Vh;exports.PasswordForm=VE;exports.PasswordRules=mf;exports.Pill=Kt;exports.Poll=ok;exports.Popover=dd;exports.Portal=pr;exports.ProfileForm=zh;exports.ProfileImageChange=Ih;exports.ProfileModal=xi;exports.ProfileModalLauncher=nu;exports.ProfilePicture=sn;exports.ProgressBar=lo;exports.ProgressTracker=Im;exports.PublishArticleForm=KE;exports.Rating=Dv;exports.RepliesFeed=Jd;exports.ResponsesHeading=Gh;exports.ResponsiveImage=Ln;exports.ResultsVisibility=ai;exports.ReturnToNavButton=$m;exports.RichTextEditor=Jo;exports.SearchForm=qh;exports.ShareLink=tf;exports.ShareLinks=lv;exports.SignupForm=XE;exports.Span=ks;exports.StatusBanner=or;exports.TableOfContents=M_;exports.Tabs=cv;exports.Tags=l_;exports.TestimonialBlock=P_;exports.TimeToComplete=Di;exports.Toggle=UE;exports.Tooltip=$n;exports.TopLevelPage=i_;exports.UUID_V4_REGEX=$r;exports.UserContext=at;exports.UserProvider=wd;exports.VisuallyHidden=Oe;exports.addAriaProps=qd;exports.basicReducer=Gr;exports.camelCaseToDashCase=nd;exports.checkIntlPathExists=si;exports.enrichPostCategories=Do;exports.generateConditions=Ma;exports.generateCssIcon=Cm;exports.getAuthorData=gr;exports.getCharacterLimitProps=uf;exports.getLongDate=ao;exports.getMember=ci;exports.getPostBody=xo;exports.getShortDate=od;exports.getValueLength=di;exports.headerData=Yr;exports.likesResponseMock=Xg;exports.mapGetStreamData=nk;exports.pageReady=ud;exports.passwordValidator=Es;exports.repliesFeedMock=Ng;exports.supportedLanguages=Fa;exports.toCamelCase=rd;exports.toCapitalisedCase=ym;exports.toSentenceCase=ad;exports.transformSlugs=Ss;exports.useBadges=vd;exports.useCurrentPath=Gc;exports.useEffectAfterMount=sr;exports.useElementWidth=In;exports.useOverlay=Ed;exports.useScrollListener=Xc;exports.useScrollToHash=no;exports.useTooltips=ro;exports.useUser=ui;
165
+ `}),L=G.turndown(L)}o&&o.mentions&&(L=await cd({text:L,template:`[${Ks}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),qw(L,G=>{const Y=[{type:"initialValue",value:G},{type:"editorKey",value:M.toString()}];o!=null&&o.link&&(Y.push({type:"enrichedUrl",value:o.link}),o.link.url&&re(o.link.url)),S(Y),setTimeout(()=>{S([{type:"stringValue",value:Oc(_)}])},150)})})()},[M]),y.useEffect(()=>{if(U===void 0&&_){const L=Vw(_);L&&re(L)}const T=L=>{var te;const G=L,Y=((te=G==null?void 0:G.detail)==null?void 0:te.url)||null;Y&&U&&U.url===Y&&S([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",T),()=>{window.removeEventListener("linkRemoved",T)}},[U]),y.useEffect(()=>{if(t){Lr.lastIndex=0;const T=t.match(Lr);T&&T.length===1&&T[0].length===t.length&&!P&&S([{type:"originalValue",value:t}])}t!==""||!_||Ia(M,t)&&!P||(x.withoutNormalizing(_,()=>{J.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),J.deselect(_),_.children.length!==0&&J.unwrapNodes(_,{at:[0]}),J.insertNodes(_,A,{at:[0]})}),S([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{R===""&&U&&S([{type:"enrichedUrl",value:void 0}])},[R]);const q=Jc(()=>{Kw({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:S})},100);return z?c.jsx("div",{id:w,className:"rich-text-editor",children:c.jsxs(ln.Provider,{value:{...k,id:w,isInOverlay:p,setFocus:ne,dispatch:S,getLinkPreview:g,onMention:C,reportError:D},children:[c.jsxs(cC,{editor:_,initialValue:z,onChange:T=>{if(_.operations.some(G=>G.type!=="set_selection")){let G=Yw(T);G==="<br>"&&(G=""),f(G,U),S([{type:"stringValue",value:Oc(_)}]),P||S([{type:"hasInteracted",value:!0}]),q(),h&&console.log({serialized:G,json:T})}},...u,children:[c.jsx(tC,{className:"input",renderElement:Q,renderLeaf:se,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async T=>{const L=U!==!1,G=T.clipboardData.getData("text");if((te=>{try{return new URL(te),!0}catch{return!1}})(G)){let te=G;if(G){const{full:le}=so(G);te=le}if(G&&g&&!L){const le=await g(te);le.url&&S([{type:"enrichedUrl",value:le}])}}},onKeyDown:T=>{if(T.key==="Enter"){W.show&&(T.preventDefault(),T.stopPropagation(),_h(_,W,S,w));const{selection:L}=_;if(L){const G=Z.isCollapsed(L),[Y,te]=x.node(_,L,{depth:1});let le=Y,X=le.type;const pe=le.children[0];if(pe&&(pe==null?void 0:pe[H.h3])===!0&&(T.stopPropagation(),T.preventDefault(),J.insertNodes(_,A)),pe&&[H.ol,H.ul].includes(pe.type)&&(le=pe,X=pe.type),le&&de.isElement(le)&&X!==H.paragraph){if(X===H.blockquote&&!T.shiftKey){T.stopPropagation(),T.preventDefault(),J.insertNodes(_,A);return}if(G){const[fe,ke]=x.parent(_,L,{edge:"end"}),Te=fe.type;if([H.ul,H.ol].includes(X))if(T.stopPropagation(),T.preventDefault(),Te===H.li&&F==="Enter"){fe.children.length===1&&"text"in fe.children[0]&&fe.children[0].text===""&&J.removeNodes(_,{at:ke}),J.insertNodes(_,A,{at:I.next(te)}),J.select(_,x.end(_,I.next(te)));return}else{const[Ke,Ne]=Uw(_,H.li),$e={type:H.li,children:[{text:""}]};J.insertNodes(_,$e,{at:I.next(Ne)}),J.select(_,x.end(_,I.next(Ne)))}}}}}else if(T.key==="Escape"){if(W.show){T.preventDefault(),T.stopPropagation(),S([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(T.key)&&W.show){T.preventDefault(),T.stopPropagation();const{selectedUser:L,possibleUsers:G}=W;let Y=T.key==="ArrowUp"?L-1:L+1;Y<0&&(Y=G.length-1),Y>=G.length+1&&(Y=0),S([{type:"mentionPopover",value:{...W,selectedUser:Y}}])}S([{type:"lastKey",value:T.key}]),Hw(T,_,S,D)},onBlur:()=>{_.selection&&S([{type:"lastAnchor",value:_.selection.anchor}])},onFocus:()=>{if(B){if(!I.isPath(B.path)||!ue.has(_,B.path))return;const T=ue.get(_,B.path);let L=0;if(he.isText(T)?L=T.text.length:T.children&&(L=T.children.length),B.offset>L)return;try{J.select(_,{anchor:B,focus:B})}catch(G){const Y=G.message;D(`Error focusing editor: ${Y}`)}}}}),U?c.jsx(wo,{data:U,variant:"condensed",onClick:()=>{S([{type:"enrichedUrl",value:!1}]);const T=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(T)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(iE,{styling:l==null?void 0:l.toolbar}),m?c.jsx(Gw,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},$),c.jsx(_o,{id:`character-limit-${e}`,limit:r,valueLength:fi(R)})]})}):c.jsx(c.Fragment,{})};const VE=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function Lh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ie.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,v]=y.useState(!1),f=y.useRef(null),b=async A=>{p(!0),v(!1);try{const E=A.target.files&&A.target.files[0];if(!E||!t)throw p(!1),new Error("Image file or userID is missing");const k=await a({fileObject:E,userId:t}),S={thumbnail:k.thumbnailURL,full:k.originalURL};d(S),s(S)}catch{v(!0)}finally{p(!1)}p(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:C=o.formatMessage({id:`${l}cta_change`}),uploading:D=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(on,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?D:u?C:g})]})}const zh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Qt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const HE=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(pm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},qh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,p]=y.useState([]),[m,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ie.useIntl(),C=async E=>{try{await u(h,E.message),p([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},D=E=>{E.preventDefault(),b("NOT_SUBMITTED"),v(!0),p([])},A=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(Lt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:D,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:A,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:D,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Qt,{id:"invite-form",fields:[{component:HE,props:{emails:h,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:C},button:{text:r,size:"medium",disabled:m}})]})},Na=e=>e.map(t=>({condition:t})),Bt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},KE=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Bt.NEW_PASSWORD]!==m[Bt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!_s(m[Bt.NEW_PASSWORD]).isValid,h=[{"data-testid":Bt.NEW_PASSWORD,id:Bt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Na(["required",d]),functions:{onChange:m=>l(_s(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Bt.CONFIRMED_PASSWORD,id:Bt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Na(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Bt.CURRENT_PASSWORD,id:Bt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Na(["required"])}),i&&h.push({component:gf,props:{matchingRules:o}});const p={id:Bt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,v)=>{(v.includes(Bt.NEW_PASSWORD)||v.includes(Bt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{...p}),r&&c.jsx(xn,{variant:"error",text:r})]})};const Uh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var $;const s=ie.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[h,p]=y.useState(!1),{uploadImage:m=()=>{},onSuccess:v=async M=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:C,predictPlaces:D}=t.useMaps(),{context:A="ProfileForm",event:E="profile-form-submit-click"}=a||{},k=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:($=l.location)==null?void 0:$.en,validation:[{condition:"required"},{condition:({location:M})=>M&&!h?!1:!C(M),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{h||p(!0)},onKeyInput:D}}],S=[{component:Lh,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},...k,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:Lt}];return c.jsx(Qt,{id:"profile-details-form",fields:e?k:S,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:E},functions:{onSuccess:async M=>{try{const z={...M,image:u||null,location:h?await g(M==null?void 0:M.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...z})),await v(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...i})},ZE=()=>{const e=ie.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Bd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ds=null;const it="publishArticleForm_",zc={},qc=10,YE=({id:e="publish-article-form",values:t=zc,functions:n,meta:r,gtm:a})=>{const i=ie.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,p]=y.useState(!1),[m,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,C]=y.useState("");y.useEffect(()=>{Ia(t,zc)||$a(t.body)&&t.body!==m&&t.body!==void 0&&v(t.body)},[t.body]);const D=()=>{!s||!s.id?b(i.formatMessage({id:`${it}error_loggedOut`})):f&&b(!1)},A=$=>({condition:M=>{const z=M[$];return!z||typeof z!="string"?!0:z.length<qc},error:i.formatMessage({id:`${it}error_underMinLength`},{length:qc})}),E=!!m&&$a(m),k=()=>c.jsxs(c.Fragment,{children:[c.jsx(Lt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${it}disclaimer`})})]}),S=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${it}title_label`}),placeholder:i.formatMessage({id:`${it}title_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("title"),{condition:()=>!E,error:i.formatMessage({id:`${it}title_error`})}]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${it}subtitle_label`}),placeholder:i.formatMessage({id:`${it}subtitle_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("subtitle")]},{component:Ko,props:{formID:e,label:{visible:i.formatMessage({id:`${it}body_label`})},showLabel:!0}},{component:Xo,props:{id:`${e}-input`,value:m,placeholder:i.formatMessage({id:`${it}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:$=>{v($),D()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return h?S.push({component:Lt}):S.push({component:k}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Qt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async $=>{if(!s||!s.id||!E)return;ds&&clearTimeout(ds),p(!0);const M={...$,body:m};try{o&&await o(M),ds=setTimeout(()=>{C(i.formatMessage({id:`${it}aria_success`})),l(M)},500)}catch{b(i.formatMessage({id:`${it}error`})),C(""),u()}},onFailure:u},fields:S,intlPath:it,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!E,text:{default:i.formatMessage({id:`${it}cta_submit`}),submitting:i.formatMessage({id:`${it}cta_submitting`}),submitted:i.formatMessage({id:`${it}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(ZE,{})},gtm:a}),f&&c.jsx(or,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${it}error`})}),g&&c.jsx(je,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const Wh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ie.useIntl(),u=y.useRef(null);sr(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(je,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(je,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(je,{children:l.formatMessage({id:"search_cta"})})})]})})})},Uc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},GE=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"]}},QE=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=GE(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}])},JE=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,v)=>{m.current&&s.validFields[v]!==m.current.validity.valid&&o([{type:`validFields.${v}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Uc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({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:cf,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const v=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Uc({ref:i.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const XE=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const e_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},t_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ie.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,v={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Qr,e_),{validFields:g,emailDetails:C,shouldManuallyApprove:D,shouldDisableButton:A,showSuccessMessage:E,showError:k}=f,[S,$]=no.useCookies(["signup-this-session","functional-cookie-consent"]),M={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{D===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[D]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{E&&S["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>JE({placeholders:n,labels:t,shouldShow:v,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,v,f]),R=A?!0:D?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(C.boxType);return v.successMessage&&E?c.jsx(XE,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(xn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Qt,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:R?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await QE({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const wn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const n_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(wn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(mr,{buttons:r})]})})};const to="editSection_";function Vh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const r_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(Et,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${to}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Vh({href:r,setShowModal:i}),children:n||s({id:`${to}placeholder_cta`})})})]})},a_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ie.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),v=!!n||!!r,f=typeof a=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:K("edit-section",t),children:[v&&c.jsx(un,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:K("edit-section-modal"),children:b||(n?c.jsx(Qt,{...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 g=>{var C,D;(C=n==null?void 0:n.functions)!=null&&C.onSuccess&&await((D=n==null?void 0:n.functions)==null?void 0:D.onSuccess(g)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Vh({href:a,setShowModal:p}),children:d({id:`${to}edit`})})]}),e||c.jsx(r_,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(Lt,{})]})};const i_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:K("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${v}`))})})]})};let fs;const hs="contactFooter_",s_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(fs),fs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(fs),window.removeEventListener("resize",l)}),[]),c.jsx(wn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${hs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${hs}text`})}),c.jsx(yn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${hs}email`})})]}),c.jsx(zh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},o_=({activeLink:e,profile:t,...n})=>c.jsx(wn,{children:c.jsx(uf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(of,{activeLink:e,profile:t}),c.jsx(vd,{...n})]})})});const ms="cookieBanner_",ps=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],gs=new Date(Date.now()+12*30*24*60*60*1e3),Hh=()=>{const e=ie.useIntl(),[t,n,r]=no.useCookies(ps),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{ps.forEach(d=>{n(d,!0,{path:"/",expires:gs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:gs}),ps.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:gs});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${ms}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${ms}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ms}text`})}),c.jsx(mr,{buttons:u})]})},tn={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Gn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Gn["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:Gn.support,gtmType:"concierge-email-click"},business:{email:Gn.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 nr="footer_",ni="SiteFooter",Wc=({group:e})=>{const t=tn[e].order||[];let n=!1;return"text"in tn[e]&&(n=tn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${nr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=tn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":i,...s,children:c.jsx(ie.FormattedMessage,{id:`${nr}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${nr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${nr}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},eu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(si,{element:"hr"}),c.jsx(Eo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Wc,{group:e}),Object.keys(tn[e]).includes("child")&&c.jsx(Wc,{group:tn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(tn.social.order)&&tn.social.order.map(e=>{const t=tn.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${nr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${nr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Le={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===wt.ACCOUNT&&t===!1&&n[wt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Le.handlerCalled[e]&&i-Le.handlerCalled[e]<500)return;Le.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case wt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case wt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case wt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Zc(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?Le.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case wt.SITE:if(n){const u=Le.findFirstChild(t.current.children,"className","has-submenu parent"),d=Le.findFirstChild(u.children,"id",wt.SITE);s=Le.findFirstChild(d.children,"href")}else s=Le.findFirstChild(t.current.children,"href");break;case wt.ACCOUNT:if(o=Le.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Le.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(Le.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Le.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Le.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Le.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Gr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ri=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ie.useIntl(),o=Zc(Gr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let D=o.gtmType||`${e}-click`;if(D.includes(".")){const A=D.split("."),E=A[A.length-2];D=`${E==="topics"?`${E}-`:""}${A[A.length-1]}`}p={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":D,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],v=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},g={},C={};if(f&&(b={...b,"aria-current":"page"}),m){const D=o.menuId||e,A={onClick:E=>Le.events.onClick(E,{id:D,callback:a,isOpen:r[D]}),onFocus:()=>Le.events.onFocus({id:D}),onBlur:()=>Le.events.onBlur({id:D,callback:a}),onMouseLeave:()=>Le.events.onBlur({id:D,callback:a}),onMouseEnter:()=>Le.events.onMouseEnter({id:D,callback:a})};g={...A,id:D===wt.SITE?wt.SITE:wt.ACCOUNT},n&&(v&&(C={...A,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Le.events.onClick(E,{id:D,callback:a,isOpen:r[D]})},"aria-haspopup":!0,"aria-expanded":r[D],"aria-controls":D}),g={...g,hidden:D in r?!r[D]:!0}),v||(g={...g})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":m,parent:v,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:h})):n&&o.order&&v?c.jsxs("button",{...C,children:[s.formatMessage({id:h}),c.jsx(je,{children:s.formatMessage({id:`header_menu_${r[wt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...g,children:o.order.map(D=>{if(!o[D])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[D].order?c.jsxs("li",{className:K({[o[D].className]:o[D].className}),children:[s.formatMessage({id:`${h}_${D}`}),c.jsx("ul",{children:o[D].order.map(E=>c.jsx(ri,{id:`${e}.${D}.${E}`,...A},E))})]},D):c.jsx(ri,{id:`${e}.${D}`,...A},D)})})]},e)};const u_={height:67,height_desktop:83};var wt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(wt||{});const tu=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=y.useContext(at),r=Rn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Le.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Qr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),ed({scrollPosition:u_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=h.current.menus;!i&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=h.current.menus;!i&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!1,g,o)}}});const p=(g,C,D=!1)=>{Le.handleMenus({id:g,value:C,menus:h.current.menus,dispatch:o,forceHandle:D})},m=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(C=>{h.current.menus[C]&&p(C,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var C;(C=document.getElementById("header"))==null||C.removeEventListener("keydown",v)}},[]),sr(()=>{u["site-navigation"]&&Le.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),sr(()=>{u["account-navigation"]&&Le.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(je,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Wh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(je,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Gr.order.map(g=>c.jsx(ri,{id:g,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(je,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Eo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:g=>Le.events.onClick(g,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Le.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Le.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(je,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(on,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Gr.buttons.order.map(g=>c.jsx(ri,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const l_=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(tu,{}),c.jsx("div",{id:"content",children:c.jsx(xn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(eu,{})]})},Kh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,v=Qc(),[f,b]=y.useState(""),g=k=>{const{detail:{message:S}}=k;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const C=Fa(e,{locale:o}),D=Fa(t,{locale:o}),A=Fa(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),h!=="default"&&(E[h]=!0),p!=="default"&&(E[p]=!0),c.jsx(mm.ErrorBoundary,{onError:r,fallback:c.jsx(l_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,E,{"has-footer":u}),children:[c.jsx(tu,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[D&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":m==="large"}),children:D}),y.createElement(d==="bold"?ho:"div",{id:"content",children:C,className:K({"large-modal":m==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(eu,{}),c.jsx(Hh,{})]}),f&&c.jsx(je,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Vc={default:"tags_",headerTopics:"header_topics_topics_"},vs={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"},c_={getTagDetails:e=>{if(e.includes("topic_")){if(e=vs.topic[e.replace("topic_","")],e){const t=Gr.topics.topics[e].href;return t?{id:e,href:t,text:`${Vc.headerTopics}${e}`}:null}return null}return vs[e]?(e=vs[e],{id:e,text:`${Vc.default}${e}`}):null}};const d_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=c_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:K("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Zh=25,f_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const p=ie.useIntl(),m="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",h),children:[u?c.jsxs("h1",{children:[p.formatMessage({id:m}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(rn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),c.jsx(yn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:p.formatMessage({id:`${m}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,C)=>c.jsxs("li",{children:[c.jsx(rn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Zt,{children:p.formatMessage({id:`${m}_admin`})})]},C)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Zh))].map((g,C)=>c.jsx("li",{children:c.jsx(ci,{layout:"member"})},C)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Jr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Ci,{form:s,showModal:f,content:{title:p.formatMessage({id:`${m}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Yh=f_,h_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ie.useIntl();return t?c.jsx("small",{children:Nt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},m_=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(Ko,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Nt(r.formatMessage,`${e}label_action`,t,"action")},...n})};let Ca=null;const Xe="discussion_form_",ea=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Qe,Ae,qe;const m=ie.useIntl(),v=y.useContext(at),[f,b]=y.useState(""),{isLoading:g=!1,isInWrapper:C=!1,isInOverlay:D=!1,isAutoFocused:A=!1,isEditing:E=!1,hasTitleField:k=!1,isPrepopulated:S=!1,showTitle:$=!1,showGuidelines:M=!0,showDivider:z=!1,showSuccessMessage:R=!0,showPostType:B=!1,postCategories:F=[]}=a||{},{onChange:P=()=>{},create:j=()=>{},handleSaveEdit:U=()=>{},handleCancel:W=()=>{},callback:ne=()=>{},onMention:re=()=>{},listMembers:w=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},getLinkPreview:se=()=>Promise.resolve({}),props:_={create:{projectNames:["questions-answers"]}}}=d,[O,q]=y.useState({title:k&&k.text||"",body:E&&E.text||S&&S.text||"",categories:E&&E.categories?E.categories:"",data:h!=null&&h.link?{link:h==null?void 0:h.link}:{}}),[T,L]=y.useState(l.error||!1),[G,Y]=y.useState(!1);if(y.useEffect(()=>{u&&!E&&S&&S!==O.body&&q(be=>({...be,body:S.text||""}))},[S]),g)return c.jsx(Pt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const te=(be,V)=>{q(me=>({...me,body:be,data:{link:V}})),P({body:be});let ae;!v||!v.id?ae=Nt(m.formatMessage,`${Xe}error_loggedOut`,n.type,"action"):r?s>0&&be.length>=s&&(ae=`${Xe}error_tooLong`):ae=Nt(m.formatMessage,`${Xe}error_noPermission`,n.type,"action"),ae?L(ae):T&&L(!1)};let le=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const be=((Qe=n.slugs)==null?void 0:Qe.reply)||((Ae=n.slugs)==null?void 0:Ae.answer)||((qe=n.slugs)==null?void 0:qe.question)||"";be&&(le=`${le}-${be.slice(-15)}`)}e&&(le=`${e}-${le}`);const X=async()=>{if(!v||!v.id||!r||Te)return;Ca&&clearTimeout(Ca),Y("submitting");const be=window.location.pathname;try{let V;switch(n.type){case"post":V=await j({title:O.title,content:O.body,categories:O.categories,data:O.data});break;case"question":V=await j({title:O.body,authorId:v&&v.id,data:O.data,..._==null?void 0:_.create});break;case"response":V=await j({questionSlug:n.slugs.question},{body:O.body,authorId:v&&v.id,contentPath:be,data:O.data});break;case"reply":V=await j({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:O.body,authorId:v&&v.id,contentPath:be,data:O.data});break;default:break}await Fm(1e3),ne&&await ne(V),Ca=setTimeout(()=>{q({title:"",body:"",categories:"",data:{}}),Y("submitted"),b(Nt(m.formatMessage,`${Xe}success`,n.type,"action"));const ae=new Event(nt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ae),pe()},500)}catch(V){const ae=V;let me=`${Xe}error`;ae!=null&&ae.message.includes("entry already exists")&&(me=Nt(m.formatMessage,`${Xe}error_alreadyExists`,n.type,"action")),ae!=null&&ae.message.includes("429")?me=Nt(m.formatMessage,`${Xe}error_tooMany`,n.type,"action"):ae!=null&&ae.message.includes("400")&&(me=`${Xe}error`),L(me),pe()}},pe=()=>{Ca=setTimeout(()=>{L(!1),Y(!1),b("")},5e3)},fe=be=>{q(V=>({...V,data:be}))},ke=!O.title||!$a(O.title),Oe=!O.body||!$a(O.body);let Te=Oe;k&&(Te=ke&&Oe);const Ke=G==="submitting",Ne=[{component:m_,props:{formID:le,intlPath:Xe,showLabel:k!==!1,type:n.type}},{component:Xo,props:{id:`${le}-input`,value:G==="submitting"&&!T?"":O.body,placeholder:i||Nt(m.formatMessage,`${Xe}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:D},functions:{onChange:te,onChangeData:fe,onMention:re,listMembers:w,clickMentionFallback:Q,getLinkPreview:se},data:h,autoFocus:E!==!1||A&&!k,"aria-invalid":!!T,"aria-errormessage":"error-message"}},{component:h_,props:{intlPath:Xe,showGuidelines:M,type:n.type,gtmContext:p}}];z&&Ne.push({component:Lt}),k&&Ne.unshift({id:"title",type:"text",value:k.text,limit:250,label:m.formatMessage({id:`${Xe}titleField_label`}),placeholder:m.formatMessage({id:`${Xe}titleField_placeholder`}),functions:{onChange:be=>{q({...O,title:be}),P({title:be})}},validation:[{condition:()=>Te,error:m.formatMessage({id:`${Xe}titleField_error`})}]}),B&&Ne.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:m.formatMessage({id:`${Xe}postType_label`}),options:F.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{q(V=>({...V,categories:be})),P({postType:be})}}});let $e=!v||!v.id||!r||Te||Ke;return E&&(k?$e=$e||O.body===E.text&&O.title===k.text:$e=$e||O.body===E.text),c.jsxs(c.Fragment,{children:[c.jsxs(Qt,{id:le,className:K("discussion-card discussion-form",{"no-styling":C&&E}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:E&&!Ke||l.cancel},functions:{onSuccess:async be=>{if(E){Y("submitting"),U(O);return}await X()},onCancel:W},fields:Ne,intlPath:Xe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`${E?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:$e,text:{default:!E&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Xe}${E?"save":"post"}`}),submitting:m.formatMessage({id:`${Xe}${E?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!v||!v.id||!O.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Xe}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[$&&!E&&["question"].includes(n.type)&&c.jsx("h2",{children:Nt(m.formatMessage,`${Xe}title`,n.type,"action")}),c.jsx(rn,{member:v?{...v,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]}})]}),G==="submitted"&&R&&c.jsx(or,{className:"success","data-testid":"success",children:Nt(m.formatMessage,`${Xe}success`,n.type,"action")}),T&&c.jsx(or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof T=="string"?T.includes(" ")?T:m.formatMessage({id:T},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):T}),f&&c.jsx(je,{"aria-live":"polite",showOnFocus:!1,children:f})]})},p_=Object.freeze(Object.defineProperty({__proto__:null,default:ea},Symbol.toStringTag,{value:"Module"})),bs=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};const g_={showForm:!1},xi=y.createContext(g_),Gh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(xi.Provider,{value:{...t,updateConversation:n},children:e})},Da="discussion_",v_=195;let wa=null;const ta=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,setFocus:m=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g})=>{var $e,Qe,Ae,qe,be,V,ae,me,ge,we,Ye,Ge,ot,Ft,gt,et;const C=ie.useIntl(),D=y.useContext(xi),A=y.useContext(at),{createContent:E=async()=>{},deleteContent:k=async()=>{},updateContent:S=async()=>{}}=o.content||{},{createLike:$=()=>{},deleteLike:M=()=>{},listLikes:z=async()=>({})}=o.likes||{},{openComments:R=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:F=()=>{}}=o.form||{},{author:P,canLike:j,createdAt:U,id:W,likes:ne=0,userLiked:re,comments:w=0,data:Q}=t,se=A&&A.id&&typeof P!="string"&&P.id&&P.id===A.id||!1,_=typeof j=="boolean"?j:!0,O=se&&(!t.createdAt||_m(t.createdAt,10,"seconds")),q=y.useRef(null),[T,L]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[G,Y]=y.useState(!1),[te,le]=y.useState(O?"highlighted":"default"),[X,pe]=y.useState("");y.useEffect(()=>{const xe=q.current;if(!(!xe||te==="default"))return document.addEventListener(nt.DISCUSSION_FORM_SUBMITTED,fe),xe.addEventListener("transitionend",ke),()=>{document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,fe),xe.removeEventListener("transitionend",ke)}},[]),y.useEffect(()=>{L(xe=>({...xe,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Fe=await Co(T.body,p,Q==null?void 0:Q.mentions,B);L(Mt=>({...Mt,postBody:Fe}))})()},[T.body,Q==null?void 0:Q.mentions]);const fe=()=>{setTimeout(()=>{le("fading")},1e3)},ke=({propertyName:xe})=>{xe==="background-color"&&le(Fe=>(Fe==="default"&&(document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,fe),q.current&&q.current.removeEventListener("transitionend",ke)),Fe==="fading"?"default":Fe))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||T.postBody===""&&t.title==="")return c.jsx(Pt,{className:"discussion-card"});const Oe=async({title:xe,body:Fe,data:Mt})=>{xe||(xe=""),Fe||(Fe=""),pe("");try{if(!Ia(xe,T.title)||!Ia(Fe,T.body)){const vt=t.type==="question"?{title:Fe}:{title:xe,body:Fe,data:Mt};await S(js(t.slugs),vt)}L(vt=>({...vt,title:xe||"",body:Fe||"",data:{...vt.data,...Mt},isEditing:!1,didEdit:!0}))}catch{pe(`${Da}form_error`)}},Te=()=>{if(D&&D.updateConversation){const xe={showForm:!0},Fe=t.author;Fe&&Fe.id&&(v&&(xe.prepopulateForm=`@{{${Fe.id}}}`),xe.mentionData={id:Fe.id,name:Fe.name}),D.updateConversation(xe)}setTimeout(()=>{var En,Jt,qn;const Fe=`reply-form-${(t.type==="answer"?t.slug:((En=t.slugs)==null?void 0:En.reply)||((Jt=t.slugs)==null?void 0:Jt.answer)||((qn=t.slugs)==null?void 0:qn.question)||"").toLowerCase().slice(-15)}`,Mt=document.getElementById(Fe),vt=document.getElementById(`${Fe}-input`);vt&&vt.focus(),Mt&&Mt.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{Y(!1);try{await k(js(t.slugs))}catch{pe("delete-error")}},Ne=[];return n&&se&&Ne.push({text:C.formatMessage({id:`${Da}moreMenu_edit`}),onClick:()=>L(xe=>({...xe,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:C.formatMessage({id:`${Da}moreMenu_delete`}),onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),Y(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Ud(`delete-${t.slug}-modal`,G)}),r&&o.pins&&Ne.push({text:C.formatMessage({id:`${Da}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),m&&(($e=q==null?void 0:q.current)==null||$e.focus(),(Qe=q==null?void 0:q.current)==null||Qe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:K("discussion-post",u,{[te]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!T.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:q,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:xe=>{if(!l.post||T.isEditing)return;xe.preventDefault(),xe.stopPropagation(),wa&&clearTimeout(wa),wa=setTimeout(()=>{window.location.href=l.post},150);const Fe=new CustomEvent(nt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:wa}});document.dispatchEvent(Fe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:K("discussion-card",t.type,{editing:T.isEditing,"has-link":l.post&&!T.isEditing}),children:[!T.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(rn,{member:P,additionalContent:{createdAt:U,didEdit:T.didEdit,customMessage:(Ae=t.componentProps)!=null&&Ae.member.additionalContent?(V=(be=(qe=t.componentProps)==null?void 0:qe.member)==null?void 0:be.additionalContent)==null?void 0:V.customMessage:{}},className:typeof P!="string"&&P.id===i?"highlighted":"",styling:{additionalContentNewLine:!!((ae=t.componentProps)!=null&&ae.member.additionalContent&&((we=(ge=(me=t.componentProps)==null?void 0:me.member)==null?void 0:ge.additionalContent)!=null&&we.customMessage))},gtmContext:d,gtmType:"profile-click",badges:f}),t.pinned&&c.jsx(Zt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(je,{children:"Pinned Post"})})]}),T.isEditing?c.jsx(ea,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:T.title!==""?{text:T.title}:!1,isEditing:{text:T.body,categories:[]},isPrepopulated:!1},isCommunity:v,maxLength:t.type==="question"?250:5e4,forceShow:{error:X!==""&&X!=="delete-error"?C.formatMessage({id:X},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:E,handleSaveEdit:Oe,handleCancel:()=>{pe(""),L(xe=>({...xe,isEditing:!1}))},listMembers:B,clickMentionFallback:F},gtmContext:`${d}Form`,data:Q}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(T==null?void 0:T.title)&&c.jsx("p",{className:"content-title",children:T==null?void 0:T.title}),T.postBody.length>v_?c.jsx(gd,{text:T.postBody,markdownOptions:{overrides:{a:Fs,blockquote:{component:bs}}}}):c.jsx(jn,{options:{overrides:{a:Fs,blockquote:{component:bs}}},children:T.postBody})]}):c.jsxs(c.Fragment,{children:[(T==null?void 0:T.title)&&c.jsx("p",{className:"content-title",children:T==null?void 0:T.title}),c.jsx(jn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:bs}}},children:T.postBody})]}),(Ye=T.data)!=null&&Ye.link?c.jsx(wo,{data:T.data.link}):c.jsx(c.Fragment,{}),(Ge=t.categories)!=null&&Ge.length?c.jsx("ul",{className:"categories-list",children:t.categories.map(xe=>c.jsx(Zt,{size:"small",element:"li",children:xe.name},xe.slug))}):c.jsx(c.Fragment,{})]}),!T.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(rf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:ne||0,userLiked:re||!1,canLike:_,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:$,deleteLike:M,listLikes:z},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&(["question","post"].includes(t.type)||l.comments)?{count:w||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof R=="function"&&R()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:Te}}:!1,shareLink:{url:`${window.location.origin}${(ot=t.slugs)==null?void 0:ot.question}/${(Ft=t.slugs)==null?void 0:Ft.answer}${(gt=t.slugs)!=null&&gt.reply?`#${(et=t.slugs)==null?void 0:et.reply}`:""}`},moreMenu:{options:Ne,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),h,c.jsx(un,{id:`delete-${t.slug}-modal`,isOpen:G,functions:{onOpen:()=>{},onClose:()=>Y(!1)},forceShow:{error:X==="delete-error"?C.formatMessage({id:"discussion_delete_error"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:C.formatMessage({id:"discussion_delete_title"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Y(!1),children:C.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Ke,children:C.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:xe=>c.jsx("p",{children:xe}),action:C.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const b_=y.lazy(()=>Promise.resolve().then(()=>T_)),y_=65,Qh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(at)||"community",l=di(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||dd("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const g=await Co(p.title||p.body||"",y_,p.mentions);m(C=>({...C,prettifiedText:g}))})()},[p.showCachedText,p.title,p.body]);const v=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const C=b;C.preventDefault(),C.stopPropagation();const A=C.target.closest("a");g=A&&A.getAttribute("href")}h(C=>({...C,warning:g||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(nt.DISCUSSION_POST_CLICKED,v),document.addEventListener(nt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[p.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!p.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(on,{name:l.name,src:l.image,alt:""}),c.jsx(jn,{className:K("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Tt,blockquote:Tt,br:Tt,em:Tt,li:Tt,ol:Tt,p:Tt,s:Tt,span:Tt,strong:Tt,ul:Tt}},children:f})]}),c.jsxs(pr,{children:[c.jsx(b_,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(un,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},x_=y.lazy(()=>Promise.resolve().then(()=>p_)),nu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(xn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(go,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...p}=t,m={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(Qh,{form:m}):c.jsx(x_,{...m})},ru=({form:e})=>{const t=y.useContext(at),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{Pm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Ci,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ys="discussion_responses_",Jh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ys}title`},{action:r.formatMessage({id:`${ys}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Nt(r.formatMessage,`${ys}empty`,e,e)})]})};const Xh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(xi),o=Fa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Jr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ea,{...r})]})};function C_(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function D_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function w_({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 E_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=We.useQueryClient(),l=li(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:vo(u),mutate:bo(u)},user:l,...u},h=D_({...d,mutationFn:t}),p=__({...d,mutationFn:n}),m=k_({...d,mutationFn:r}),v=F_({...d,mutationFn:a}),f=A_({...d,mutationFn:i}),{activity:b,...g}=w_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:v,unpin:f},user:l,...g}}function __({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function k_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Kd({activity:s,user:r}),s)),onError:n});return a}function F_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function A_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Zd({activity:s,user:r}),s))),onError:n});return a}const B_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:p,categories:m})=>{var W,ne,re,w,Q,se;const v=ie.useIntl(),{activity:f,error:b,isLoading:g,mutations:{edit:C,like:D,unlike:A,pin:E,unpin:k}}=E_({queryFns:s,queryKey:[e,t,n]});if(g)return c.jsx(Pt,{style:{height:"400px"}});if(b||!f)return c.jsx(xn,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:S,verb:$,latest_reactions:M,mentioned_users:z,additional_data:R}=f,B=(((W=M==null?void 0:M.like)==null?void 0:W.length)||0)>0,F=(((ne=S==null?void 0:S.like)==null?void 0:ne.length)||0)>0,P=F?S==null?void 0:S.like[0].id:"",j=B?(re=M==null?void 0:M.like)==null?void 0:re.map(_=>{var O,q,T;return{id:(O=_==null?void 0:_.user)==null?void 0:O.id,name:(T=(q=_==null?void 0:_.user)==null?void 0:q.data)==null?void 0:T.name}}):!1,U=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ta,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:Do((f==null?void 0:f.categories)||[],m||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:gr(U),userLiked:F,likes:((w=f==null?void 0:f.reaction_counts)==null?void 0:w.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:j,data:{mentions:z,...R||{}},pinned:((Q=f==null?void 0:f.reaction_counts)==null?void 0:Q.pin)&&((se=f==null?void 0:f.reaction_counts)==null?void 0:se.pin)>0||!1},originalAuthorId:U==null?void 0:U.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(_,{title:O,body:q})=>C({title:O,content:q})},likes:{createLike:()=>D({activityId:n}),deleteLike:()=>A({activityId:n,reactionId:P}),listLikes:_=>o.list({activityId:n,..._})},comments:{openComments:()=>{}},pins:{createPin:()=>E({activityId:n}),deletePin:()=>{var _;return k({activityId:n,reactionId:(_=M==null?void 0:M.pin)==null?void 0:_[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(Xd,{basePath:e,parentId:t,activityId:n,showReplies:C_($,M),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:p})]})};const em=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(un,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",a),children:c.jsx(ea,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const C=v||{};C[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(D=>({...D,mentions:C}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},T_=Object.freeze(Object.defineProperty({__proto__:null,default:em},Symbol.toStringTag,{value:"Module"}));const S_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=ie.useIntl();return a||(a=h.formatMessage({id:"inviteModal_formTitle"})),i||(i=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(un,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:K("invite-modal",e,{success:!!n}),children:c.jsx(qh,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const j_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(dd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(un,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:K("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(Uh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},Ci=j_,O_=Object.freeze(Object.defineProperty({__proto__:null,default:Ci},Symbol.toStringTag,{value:"Module"}));const P_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(on,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(un,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(jn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const M_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:K("testimonial-block",a),children:[c.jsx(Kt,{className:"testimonial",children:n}),r?c.jsx(rn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),N_=y.memo(M_);const I_=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Et,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Di=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,v=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&v>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${v>0?i.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:K("time-to-complete",a),"aria-label":u,children:l})};const R_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(Ln,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const $_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],L_=({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 v,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:g,element:C}=t[b];if(C&&$_.includes(C.toLowerCase()))return;p[b]={text:g,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(wn,{className:K("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:g,element:C=""}=p[b];return b==="text"?c.jsx(jn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(C,{key:b,className:b},g)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Ln,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},z_=y.memo(L_);const q_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(wn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const U_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(jn,{children:n}):n;return c.jsxs(wn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Ln,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},W_=y.memo(U_);const V_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),H_=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&Es(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):io(d)});if(o)return c.jsx(Zt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&Es(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},K_={title:66,text:3e3,secondaryText:1e3,partner:34},ai={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"}},Z_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=ai[p])!=null&&f.gtmEvent&&(m=ai[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(p)&&d!=="premium"){const g=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),C=async D=>{if(D.preventDefault(),D.stopPropagation(),!(g||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:C,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${g?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function Y_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(at),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Zt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const au=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,P;const u=ie.useIntl(),d=y.useContext(at),h=!!(d!=null&&d.id),{isTabbable:p=!0,setFocus:m=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(j=>{b({data:j,isLoading:!1})}).catch(()=>b(j=>({...j,isLoading:!1})))},[a,h,n]);const{data:g,isLoading:C}=f;if(C||!g)return c.jsx(Pt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:D}=g;if(!D||!ai[D])return c.jsx(Pt,{element:"li",className:"card-wrapper"});const{basePath:A="",className:E,length:k,gtmEvent:S}=ai[D];let $=p&&g.slug?`${A}${g.slug}`:!1;p&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&($=g.slug);const M=j=>{$&&(j.preventDefault(),j.stopPropagation(),window.location.href=$)},z={...K_,...k};let R={className:"card"},B={};return $&&(B={href:$,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${S}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),R={onClick:M,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${S}-click`}),m&&(R={...R,tabIndex:"0"},(F=v==null?void 0:v.current)==null||F.focus(),(P=v==null?void 0:v.current)==null||P.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",E,t,{"has-link":$,"no-link":!$,"has-image":g.banner}),"data-testid":`${D}-card`,children:c.jsxs("div",{...R,ref:v,children:[c.jsx(hd,{className:"card-label",contentType:D,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),D==="communityPage"&&(g==null?void 0:g.createdAt)&&km(g==null?void 0:g.createdAt,60)&&c.jsx(Zt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Zt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):ud(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Zt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Ln,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(on,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(fo,{contributors:{data:g.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(D)?u.formatMessage({id:`card_contributors_${D}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):ir(g.partner[0],z.partner)}),["title","text","secondaryText"].map(j=>{const U=g[j];if(!U)return null;const W=rd(j),ne={key:j,className:W,"data-testid":W},re={wrapper:"p",forceWrapper:!0,forceInline:!0},w=ir(U,z[j]);return["title","text"].includes(j)&&$?(re.wrapper="a",c.jsx("p",{...ne,children:c.jsx(Kt,{options:re,...B,children:w})})):c.jsx(Kt,{options:re,...ne,children:w})}),a.contentType==="communityPage"&&(a.slug||g.slug)&&r&&c.jsx(Y_,{communitySlug:a.slug||g.slug,buildMemberData:r}),c.jsx(H_,{type:E||"",data:g}),c.jsx(Z_,{data:g,cta:i,link:$||"",gtmContext:s})]})})};const tm=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(au,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),G_=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},Q_=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:K("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const xs={fourCards:1024,threeCards:769,twoCards:480};let Ea=null,Cs=null;const J_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[C,D]=y.useState(""),A=t.length,E=Math.ceil(A/p),k=y.useRef(null),S=Rn(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let F=1;S&&(S>=xs.fourCards?F=4:S>=xs.threeCards?F=3:S>=xs.twoCards&&(F=2),F>A&&(F=A)),h(P=>({...P,cardsPerPage:F,isLoading:!1}))},[S,A]);const $=(F="next")=>{Cs&&clearTimeout(Cs);let P=b;if(typeof F=="string")if(F==="next")if(b<E-1)P=b+1;else return;else if(b>0)P=b-1;else return;else P=F;D(""),f(U=>({...U,currentPage:P,loadedPages:[...new Set([...g,P])]}));const j=()=>{const U=P*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};Cs=setTimeout(()=>{D(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:j()}))},500)},M=F=>{Ea=F.touches[0].clientX},z=F=>{if(Ea===null)return;const P=F.touches[0].clientX,j=Ea-P;j>5?$("next"):j<-5&&$("previous"),Ea=null},R={"--width":`${S||0}px`,"--total-cards":A,"--cards-per-page":p,"--page":b};if(m)return c.jsx(ci,{layout:`carousel${a?"-with-title":""}`});const B=(F,P)=>{var U;let j=null;return(U=F==null?void 0:F.sys)!=null&&U.id?j=`card-${F.sys.id}`:F!=null&&F.slug?j=`card-${F.slug}`:[n[P],F.contentType].includes("customCard")&&(j=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${P}`),j};return c.jsxs("section",{ref:k,className:K("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(Q_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:M,onTouchMove:z,style:R,"data-testid":"carousel-list",children:t.map((F,P)=>{let j=B(F,P);const{inView:U,isLoaded:W}=G_(P,p,b,g);return j&&(U||W)?c.jsx(au,{id:j,card:{...F,contentType:n[P]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},j):(j=j||`${e}-card-${P}`,c.jsx(Pt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),E<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((F,P)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:P===b}),onClick:j=>{j.preventDefault(),j.stopPropagation(),$(P)},children:c.jsx(je,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:P+1,total:E})})})},`page-indicator-${P}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(je,{"aria-live":"polite",showOnFocus:!1,children:C})]})]})},X_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(ci,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Lt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(J_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Lt,{})]},`carousel-${d}`)});const ek=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:K("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!a}),children:a&&c.jsx(Ln,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const tk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(Di,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(co,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const nm=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:K("lesson-name",a),"data-number":`${t}.${n}`,children:r});const rm=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=oi(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):id(a||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Di,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const nk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ie.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(ui,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(Di,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:f,contentType:b,icon:g,image:C,isIntroduction:D,optional:A,slug:E,subsectionId:k,title:S,type:$})=>{const M=a&&t||D,z={};return C&&(z.style={"--image":`url(${C})`}),c.jsx("li",{className:K({article:b===Fr.ARTICLE,discussion:b===Fr.DISCUSSION,quiz:b===Fr.QUIZ,completed:v&&b===Fr.ARTICLE,locked:!M}),...z,children:c.jsx(yn,{href:M?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${ad(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(nm,{sectionId:i,subsectionId:k,title:S,className:"course-title"})," ",c.jsx(rm,{completionTime:f,icon:g,optional:A,type:$,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const rk=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},ak=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Hc=[{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 _a="notFoundError_",ik=()=>{const e=ie.useIntl(),t=[];return Hc.forEach((n,r)=>{n.title=e.formatMessage({id:`${_a}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Kh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(wn,{children:[c.jsx(tm,{cards:Hc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${_a}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${_a}title`})}),c.jsx("p",{children:e.formatMessage({id:`${_a}text`})})]})};var ii=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(ii||{});const sk=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,ok=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const uk=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let h=0,p={};const m=(a||!s)&&!t.hasUserVoted;i&&(h=Math.round(t.numVotes/r*100)||0,p={"--vote-perc":`${h}%`});const v=g=>{g.stopPropagation(),m&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:K({"can-vote":m}),tabIndex:o&&m?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var C;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const D=g.code==="ArrowUp"?"prev":"next",{nextElement:A,nextIndex:E}=ok(g.currentTarget.parentElement,"selected",D,n);A&&((C=A.querySelector("label"))==null||C.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:p,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(on,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[h,"%"]})]}),c.jsx("input",{type:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const lk=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ie.useIntl(),s=y.useContext(at),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=ii.AfterVoting}=n||{},[d,h]=y.useState(sk(t,l,s==null?void 0:s.id)),{createVote:p=async()=>{},removeVote:m=()=>{}}=r||{},v=t.reduce((D,A)=>D+A.numVotes,0),f=t.filter(D=>D.hasUserVoted).length,b=t.filter(D=>D.hasUserVoted),g=y.useCallback(async D=>{await p(D.id)},[]),C=y.useCallback(async()=>{t.forEach(async D=>{D.hasUserVoted&&D.userVote&&await m(D.userVote.id)})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:i.formatMessage({id:`${a}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:v})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ee,{variant:"tertiary",onClick:C,"data-testid":"remove-votes-button",disabled:f===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:f})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll",children:t==null?void 0:t.map((D,A)=>c.jsx(uk,{isTabbable:d===A,user:s,option:D,optionIndex:A,totalPollVotes:v,showResults:u==ii.Always||!!f,allowMultipleVotes:l,hasVotedOnPoll:!!f,functions:{createVote:g,setTabbableOption:h}},D.id))})})}),c.jsxs(je,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:f}),!!f&&c.jsx("ul",{children:b.map(D=>c.jsx("li",{children:D.label}))})]})]})};exports.ASSETS_BUCKET=Yt;exports.ActionBar=rf;exports.ActionButton=zr;exports.ActivitiesFeed=Ig;exports.ActivitySection=B_;exports.AddPost=nu;exports.Badge=Fd;exports.BadgeScope=lt;exports.Badges=Ad;exports.BadgesContext=oo;exports.BadgesProvider=yd;exports.Banner=R_;exports.BannerSection=z_;exports.Breadcrumbs=rv;exports.Buckets=qm;exports.Button=Ee;exports.ButtonWrapper=mr;exports.COURSE_CONTENT_TYPES=Fr;exports.CacheProvider=xd;exports.Card=au;exports.CardBlock=tm;exports.Carousel=X_;exports.CharacterLimit=_o;exports.CollapsibleSection=ui;exports.Columns=uf;exports.CommunityDetails=ug;exports.ContactFooter=s_;exports.ContactForm=zh;exports.ContentTypeLabel=hd;exports.Contributors=fo;exports.ConversationContext=xi;exports.CookieBanner=Hh;exports.CourseProgression=tk;exports.CourseStructure=nk;exports.CustomContentBanner=q_;exports.CustomEvents=nt;exports.DELETED_USER_ID=$r;exports.Directory=P_;exports.DiscussionConversation=Gh;exports.DiscussionForm=ea;exports.DiscussionFormCard=Qh;exports.DiscussionFormModal=em;exports.DiscussionPost=ta;exports.DiscussionThread=Xh;exports.Divider=Lt;exports.DownloadSection=n_;exports.EMAILS=Gn;exports.EditSection=a_;exports.EmailHelperTextBox=cf;exports.EmptyStateBox=xn;exports.EnrichedUrl=wo;exports.FeatureFlags=Dd;exports.Filters=af;exports.FlagsProvider=Cd;exports.Footer=eu;exports.Form=Qt;exports.Formatting=H;exports.Fragment=Tt;exports.FullWidthSection=wn;exports.GET_STREAM_USER_PREFIX=ws;exports.GlobalProviders=np;exports.Header=tu;exports.HelperTextBox=pd;exports.HiddenFromScreenReaders=si;exports.HideShowTextBox=gd;exports.HighlightSection=W_;exports.HighlightedTextBox=Et;exports.INVALID_TOKEN=sd;exports.IconBulletedList=Vm;exports.ImageContainer=Rm;exports.IntlProvider=wd;exports.InviteForm=qh;exports.InviteModal=S_;exports.JoinButton=go;exports.Label=Ko;exports.LanguageContext=uo;exports.LanguageSwitcher=iv;exports.LessonName=nm;exports.LessonType=rm;exports.LikesButton=Wd;exports.LikesFeed=ef;exports.LikesModal=tf;exports.Link=yn;exports.LoadMore=Jr;exports.LoadingBlock=Bd;exports.LoadingPlaceholder=Pt;exports.LoadingState=ci;exports.Logo=Eo;exports.LogoSection=i_;exports.MEMBERS_PER_PAGE=Zh;exports.MENTION_REGEX=od;exports.MarkCompleteButton=rk;exports.MarkdownText=jn;exports.MarketingBlock=V_;exports.Marks=Ht;exports.Member=rn;exports.MembersList=Yh;exports.Modal=ho;exports.MoreMenu=sf;exports.NUMBER_OF_COUNTRIES=wm;exports.NUMBER_OF_USERS=Dm;exports.NarrowCard=ek;exports.NavigationMenu=of;exports.NotFoundError=ik;exports.Overlay=un;exports.OverlayContext=lo;exports.OverlayProvider=kd;exports.PageHeading=vd;exports.PageLayout=Kh;exports.PasswordForm=KE;exports.PasswordRules=gf;exports.Pill=Zt;exports.Poll=lk;exports.Popover=fd;exports.Portal=pr;exports.ProfileForm=Uh;exports.ProfileImageChange=Lh;exports.ProfileModal=Ci;exports.ProfileModalLauncher=ru;exports.ProfilePicture=on;exports.ProgressBar=co;exports.ProgressTracker=Lm;exports.PublishArticleForm=YE;exports.Rating=wv;exports.RepliesFeed=Xd;exports.ResponsesHeading=Jh;exports.ResponsiveImage=Ln;exports.ResultsVisibility=ii;exports.ReturnToNavButton=zm;exports.RichTextEditor=Xo;exports.SearchForm=Wh;exports.ShareLink=nf;exports.ShareLinks=dv;exports.SignupForm=t_;exports.Span=Fs;exports.StatusBanner=or;exports.TableOfContents=I_;exports.Tabs=fv;exports.Tags=d_;exports.TestimonialBlock=N_;exports.TimeToComplete=Di;exports.Toggle=VE;exports.Tooltip=$n;exports.TopLevelPage=o_;exports.UUID_V4_REGEX=Lr;exports.UserContext=at;exports.UserProvider=Ed;exports.VisuallyHidden=je;exports.addAriaProps=Ud;exports.basicReducer=Qr;exports.camelCaseToDashCase=rd;exports.checkIntlPathExists=oi;exports.enrichPostCategories=Do;exports.generateConditions=Na;exports.generateCssIcon=Em;exports.getAuthorData=gr;exports.getCharacterLimitProps=lf;exports.getLongDate=io;exports.getMember=di;exports.getPostBody=Co;exports.getShortDate=ud;exports.getValueLength=fi;exports.headerData=Gr;exports.likesResponseMock=tv;exports.mapGetStreamData=ak;exports.pageReady=ld;exports.passwordValidator=_s;exports.repliesFeedMock=Rg;exports.supportedLanguages=Aa;exports.toCamelCase=ad;exports.toCapitalisedCase=Cm;exports.toSentenceCase=id;exports.transformSlugs=js;exports.useBadges=bd;exports.useCurrentPath=Qc;exports.useEffectAfterMount=sr;exports.useElementWidth=Rn;exports.useOverlay=_d;exports.useScrollListener=ed;exports.useScrollToHash=ro;exports.useTooltips=ao;exports.useUser=li;