@apolitical/component-library 4.1.0-beta.0 → 4.1.0-beta.2
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 +19 -19
- package/index.mjs +686 -678
- package/package.json +1 -1
- package/style.css +1 -1
package/index.js
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
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 wo;function rh(){return wo||(wo=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function b(S){if(S===null||typeof S!="object")return null;var re=g&&S[g]||S[m];return typeof re=="function"?re:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(S){{for(var re=arguments.length,ue=new Array(re>1?re-1:0),ve=1;ve<re;ve++)ue[ve-1]=arguments[ve];A("error",S,ue)}}function A(S,re,ue){{var ve=v.ReactDebugCurrentFrame,Be=ve.getStackAddendum();Be!==""&&(re+="%s",ue=ue.concat([Be]));var Oe=ue.map(function(Ee){return String(Ee)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[S],console,Oe)}}var k=!1,
|
|
22
|
-
`+
|
|
21
|
+
*/var wo;function rh(){return wo||(wo=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function b(S){if(S===null||typeof S!="object")return null;var re=g&&S[g]||S[m];return typeof re=="function"?re:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(S){{for(var re=arguments.length,ue=new Array(re>1?re-1:0),ve=1;ve<re;ve++)ue[ve-1]=arguments[ve];A("error",S,ue)}}function A(S,re,ue){{var ve=v.ReactDebugCurrentFrame,Be=ve.getStackAddendum();Be!==""&&(re+="%s",ue=ue.concat([Be]));var Oe=ue.map(function(Ee){return String(Ee)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[S],console,Oe)}}var k=!1,E=!1,B=!1,P=!1,z=!1,I;I=Symbol.for("react.module.reference");function N(S){return!!(typeof S=="string"||typeof S=="function"||S===r||S===i||z||S===a||S===u||S===c||P||S===h||k||E||B||typeof S=="object"&&S!==null&&(S.$$typeof===p||S.$$typeof===f||S.$$typeof===s||S.$$typeof===o||S.$$typeof===l||S.$$typeof===I||S.getModuleId!==void 0))}function O(S,re,ue){var ve=S.displayName;if(ve)return ve;var Be=re.displayName||re.name||"";return Be!==""?ue+"("+Be+")":ue}function w(S){return S.displayName||"Context"}function T(S){if(S==null)return null;if(typeof S.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof S=="object")switch(S.$$typeof){case o:var re=S;return w(re)+".Consumer";case s:var ue=S;return w(ue._context)+".Provider";case l:return O(S,S.render,"ForwardRef");case f:var ve=S.displayName||null;return ve!==null?ve:T(S.type)||"Memo";case p:{var Be=S,Oe=Be._payload,Ee=Be._init;try{return T(Ee(Oe))}catch{return null}}}return null}var R=Object.assign,M=0,K,V,ie,Q,D,U,X;function _(){}_.__reactDisabledLog=!0;function F(){{if(M===0){K=console.log,V=console.info,ie=console.warn,Q=console.error,D=console.group,U=console.groupCollapsed,X=console.groupEnd;var S={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}M++}}function L(){{if(M--,M===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},S,{value:K}),info:R({},S,{value:V}),warn:R({},S,{value:ie}),error:R({},S,{value:Q}),group:R({},S,{value:D}),groupCollapsed:R({},S,{value:U}),groupEnd:R({},S,{value:X})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=v.ReactCurrentDispatcher,q;function ne(S,re,ue){{if(q===void 0)try{throw Error()}catch(Be){var ve=Be.stack.trim().match(/\n( *(at )?)/);q=ve&&ve[1]||""}return`
|
|
22
|
+
`+q+S}}var te=!1,Z;{var le=typeof WeakMap=="function"?WeakMap:Map;Z=new le}function J(S,re){if(!S||te)return"";{var ue=Z.get(S);if(ue!==void 0)return ue}var ve;te=!0;var Be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=$.current,$.current=null,F();try{if(re){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(Rt){ve=Rt}Reflect.construct(S,[],Ee)}else{try{Ee.call()}catch(Rt){ve=Rt}S.call(Ee.prototype)}}else{try{throw Error()}catch(Rt){ve=Rt}S()}}catch(Rt){if(Rt&&ve&&typeof Rt.stack=="string"){for(var xe=Rt.stack.split(`
|
|
23
23
|
`),nt=ve.stack.split(`
|
|
24
24
|
`),ze=xe.length-1,He=nt.length-1;ze>=1&&He>=0&&xe[ze]!==nt[He];)He--;for(;ze>=1&&He>=0;ze--,He--)if(xe[ze]!==nt[He]){if(ze!==1||He!==1)do if(ze--,He--,He<0||xe[ze]!==nt[He]){var gt=`
|
|
25
25
|
`+xe[ze].replace(" at new "," at ");return S.displayName&>.includes("<anonymous>")&&(gt=gt.replace("<anonymous>",S.displayName)),typeof S=="function"&&Z.set(S,gt),gt}while(ze>=1&&He>=0);break}}}finally{te=!1,$.current=Oe,L(),Error.prepareStackTrace=Be}var En=S?S.displayName||S.name:"",Co=En?ne(En):"";return typeof S=="function"&&Z.set(S,Co),Co}function be(S,re,ue){return J(S,!1)}function pe(S){var re=S.prototype;return!!(re&&re.isReactComponent)}function _e(S,re,ue){if(S==null)return"";if(typeof S=="function")return J(S,pe(S));if(typeof S=="string")return ne(S);switch(S){case u:return ne("Suspense");case c:return ne("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case l:return be(S.render);case f:return _e(S.type,re,ue);case p:{var ve=S,Be=ve._payload,Oe=ve._init;try{return _e(Oe(Be),re,ue)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,Pe={},Ge=v.ReactDebugCurrentFrame;function Ke(S){if(S){var re=S._owner,ue=_e(S.type,S._source,re?re.type:null);Ge.setExtraStackFrame(ue)}else Ge.setExtraStackFrame(null)}function Ze(S,re,ue,ve,Be){{var Oe=Function.call.bind(Se);for(var Ee in S)if(Oe(S,Ee)){var xe=void 0;try{if(typeof S[Ee]!="function"){var nt=Error((ve||"React class")+": "+ue+" type `"+Ee+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof S[Ee]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw nt.name="Invariant Violation",nt}xe=S[Ee](re,Ee,ve,ue,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ze){xe=ze}xe&&!(xe instanceof Error)&&(Ke(Be),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ve||"React class",ue,Ee,typeof xe),Ke(null)),xe instanceof Error&&!(xe.message in Pe)&&(Pe[xe.message]=!0,Ke(Be),x("Failed %s type: %s",ue,xe.message),Ke(null))}}}var tt=Array.isArray;function Ae(S){return tt(S)}function We(S){{var re=typeof Symbol=="function"&&Symbol.toStringTag,ue=re&&S[Symbol.toStringTag]||S.constructor.name||"Object";return ue}}function $e(S){try{return H(S),!1}catch{return!0}}function H(S){return""+S}function ae(S){if($e(S))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(S)),H(S)}var fe=v.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},De,Ue,Ve;Ve={};function ft(S){if(Se.call(S,"ref")){var re=Object.getOwnPropertyDescriptor(S,"ref").get;if(re&&re.isReactWarning)return!1}return S.ref!==void 0}function Nt(S){if(Se.call(S,"key")){var re=Object.getOwnPropertyDescriptor(S,"key").get;if(re&&re.isReactWarning)return!1}return S.key!==void 0}function wt(S,re){if(typeof S.ref=="string"&&fe.current&&re&&fe.current.stateNode!==re){var ue=T(fe.current.type);Ve[ue]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',T(fe.current.type),S.ref),Ve[ue]=!0)}}function Qe(S,re){{var ue=function(){De||(De=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ue.isReactWarning=!0,Object.defineProperty(S,"key",{get:ue,configurable:!0})}}function Bt(S,re){{var ue=function(){Ue||(Ue=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ue.isReactWarning=!0,Object.defineProperty(S,"ref",{get:ue,configurable:!0})}}var ht=function(S,re,ue,ve,Be,Oe,Ee){var xe={$$typeof:t,type:S,key:re,ref:ue,props:Ee,_owner:Oe};return xe._store={},Object.defineProperty(xe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(xe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ve}),Object.defineProperty(xe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Be}),Object.freeze&&(Object.freeze(xe.props),Object.freeze(xe)),xe};function Ga(S,re,ue,ve,Be){{var Oe,Ee={},xe=null,nt=null;ue!==void 0&&(ae(ue),xe=""+ue),Nt(re)&&(ae(re.key),xe=""+re.key),ft(re)&&(nt=re.ref,wt(re,Be));for(Oe in re)Se.call(re,Oe)&&!me.hasOwnProperty(Oe)&&(Ee[Oe]=re[Oe]);if(S&&S.defaultProps){var ze=S.defaultProps;for(Oe in ze)Ee[Oe]===void 0&&(Ee[Oe]=ze[Oe])}if(xe||nt){var He=typeof S=="function"?S.displayName||S.name||"Unknown":S;xe&&Qe(Ee,He),nt&&Bt(Ee,He)}return ht(S,xe,nt,Be,ve,fe.current,Ee)}}var er=v.ReactCurrentOwner,Pr=v.ReactDebugCurrentFrame;function wn(S){if(S){var re=S._owner,ue=_e(S.type,S._source,re?re.type:null);Pr.setExtraStackFrame(ue)}else Pr.setExtraStackFrame(null)}var Qa;Qa=!1;function Ja(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function go(){{if(er.current){var S=T(er.current.type);if(S)return`
|
|
@@ -28,13 +28,13 @@ Check the render method of \``+S+"`."}return""}}function $f(S){{if(S!==void 0){v
|
|
|
28
28
|
|
|
29
29
|
Check your code at `+re+":"+ue+"."}return""}}var vo={};function Lf(S){{var re=go();if(!re){var ue=typeof S=="string"?S:S.displayName||S.name;ue&&(re=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+ue+">.")}return re}}function bo(S,re){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var ue=Lf(re);if(vo[ue])return;vo[ue]=!0;var ve="";S&&S._owner&&S._owner!==er.current&&(ve=" It was passed a child from "+T(S._owner.type)+"."),wn(S),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ue,ve),wn(null)}}function yo(S,re){{if(typeof S!="object")return;if(Ae(S))for(var ue=0;ue<S.length;ue++){var ve=S[ue];Ja(ve)&&bo(ve,re)}else if(Ja(S))S._store&&(S._store.validated=!0);else if(S){var Be=b(S);if(typeof Be=="function"&&Be!==S.entries)for(var Oe=Be.call(S),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&bo(Ee.value,re)}}}function zf(S){{var re=S.type;if(re==null||typeof re=="string")return;var ue;if(typeof re=="function")ue=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===f))ue=re.propTypes;else return;if(ue){var ve=T(re);Ze(ue,S.props,"prop",ve,S)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var Be=T(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qf(S){{for(var re=Object.keys(S.props),ue=0;ue<re.length;ue++){var ve=re[ue];if(ve!=="children"&&ve!=="key"){wn(S),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ve),wn(null);break}}S.ref!==null&&(wn(S),x("Invalid attribute `ref` supplied to `React.Fragment`."),wn(null))}}function Do(S,re,ue,ve,Be,Oe){{var Ee=N(S);if(!Ee){var xe="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(xe+=" 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 nt=$f(Be);nt?xe+=nt:xe+=go();var ze;S===null?ze="null":Ae(S)?ze="array":S!==void 0&&S.$$typeof===t?(ze="<"+(T(S.type)||"Unknown")+" />",xe=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof S,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ze,xe)}var He=Ga(S,re,ue,Be,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(ve)if(Ae(gt)){for(var En=0;En<gt.length;En++)yo(gt[En],S);Object.freeze&&Object.freeze(gt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else yo(gt,S)}return S===r?qf(He):zf(He),He}}function Wf(S,re,ue){return Do(S,re,ue,!0)}function Hf(S,re,ue){return Do(S,re,ue,!1)}var Uf=Hf,Vf=Wf;nr.Fragment=r,nr.jsx=Uf,nr.jsxs=Vf}()),nr}process.env.NODE_ENV==="production"?Zi.exports=nh():Zi.exports=rh();var d=Zi.exports;const rc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},zn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function ah(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),f=C.useRef(!0);c.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=b?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var A=C.useMemo(function(){var k=function(N){var O=o.current,E=l.current;return o.current=l.current=null,i.current=N,u.current=c.current.apply(E,O)},w=function(N,O){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame(N):setTimeout(N,O)},B=function(N){if(!f.current)return!1;var O=N-a.current;return!a.current||O>=t||O<0||b&&N-i.current>=x},P=function(N){return s.current=null,m&&o.current?k(N):(o.current=l.current=null,u.current)},q=function N(){var O=Date.now();if(B(O))return P(O);if(f.current){var E=t-(O-a.current),T=b?Math.min(E,x-(O-i.current)):E;w(N,T)}},I=function(){if(p||v){var N=Date.now(),O=B(N);if(o.current=[].slice.call(arguments),l.current=r,a.current=N,O){if(!s.current&&f.current)return i.current=a.current,w(q,t),g?k(a.current):u.current;if(b)return w(q,t),k(a.current)}return s.current||w(q,t),u.current}};return I.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?P(Date.now()):u.current},I},[g,b,t,x,m,h,p,v]);return A}function ac(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return ah(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Xa;const Zn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Xa),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=ac(()=>{s()!==r&&(t&&(clearTimeout(Xa),document.body.classList.add("is-resizing"),Xa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},ic=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,f=a.current,p=c-f,h=p>0?"down":"up";if(i({current:c,past:f}),h==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=ac(()=>{l()},250);return a},sc=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);zn(()=>{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)},Bs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=fn(e);return t.forEach(({type:r,value:a})=>{Kf(n,r,a)}),n},oc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},uc=(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},lc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),cc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),dc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",Tn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},lr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},fc="Invalid token error: Logging user out...",ih="200,000+",sh="160+";function hc(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},mc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),ks=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Yi=e=>{let t;const n=ha(),r=ha(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/cn.milliseconds.inHour,i=Math.floor(t/cn.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=cn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/cn.year.days)}},ha=e=>{const n=(e||new Date).toUTCString();return new Date(n)},oh=(e,t,n)=>{let r;const a=ha(),i=ha(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/cn.milliseconds.inSecond<=t;case"minutes":return r/cn.milliseconds.inMinute<=t;case"hours":return r/cn.milliseconds.inHour<=t}return!1},uh=e=>new Promise(t=>setTimeout(t,e)),Yn={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_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+ue+">.")}return re}}function bo(S,re){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var ue=Lf(re);if(vo[ue])return;vo[ue]=!0;var ve="";S&&S._owner&&S._owner!==er.current&&(ve=" It was passed a child from "+T(S._owner.type)+"."),wn(S),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ue,ve),wn(null)}}function yo(S,re){{if(typeof S!="object")return;if(Ae(S))for(var ue=0;ue<S.length;ue++){var ve=S[ue];Ja(ve)&&bo(ve,re)}else if(Ja(S))S._store&&(S._store.validated=!0);else if(S){var Be=b(S);if(typeof Be=="function"&&Be!==S.entries)for(var Oe=Be.call(S),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&bo(Ee.value,re)}}}function zf(S){{var re=S.type;if(re==null||typeof re=="string")return;var ue;if(typeof re=="function")ue=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===f))ue=re.propTypes;else return;if(ue){var ve=T(re);Ze(ue,S.props,"prop",ve,S)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var Be=T(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qf(S){{for(var re=Object.keys(S.props),ue=0;ue<re.length;ue++){var ve=re[ue];if(ve!=="children"&&ve!=="key"){wn(S),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ve),wn(null);break}}S.ref!==null&&(wn(S),x("Invalid attribute `ref` supplied to `React.Fragment`."),wn(null))}}function Do(S,re,ue,ve,Be,Oe){{var Ee=N(S);if(!Ee){var xe="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(xe+=" 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 nt=$f(Be);nt?xe+=nt:xe+=go();var ze;S===null?ze="null":Ae(S)?ze="array":S!==void 0&&S.$$typeof===t?(ze="<"+(T(S.type)||"Unknown")+" />",xe=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof S,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ze,xe)}var He=Ga(S,re,ue,Be,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(ve)if(Ae(gt)){for(var En=0;En<gt.length;En++)yo(gt[En],S);Object.freeze&&Object.freeze(gt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else yo(gt,S)}return S===r?qf(He):zf(He),He}}function Wf(S,re,ue){return Do(S,re,ue,!0)}function Hf(S,re,ue){return Do(S,re,ue,!1)}var Uf=Hf,Vf=Wf;nr.Fragment=r,nr.jsx=Uf,nr.jsxs=Vf}()),nr}process.env.NODE_ENV==="production"?Zi.exports=nh():Zi.exports=rh();var d=Zi.exports;const rc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},zn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function ah(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),f=C.useRef(!0);c.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=b?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var A=C.useMemo(function(){var k=function(N){var O=o.current,w=l.current;return o.current=l.current=null,i.current=N,u.current=c.current.apply(w,O)},E=function(N,O){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame(N):setTimeout(N,O)},B=function(N){if(!f.current)return!1;var O=N-a.current;return!a.current||O>=t||O<0||b&&N-i.current>=x},P=function(N){return s.current=null,m&&o.current?k(N):(o.current=l.current=null,u.current)},z=function N(){var O=Date.now();if(B(O))return P(O);if(f.current){var w=t-(O-a.current),T=b?Math.min(w,x-(O-i.current)):w;E(N,T)}},I=function(){if(p||v){var N=Date.now(),O=B(N);if(o.current=[].slice.call(arguments),l.current=r,a.current=N,O){if(!s.current&&f.current)return i.current=a.current,E(z,t),g?k(a.current):u.current;if(b)return E(z,t),k(a.current)}return s.current||E(z,t),u.current}};return I.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?P(Date.now()):u.current},I},[g,b,t,x,m,h,p,v]);return A}function ac(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return ah(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Xa;const Zn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Xa),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=ac(()=>{s()!==r&&(t&&(clearTimeout(Xa),document.body.classList.add("is-resizing"),Xa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},ic=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,f=a.current,p=c-f,h=p>0?"down":"up";if(i({current:c,past:f}),h==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=ac(()=>{l()},250);return a},sc=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);zn(()=>{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)},Bs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=fn(e);return t.forEach(({type:r,value:a})=>{Kf(n,r,a)}),n},oc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},uc=(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},lc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),cc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),dc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",Tn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},lr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},fc="Invalid token error: Logging user out...",ih="200,000+",sh="160+";function hc(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},mc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),ks=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Yi=e=>{let t;const n=ha(),r=ha(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/cn.milliseconds.inHour,i=Math.floor(t/cn.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=cn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/cn.year.days)}},ha=e=>{const n=(e||new Date).toUTCString();return new Date(n)},oh=(e,t,n)=>{let r;const a=ha(),i=ha(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/cn.milliseconds.inSecond<=t;case"minutes":return r/cn.milliseconds.inMinute<=t;case"hours":return r/cn.milliseconds.inHour<=t}return!1},uh=e=>new Promise(t=>setTimeout(t,e)),Yn={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_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
35
|
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},lh={...Yn,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>"},ch={...Yn,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"},dh={...Yn,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>"},fh=Object.freeze(Object.defineProperty({__proto__:null,en:Yn,es:lh,fr:ch,pt:dh},Symbol.toStringTag,{value:"Module"})),Na=(e,t=Yn)=>e in t,At=(e,t,n,r,a={})=>{let i="";return Na(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},hh=(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},ra=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),pc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},mh=(e="")=>e.replace(/\s+/g,"").length>0,Gi=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}}},we=({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,screenreaderText:u=!1,children:c=!1,...f})=>{const h=Zn(typeof t=="object");if(typeof t=="object"&&typeof h=="number"){const b=Object.assign({},t),v=oc(Object.keys(b));t=uc(h,v,b)}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"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const m={...f,className:Y(e,o,g,{"no-text":!c,disabled:l,button:a}),onClick:b=>{(!a||a[0]==="#")&&s&&(b.preventDefault(),b.stopPropagation()),s&&s(b)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return a&&(i="a",m.href=a),C.createElement(i,m,c||(u?d.jsx(Le,{showOnFocus:!1,children:u}):null))},Dn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(we,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(we,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Jt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},Eo={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},ph=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Eo[e]:Eo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gh=({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}?${gh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Gn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:p,sizes:h}=ph(e),g=ei({format:"avif",query:s,range:p,url:o}),m=ei({format:"webp",query:s,range:p,url:o}),b=ei({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:m,sizes:h,"data-testid":"source"}),d.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Gn,{image:{...e},className:"image"})}),Cn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const bh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Le,{children:d.jsx(oe.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const yh=({elementId:e,offset:t=20})=>{const n=oe.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(we,{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 Dh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),_o=300,Bo="ease-in-out";class Ch{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:_o,easing:Bo}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:_o,easing:Bo}),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 Ra=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=oe.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Ch(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},ko={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},xh=e=>{let t=e;return Object.keys(ko).includes(e)&&(t=ko[e]),`url(${zt}icons/${t}.svg)`};const Ao={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},gc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":xh(t)}:{},s=Na(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Ao?Ao[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const jt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${zt}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const nn=({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=Zn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),p=oc(Object.keys(f));a=uc(s,p,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(jt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Qt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(we,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Qi=({children:e,...t})=>d.jsx("p",{...t,children:e}),vc={q:Qi,blockquote:Qi};for(let e=1;e<=6;e++)vc[`h${e}`]={component:Qi,props:{className:"title"}};const bc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Qt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:vc},children:r}):d.jsx("p",{children:r})]});const yc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=oe.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,p]=C.useState("closed");C.useEffect(()=>{const m=l.current;if(m)return m.addEventListener("transitionend",h),()=>{m.removeEventListener("transitionend",h)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const m=a.split(`
|
|
36
36
|
`);c(m.length<3?`${a.substring(0,400)}...`:m.slice(0,3).join(`
|
|
37
|
-
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const h=({propertyName:m})=>{m==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(jt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[d.jsx(Qt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const wh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Qt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,Eh=({children:e})=>d.jsx(jt,{variant:"secondary",children:e}),_h=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Bh=["span","strong","h1","h2","h3","h4","h5","h6","p"],kh=({children:e})=>{const t=oe.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Bh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Ra,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Ah=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(jt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},Fh=e=>{const t=oe.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Le,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Fo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Th=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Fo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Fo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(we,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},Ji=({children:e})=>d.jsx("span",{children:e});const Sh={default:{a:Th,CollapsibleSection:Ra,TextBox:jt,CaseStudy:Eh,style:Xe,details:kh,div:Ah,iframe:Fh,center:_h},"text-only":{h1:Xe,h2:Xe,h3:Xe,h4:Xe,h5:Xe,h6:Xe,style:Xe,details:Xe,div:Xe,TextBox:Xe,CollapsibleSection:Xe,CaseStudy:Xe,blockquote:Xe,iframe:Xe,button:Xe}},qn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0,overrides:Sh[r]};return d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Qt,{options:{...s,...t},children:n})})};const Dc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Mn=({size:e="medium",variant:t="default",className:n="",icon:r,children:a,...i})=>{const s={"--icon":`url(${zt}icons/${r}.svg)`};return d.jsx("span",{className:Y("pill",e,t,n,{"has-icon":r}),style:s,...i,children:a})};const Dr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const jh=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=oe.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Le,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},As=C.memo(jh);const ti="loadingBlock_",Oh=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${ti}loading`})},75:{text:r.formatMessage({id:`${ti}almostDone`})},100:{text:r.formatMessage({id:`${ti}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${zt}icons/${t[a].icon}.svg)`}:{};return d.jsxs(jt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(As,{progress:e})]})},Ph=C.memo(Oh);const xt=({element:e="div",className:t="",...n})=>d.jsx(Pa,{element:e,className:Y("loading-placeholder",t),...n});const Xi={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Cc=(e,t)=>e in Xi?d.jsx("div",{className:e,children:Xi[e].map((n,r)=>Cc(n,r))},t):d.jsx(xt,{className:e},t),Fs=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:Xi[e].map((n,r)=>Cc(n,r))}),xc=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):""},Rr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Nh=e=>{const t=Math.ceil(26/Rr.length),n=xc(e).toLowerCase();if(n==="")return Rr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Rr.length;a++)if(r<=t*(a+1))return Rr[a]};const To=256,rn=({className:e="",src:t="",name:n,alt:r,width:a=To,height:i=To,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const h=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=h*window.devicePixelRatio,f.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=Nh(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(xc(n),h/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ts=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Rh=({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=Ln(l,r)),l};const Fr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl(),{size:l="medium"}=r,u=Ts(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:p}=u;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const h=Rh(u),g=n&&n.createdAt?Yi(n.createdAt):!1,m=n&&n.createdAt?ks(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",l,s),children:d.jsxs(Cn,{href:p,gtmType:i,gtmContext:a,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(rn,{name:c,src:f}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:m,"aria-label":m,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),h&&d.jsx("small",{className:Y({"text-medium":l==="large"}),children:h})]})]})})};const So={small:24,medium:48},Ss=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,h)=>{let g,m="";if(h<o){const{name:b="",image:v=""}=Ts(p);if(s)return d.jsx(xt,{element:"li",className:"contributor"},h);g=d.jsx(rn,{name:b,src:v,width:So[a||"medium"],height:So[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":b>99}),children:["+",hh(b,0)]}),m="number-left"}return g?d.jsx("li",{className:Y("contributor",m),children:g},h):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Ln(n[0].name||"",20):l||null})]})})};const Mr="emailHelperTextBox_",wc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Mr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=m=>{s({path:`${Mr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:m})};if(typeof r!="function"){g(a.formatMessage({id:`${Mr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(m=>{g(m.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let h=Mr,g="default",m={},b={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",m={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":h+="emailAlreadyExists",g="error",m={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:h,type:g,link:m,mail:b})},[e]);const c={};return["link","mail"].forEach(h=>{c[h]=Object.keys(i[h]).length?g=>d.jsx("a",{...i[h],children:g}):g=>g}),d.jsx(bc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(xt,{element:"span"}),d.jsx(xt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:h=>d.jsx("strong",{children:h}),em:h=>d.jsx("em",{children:h}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Sn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:p=>{const h=p.target;a.onChange(h.value)}})};const _n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Mh=500,Ih=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},m]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=oe.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const k=setTimeout(()=>{g||f(w=>({...w,debouncedInput:l}))},Mh);return()=>{clearTimeout(k)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const w=await o(c)||[];m(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),m(B=>({...B,predictions:[]}))}})():m(k=>({...k,predictions:[]}))},[c,g]),C.useEffect(()=>{h>=0&&p[h]&&f(k=>({...k,displayInput:p[h].description}))},[h,p]);const v=k=>{[_n.DOWN,_n.UP,_n.ENTER].includes(k.key)&&(k.preventDefault(),k.key===_n.DOWN&&h<p.length-1?m(w=>({...w,activePredictionIndex:h+1})):k.key===_n.UP&&h>0?m(w=>({...w,activePredictionIndex:h-1})):k.key===_n.ENTER&&h>-1&&(s(p[h].description),f(w=>({...w,input:p[h].description})),m(w=>({...w,predictions:[],isPredictionSelected:!0}))))},x=k=>{s(k.target.value),f(w=>({...w,input:k.target.value,displayInput:k.target.value})),m(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),f(w=>({...w,input:k.description,displayInput:k.description})),m(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((k,w)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>m(B=>({...B,activePredictionIndex:w})),className:Y("predictions-list-item",{active:w===h}),children:k.description},w))})]})};const Ec=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const p=oe.useIntl(),{onChange:h,...g}=r,m=()=>{t||h(c?null:l)},b=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),m())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const x=v.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),m())},className:Y("checkbox-wrapper",e),...f,...g},b)};const $h=C.memo(function({direction:t="down"}){return d.jsx(Pa,{className:Y("rotating-chevron",`direction-${t}`)})});const Lh=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=oe.useIntl(),[f,p]=C.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[m,b]=C.useState(g);let v;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?v=t&&m?t.find(P=>P.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?v=m[0]:v={id:"",label:""},C.useEffect(()=>{b(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:A,...k}=a,w=P=>{if(o){let q=[];m!=null&&m.includes(P.id)?q=m.filter(I=>I!==P.id):q=[...m,P.id],b([...q]),x&&x([...q])}else b([P]),x&&x(P.id),p(!1)},B=P=>{if(P==="all"){const q=(t==null?void 0:t.map(I=>I.id))||[];b(q),x&&x(q)}else b([]),x&&x([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:P=>{P.preventDefault(),P.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${m.length}`:v.label,d.jsx($h,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:P=>{P.preventDefault(),P.stopPropagation();const q=t&&t.find(I=>I.id===P.target.value);w(q)},hidden:!f,...k,children:t==null?void 0:t.map(P=>d.jsx("option",{value:P.id,children:P.label},P.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${m==null?void 0:m.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(P=>{const q=P.id===v.id||(m==null?void 0:m.includes(P))||(m==null?void 0:m.includes(P.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${P}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),w(P)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:P.label})]})},P.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(we,{variant:"secondary",onClick:()=>{A&&A(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const zh=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const p=oe.useIntl(),h=i?c:[],g=c;return d.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:m,label:b=!1,value:v=m,disabled:x=!1})=>{const A=`${r}_${m}`,k=()=>{if(x)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return d.jsx(Ec,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:k},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${m}`:m}),disabled:x},A)})})};const qh=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=oe.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var p;l(!o),c(o?"password":"text"),(p=s.current)==null||p.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Sn,{inputRef:s,type:u,...r})]})};const Bn={text:{component:Sn},email:{component:Sn},url:{component:Sn},textarea:{component:Sn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ec},checkboxes:{component:zh,props:{multiSelect:!0}},select:{component:Lh},password:{component:qh},autocomplete:{component:Ih}},Wh=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const p=oe.useIntl(),h=l&&l.some(({condition:w})=>w==="required"),g=(u==null?void 0:u.toString().length)||0,m=o&&Bn[o]&&Bn[o].component?Bn[o].component:Sn,b={};o&&["checkboxes"].includes(o)?b.element="span":b.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:fn(a),value:u};i>0&&(v["data-character-limit"]=i,v.functions&&(v.functions.onChange=w=>{((w==null?void 0:w.toString().length)||0)>i&&(w=w==null?void 0:w.toString().slice(0,i)),a.onChange(w)})),o&&Bn[o]&&Bn[o].props&&(v={...v,...Bn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const x=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),A=({...w})=>r?C.createElement(w.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...w},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(m,{...v,label:x,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=w=>C.createElement(w.element||"label",{...w,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...b,children:[x,h&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(m,{...v}),i>0?d.jsxs("small",{className:Y("character-limit",{"near-limit":g>=.99*i,"approaching-limit":g>=.9*i&&g<.99*i}),children:[d.jsx("span",{className:"hidden",children:p.formatMessage({id:"form_fieldWrapper_characterLimit"})}),g," / ",i]}):null]}),d.jsx(A,{})]})},Hh=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?fn(e.errors):{},i=e.values?fn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=fn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:m=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=m||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ni=null;const Qn=({fields:e,className:t="",id:n=e.length?`form__${e[0].id}`:"form",formRef:r,intlPath:a=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:s={variant:"secondary",size:"large"},meta:o,gtm:l={context:"Form",event:"form-submit-click"},functions:{onSuccess:u=async()=>{},onCancel:c=()=>{},onCatch:f=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...h})=>{const{customOnSubmit:g,hideButton:m,...b}=i,v=40,{shouldShowCancelButton:x=!1,shouldReset:A=!0,showRequiredLabels:k=!0,showSuccessMessage:w=!1}=o||{},B=oe.useIntl(),P={};e.length&&e.forEach(Q=>{const D=Q.id||Q.name;D&&(P[D]=Q.value||"")});const[q,I]=C.useReducer(Hh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:P}),{errors:N,isSubmitting:O,formSubmitted:E,values:T}=q;C.useEffect(()=>{A&&E&&(ni=setTimeout(()=>{I({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[E]),C.useEffect(()=>()=>{ni&&clearTimeout(ni)},[]),C.useEffect(()=>{const Q=D=>{I({type:"updateValue",payload:{key:D.detail.id,value:D.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",Q),()=>{document.removeEventListener("dropdownMultiSelectSubmit",Q)}},[]);const R=C.useRef(null),M=r||R;if(!e.length)return null;i.text||(i.text=B.formatMessage({id:"form_submit"}));const K=()=>{if(!O){if(I({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&I({type:"submitForm",payload:{fields:e,dispatch:I,intl:B}});return}I({type:"submitForm",payload:{fields:e,dispatch:I,onSuccess:async Q=>{try{await u(Q),I({type:A?"formSubmittedAndReset":"formSubmitted"})}catch(D){f(D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(Q,D)=>{p(Q,D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},ie=[{...b,icon:E?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:Q=>{var X;if(Q.preventDefault(),Q.stopPropagation(),O)return;let D=0;if((X=M==null?void 0:M.current)!=null&&X.id){const _=document.getElementById(M.current.id);_&&(D=_.getBoundingClientRect().top+window.scrollY)}const U=document.getElementById("header");U&&(D=D-U.offsetHeight-v),D<0&&(D=0),window.scrollTo({top:D,behavior:"smooth"}),K()},disabled:O||E||i.disabled,"data-gtm-event-context":l.context,"data-gtm-event-type":l.event,children:O||E?B.formatMessage({id:`form_${O?"submitting":"submitted"}`}):i.text}];return x&&ie.unshift({...s,className:"gtm-trackable","data-gtm-event-context":l.context,"data-gtm-event-type":l.event,disabled:O||E,onClick:c,children:s.text||B.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[d.jsxs("form",{...h,id:n,className:Y("form",t),ref:M,children:[N!=null&&N.general?d.jsx(nn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,(!A||!O&&!E||g)&&e.map((Q,D)=>{const{id:U=Q.name||D,component:X,functions:_={onChange:()=>{}},submitOnEnter:F=!1}=Q;if(X)return d.jsx(X,{...Q.props||{}},`component-${U}-${D}`);const L=T?T[U]:"",$={..._,onChange:z=>{I({type:"updateValue",payload:{key:U,value:z}}),_.onChange(z&&z.toString(),I)}};return F&&($.onKeyDown=z=>{z.key==="Enter"&&(z.stopPropagation(),z.preventDefault(),K()),_.onKeyDown&&_.onKeyDown(z)}),d.jsx(Wh,{intlPath:a,...Q,showRequiredLabels:k,value:L,error:N==null?void 0:N[U],functions:$},U)}),m?null:(O||E)&&g?g:d.jsx(Dn,{className:Y("cta",{center:O||E,submitted:E}),buttons:ie})]}),w&&E&&d.jsx(Dr,{className:"success",children:typeof w=="string"?w:B.formatMessage({id:"form_success"})})]})};const Ir="passwordRules_",_c="isMoreThanEightCharacters",Bc="includesNumberAndSymbol",kc="includesLowerAndUppercase",Uh={[_c]:"8Characters",[Bc]:"numberSymbol",[kc]:"lowercaseUppercase"},Vh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Ir}intro`})}),d.jsx("ul",{children:[_c,Bc,kc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Le,{children:[n.formatMessage({id:`${Ir}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Ir}rule_${Uh[r]}`})}),!e[r]&&d.jsxs(Le,{element:"strong",children:[" ",n.formatMessage({id:`${Ir}notMet`})]})]},`rule-${r}`))})]})},Ac=C.memo(Vh);const Kh=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=oe.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(x=>({...x,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(x=>({...x,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(xt,{className:"rating-placeholder"});const{id:f,rating:p,disabled:h}=l,g="ratings_",m={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!f||h))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(A=>({...A,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:m[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return d.jsx("li",{className:Y({selected:p&&x<=p}),children:d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!p||x>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${m[x===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),b(x)},disabled:h})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Zh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ri={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Fc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Zh?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},js={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 $r=1;$r<20;$r++)js["f"+$r]=111+$r;function Ma(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Tc(s,t)}),a=function(o){return r.some(function(l){return Sc(l,o)})},i=n==null?a:a(n);return i}function Yh(e,t){return Ma(e,t)}function Gh(e,t){return Ma(e,{byKey:!0},t)}function Tc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ri)r[ri[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),f;!(o=(f=c.next()).done);o=!0){var p=f.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Os(p),m=ri[g];if(p.length>1&&!m&&!Fc[p]&&!js[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!m)&&(n?r.key=g:r.which=jc(p)),m&&(r[m]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Sc(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 jc(e){e=Os(e);var t=js[e]||e.toUpperCase().charCodeAt(0);return t}function Os(e){return e=e.toLowerCase(),e=Fc[e]||e,e}var Qh=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=Yh;Wt.isKeyHotkey=Gh;Wt.parseHotkey=Tc;Wt.compareHotkey=Sc;Wt.toKeyCode=jc;Wt.toKeyName=Os;function Jh(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 es(e,t){return Array(t+1).join(e)}function Xh(e){return e.replace(/^\n*/,"")}function em(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
37
|
+
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const h=({propertyName:m})=>{m==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(jt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[d.jsx(Qt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const wh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Qt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,Eh=({children:e})=>d.jsx(jt,{variant:"secondary",children:e}),_h=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Bh=["span","strong","h1","h2","h3","h4","h5","h6","p"],kh=({children:e})=>{const t=oe.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Bh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Ra,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Ah=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(jt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},Fh=e=>{const t=oe.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Le,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Fo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Th=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Fo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Fo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(we,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},Ji=({children:e})=>d.jsx("span",{children:e});const Sh={default:{a:Th,CollapsibleSection:Ra,TextBox:jt,CaseStudy:Eh,style:Xe,details:kh,div:Ah,iframe:Fh,center:_h},"text-only":{h1:Xe,h2:Xe,h3:Xe,h4:Xe,h5:Xe,h6:Xe,style:Xe,details:Xe,div:Xe,TextBox:Xe,CollapsibleSection:Xe,CaseStudy:Xe,blockquote:Xe,iframe:Xe,button:Xe}},qn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0,overrides:Sh[r]};return d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Qt,{options:{...s,...t},children:n})})};const Dc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Mn=({size:e="medium",variant:t="default",className:n="",icon:r,children:a,...i})=>{const s={"--icon":`url(${zt}icons/${r}.svg)`};return d.jsx("span",{className:Y("pill",e,t,n,{"has-icon":r}),style:s,...i,children:a})};const Dr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const jh=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=oe.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Le,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},As=C.memo(jh);const ti="loadingBlock_",Oh=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${ti}loading`})},75:{text:r.formatMessage({id:`${ti}almostDone`})},100:{text:r.formatMessage({id:`${ti}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${zt}icons/${t[a].icon}.svg)`}:{};return d.jsxs(jt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(As,{progress:e})]})},Ph=C.memo(Oh);const xt=({element:e="div",className:t="",...n})=>d.jsx(Pa,{element:e,className:Y("loading-placeholder",t),...n});const Xi={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Cc=(e,t)=>e in Xi?d.jsx("div",{className:e,children:Xi[e].map((n,r)=>Cc(n,r))},t):d.jsx(xt,{className:e},t),Fs=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:Xi[e].map((n,r)=>Cc(n,r))}),xc=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):""},Rr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Nh=e=>{const t=Math.ceil(26/Rr.length),n=xc(e).toLowerCase();if(n==="")return Rr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Rr.length;a++)if(r<=t*(a+1))return Rr[a]};const To=256,rn=({className:e="",src:t="",name:n,alt:r,width:a=To,height:i=To,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const h=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=h*window.devicePixelRatio,f.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=Nh(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(xc(n),h/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ts=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Rh=({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=Ln(l,r)),l};const Fr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl(),{size:l="medium"}=r,u=Ts(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:p}=u;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const h=Rh(u),g=n&&n.createdAt?Yi(n.createdAt):!1,m=n&&n.createdAt?ks(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",l,s),children:d.jsxs(Cn,{href:p,gtmType:i,gtmContext:a,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(rn,{name:c,src:f}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:m,"aria-label":m,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),h&&d.jsx("small",{className:Y({"text-medium":l==="large"}),children:h})]})]})})};const So={small:24,medium:48},Ss=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,h)=>{let g,m="";if(h<o){const{name:b="",image:v=""}=Ts(p);if(s)return d.jsx(xt,{element:"li",className:"contributor"},h);g=d.jsx(rn,{name:b,src:v,width:So[a||"medium"],height:So[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":b>99}),children:["+",hh(b,0)]}),m="number-left"}return g?d.jsx("li",{className:Y("contributor",m),children:g},h):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Ln(n[0].name||"",20):l||null})]})})};const Mr="emailHelperTextBox_",wc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Mr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=m=>{s({path:`${Mr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:m})};if(typeof r!="function"){g(a.formatMessage({id:`${Mr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(m=>{g(m.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let h=Mr,g="default",m={},b={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",m={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":h+="emailAlreadyExists",g="error",m={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:h,type:g,link:m,mail:b})},[e]);const c={};return["link","mail"].forEach(h=>{c[h]=Object.keys(i[h]).length?g=>d.jsx("a",{...i[h],children:g}):g=>g}),d.jsx(bc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(xt,{element:"span"}),d.jsx(xt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:h=>d.jsx("strong",{children:h}),em:h=>d.jsx("em",{children:h}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Sn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:p=>{const h=p.target;a.onChange(h.value)}})};const _n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Mh=500,Ih=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},m]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=oe.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const k=setTimeout(()=>{g||f(E=>({...E,debouncedInput:l}))},Mh);return()=>{clearTimeout(k)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];m(B=>({...B,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),m(B=>({...B,predictions:[]}))}})():m(k=>({...k,predictions:[]}))},[c,g]),C.useEffect(()=>{h>=0&&p[h]&&f(k=>({...k,displayInput:p[h].description}))},[h,p]);const v=k=>{[_n.DOWN,_n.UP,_n.ENTER].includes(k.key)&&(k.preventDefault(),k.key===_n.DOWN&&h<p.length-1?m(E=>({...E,activePredictionIndex:h+1})):k.key===_n.UP&&h>0?m(E=>({...E,activePredictionIndex:h-1})):k.key===_n.ENTER&&h>-1&&(s(p[h].description),f(E=>({...E,input:p[h].description})),m(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=k=>{s(k.target.value),f(E=>({...E,input:k.target.value,displayInput:k.target.value})),m(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),f(E=>({...E,input:k.description,displayInput:k.description})),m(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((k,E)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>m(B=>({...B,activePredictionIndex:E})),className:Y("predictions-list-item",{active:E===h}),children:k.description},E))})]})};const Ec=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const p=oe.useIntl(),{onChange:h,...g}=r,m=()=>{t||h(c?null:l)},b=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),m())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const x=v.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),m())},className:Y("checkbox-wrapper",e),...f,...g},b)};const $h=C.memo(function({direction:t="down"}){return d.jsx(Pa,{className:Y("rotating-chevron",`direction-${t}`)})});const Lh=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=oe.useIntl(),[f,p]=C.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[m,b]=C.useState(g);let v;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?v=t&&m?t.find(P=>P.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?v=m[0]:v={id:"",label:""},C.useEffect(()=>{b(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:A,...k}=a,E=P=>{if(o){let z=[];m!=null&&m.includes(P.id)?z=m.filter(I=>I!==P.id):z=[...m,P.id],b([...z]),x&&x([...z])}else b([P]),x&&x(P.id),p(!1)},B=P=>{if(P==="all"){const z=(t==null?void 0:t.map(I=>I.id))||[];b(z),x&&x(z)}else b([]),x&&x([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:P=>{P.preventDefault(),P.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${m.length}`:v.label,d.jsx($h,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:P=>{P.preventDefault(),P.stopPropagation();const z=t&&t.find(I=>I.id===P.target.value);E(z)},hidden:!f,...k,children:t==null?void 0:t.map(P=>d.jsx("option",{value:P.id,children:P.label},P.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${m==null?void 0:m.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(P=>{const z=P.id===v.id||(m==null?void 0:m.includes(P))||(m==null?void 0:m.includes(P.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${P}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),E(P)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:P.label})]})},P.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(we,{variant:"secondary",onClick:()=>{A&&A(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const zh=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const p=oe.useIntl(),h=i?c:[],g=c;return d.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:m,label:b=!1,value:v=m,disabled:x=!1})=>{const A=`${r}_${m}`,k=()=>{if(x)return;let E;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(E=h,E.splice(B,1)):(!h||h.length===0?E=[]:E=h,E.push(v))}else E=g===v?void 0:v;t.onChange(E)};return d.jsx(Ec,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:k},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${m}`:m}),disabled:x},A)})})};const qh=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=oe.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var p;l(!o),c(o?"password":"text"),(p=s.current)==null||p.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Sn,{inputRef:s,type:u,...r})]})};const Bn={text:{component:Sn},email:{component:Sn},url:{component:Sn},textarea:{component:Sn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ec},checkboxes:{component:zh,props:{multiSelect:!0}},select:{component:Lh},password:{component:qh},autocomplete:{component:Ih}},Wh=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const p=oe.useIntl(),h=l&&l.some(({condition:E})=>E==="required"),g=(u==null?void 0:u.toString().length)||0,m=o&&Bn[o]&&Bn[o].component?Bn[o].component:Sn,b={};o&&["checkboxes"].includes(o)?b.element="span":b.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:fn(a),value:u};i>0&&(v["data-character-limit"]=i,v.functions&&(v.functions.onChange=E=>{((E==null?void 0:E.toString().length)||0)>i&&(E=E==null?void 0:E.toString().slice(0,i)),a.onChange(E)})),o&&Bn[o]&&Bn[o].props&&(v={...v,...Bn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const x=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),A=({...E})=>r?C.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(m,{...v,label:x,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=E=>C.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...b,children:[x,h&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(m,{...v}),i>0?d.jsxs("small",{className:Y("character-limit",{"near-limit":g>=.99*i,"approaching-limit":g>=.9*i&&g<.99*i}),children:[d.jsx("span",{className:"hidden",children:p.formatMessage({id:"form_fieldWrapper_characterLimit"})}),g," / ",i]}):null]}),d.jsx(A,{})]})},Hh=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?fn(e.errors):{},i=e.values?fn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=fn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:m=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=m||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ni=null;const Qn=({fields:e,className:t="",id:n=e.length?`form__${e[0].id}`:"form",formRef:r,intlPath:a=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:s={variant:"secondary",size:"large"},meta:o,gtm:l={context:"Form",event:"form-submit-click"},functions:{onSuccess:u=async()=>{},onCancel:c=()=>{},onCatch:f=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...h})=>{const{customOnSubmit:g,hideButton:m,...b}=i,v=40,{shouldShowCancelButton:x=!1,shouldReset:A=!0,showRequiredLabels:k=!0,showSuccessMessage:E=!1}=o||{},B=oe.useIntl(),P={};e.length&&e.forEach(Q=>{const D=Q.id||Q.name;D&&(P[D]=Q.value||"")});const[z,I]=C.useReducer(Hh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:P}),{errors:N,isSubmitting:O,formSubmitted:w,values:T}=z;C.useEffect(()=>{A&&w&&(ni=setTimeout(()=>{I({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[w]),C.useEffect(()=>()=>{ni&&clearTimeout(ni)},[]),C.useEffect(()=>{const Q=D=>{I({type:"updateValue",payload:{key:D.detail.id,value:D.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",Q),()=>{document.removeEventListener("dropdownMultiSelectSubmit",Q)}},[]);const R=C.useRef(null),M=r||R;if(!e.length)return null;i.text||(i.text=B.formatMessage({id:"form_submit"}));const K=()=>{if(!O){if(I({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&I({type:"submitForm",payload:{fields:e,dispatch:I,intl:B}});return}I({type:"submitForm",payload:{fields:e,dispatch:I,onSuccess:async Q=>{try{await u(Q),I({type:A?"formSubmittedAndReset":"formSubmitted"})}catch(D){f(D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(Q,D)=>{p(Q,D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},ie=[{...b,icon:w?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:Q=>{var X;if(Q.preventDefault(),Q.stopPropagation(),O)return;let D=0;if((X=M==null?void 0:M.current)!=null&&X.id){const _=document.getElementById(M.current.id);_&&(D=_.getBoundingClientRect().top+window.scrollY)}const U=document.getElementById("header");U&&(D=D-U.offsetHeight-v),D<0&&(D=0),window.scrollTo({top:D,behavior:"smooth"}),K()},disabled:O||w||i.disabled,"data-gtm-event-context":l.context,"data-gtm-event-type":l.event,children:O||w?B.formatMessage({id:`form_${O?"submitting":"submitted"}`}):i.text}];return x&&ie.unshift({...s,className:"gtm-trackable","data-gtm-event-context":l.context,"data-gtm-event-type":l.event,disabled:O||w,onClick:c,children:s.text||B.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[d.jsxs("form",{...h,id:n,className:Y("form",t),ref:M,children:[N!=null&&N.general?d.jsx(nn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,(!A||!O&&!w||g)&&e.map((Q,D)=>{const{id:U=Q.name||D,component:X,functions:_={onChange:()=>{}},submitOnEnter:F=!1}=Q;if(X)return d.jsx(X,{...Q.props||{}},`component-${U}-${D}`);const L=T?T[U]:"",$={..._,onChange:q=>{I({type:"updateValue",payload:{key:U,value:q}}),_.onChange(q&&q.toString(),I)}};return F&&($.onKeyDown=q=>{q.key==="Enter"&&(q.stopPropagation(),q.preventDefault(),K()),_.onKeyDown&&_.onKeyDown(q)}),d.jsx(Wh,{intlPath:a,...Q,showRequiredLabels:k,value:L,error:N==null?void 0:N[U],functions:$},U)}),m?null:(O||w)&&g?g:d.jsx(Dn,{className:Y("cta",{center:O||w,submitted:w}),buttons:ie})]}),E&&w&&d.jsx(Dr,{className:"success",children:typeof E=="string"?E:B.formatMessage({id:"form_success"})})]})};const Ir="passwordRules_",_c="isMoreThanEightCharacters",Bc="includesNumberAndSymbol",kc="includesLowerAndUppercase",Uh={[_c]:"8Characters",[Bc]:"numberSymbol",[kc]:"lowercaseUppercase"},Vh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Ir}intro`})}),d.jsx("ul",{children:[_c,Bc,kc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Le,{children:[n.formatMessage({id:`${Ir}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Ir}rule_${Uh[r]}`})}),!e[r]&&d.jsxs(Le,{element:"strong",children:[" ",n.formatMessage({id:`${Ir}notMet`})]})]},`rule-${r}`))})]})},Ac=C.memo(Vh);const Kh=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=oe.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(x=>({...x,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(x=>({...x,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(xt,{className:"rating-placeholder"});const{id:f,rating:p,disabled:h}=l,g="ratings_",m={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!f||h))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(A=>({...A,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:m[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return d.jsx("li",{className:Y({selected:p&&x<=p}),children:d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!p||x>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${m[x===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),b(x)},disabled:h})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Zh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ri={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Fc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Zh?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},js={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 $r=1;$r<20;$r++)js["f"+$r]=111+$r;function Ma(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Tc(s,t)}),a=function(o){return r.some(function(l){return Sc(l,o)})},i=n==null?a:a(n);return i}function Yh(e,t){return Ma(e,t)}function Gh(e,t){return Ma(e,{byKey:!0},t)}function Tc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ri)r[ri[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),f;!(o=(f=c.next()).done);o=!0){var p=f.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Os(p),m=ri[g];if(p.length>1&&!m&&!Fc[p]&&!js[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!m)&&(n?r.key=g:r.which=jc(p)),m&&(r[m]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Sc(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 jc(e){e=Os(e);var t=js[e]||e.toUpperCase().charCodeAt(0);return t}function Os(e){return e=e.toLowerCase(),e=Fc[e]||e,e}var Qh=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=Yh;Wt.isKeyHotkey=Gh;Wt.parseHotkey=Tc;Wt.compareHotkey=Sc;Wt.toKeyCode=jc;Wt.toKeyName=Os;function Jh(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 es(e,t){return Array(t+1).join(e)}function Xh(e){return e.replace(/^\n*/,"")}function em(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
38
|
`;)t--;return e.substring(0,t)}var tm=["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 Ps(e){return Ns(e,tm)}var Oc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Pc(e){return Ns(e,Oc)}function nm(e){return Rc(e,Oc)}var Nc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function rm(e){return Ns(e,Nc)}function am(e){return Rc(e,Nc)}function Ns(e,t){return t.indexOf(e.nodeName)>=0}function Rc(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var et={};et.paragraph={filter:"p",replacement:function(e){return`
|
|
39
39
|
|
|
40
40
|
`+e+`
|
|
@@ -100,7 +100,7 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
100
100
|
* Copyright(c) 2015 Andreas Lubbe
|
|
101
101
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
102
102
|
* MIT Licensed
|
|
103
|
-
*/var wm=/["'&<>]/,Em=_m;function _m(e){var t=""+e,n=wm.exec(t);if(!n)return t;var r,a="",i=0,s=0;for(i=n.index;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}s!==i&&(a+=t.substring(s,i)),s=i+1,a+=r}return s!==i?a+t.substring(s,i):a}const Bm=tn(Em);function bt(){return bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bt.apply(this,arguments)}var jn={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasis_mark:"italic",strong_mark:"bold",delete_mark:"strikeThrough",inline_code_mark:"code",thematic_break:"thematic_break",image:"image"};function Lc(e,t){var n,r,a,i,s,o,l,u,c,f,p,h=bt({},jn,t==null?void 0:t.nodeTypes,{heading:bt({},jn.heading,t==null||(n=t.nodeTypes)===null||n===void 0?void 0:n.heading)}),g=(r=t==null?void 0:t.linkDestinationKey)!==null&&r!==void 0?r:"link",m=(a=t==null?void 0:t.imageSourceKey)!==null&&a!==void 0?a:"link",b=(i=t==null?void 0:t.imageCaptionKey)!==null&&i!==void 0?i:"caption",v=[{text:""}],x=e.children;switch(x&&Array.isArray(x)&&x.length>0&&(v=x.flatMap(function(k){return Lc(bt({},k,{ordered:e.ordered||!1}),t)})),e.type){case"heading":return{type:h.heading[e.depth||1],children:v};case"list":return{type:e.ordered?h.ol_list:h.ul_list,children:v};case"listItem":return{type:h.listItem,children:v};case"paragraph":return{type:h.paragraph,children:v};case"link":return s={type:h.link},s[g]=e.url,s.children=v,s;case"image":return o={type:h.image,children:[{text:""}]},o[m]=e.url,o[b]=e.alt,o;case"blockquote":return{type:h.block_quote,children:v};case"code":return{type:h.code_block,language:e.lang,children:[{text:e.value}]};case"html":if((l=e.value)!==null&&l!==void 0&&l.includes("<br>")){var A;return{break:!0,type:h.paragraph,children:[{text:((A=e.value)===null||A===void 0?void 0:A.replace(/<br>/g,""))||""}]}}return{type:"paragraph",children:[{text:e.value||""}]};case"emphasis":return bt((u={},u[h.emphasis_mark]=!0,u),ui(v),Lr(v));case"strong":return bt((c={},c[h.strong_mark]=!0,c),ui(v),Lr(v));case"delete":return bt((f={},f[h.delete_mark]=!0,f),ui(v),Lr(v));case"inlineCode":return bt((p={},p[h.inline_code_mark]=!0,p.text=e.value,p),Lr(v));case"thematicBreak":return{type:h.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}var ui=function(t){return{text:t.map(function(n){return n==null?void 0:n.text}).join("")}};function Lr(e){return e.reduce(function(t,n){return Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t},{})}var kn=function(t){return typeof t.text=="string"},km=["thematic_break","image"],Po="<br>";function zc(e,t){t===void 0&&(t={nodeTypes:jn});var n=t,r=n.nodeTypes,a=r===void 0?jn:r,i=n.ignoreParagraphNewline,s=i===void 0?!1:i,o=n.listDepth,l=o===void 0?0:o,u=e.text||"",c=e.type||"",f=bt({},jn,a,{heading:bt({},jn.heading,a.heading)}),p=[f.ul_list,f.ol_list],h=u;if(kn(e)||(h=e.children.map(function(x){var A=kn(x)?!1:p.includes(x.type||""),k=p.includes(e.type||""),
|
|
103
|
+
*/var wm=/["'&<>]/,Em=_m;function _m(e){var t=""+e,n=wm.exec(t);if(!n)return t;var r,a="",i=0,s=0;for(i=n.index;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}s!==i&&(a+=t.substring(s,i)),s=i+1,a+=r}return s!==i?a+t.substring(s,i):a}const Bm=tn(Em);function bt(){return bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bt.apply(this,arguments)}var jn={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasis_mark:"italic",strong_mark:"bold",delete_mark:"strikeThrough",inline_code_mark:"code",thematic_break:"thematic_break",image:"image"};function Lc(e,t){var n,r,a,i,s,o,l,u,c,f,p,h=bt({},jn,t==null?void 0:t.nodeTypes,{heading:bt({},jn.heading,t==null||(n=t.nodeTypes)===null||n===void 0?void 0:n.heading)}),g=(r=t==null?void 0:t.linkDestinationKey)!==null&&r!==void 0?r:"link",m=(a=t==null?void 0:t.imageSourceKey)!==null&&a!==void 0?a:"link",b=(i=t==null?void 0:t.imageCaptionKey)!==null&&i!==void 0?i:"caption",v=[{text:""}],x=e.children;switch(x&&Array.isArray(x)&&x.length>0&&(v=x.flatMap(function(k){return Lc(bt({},k,{ordered:e.ordered||!1}),t)})),e.type){case"heading":return{type:h.heading[e.depth||1],children:v};case"list":return{type:e.ordered?h.ol_list:h.ul_list,children:v};case"listItem":return{type:h.listItem,children:v};case"paragraph":return{type:h.paragraph,children:v};case"link":return s={type:h.link},s[g]=e.url,s.children=v,s;case"image":return o={type:h.image,children:[{text:""}]},o[m]=e.url,o[b]=e.alt,o;case"blockquote":return{type:h.block_quote,children:v};case"code":return{type:h.code_block,language:e.lang,children:[{text:e.value}]};case"html":if((l=e.value)!==null&&l!==void 0&&l.includes("<br>")){var A;return{break:!0,type:h.paragraph,children:[{text:((A=e.value)===null||A===void 0?void 0:A.replace(/<br>/g,""))||""}]}}return{type:"paragraph",children:[{text:e.value||""}]};case"emphasis":return bt((u={},u[h.emphasis_mark]=!0,u),ui(v),Lr(v));case"strong":return bt((c={},c[h.strong_mark]=!0,c),ui(v),Lr(v));case"delete":return bt((f={},f[h.delete_mark]=!0,f),ui(v),Lr(v));case"inlineCode":return bt((p={},p[h.inline_code_mark]=!0,p.text=e.value,p),Lr(v));case"thematicBreak":return{type:h.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}var ui=function(t){return{text:t.map(function(n){return n==null?void 0:n.text}).join("")}};function Lr(e){return e.reduce(function(t,n){return Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t},{})}var kn=function(t){return typeof t.text=="string"},km=["thematic_break","image"],Po="<br>";function zc(e,t){t===void 0&&(t={nodeTypes:jn});var n=t,r=n.nodeTypes,a=r===void 0?jn:r,i=n.ignoreParagraphNewline,s=i===void 0?!1:i,o=n.listDepth,l=o===void 0?0:o,u=e.text||"",c=e.type||"",f=bt({},jn,a,{heading:bt({},jn.heading,a.heading)}),p=[f.ul_list,f.ol_list],h=u;if(kn(e)||(h=e.children.map(function(x){var A=kn(x)?!1:p.includes(x.type||""),k=p.includes(e.type||""),E=!1;return!kn(e)&&Array.isArray(e.children)&&(E=e.children.some(function(B){return!kn(B)&&B.type===f.link})),zc(bt({},x,{parentType:c}),{nodeTypes:f,ignoreParagraphNewline:(s||A||k||E)&&!x.break,listDepth:p.includes(x.type||"")?l+1:l})}).join("")),!s&&(u===""||u===`
|
|
104
104
|
`)&&e.parentType===f.paragraph&&(c=f.paragraph,h=Po),!(h===""&&!km.find(function(x){return f[x]===c})))switch(h!==Po&&kn(e)&&(e.strikeThrough&&e.bold&&e.italic?h=An(h,"~~***"):e.bold&&e.italic?h=An(h,"***"):(e.bold&&(h=An(h,"**")),e.italic&&(h=An(h,"_")),e.strikeThrough&&(h=An(h,"~~")),e.code&&(h=An(h,"`")))),c){case f.heading[1]:return"# "+h+`
|
|
105
105
|
`;case f.heading[2]:return"## "+h+`
|
|
106
106
|
`;case f.heading[3]:return"### "+h+`
|
|
@@ -120,43 +120,43 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
120
120
|
*
|
|
121
121
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
122
122
|
* Released under the MIT License.
|
|
123
|
-
*/function Ro(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return Ro(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Ro(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var qc=Symbol.for("immer-nothing"),Mo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Fm=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 lt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Fm[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 Wn=Object.getPrototypeOf;function gn(e){return!!e&&!!e[mt]}function vn(e){var t;return e?Wc(e)||Array.isArray(e)||!!e[Mo]||!!((t=e.constructor)!=null&&t[Mo])||$a(e)||La(e):!1}var Tm=Object.prototype.constructor.toString();function Wc(e){if(!e||typeof e!="object")return!1;const t=Wn(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)===Tm}function ga(e,t){Ia(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ia(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:$a(e)?2:La(e)?3:0}function ts(e,t){return Ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $a(e){return e instanceof Map}function La(e){return e instanceof Set}function un(e){return e.copy_||e.base_}function ns(e,t){if($a(e))return new Map(e);if(La(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Wc(e))return Wn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[mt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Wn(e),n)}function Ms(e,t=!1){return za(e)||gn(e)||!vn(e)||(Ia(e)>1&&(e.set=e.add=e.clear=e.delete=jm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ms(r,!0))),e}function jm(){lt(2)}function za(e){return Object.isFrozen(e)}var Om={};function bn(e){const t=Om[e];return t||lt(0,e),t}var Cr;function Uc(){return Cr}function Pm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Io(e,t){t&&(bn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rs(e){as(e),e.drafts_.forEach(Nm),e.drafts_=null}function as(e){e===Cr&&(Cr=e.parent_)}function $o(e){return Cr=Pm(Cr,e)}function Nm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(rs(t),lt(4)),vn(e)&&(e=va(t,e),t.parent_||ba(t,e)),t.patches_&&bn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=va(t,n,[]),rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qc?e:void 0}function va(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return ga(t,(a,i)=>zo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ba(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),ga(i,(o,l)=>zo(e,r,a,o,l,n,s)),ba(e,a,!1),n&&e.patches_&&bn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function zo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&<(5),gn(a)){const o=i&&t&&t.type_!==3&&!ts(t.assigned_,r)?i.concat(r):void 0,l=va(e,a,o);if(Hc(n,r,l),gn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(vn(a)&&!za(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;va(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ba(e,a)}}function ba(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ms(t,n)}function Rm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Uc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Is;n&&(a=[r],i=xr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Is={get(e,t){if(t===mt)return e;const n=un(e);if(!ts(n,t))return Mm(e,n,t);const r=n[t];return e.finalized_||!vn(r)?r:r===li(e.base_,t)?(ci(e),e.copy_[t]=ss(r,e)):r},has(e,t){return t in un(e)},ownKeys(e){return Reflect.ownKeys(un(e))},set(e,t,n){const r=Vc(un(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=li(un(e),t),i=a==null?void 0:a[mt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sm(n,a)&&(n!==void 0||ts(e.base_,t)))return!0;ci(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 li(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ci(e),is(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return Wn(e.base_)},setPrototypeOf(){lt(12)}},xr={};ga(Is,(e,t)=>{xr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});xr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),xr.set.call(this,e,t,void 0)};xr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),Is.set.call(this,e[0],t,n,e[0])};function li(e,t){const n=e[mt];return(n?un(n):e)[t]}function Mm(e,t,n){var a;const r=Vc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Vc(e,t){if(!(t in e))return;let n=Wn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wn(n)}}function is(e){e.modified_||(e.modified_=!0,e.parent_&&is(e.parent_))}function ci(e){e.copy_||(e.copy_=ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Im=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&<(6),r!==void 0&&typeof r!="function"&<(7);let a;if(vn(t)){const i=$o(this),s=ss(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?rs(i):as(i)}return Io(i,r),Lo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===qc&&(a=void 0),this.autoFreeze_&&Ms(a,!0),r){const i=[],s=[];bn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else lt(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){vn(e)||lt(8),gn(e)&&(e=$m(e));const t=$o(this),n=ss(e,void 0);return n[mt].isManual_=!0,as(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Io(r,t),Lo(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=bn("Patches").applyPatches_;return gn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ss(e,t){const n=$a(e)?bn("MapSet").proxyMap_(e,t):La(e)?bn("MapSet").proxySet_(e,t):Rm(e,t);return(t?t.scope_:Uc()).drafts_.push(n),n}function $m(e){return gn(e)||lt(10,e),Kc(e)}function Kc(e){if(!vn(e)||za(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ns(e,!0);return ga(n,(r,a)=>{Hc(n,r,Kc(a))}),t&&(t.finalized_=!1),n}var pt=new Im,$s=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var qo=pt.createDraft.bind(pt),Wo=pt.finishDraft.bind(pt),Lm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=j.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},zm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ce.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},qm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=W.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ya=new WeakMap,Da=new WeakMap,fr=new WeakMap,Zc=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,j={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=j.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 j.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return j.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 j.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 j.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&j.compare(e,t)===0},isBefore(e,t){return j.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&j.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&j.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&j.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&j.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&&j.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(!j.isAncestor(t,e)&&!j.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;(j.equals(i,r)||j.endsBefore(i,r)||j.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(j.equals(s,r)||j.isAncestor(s,r))return null;j.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;j.equals(o,r)||j.endsBefore(o,r)?r[o.length-1]-=1:j.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(j.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else j.endsBefore(u,r)?r[u.length-1]+=1:j.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:p}=t;if(j.equals(f,p))return r;if(j.isAncestor(f,r)||j.equals(f,r)){var h=p.slice();return j.endsBefore(f,p)&&f.length<p.length&&(h[f.length-1]-=1),h.concat(r.slice(f.length))}else j.isSibling(f,p)&&(j.isAncestor(p,r)||j.equals(p,r))?j.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:j.endsBefore(p,r)||j.equals(p,r)||j.isAncestor(p,r)?(j.endsBefore(f,r)&&(r[f.length-1]-=1),r[p.length-1]+=1):j.endsBefore(f,r)&&(j.equals(p,r)&&(r[p.length-1]+=1),r[f.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 Wm(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 Hm(e){var t=Wm(e,"string");return wr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Hm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ko(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 rr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ko(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ko(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Um=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of W.points(t))t[l]=Ce.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var p=se.leaf(e,u),h=p.text.slice(0,c),g=p.text.slice(c);if(p.text=h+f+g,t)for(var[m,b]of W.points(t))t[b]=Ce.transform(m,n);break}case"merge_node":{var{path:v}=n,x=se.get(e,v),A=j.previous(v),k=se.get(e,A),w=se.parent(e,v),B=v[v.length-1];if(de.isText(x)&&de.isText(k))k.text+=x.text;else if(!de.isText(x)&&!de.isText(k))k.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(k)));if(w.children.splice(B,1),t)for(var[P,q]of W.points(t))t[q]=Ce.transform(P,n);break}case"move_node":{var{path:I,newPath:N}=n;if(j.isAncestor(I,N))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(N,"] because the destination is inside itself."));var O=se.get(e,I),E=se.parent(e,I),T=I[I.length-1];E.children.splice(T,1);var R=j.transform(I,n),M=se.get(e,j.parent(R)),K=R[R.length-1];if(M.children.splice(K,0,O),t)for(var[V,ie]of W.points(t))t[ie]=Ce.transform(V,n);break}case"remove_node":{var{path:Q}=n,D=Q[Q.length-1],U=se.parent(e,Q);if(U.children.splice(D,1),t)for(var[X,_]of W.points(t)){var F=Ce.transform(X,n);if(t!=null&&F!=null)t[_]=F;else{var L=void 0,$=void 0;for(var[z,ne]of se.texts(e))if(j.compare(ne,Q)===-1)L=[z,ne];else{$=[z,ne];break}var te=!1;L&&$&&(j.equals($[1],Q)?te=!j.hasPrevious($[1]):te=j.common(L[1],Q).length<j.common($[1],Q).length),L&&!te?(X.path=L[1],X.offset=L[0].text.length):$?(X.path=$[1],X.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:le,text:J}=n;if(J.length===0)break;var be=se.leaf(e,Z),pe=be.text.slice(0,le),_e=be.text.slice(le+J.length);if(be.text=pe+_e,t)for(var[Se,Pe]of W.points(t))t[Pe]=Ce.transform(Se,n);break}case"set_node":{var{path:Ge,properties:Ke,newProperties:Ze}=n;if(Ge.length===0)throw new Error("Cannot set properties on the root node!");var tt=se.get(e,Ge);for(var Ae in Ze){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ze[Ae];We==null?delete tt[Ae]:tt[Ae]=We}for(var $e in Ke)Ze.hasOwnProperty($e)||delete tt[$e];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!W.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ye.stringify(H)," when there is no current selection."));t=rr({},H)}for(var ae in H){var fe=H[ae];if(fe==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=fe}}break}case"split_node":{var{path:me,position:De,properties:Ue}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var Ve=se.get(e,me),ft=se.parent(e,me),Nt=me[me.length-1],wt;if(de.isText(Ve)){var Qe=Ve.text.slice(0,De),Bt=Ve.text.slice(De);Ve.text=Qe,wt=rr(rr({},Ue),{},{text:Bt})}else{var ht=Ve.children.slice(0,De),Ga=Ve.children.slice(De);Ve.children=ht,wt=rr(rr({},Ue),{},{children:Ga})}if(ft.children.splice(Nt+1,0,wt),t)for(var[er,Pr]of W.points(t))t[Pr]=Ce.transform(er,n);break}}return t},Vm={transform(e,t){e.children=qo(e.children);var n=e.selection&&qo(e.selection);try{n=Um(e,n,t)}finally{e.children=Wo(e.children),n?e.selection=gn(n)?Wo(n):n:e.selection=null}}},Km={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)}},Zm={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)}},Yc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Yc(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 Ym(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 qt(e,t){if(e==null)return{};var n=Ym(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 Gm=["anchor","focus"];function Zo(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 Qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return W.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=W.edges(e);return t},equals(e,t){return Ce.equals(e.anchor,t.anchor)&&Ce.equals(e.focus,t.focus)},includes(e,t){if(W.isRange(t)){if(W.includes(e,t.anchor)||W.includes(e,t.focus))return!0;var[n,r]=W.edges(e),[a,i]=W.edges(t);return Ce.isBefore(n,a)&&Ce.isAfter(r,i)}var[s,o]=W.edges(e),l=!1,u=!1;return Ce.isPoint(t)?(l=Ce.compare(t,s)>=0,u=Ce.compare(t,o)<=0):(l=j.compare(t,s.path)>=0,u=j.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=qt(e,Gm),[r,a]=W.edges(e),[i,s]=W.edges(t),o=Ce.isBefore(r,i)?i:r,l=Ce.isBefore(a,s)?a:s;return Ce.isBefore(l,o)?null:Qm({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ce.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ce.equals(t,n)},isExpanded(e){return!W.isCollapsed(e)},isForward(e){return!W.isBackward(e)},isRange(e){return Je(e)&&Ce.isPoint(e.anchor)&&Ce.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=W.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $s(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=W.isCollapsed(r);W.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?W.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ce.transform(r.anchor,t,{affinity:i}),u=Ce.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Yo=e=>Je(e)&&se.isNodeList(e.children)&&!y.isEditor(e),ce={isAncestor(e){return Je(e)&&se.isNodeList(e.children)},isElement:Yo,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.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 Yo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Jm=["children"],Xm=["text"],Go=new WeakMap,se={ancestor(e,t){var n=se.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Ye.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of j.ancestors(t,n)){var a=se.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Ye.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ye.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=j.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(y.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ye.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=qt(e,Jm);return t}else{var t=qt(e,Xm);return t}},first(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Ye.stringify(e)));var n=$s({children:e.children},r=>{var[a,i]=W.edges(t),s=se.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!W.includes(t,h)}});for(var[,o]of s){if(!W.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(j.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(j.equals(o,a.path)){var f=se.leaf(r,o);f.text=f.text.slice(a.offset)}}y.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(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ye.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(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||y.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Go.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return Go.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=se.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Ye.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of j.levels(t,n)){var a=se.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.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?j.isBefore(o,i):j.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;j.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=j.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=j.previous(o);o=f,l=se.get(e,o);continue}o=j.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=j.parent(t),r=se.get(e,n);if(de.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 de.isText(e)?e.text:e.children.map(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function Qo(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 Re(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Qo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yt={isNodeOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Je(e))return!1;switch(e.type){case"insert_node":return j.isPath(e.path)&&se.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"merge_node":return typeof e.position=="number"&&j.isPath(e.path)&&Je(e.properties);case"move_node":return j.isPath(e.path)&&j.isPath(e.newPath);case"remove_node":return j.isPath(e.path)&&se.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"set_node":return j.isPath(e.path)&&Je(e.properties)&&Je(e.newProperties);case"set_selection":return e.properties===null&&W.isRange(e.newProperties)||e.newProperties===null&&W.isRange(e.properties)||Je(e.properties)&&Je(e.newProperties);case"split_node":return j.isPath(e.path)&&typeof e.position=="number"&&Je(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Yt.isOperation(t))},isSelectionOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Re(Re({},e),{},{type:"remove_node"});case"insert_text":return Re(Re({},e),{},{type:"remove_text"});case"merge_node":return Re(Re({},e),{},{type:"split_node",path:j.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(j.equals(t,n))return e;if(j.isSibling(n,t))return Re(Re({},e),{},{path:t,newPath:n});var r=j.transform(n,e),a=j.transform(j.next(n),e);return Re(Re({},e),{},{path:r,newPath:a})}case"remove_node":return Re(Re({},e),{},{type:"insert_node"});case"remove_text":return Re(Re({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Re(Re({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Re(Re({},e),{},{properties:l,newProperties:null}):l==null?Re(Re({},e),{},{properties:null,newProperties:o}):Re(Re({},e),{},{properties:l,newProperties:o})}case"split_node":return Re(Re({},e),{},{type:"merge_node",path:j.next(e.path)})}}},Jo=new WeakMap,ep=e=>{var t=Jo.get(e);if(t!==void 0)return t;if(!Je(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||Je(e.marks))&&(e.selection===null||W.isRange(e.selection))&&se.isNodeList(e.children)&&Yt.isOperationList(e.operations);return Jo.set(e,n),n},y={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 ep(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)}},tp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(j.isPath)}};function Xo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ce={compare(e,t){var n=j.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ce.compare(e,t)===1},isBefore(e,t){return Ce.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&j.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&j.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $s(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=j.transform(i,t,n);break}case"insert_text":{j.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{j.equals(t.path,i)&&(r.offset+=t.position),r.path=j.transform(i,t,n);break}case"remove_text":{j.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(j.equals(t.path,i)||j.isAncestor(t.path,i))return null;r.path=j.transform(i,t,n);break}case"split_node":{if(j.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=j.transform(i,t,eu(eu({},n),{},{affinity:"forward"})))}else r.path=j.transform(i,t,n);break}}})}},tu=void 0,Ye={setScrubber(e){tu=e},stringify(e){return JSON.stringify(e,tu)}},np=["text"],rp=["anchor","focus"];function nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=qt(i,np);return s}return Yc(r?a(e):e,r?a(t):t)},isText(e){return Je(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.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=[Mt({},e)];for(var r of t){var a=qt(r,rp),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:p}=f.text,h=l;if(l+=p,u<=h&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===h)||u>l||c<h||c===h&&h!==0){o.push(f);continue}var g=f,m=void 0,b=void 0;if(c<l){var v=c-h;b=Mt(Mt({},g),{},{text:g.text.slice(v)}),g=Mt(Mt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var x=u-h;m=Mt(Mt({},g),{},{text:g.text.slice(0,x)}),g=Mt(Mt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),m&&o.push(m),o.push(g),b&&o.push(b)}n=o}return n}},Ls=e=>e.selection?e.selection:e.children.length>0?y.end(e,[]):[0],Jn=(e,t)=>{var[n]=y.node(e,t);return r=>r===n},zs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?lp(t):t,i=ye.None,s=ye.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var p=Cp(c,f);if([i,s]=r?[s,p]:[p,i],On(i,ye.ZWJ)&&On(s,ye.ExtPict)&&(r?l=ru(t.substring(0,o)):l=ru(t.substring(0,t.length-o)),!l)||On(i,ye.RI)&&On(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=Bp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&wp(i,s))break;o+=c.length}return o||1},ap=/\s/,ip=/[\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]/,sp=/['\u2018\u2019]/,op=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=zs(t,n),[s,o]=qs(t,i,n);if(up(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},qs=(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)]},up=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ap.test(t))return!1;if(sp.test(t)){var a=zs(n,r),[i,s]=qs(n,a,r);if(e(i,s,r))return!0}return!ip.test(t)},lp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(dp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(cp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},cp=e=>e>=55296&&e<=56319,dp=e=>e>=56320&&e<=57343,ye;(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"})(ye||(ye={}));var fp=/^(?:[\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])$/,hp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,mp=/^(?:[\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])$/,pp=/^[\u1100-\u115F\uA960-\uA97C]$/,gp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,vp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,bp=/^[\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]$/,yp=/^[\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]$/,Dp=/^(?:[\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])$/,Cp=(e,t)=>{var n=ye.Any;return e.search(fp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(hp)!==-1&&(n|=ye.Prepend),e.search(mp)!==-1&&(n|=ye.SpacingMark),e.search(pp)!==-1&&(n|=ye.L),e.search(gp)!==-1&&(n|=ye.V),e.search(vp)!==-1&&(n|=ye.T),e.search(bp)!==-1&&(n|=ye.LV),e.search(yp)!==-1&&(n|=ye.LVT),e.search(Dp)!==-1&&(n|=ye.ExtPict),n};function On(e,t){return(e&t)!==0}var xp=[[ye.L,ye.L|ye.V|ye.LV|ye.LVT],[ye.LV|ye.V,ye.V|ye.T],[ye.LVT|ye.T,ye.T],[ye.Any,ye.Extend|ye.ZWJ],[ye.Any,ye.SpacingMark],[ye.Prepend,ye.Any],[ye.ZWJ,ye.ExtPict],[ye.RI,ye.RI]];function wp(e,t){return xp.findIndex(n=>On(e,n[0])&&On(t,n[1]))===-1}var Ep=/(?:[\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$/,ru=e=>e.search(Ep)!==-1,_p=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Bp=e=>{var t=e.match(_p);if(t===null)return!1;var n=t[0].length/2;return n%2===1},kp={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]:{};y.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Ls(e)}=n;if(j.isPath(a)&&(a=y.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&y.void(e,{at:i}))return;var s=W.start(a),o=y.pointRef(e,s),l=y.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&y.void(e,{at:a})||y.elementReadOnly(e,{at:a}))){var{path:f,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:p,text:t})}})}};function au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?au(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ee=zr(zr(zr(zr({},Vm),Km),Zm),kp),aa=new WeakMap,Ap=e=>aa.get(e)||!1,Fp=(e,t,n)=>{var r=aa.get(e)||!1;aa.set(e,!0);try{t(),n()}finally{aa.set(e,r)}};function Gc(e,t,n){var r=ya.get(e)||[],a=Da.get(e)||new Set,i,s,o=f=>{if(f){var p=f.join(",");s.has(p)||(s.add(p),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);ya.set(e,i),Da.set(e,s)}var Tp=(e,t)=>{for(var n of y.pathRefs(e))Lm.transform(n,t);for(var r of y.pointRefs(e))zm.transform(r,t);for(var a of y.rangeRefs(e))qm.transform(a,t);if(!Ap(e)){var i=j.operationCanTransformPath(t)?s=>j.transform(s,t):void 0;Gc(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),y.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),fr.get(e)||(fr.set(e,!0),Promise.resolve().then(()=>{fr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Sp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return j.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=j.levels(a),s=de.isText(r)?[]:Array.from(se.nodes(r),N=>{var[,O]=N;return a.concat(O)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=j.ancestors(o),u=j.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(j.equals(c,f))return[];var p=[],h=[];for(var g of j.ancestors(c)){var m=j.transform(g,t);p.push(m)}for(var b of j.ancestors(f)){var v=j.transform(b,t);h.push(v)}var x=h[h.length-1],A=f[f.length-1],k=x.concat(A);return[...p,...h,k]}case"remove_node":{var{path:w}=t,B=j.ancestors(w);return[...B]}case"split_node":{var{path:P}=t,q=j.levels(P),I=j.next(P);return[...q,I]}default:return[]}},jp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Op=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=y.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=se.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,p=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(p!==i)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var h={text:""};ee.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Pp=(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},Np=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=y.path(t,i),l=a==="lowest";for(var[u,c]of y.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(W.isRange(i)){if(j.isAncestor(c,i.anchor.path)&&j.isAncestor(c,i.focus.path))return[u,c]}else if(!j.equals(o,c))return[u,c]}}};function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,p)=>{if(!de.isText(f))return!1;var[h,g]=y.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=y.node(e,r);if(o&&a(o,l)){var[u]=y.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=su(su({},y.marks(e)||{}),{},{[t]:n});e.marks=c,fr.get(e)||e.onChange()}}};function ou(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 uu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Mp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.point(t,n,{edge:"end"}),i=y.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,uu(uu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ip=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.start(t,[]),i=y.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,cu(cu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},$p=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Lp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t})},zp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},qp=(e,t)=>[y.start(e,t),y.end(e,t)];function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Wp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,fu(fu({},n),{},{match:r=>ce.isElement(r)&&y.isElementReadOnly(t,r)}))},Hp=(e,t)=>y.point(e,t,{edge:"end"}),Up=(e,t)=>{var n=y.path(e,t,{edge:"start"});return y.node(e,n)},Vp=(e,t)=>{var n=y.range(e,t);return se.fragment(e,n)};function hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,mu(mu({},n),{},{match:r=>ce.isElement(r)&&y.isVoid(t,r)}))},Zp=(e,t)=>t.children.some(n=>ce.isElement(n)&&y.isBlock(e,n)),Yp=(e,t)=>t.children.some(n=>de.isText(n)||y.isInline(e,n)),Gp=(e,t)=>se.has(e,t),Qp=(e,t)=>t.children.every(n=>de.isText(n)),Jp=e=>{ee.splitNodes(e,{always:!0})},Xp=(e,t,n)=>{ee.insertNodes(e,t,n)},eg=e=>{ee.splitNodes(e,{always:!0})};function pu(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 tg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ng=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=tg({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},rg=(e,t)=>!e.isInline(t),ag=(e,t,n)=>y.isStart(e,t,n)||y.isEnd(e,t,n),ig=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},sg=(e,t,n)=>{var r=y.end(e,n);return Ce.equals(t,r)},og=e=>{var t=Zc.get(e);return t===void 0?!0:t},ug=(e,t,n)=>{if(t.offset!==0)return!1;var r=y.start(e,n);return Ce.equals(t,r)},lg=(e,t)=>{var n=y.path(e,t,{edge:"end"});return y.node(e,n)},cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.leaf(t,a);return[i,a]};function dg(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=y.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&y.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var fg=["text"],hg=["text"],mg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(W.isExpanded(r)){var s=y.isEnd(t,a,a.path);if(s){var o=y.after(t,a);o&&(a=o)}var[l]=y.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,fg);return c}else return{}}var{path:f}=a,[p]=y.leaf(t,f);if(a.offset===0){var h=y.previous(t,{at:f,match:de.isText}),g=y.above(t,{match:k=>ce.isElement(k)&&y.isVoid(t,k)&&t.markableVoid(k)});if(!g){var m=y.above(t,{match:k=>ce.isElement(k)&&y.isBlock(t,k)});if(h&&m){var[b,v]=h,[,x]=m;j.isAncestor(x,v)&&(p=b)}}}var A=qt(p,hg);return A},pg=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=y.after(t,s,{voids:a});if(o){var[,l]=y.last(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.get(t,a);return[i,a]};function vg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(tp.isSpan(n))u=n[0],c=n[1];else{var f=y.path(e,n,{edge:"start"}),p=y.path(e,n,{edge:"end"});u=i?p:f,c=i?f:p}var h=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[w]=k;return ce.isElement(w)?!!(!s&&(y.isVoid(e,w)||y.isElementReadOnly(e,w))||o&&!y.isSelectable(e,w)):!1}}),g=[],m;for(var[b,v]of h)if(!(o&&ce.isElement(b)&&!y.isSelectable(e,b))){var x=m&&j.compare(v,m[1])===0;if(!(r==="highest"&&x)){if(!l(b,v)){if(a&&!x&&de.isText(b))return;continue}if(r==="lowest"&&x){m=[b,v];continue}var A=r==="lowest"?m:[b,v];A&&(a?g.push(A):yield A),m=[b,v]}}r==="lowest"&&m&&(a?g.push(m):yield m),a&&(yield*g)}}()}var bg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ya.get(c)||[],s=c=>Da.get(c)||new Set,o=c=>{var f=i(c).pop(),p=f.join(",");return s(c).delete(p),f};if(y.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ya.set(t,l),Da.set(t,u)}i(t).length!==0&&y.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var f=y.node(t,c),[p,h]=f;ce.isElement(p)&&p.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),m=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:m,operation:a}))return;var v=o(t);if(se.has(t,v)){var x=y.node(t,v);t.normalizeNode(x,{operation:a})}b++,g=i(t)}})}},yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=j.parent(a),s=y.node(t,i);return s},Dg=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=y.pathRefs(t);return l.delete(i),i.current=null,o}},s=y.pathRefs(t);return s.add(i),i},Cg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(j.isPath(n)){if(i==="start"){var[,s]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=j.common(n.anchor.path,n.focus.path)),Ce.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},wg=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=y.pointRefs(t);return l.delete(i),i.current=null,o}},s=y.pointRefs(t);return s.add(i),i},Eg=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(j.isPath(n)){var i;if(a==="end"){var[,s]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.get(t,i);if(!de.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(W.isRange(n)){var[u,c]=W.edges(n);return a==="start"?u:c}return n};function Bg(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=y.range(e,n),[l,u]=W.edges(o),c=a?u:l,f=!1,p="",h=0,g=0,m=0;for(var[b,v]of y.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield y.start(e,v);continue}if(e.isInline(b))continue;if(y.hasInlines(e,b)){var x=j.isAncestor(v,u.path)?u:y.end(e,v),A=j.isAncestor(v,l.path)?l:y.start(e,v);p=y.string(e,{anchor:A,focus:x},{voids:i}),f=!0}}if(de.isText(b)){var k=j.equals(v,c.path);for(k?(g=a?c.offset:b.text.length-c.offset,m=c.offset):(g=b.text.length,m=a?g:0),(k||f||r==="offset")&&(yield{path:v,offset:m},f=!1);;){if(h===0){if(p==="")break;h=w(p,r,a),p=qs(p,h,a)[1]}if(m=a?m-h:m+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:m}}}}function w(B,P,q){return P==="character"?zs(B,q):P==="word"?op(B,q):P==="line"||P==="block"?B.length:1}}()}var kg=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=y.before(t,s,{voids:a});if(o){var[,l]=y.first(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},Ag=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=y.rangeRefs(t);return l.delete(i),i.current=null,o}},s=y.rangeRefs(t);return s.add(i),i},Fg=e=>{var t=Vo.get(e);return t||(t=new Set,Vo.set(e,t)),t},Tg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=y.start(e,t),a=y.end(e,n||t);return{anchor:r,focus:a}};function gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!de.isText(c))return!1;var[p,h]=y.parent(e,f);return!e.isVoid(p)||e.markableVoid(p)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=y.node(e,n);if(s&&r(s,o)){var[l]=y.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Sg({},y.marks(e)||{});delete u[t],e.marks=u,fr.get(e)||e.onChange()}}},Og=(e,t)=>{Zc.set(e,t)},Pg=(e,t)=>y.point(e,t,{edge:"start"}),Ng=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=y.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of y.nodes(t,{at:i,match:de.isText,voids:a})){var f=u.text;j.equals(c,o.path)&&(f=f.slice(0,o.offset)),j.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=W.edges(n);if(i.offset!==0||s.offset!==0||W.isCollapsed(n)||j.hasPrevious(s.path))return n;var o=y.above(t,{at:s,match:g=>ce.isElement(g)&&y.isBlock(t,g),voids:a}),l=o?o[1]:[],u=y.start(t,i),c={anchor:u,focus:s},f=!0;for(var[p,h]of y.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(p.text!==""||j.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},Mg=(e,t)=>{var n=y.isNormalizing(e);y.setNormalizing(e,!1);try{t()}finally{y.setNormalizing(e,n)}y.normalize(e)},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var f=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(f=!0,u=u.anchor),Ce.isPoint(u)){var p=y.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},m=i?y.before(t,u,g)||y.start(t,[]):y.after(t,u,g)||y.end(t,[]);u={anchor:u,focus:m},c=!0}}if(j.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,b]=W.edges(u),v=y.end(t,[]);Ce.equals(b,v)||(u=y.unhangRange(t,u,{voids:l}))}var[x,A]=W.edges(u),k=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:x,voids:l}),w=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:A,voids:l}),B=k&&w&&!j.equals(k[1],w[1]),P=j.equals(x.path,A.path),q=l?null:(r=y.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:y.elementReadOnly(t,{at:x,mode:"highest"}),I=l?null:(a=y.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:y.elementReadOnly(t,{at:A,mode:"highest"});if(q){var N=y.before(t,x);N&&k&&j.isAncestor(k[1],N.path)&&(x=N)}if(I){var O=y.after(t,A);O&&w&&j.isAncestor(w[1],O.path)&&(A=O)}var E=[],T;for(var R of y.nodes(t,{at:u,voids:l})){var[M,K]=R;T&&j.compare(K,T)===0||(!l&&ce.isElement(M)&&(y.isVoid(t,M)||y.isElementReadOnly(t,M))||!j.isCommon(K,x.path)&&!j.isCommon(K,A.path))&&(E.push(R),T=K)}var V=Array.from(E,pe=>{var[,_e]=pe;return y.pathRef(t,_e)}),ie=y.pointRef(t,x),Q=y.pointRef(t,A),D="";if(!P&&!q){var U=ie.current,[X]=y.leaf(t,U),{path:_}=U,{offset:F}=x,L=X.text.slice(F);L.length>0&&(t.apply({type:"remove_text",path:_,offset:F,text:L}),D=L)}if(V.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>ee.removeNodes(t,{at:pe,voids:l})),!I){var $=Q.current,[z]=y.leaf(t,$),{path:ne}=$,te=P?x.offset:0,Z=z.text.slice(te,A.offset);Z.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:Z}),D=Z)}!P&&B&&Q.current&&ie.current&&ee.mergeNodes(t,{at:Q.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,D.slice(0,D.length-o));var le=ie.unref(),J=Q.unref(),be=i?le||J:J||le;n.at==null&&be&&ee.select(t,be)}}})},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Ls(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=y.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&y.void(t,{at:l}))return;var u=y.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else j.isPath(s)&&(s=y.start(t,s));if(!(!i&&y.void(t,{at:s}))){var c=y.above(t,{at:s,match:L=>ce.isElement(L)&&y.isInline(t,L),mode:"highest",voids:i});if(c){var[,f]=c;if(y.isEnd(t,s,f)){var p=y.after(t,f);s=p}else if(y.isStart(t,s,f)){var h=y.before(t,f);s=h}}var g=y.above(t,{match:L=>ce.isElement(L)&&y.isBlock(t,L),at:s,voids:i}),[,m]=g,b=y.isStart(t,s,m),v=y.isEnd(t,s,m),x=b&&v,A=!b||b&&v,k=!v,[,w]=se.first({children:n},[]),[,B]=se.last({children:n},[]),P=[],q=L=>{var[$,z]=L,ne=z.length===0;return ne?!1:x?!0:!(A&&j.isAncestor(z,w)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($)||k&&j.isAncestor(z,B)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var I of se.nodes({children:n},{pass:q}))q(I)&&P.push(I);var N=[],O=[],E=[],T=!0,R=!1;for(var[M]of P)ce.isElement(M)&&!t.isInline(M)?(T=!1,R=!0,O.push(M)):T?N.push(M):E.push(M);var[K]=y.nodes(t,{at:s,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i}),[,V]=K,ie=y.isStart(t,s,V),Q=y.isEnd(t,s,V),D=y.pathRef(t,v&&!E.length?j.next(m):m),U=y.pathRef(t,Q?j.next(V):V);ee.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&y.isBlock(t,L):de.isText(L)||y.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!b||N.length>0)&&(!v||E.length>0),voids:i});var X=y.pathRef(t,!ie||ie&&Q?j.next(V):V);if(ee.insertNodes(t,N,{at:X.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!N.length&&O.length&&!E.length&&ee.delete(t,{at:m,voids:i}),ee.insertNodes(t,O,{at:D.current,match:L=>ce.isElement(L)&&y.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,E,{at:U.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(E.length>0&&U.current?_=j.previous(U.current):O.length>0&&D.current?_=j.previous(D.current):X.current&&(_=j.previous(X.current)),_){var F=y.end(t,_);ee.select(t,F)}}X.unref(),D.unref(),U.unref()}}})},Lg=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")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);ee.select(t,s)}}else return},zg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},qg=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=W.isBackward(r)?"focus":"anchor"),o==="end"&&(o=W.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var p=s?y.before(t,l,c):y.after(t,l,c);p&&(f.anchor=p)}if(o==null||o==="focus"){var h=s?y.before(t,u,c):y.after(t,u,c);h&&(f.focus=h)}ee.setSelection(t,f)}},Wg=(e,t)=>{var{selection:n}=e;if(t=y.range(e,t),n){ee.setSelection(e,t);return}if(!W.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(Ye.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hg=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=W.isBackward(a)?"focus":"anchor"),i==="end"&&(i=W.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:bu(bu({},l),n)})}},Ug=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ce.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ce.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})}},Vg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Ls(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=y.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,p]=W.edges(l),h=y.pointRef(t,p);ee.delete(t,{at:l}),l=h.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(f)?u=N=>de.isText(N):t.isInline(f)?u=N=>de.isText(N)||y.isInline(t,N):u=N=>ce.isElement(N)&&y.isBlock(t,N));var[g]=y.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,m]=g,b=y.pathRef(t,m),v=y.isEnd(t,l,m);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=b.unref();l=v?j.next(x):x}else return}var A=j.parent(l),k=l[l.length-1];if(!(!i&&y.void(t,{at:A}))){if(o){var w=[],B=j.levels(A);Fp(t,()=>{var N=function(){var T=A.concat(k);k++;var R={type:"insert_node",path:T,node:O};t.apply(R),l=j.next(l),w.push(R),de.isText?B.push(...Array.from(se.nodes(O),M=>{var[,K]=M;return T.concat(K)})):B.push(T)};for(var O of n)N()},()=>{Gc(t,B,N=>{var O=N;for(var E of w)if(j.operationCanTransformPath(E)&&(O=j.transform(O,E),!O))return null;return O})})}else for(var P of n){var q=A.concat(k);k++,t.apply({type:"insert_node",path:q,node:P}),l=j.next(l)}if(l=j.previous(l),c){var I=y.end(t,l);I&&ee.select(t,I)}}}})},Kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=j.isPath(r)?Jn(t,r):k=>ce.isElement(k)&&y.isBlock(t,k)),!!r){var o=y.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,w]=k;return y.pathRef(t,w)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var f=y.node(t,j.parent(c)),[p,h]=f,g=c[c.length-1],{length:m}=p.children;if(m===1){var b=j.next(h);ee.moveNodes(t,{at:c,to:b,voids:i}),ee.removeNodes(t,{at:h,voids:i})}else if(g===0)ee.moveNodes(t,{at:c,to:h,voids:i});else if(g===m-1){var v=j.next(h);ee.moveNodes(t,{at:c,to:v,voids:i})}else{var x=j.next(c),A=j.next(h);ee.splitNodes(t,{at:x,voids:i}),ee.moveNodes(t,{at:c,to:A,voids:i})}}}})},Zg=["text"],Yg=["children"],Qc=(e,t)=>{if(ce.isElement(t)){var n=t;return y.isVoid(e,t)?!0:n.children.length===1?Qc(e,n.children[0]):!1}else return!y.isEditor(t)},Gg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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(j.isPath(a)){var[l]=y.parent(t,a);r=N=>l.children.includes(N)}else r=N=>ce.isElement(N)&&y.isBlock(t,N);if(!i&&W.isRange(a)&&(a=y.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=y.pointRef(t,u);ee.delete(t,{at:a}),a=c.unref(),n.at==null&&ee.select(t,a)}var[f]=y.nodes(t,{at:a,match:r,voids:s,mode:o}),p=y.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!p)){var[h,g]=f,[m,b]=p;if(!(g.length===0||b.length===0)){var v=j.next(b),x=j.common(g,b),A=j.isSibling(g,b),k=Array.from(y.levels(t,{at:g}),N=>{var[O]=N;return O}).slice(x.length).slice(0,-1),w=y.above(t,{at:g,mode:"highest",match:N=>k.includes(N)&&Qc(t,N)}),B=w&&y.pathRef(t,w[1]),P,q;if(de.isText(h)&&de.isText(m)){var I=qt(h,Zg);q=m.text.length,P=I}else if(ce.isElement(h)&&ce.isElement(m)){var I=qt(h,Yg);q=m.children.length,P=I}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ye.stringify(h)," ").concat(Ye.stringify(m)));A||ee.moveNodes(t,{at:g,to:v,voids:s}),B&&ee.removeNodes(t,{at:B.current,voids:s}),ce.isElement(m)&&y.isEmpty(t,m)||de.isText(m)&&m.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:P}),B&&B.unref()}}}})},Qg=(e,t)=>{y.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=j.isPath(r)?Jn(e,r):h=>ce.isElement(h)&&y.isBlock(e,h));var o=y.pathRef(e,n),l=y.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(e,g)});for(var c of u){var f=c.unref(),p=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:p}),o.current&&j.isSibling(p,f)&&j.isAfter(p,f)&&(o.current=j.next(o.current))}o.unref()}})},Jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),!r&&W.isRange(s)&&(s=y.unhangRange(t,s,{voids:a}));var l=y.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[p]=y.node(t,f);t.apply({type:"remove_node",path:f,node:p})}}}})},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=j.isPath(i)?Jn(t,i):q=>ce.isElement(q)&&y.isBlock(t,q)),!l&&W.isRange(i)&&(i=y.unhangRange(t,i,{voids:f})),c&&W.isRange(i)){if(W.isCollapsed(i)&&y.leaf(t,i.anchor)[0].text.length>0)return;var p=y.rangeRef(t,i,{affinity:"inward"}),[h,g]=W.edges(i),m=u==="lowest"?"lowest":"highest",b=y.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:m,voids:f,always:!b});var v=y.isStart(t,h,h.path);ee.splitNodes(t,{at:h,match:a,mode:m,voids:f,always:!v}),i=p.unref(),r.at==null&&ee.select(t,i)}s||(s=(q,I)=>q!==I);for(var[x,A]of y.nodes(t,{at:i,match:a,mode:u,voids:f})){var k={},w={};if(A.length!==0){var B=!1;for(var P in n)P==="children"||P==="text"||s(n[P],x[P])&&(B=!0,x.hasOwnProperty(P)&&(k[P]=x[P]),o?n[P]!=null&&(w[P]=o(x[P],n[P])):n[P]!=null&&(w[P]=n[P]));B&&t.apply({type:"set_node",path:A,properties:k,newProperties:w})}}}})},ev=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=y.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=Q=>ce.isElement(Q)&&y.isBlock(t,Q)),W.isRange(s)&&(s=ev(t,s)),j.isPath(s)){var u=s,c=y.point(t,u),[f]=y.parent(t,u);i=Q=>Q===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=y.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=y.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var m=y.void(t,{at:s,mode:"highest"}),b=0;if(!a&&m){var[v,x]=m;if(ce.isElement(v)&&t.isInline(v)){var A=y.after(t,x);if(!A){var k={text:""},w=j.next(x);ee.insertNodes(t,k,{at:w,voids:a}),A=y.point(t,w)}s=A,l=!0}var B=s.path.length-x.length;o=B+1,l=!0}h=y.pointRef(t,s);var P=s.path.length-o,[,q]=g,I=s.path.slice(0,P),N=o===0?s.offset:s.path[P]+b;for(var[O,E]of y.levels(t,{at:I,reverse:!0,voids:a})){var T=!1;if(E.length<q.length||E.length===0||!a&&ce.isElement(O)&&y.isVoid(t,O))break;var R=p.current,M=y.isEnd(t,R,E);if(l||!p||!y.isEdge(t,R,E)){T=!0;var K=se.extractProps(O);t.apply({type:"split_node",path:E,position:N,properties:K})}N=E[E.length-1]+(T||M?1:0)}if(n.at==null){var V=h.current||y.end(t,[]);ee.select(t,V)}}finally{var ie;p.unref(),(ie=h)===null||ie===void 0||ie.unref()}}})},nv=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;ee.setNodes(t,a,r)},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),j.isPath(s)&&(s=y.range(t,s));var l=W.isRange(s)?y.rangeRef(t,s):null,u=y.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,h=>{var[,g]=h;return y.pathRef(t,g)}).reverse(),f=function(){var g=p.unref(),[m]=y.node(t,g),b=y.range(t,g);a&&l&&(b=W.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>ce.isAncestor(m)&&m.children.includes(v),voids:i})};for(var p of c)f();l&&l.unref()}})};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.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&&(j.isPath(l)?o=Jn(t,l):t.isInline(n)?o=b=>ce.isElement(b)&&y.isInline(t,b)||de.isText(b):o=b=>ce.isElement(b)&&y.isBlock(t,b)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=y.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:c,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&ee.select(t,l)}var p=Array.from(y.nodes(t,{at:l,match:t.isInline(n)?b=>ce.isElement(b)&&y.isBlock(t,b):b=>y.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=W.isRange(l)?W.intersection(l,y.range(t,m)):l;if(!v)return 0;var x=Array.from(y.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[A]=x,k=x[x.length-1],[,w]=A,[,B]=k;if(w.length===0&&B.length===0)return 0;var P=j.equals(w,B)?j.parent(w):j.common(w,B),q=y.range(t,w,B),I=y.node(t,P),[N]=I,O=P.length+1,E=j.next(B.slice(0,O)),T=Du(Du({},n),{},{children:[]});ee.insertNodes(t,T,{at:E,voids:s}),ee.moveNodes(t,{at:q,match:R=>ce.isAncestor(N)&&N.children.includes(R),to:E.concat(0),voids:s})}},g;for(var[,m]of p)g=h()}})},iv=()=>{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 Tp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)}};return e},sv={isHistory(e){return Je(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Yt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Yt.isOperationList(e.undos[0].operations))}},di=new WeakMap,fi=new WeakMap,Pn={isHistoryEditor(e){return sv.isHistory(e.history)&&y.isEditor(e)},isMerging(e){return fi.get(e)},isSaving(e){return di.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Pn.isMerging(e);fi.set(e,!1),t(),fi.set(e,n)},withoutSaving(e,t){var n=Pn.isSaving(e);di.set(e,!1),t(),di.set(e,n)}},ov=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&&ee.setSelection(t,i.selectionBefore),Pn.withoutSaving(t,()=>{y.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];Pn.withoutSaving(t,()=>{y.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.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=Pn.isSaving(t),c=Pn.isMerging(t);if(u==null&&(u=lv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=uv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},uv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&j.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&j.equals(e.path,t.path)),lv=(e,t)=>e.type!=="set_selection",cv=hv,Jc="֑-߿יִ-﷽ﹰ-ﻼ",Xc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",dv=new RegExp("^[^"+Xc+"]*["+Jc+"]"),fv=new RegExp("^[^"+Jc+"]*["+Xc+"]");function hv(e){return e=String(e||""),dv.test(e)?"rtl":fv.test(e)?"ltr":"neutral"}const ed=tn(cv);function mv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ws=mv,pv=typeof Nr=="object"&&Nr&&Nr.Object===Object&&Nr,gv=pv,vv=gv,bv=typeof self=="object"&&self&&self.Object===Object&&self,yv=vv||bv||Function("return this")(),td=yv,Dv=td,Cv=function(){return Dv.Date.now()},xv=Cv,wv=/\s/;function Ev(e){for(var t=e.length;t--&&wv.test(e.charAt(t)););return t}var _v=Ev,Bv=_v,kv=/^\s+/;function Av(e){return e&&e.slice(0,Bv(e)+1).replace(kv,"")}var Fv=Av,Tv=td,Sv=Tv.Symbol,nd=Sv,Cu=nd,rd=Object.prototype,jv=rd.hasOwnProperty,Ov=rd.toString,ar=Cu?Cu.toStringTag:void 0;function Pv(e){var t=jv.call(e,ar),n=e[ar];try{e[ar]=void 0;var r=!0}catch{}var a=Ov.call(e);return r&&(t?e[ar]=n:delete e[ar]),a}var Nv=Pv,Rv=Object.prototype,Mv=Rv.toString;function Iv(e){return Mv.call(e)}var $v=Iv,xu=nd,Lv=Nv,zv=$v,qv="[object Null]",Wv="[object Undefined]",wu=xu?xu.toStringTag:void 0;function Hv(e){return e==null?e===void 0?Wv:qv:wu&&wu in Object(e)?Lv(e):zv(e)}var Uv=Hv;function Vv(e){return e!=null&&typeof e=="object"}var Kv=Vv,Zv=Uv,Yv=Kv,Gv="[object Symbol]";function Qv(e){return typeof e=="symbol"||Yv(e)&&Zv(e)==Gv}var Jv=Qv,Xv=Fv,Eu=Ws,e0=Jv,_u=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,a0=parseInt;function i0(e){if(typeof e=="number")return e;if(e0(e))return _u;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xv(e);var n=n0.test(e);return n||r0.test(e)?a0(e.slice(2),n?2:8):t0.test(e)?_u:+e}var s0=i0,o0=Ws,hi=xv,Bu=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(u0);t=Bu(t)||0,o0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?l0(Bu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var P=r,q=a;return r=a=void 0,u=B,s=e.apply(q,P),s}function g(B){return u=B,o=setTimeout(v,t),c?h(B):s}function m(B){var P=B-l,q=B-u,I=t-P;return f?c0(I,i-q):I}function b(B){var P=B-l,q=B-u;return l===void 0||P>=t||P<0||f&&q>=i}function v(){var B=hi();if(b(B))return x(B);o=setTimeout(v,m(B))}function x(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:x(hi())}function w(){var B=hi(),P=b(B);if(r=arguments,a=this,l=B,P){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=A,w.flush=k,w}var ad=d0;const f0=tn(ad);var h0=ad,m0=Ws,p0="Expected a function";function g0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(p0);return m0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),h0(e,t,{leading:r,maxWait:t,trailing:a})}var v0=g0;const b0=tn(v0),ku=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",mi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Au(n.overflowY,t)||Au(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},qr=(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,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Fu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:K=>K!==u;if(!ku(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;ku(g)&&f(g);){if(g=y0(g),g===p){h.push(g);break}g!=null&&g===document.body&&mi(g)&&!mi(document.documentElement)||g!=null&&mi(g,c)&&h.push(g)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:A,width:k,top:w,right:B,bottom:P,left:q}=e.getBoundingClientRect(),{top:I,right:N,bottom:O,left:E}=(K=>{const V=window.getComputedStyle(K);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let T=o==="start"||o==="nearest"?w-I:o==="end"?P+O:w+A/2-I+O,R=l==="center"?q+k/2-E+N:l==="end"?B+N:q-E;const M=[];for(let K=0;K<h.length;K++){const V=h[K],{height:ie,width:Q,top:D,right:U,bottom:X,left:_}=V.getBoundingClientRect();if(s==="if-needed"&&w>=0&&q>=0&&P<=b&&B<=m&&w>=D&&P<=X&&q>=_&&B<=U)return M;const F=getComputedStyle(V),L=parseInt(F.borderLeftWidth,10),$=parseInt(F.borderTopWidth,10),z=parseInt(F.borderRightWidth,10),ne=parseInt(F.borderBottomWidth,10);let te=0,Z=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-L-z:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-$-ne:0,be="offsetWidth"in V?V.offsetWidth===0?0:Q/V.offsetWidth:0,pe="offsetHeight"in V?V.offsetHeight===0?0:ie/V.offsetHeight:0;if(p===V)te=o==="start"?T:o==="end"?T-b:o==="nearest"?qr(x,x+b,b,$,ne,x+T,x+T+A,A):T-b/2,Z=l==="start"?R:l==="center"?R-m/2:l==="end"?R-m:qr(v,v+m,m,L,z,v+R,v+R+k,k),te=Math.max(0,te+x),Z=Math.max(0,Z+v);else{te=o==="start"?T-D-$:o==="end"?T-X+ne+J:o==="nearest"?qr(D,X,ie,$,ne+J,T,T+A,A):T-(D+ie/2)+J/2,Z=l==="start"?R-_-L:l==="center"?R-(_+Q/2)+le/2:l==="end"?R-U+z+le:qr(_,U,Q,L,z+le,R,R+k,k);const{scrollLeft:_e,scrollTop:Se}=V;te=pe===0?0:Math.max(0,Math.min(Se+te/pe,V.scrollHeight-ie/pe+J)),Z=be===0?0:Math.max(0,Math.min(_e+Z/be,V.scrollWidth-Q/be+le)),T+=Se-te,R+=_e-Z}M.push({el:V,top:te,left:Z})}return M},D0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function C0(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(Fu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Fu(e,D0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var hn=[],x0=function(){return hn.some(function(e){return e.activeTargets.length>0})},w0=function(){return hn.some(function(e){return e.skippedTargets.length>0})},Tu="ResizeObserver loop completed with undelivered notifications.",E0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Tu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Tu),window.dispatchEvent(e)},Er;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Er||(Er={}));var mn=function(e){return Object.freeze(e)},_0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,mn(this)}return e}(),id=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,mn(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}(),Hs=function(e){return e instanceof SVGElement&&"getBBox"in e},sd=function(e){if(Hs(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)},Su=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)},B0=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},hr=typeof window<"u"?window:{},Wr=new WeakMap,ju=/auto|scroll/,k0=/^tb|vertical/,A0=/msie|trident/i.test(hr.navigator&&hr.navigator.userAgent),kt=function(e){return parseFloat(e||"0")},In=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new _0((n?t:e)||0,(n?e:t)||0)},Ou=mn({devicePixelContentBoxSize:In(),borderBoxSize:In(),contentBoxSize:In(),contentRect:new id(0,0,0,0)}),od=function(e,t){if(t===void 0&&(t=!1),Wr.has(e)&&!t)return Wr.get(e);if(sd(e))return Wr.set(e,Ou),Ou;var n=getComputedStyle(e),r=Hs(e)&&e.ownerSVGElement&&e.getBBox(),a=!A0&&n.boxSizing==="border-box",i=k0.test(n.writingMode||""),s=!r&&ju.test(n.overflowY||""),o=!r&&ju.test(n.overflowX||""),l=r?0:kt(n.paddingTop),u=r?0:kt(n.paddingRight),c=r?0:kt(n.paddingBottom),f=r?0:kt(n.paddingLeft),p=r?0:kt(n.borderTopWidth),h=r?0:kt(n.borderRightWidth),g=r?0:kt(n.borderBottomWidth),m=r?0:kt(n.borderLeftWidth),b=f+u,v=l+c,x=m+h,A=p+g,k=o?e.offsetHeight-A-e.clientHeight:0,w=s?e.offsetWidth-x-e.clientWidth:0,B=a?b+x:0,P=a?v+A:0,q=r?r.width:kt(n.width)-B-w,I=r?r.height:kt(n.height)-P-k,N=q+b+w+x,O=I+v+k+A,E=mn({devicePixelContentBoxSize:In(Math.round(q*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:In(N,O,i),contentBoxSize:In(q,I,i),contentRect:new id(f,l,q,I)});return Wr.set(e,E),E},ud=function(e,t,n){var r=od(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Er.DEVICE_PIXEL_CONTENT_BOX:return s;case Er.BORDER_BOX:return a;default:return i}},F0=function(){function e(t){var n=od(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=mn([n.borderBoxSize]),this.contentBoxSize=mn([n.contentBoxSize]),this.devicePixelContentBoxSize=mn([n.devicePixelContentBoxSize])}return e}(),ld=function(e){if(sd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},T0=function(){var e=1/0,t=[];hn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new F0(u.target),f=ld(u.target);o.push(c),u.lastReportedSize=ud(u.target,u.observedBox),f<e&&(e=f)}),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},Pu=function(e){hn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(ld(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},S0=function(){var e=0;for(Pu(e);x0();)e=T0(),Pu(e);return w0()&&E0(),e>0},pi,cd=[],j0=function(){return cd.splice(0).forEach(function(e){return e()})},O0=function(e){if(!pi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return j0()}).observe(n,r),pi=function(){n.textContent="".concat(t?t--:t++)}}cd.push(e),pi()},P0=function(e){O0(function(){requestAnimationFrame(e)})},ia=0,N0=function(){return!!ia},R0=250,M0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Nu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ru=function(e){return e===void 0&&(e=0),Date.now()+e},gi=!1,I0=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=R0),!gi){gi=!0;var r=Ru(t);P0(function(){var a=!1;try{a=S0()}finally{if(gi=!1,t=r-Ru(),!N0())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,M0)};document.body?n():hr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Nu.forEach(function(n){return hr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nu.forEach(function(n){return hr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),os=new I0,Mu=function(e){!ia&&e>0&&os.start(),ia+=e,!ia&&os.stop()},$0=function(e){return!Hs(e)&&!B0(e)&&getComputedStyle(e).display==="inline"},L0=function(){function e(t,n){this.target=t,this.observedBox=n||Er.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=ud(this.target,this.observedBox,!0);return $0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),z0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Hr=new WeakMap,Iu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Ur=function(){function e(){}return e.connect=function(t,n){var r=new z0(t,n);Hr.set(t,r)},e.observe=function(t,n,r){var a=Hr.get(t),i=a.observationTargets.length===0;Iu(a.observationTargets,n)<0&&(i&&hn.push(a),a.observationTargets.push(new L0(n,r&&r.box)),Mu(1),os.schedule())},e.unobserve=function(t,n){var r=Hr.get(t),a=Iu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&hn.splice(hn.indexOf(r),1),r.observationTargets.splice(a,1),Mu(-1))},e.disconnect=function(t){var n=this,r=Hr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),q0=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.");Ur.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(!Su(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.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(!Su(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.unobserve(this,t)},e.prototype.disconnect=function(){Ur.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function W0(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 Hn(e,t){if(e==null)return{};var n=W0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function H0(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function U0(e){var t=H0(e,"string");return _r(t)==="symbol"?t:String(t)}function Ct(e,t,n){return t=U0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Us=C.createContext(null),an=()=>{var e=C.useContext(Us);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},dd=parseInt(C.version.split(".")[0],10),V0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$u=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Nn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),fd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Z0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Y0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),G0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Q0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),J0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),sa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!Z0||!Y0)&&!K0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Vs=new WeakMap,Ks=new WeakMap,hd=new WeakMap,oa=new WeakMap,us=new WeakMap,Br=new WeakMap,pn=new WeakMap,Ca=new WeakMap,qa=new WeakMap,ls=new WeakMap,Gt=new WeakMap,dn=new WeakMap,mr=new WeakMap,cs=new WeakMap,Zs=new WeakMap,Et=new WeakMap,Lt=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,md=new WeakMap,Un=Symbol("placeholder"),pd=Symbol("mark-placeholder"),X0=globalThis.Text,Ys=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,eb=e=>Xt(e)&&e.nodeType===8,Dt=e=>Xt(e)&&e.nodeType===1,Xt=e=>{var t=Ys(e);return!!t&&e instanceof t.Node},ds=e=>{var t=e&&e.anchorNode&&Ys(e.anchorNode);return!!t&&e instanceof t.Selection},gd=e=>Xt(e)&&e.nodeType===3,tb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,nb=e=>{var[t,n]=e;if(Dt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=vd(t,a,r?"backward":"forward"),r=a<n;Dt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=ab(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},rb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},vd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(eb(a)||Dt(a)&&a.childNodes.length===0||Dt(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]},ab=(e,t,n)=>{var[r]=vd(e,t,n);return r},bd=e=>{var t="";if(gd(e)&&e.nodeValue)return e.nodeValue;if(Dt(e)){for(var n of Array.from(e.childNodes))t+=bd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
124
|
-
`)}return t},ib=/data-slate-fragment="(.+?)"/m,sb=e=>{var t=e.getData("text/html"),[,n]=t.match(ib)||[];return n},Gs=(e,t,n)=>{var{target:r}=t;if(Dt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=G.getWindow(e);if(a.contains(r))return G.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:Gs(e,i,n)},ob=0;class ub{constructor(){Ct(this,"id",void 0),this.id="".concat(ob++)}}var G={androidPendingDiffs:e=>ut.get(e),androidScheduleFlush:e=>{var t;(t=Zs.get(e))===null||t===void 0||t()},blur:e=>{var t=G.toDOMNode(e,e),n=G.findDocumentOrShadowRoot(e);Gt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=G.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=G.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=G.toSlateNode(e,t.target),s=G.findPath(e,i);if(ce.isElement(i)&&y.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=y.point(e,s,{edge:l?"start":"end"}),c=l?y.before(e,u):y.after(e,u);if(c){var f=y.range(e,c);return f}}var p,{document:h}=G.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var m=G.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return m},findKey:(e,t)=>{var n=Ca.get(t);return n||(n=new ub,Ca.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Ks.get(r);if(a==null){if(y.isEditor(r))return n;break}var i=Vs.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ye.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!Gt.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(()=>{G.focus(t,{retries:n.retries-1})},10);return}var r=G.toDOMNode(t,t),a=G.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=G.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(ee.select(t,y.start(t,[])),t.onChange()),Gt.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=hd.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=G.toDOMNode(t,t),s;try{s=Dt(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)=>Xt(t)&&G.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return y.hasPath(e,n.path)&&y.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>G.hasEditableTarget(e,t)||G.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Xt(t)&&G.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!dn.get(e),isFocused:e=>!!Gt.get(e),isReadOnly:e=>!!ls.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(ls.get(e))return!1;var n=G.hasTarget(e,t)&&G.toSlateNode(e,t);return ce.isElement(n)&&y.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=qa.get(e),r=y.isEditor(t)?oa.get(e):n==null?void 0:n.get(G.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ye.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=y.node(e,t.path),r=G.toDOMNode(e,n),a;y.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:f}=c.textContent,p=u.getAttribute("data-slate-length"),h=p==null?f:parseInt(p,10),g=o+h,m=s[l+1];if(t.offset===g&&m!==null&&m!==void 0&&m.hasAttribute("data-slate-mark-placeholder")){var b,v=m.childNodes[0];a=[v instanceof X0?v:m,(b=m.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(f,Math.max(0,t.offset-o));a=[c,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ye.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=W.isBackward(t),i=G.toDOMPoint(e,n),s=W.isCollapsed(t)?i:G.toDOMPoint(e,r),o=G.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[f,p]=a?i:s,h=Dt(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),m=Dt(f)?f:f.parentElement,b=!!m.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(f,b?1:p),l},toSlateNode:(e,t)=>{var n=Dt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Br.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:nb(t),o=i.parentNode,l=null,u=0;if(o){var c,f,p=G.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,m=o.closest("[data-slate-leaf]"),b=null;if(m){if(l=m.closest('[data-slate-node="text"]'),l){var v=G.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var A=x.cloneContents(),k=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];k.forEach(R=>{if(at&&!r&&R.hasAttribute("data-slate-zero-width")&&R.textContent.length>0&&R.textContext!=="\uFEFF"){R.textContent.startsWith("\uFEFF")&&(R.textContent=R.textContent.slice(1));return}R.parentNode.removeChild(R)}),u=A.textContent.length,b=l}}else if(g){for(var
|
|
123
|
+
*/function Ro(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return Ro(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Ro(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var qc=Symbol.for("immer-nothing"),Mo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Fm=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 lt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Fm[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 Wn=Object.getPrototypeOf;function gn(e){return!!e&&!!e[mt]}function vn(e){var t;return e?Wc(e)||Array.isArray(e)||!!e[Mo]||!!((t=e.constructor)!=null&&t[Mo])||$a(e)||La(e):!1}var Tm=Object.prototype.constructor.toString();function Wc(e){if(!e||typeof e!="object")return!1;const t=Wn(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)===Tm}function ga(e,t){Ia(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ia(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:$a(e)?2:La(e)?3:0}function ts(e,t){return Ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $a(e){return e instanceof Map}function La(e){return e instanceof Set}function un(e){return e.copy_||e.base_}function ns(e,t){if($a(e))return new Map(e);if(La(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Wc(e))return Wn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[mt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Wn(e),n)}function Ms(e,t=!1){return za(e)||gn(e)||!vn(e)||(Ia(e)>1&&(e.set=e.add=e.clear=e.delete=jm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ms(r,!0))),e}function jm(){lt(2)}function za(e){return Object.isFrozen(e)}var Om={};function bn(e){const t=Om[e];return t||lt(0,e),t}var Cr;function Uc(){return Cr}function Pm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Io(e,t){t&&(bn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rs(e){as(e),e.drafts_.forEach(Nm),e.drafts_=null}function as(e){e===Cr&&(Cr=e.parent_)}function $o(e){return Cr=Pm(Cr,e)}function Nm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(rs(t),lt(4)),vn(e)&&(e=va(t,e),t.parent_||ba(t,e)),t.patches_&&bn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=va(t,n,[]),rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qc?e:void 0}function va(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return ga(t,(a,i)=>zo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ba(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),ga(i,(o,l)=>zo(e,r,a,o,l,n,s)),ba(e,a,!1),n&&e.patches_&&bn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function zo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&<(5),gn(a)){const o=i&&t&&t.type_!==3&&!ts(t.assigned_,r)?i.concat(r):void 0,l=va(e,a,o);if(Hc(n,r,l),gn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(vn(a)&&!za(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;va(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ba(e,a)}}function ba(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ms(t,n)}function Rm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Uc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Is;n&&(a=[r],i=xr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Is={get(e,t){if(t===mt)return e;const n=un(e);if(!ts(n,t))return Mm(e,n,t);const r=n[t];return e.finalized_||!vn(r)?r:r===li(e.base_,t)?(ci(e),e.copy_[t]=ss(r,e)):r},has(e,t){return t in un(e)},ownKeys(e){return Reflect.ownKeys(un(e))},set(e,t,n){const r=Vc(un(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=li(un(e),t),i=a==null?void 0:a[mt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sm(n,a)&&(n!==void 0||ts(e.base_,t)))return!0;ci(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 li(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ci(e),is(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return Wn(e.base_)},setPrototypeOf(){lt(12)}},xr={};ga(Is,(e,t)=>{xr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});xr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),xr.set.call(this,e,t,void 0)};xr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),Is.set.call(this,e[0],t,n,e[0])};function li(e,t){const n=e[mt];return(n?un(n):e)[t]}function Mm(e,t,n){var a;const r=Vc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Vc(e,t){if(!(t in e))return;let n=Wn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wn(n)}}function is(e){e.modified_||(e.modified_=!0,e.parent_&&is(e.parent_))}function ci(e){e.copy_||(e.copy_=ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Im=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&<(6),r!==void 0&&typeof r!="function"&<(7);let a;if(vn(t)){const i=$o(this),s=ss(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?rs(i):as(i)}return Io(i,r),Lo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===qc&&(a=void 0),this.autoFreeze_&&Ms(a,!0),r){const i=[],s=[];bn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else lt(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){vn(e)||lt(8),gn(e)&&(e=$m(e));const t=$o(this),n=ss(e,void 0);return n[mt].isManual_=!0,as(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Io(r,t),Lo(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=bn("Patches").applyPatches_;return gn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ss(e,t){const n=$a(e)?bn("MapSet").proxyMap_(e,t):La(e)?bn("MapSet").proxySet_(e,t):Rm(e,t);return(t?t.scope_:Uc()).drafts_.push(n),n}function $m(e){return gn(e)||lt(10,e),Kc(e)}function Kc(e){if(!vn(e)||za(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ns(e,!0);return ga(n,(r,a)=>{Hc(n,r,Kc(a))}),t&&(t.finalized_=!1),n}var pt=new Im,$s=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var qo=pt.createDraft.bind(pt),Wo=pt.finishDraft.bind(pt),Lm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=j.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},zm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ce.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},qm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=W.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ya=new WeakMap,Da=new WeakMap,fr=new WeakMap,Zc=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,j={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=j.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 j.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return j.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 j.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 j.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&j.compare(e,t)===0},isBefore(e,t){return j.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&j.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&j.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&j.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&j.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&&j.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(!j.isAncestor(t,e)&&!j.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;(j.equals(i,r)||j.endsBefore(i,r)||j.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(j.equals(s,r)||j.isAncestor(s,r))return null;j.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;j.equals(o,r)||j.endsBefore(o,r)?r[o.length-1]-=1:j.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(j.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else j.endsBefore(u,r)?r[u.length-1]+=1:j.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:p}=t;if(j.equals(f,p))return r;if(j.isAncestor(f,r)||j.equals(f,r)){var h=p.slice();return j.endsBefore(f,p)&&f.length<p.length&&(h[f.length-1]-=1),h.concat(r.slice(f.length))}else j.isSibling(f,p)&&(j.isAncestor(p,r)||j.equals(p,r))?j.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:j.endsBefore(p,r)||j.equals(p,r)||j.isAncestor(p,r)?(j.endsBefore(f,r)&&(r[f.length-1]-=1),r[p.length-1]+=1):j.endsBefore(f,r)&&(j.equals(p,r)&&(r[p.length-1]+=1),r[f.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 Wm(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 Hm(e){var t=Wm(e,"string");return wr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Hm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ko(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 rr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ko(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ko(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Um=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of W.points(t))t[l]=Ce.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var p=se.leaf(e,u),h=p.text.slice(0,c),g=p.text.slice(c);if(p.text=h+f+g,t)for(var[m,b]of W.points(t))t[b]=Ce.transform(m,n);break}case"merge_node":{var{path:v}=n,x=se.get(e,v),A=j.previous(v),k=se.get(e,A),E=se.parent(e,v),B=v[v.length-1];if(de.isText(x)&&de.isText(k))k.text+=x.text;else if(!de.isText(x)&&!de.isText(k))k.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(k)));if(E.children.splice(B,1),t)for(var[P,z]of W.points(t))t[z]=Ce.transform(P,n);break}case"move_node":{var{path:I,newPath:N}=n;if(j.isAncestor(I,N))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(N,"] because the destination is inside itself."));var O=se.get(e,I),w=se.parent(e,I),T=I[I.length-1];w.children.splice(T,1);var R=j.transform(I,n),M=se.get(e,j.parent(R)),K=R[R.length-1];if(M.children.splice(K,0,O),t)for(var[V,ie]of W.points(t))t[ie]=Ce.transform(V,n);break}case"remove_node":{var{path:Q}=n,D=Q[Q.length-1],U=se.parent(e,Q);if(U.children.splice(D,1),t)for(var[X,_]of W.points(t)){var F=Ce.transform(X,n);if(t!=null&&F!=null)t[_]=F;else{var L=void 0,$=void 0;for(var[q,ne]of se.texts(e))if(j.compare(ne,Q)===-1)L=[q,ne];else{$=[q,ne];break}var te=!1;L&&$&&(j.equals($[1],Q)?te=!j.hasPrevious($[1]):te=j.common(L[1],Q).length<j.common($[1],Q).length),L&&!te?(X.path=L[1],X.offset=L[0].text.length):$?(X.path=$[1],X.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:le,text:J}=n;if(J.length===0)break;var be=se.leaf(e,Z),pe=be.text.slice(0,le),_e=be.text.slice(le+J.length);if(be.text=pe+_e,t)for(var[Se,Pe]of W.points(t))t[Pe]=Ce.transform(Se,n);break}case"set_node":{var{path:Ge,properties:Ke,newProperties:Ze}=n;if(Ge.length===0)throw new Error("Cannot set properties on the root node!");var tt=se.get(e,Ge);for(var Ae in Ze){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ze[Ae];We==null?delete tt[Ae]:tt[Ae]=We}for(var $e in Ke)Ze.hasOwnProperty($e)||delete tt[$e];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!W.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ye.stringify(H)," when there is no current selection."));t=rr({},H)}for(var ae in H){var fe=H[ae];if(fe==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=fe}}break}case"split_node":{var{path:me,position:De,properties:Ue}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var Ve=se.get(e,me),ft=se.parent(e,me),Nt=me[me.length-1],wt;if(de.isText(Ve)){var Qe=Ve.text.slice(0,De),Bt=Ve.text.slice(De);Ve.text=Qe,wt=rr(rr({},Ue),{},{text:Bt})}else{var ht=Ve.children.slice(0,De),Ga=Ve.children.slice(De);Ve.children=ht,wt=rr(rr({},Ue),{},{children:Ga})}if(ft.children.splice(Nt+1,0,wt),t)for(var[er,Pr]of W.points(t))t[Pr]=Ce.transform(er,n);break}}return t},Vm={transform(e,t){e.children=qo(e.children);var n=e.selection&&qo(e.selection);try{n=Um(e,n,t)}finally{e.children=Wo(e.children),n?e.selection=gn(n)?Wo(n):n:e.selection=null}}},Km={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)}},Zm={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)}},Yc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Yc(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 Ym(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 qt(e,t){if(e==null)return{};var n=Ym(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 Gm=["anchor","focus"];function Zo(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 Qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return W.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=W.edges(e);return t},equals(e,t){return Ce.equals(e.anchor,t.anchor)&&Ce.equals(e.focus,t.focus)},includes(e,t){if(W.isRange(t)){if(W.includes(e,t.anchor)||W.includes(e,t.focus))return!0;var[n,r]=W.edges(e),[a,i]=W.edges(t);return Ce.isBefore(n,a)&&Ce.isAfter(r,i)}var[s,o]=W.edges(e),l=!1,u=!1;return Ce.isPoint(t)?(l=Ce.compare(t,s)>=0,u=Ce.compare(t,o)<=0):(l=j.compare(t,s.path)>=0,u=j.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=qt(e,Gm),[r,a]=W.edges(e),[i,s]=W.edges(t),o=Ce.isBefore(r,i)?i:r,l=Ce.isBefore(a,s)?a:s;return Ce.isBefore(l,o)?null:Qm({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ce.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ce.equals(t,n)},isExpanded(e){return!W.isCollapsed(e)},isForward(e){return!W.isBackward(e)},isRange(e){return Je(e)&&Ce.isPoint(e.anchor)&&Ce.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=W.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $s(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=W.isCollapsed(r);W.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?W.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ce.transform(r.anchor,t,{affinity:i}),u=Ce.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Yo=e=>Je(e)&&se.isNodeList(e.children)&&!y.isEditor(e),ce={isAncestor(e){return Je(e)&&se.isNodeList(e.children)},isElement:Yo,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.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 Yo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Jm=["children"],Xm=["text"],Go=new WeakMap,se={ancestor(e,t){var n=se.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Ye.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of j.ancestors(t,n)){var a=se.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Ye.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ye.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=j.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(y.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ye.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=qt(e,Jm);return t}else{var t=qt(e,Xm);return t}},first(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Ye.stringify(e)));var n=$s({children:e.children},r=>{var[a,i]=W.edges(t),s=se.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!W.includes(t,h)}});for(var[,o]of s){if(!W.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(j.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(j.equals(o,a.path)){var f=se.leaf(r,o);f.text=f.text.slice(a.offset)}}y.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(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ye.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(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||y.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Go.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return Go.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=se.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Ye.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of j.levels(t,n)){var a=se.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.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?j.isBefore(o,i):j.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;j.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=j.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=j.previous(o);o=f,l=se.get(e,o);continue}o=j.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=j.parent(t),r=se.get(e,n);if(de.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 de.isText(e)?e.text:e.children.map(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function Qo(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 Re(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Qo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yt={isNodeOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Je(e))return!1;switch(e.type){case"insert_node":return j.isPath(e.path)&&se.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"merge_node":return typeof e.position=="number"&&j.isPath(e.path)&&Je(e.properties);case"move_node":return j.isPath(e.path)&&j.isPath(e.newPath);case"remove_node":return j.isPath(e.path)&&se.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"set_node":return j.isPath(e.path)&&Je(e.properties)&&Je(e.newProperties);case"set_selection":return e.properties===null&&W.isRange(e.newProperties)||e.newProperties===null&&W.isRange(e.properties)||Je(e.properties)&&Je(e.newProperties);case"split_node":return j.isPath(e.path)&&typeof e.position=="number"&&Je(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Yt.isOperation(t))},isSelectionOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Re(Re({},e),{},{type:"remove_node"});case"insert_text":return Re(Re({},e),{},{type:"remove_text"});case"merge_node":return Re(Re({},e),{},{type:"split_node",path:j.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(j.equals(t,n))return e;if(j.isSibling(n,t))return Re(Re({},e),{},{path:t,newPath:n});var r=j.transform(n,e),a=j.transform(j.next(n),e);return Re(Re({},e),{},{path:r,newPath:a})}case"remove_node":return Re(Re({},e),{},{type:"insert_node"});case"remove_text":return Re(Re({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Re(Re({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Re(Re({},e),{},{properties:l,newProperties:null}):l==null?Re(Re({},e),{},{properties:null,newProperties:o}):Re(Re({},e),{},{properties:l,newProperties:o})}case"split_node":return Re(Re({},e),{},{type:"merge_node",path:j.next(e.path)})}}},Jo=new WeakMap,ep=e=>{var t=Jo.get(e);if(t!==void 0)return t;if(!Je(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||Je(e.marks))&&(e.selection===null||W.isRange(e.selection))&&se.isNodeList(e.children)&&Yt.isOperationList(e.operations);return Jo.set(e,n),n},y={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 ep(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)}},tp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(j.isPath)}};function Xo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ce={compare(e,t){var n=j.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ce.compare(e,t)===1},isBefore(e,t){return Ce.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&j.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&j.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $s(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=j.transform(i,t,n);break}case"insert_text":{j.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{j.equals(t.path,i)&&(r.offset+=t.position),r.path=j.transform(i,t,n);break}case"remove_text":{j.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(j.equals(t.path,i)||j.isAncestor(t.path,i))return null;r.path=j.transform(i,t,n);break}case"split_node":{if(j.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=j.transform(i,t,eu(eu({},n),{},{affinity:"forward"})))}else r.path=j.transform(i,t,n);break}}})}},tu=void 0,Ye={setScrubber(e){tu=e},stringify(e){return JSON.stringify(e,tu)}},np=["text"],rp=["anchor","focus"];function nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=qt(i,np);return s}return Yc(r?a(e):e,r?a(t):t)},isText(e){return Je(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.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=[Mt({},e)];for(var r of t){var a=qt(r,rp),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:p}=f.text,h=l;if(l+=p,u<=h&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===h)||u>l||c<h||c===h&&h!==0){o.push(f);continue}var g=f,m=void 0,b=void 0;if(c<l){var v=c-h;b=Mt(Mt({},g),{},{text:g.text.slice(v)}),g=Mt(Mt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var x=u-h;m=Mt(Mt({},g),{},{text:g.text.slice(0,x)}),g=Mt(Mt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),m&&o.push(m),o.push(g),b&&o.push(b)}n=o}return n}},Ls=e=>e.selection?e.selection:e.children.length>0?y.end(e,[]):[0],Jn=(e,t)=>{var[n]=y.node(e,t);return r=>r===n},zs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?lp(t):t,i=ye.None,s=ye.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var p=Cp(c,f);if([i,s]=r?[s,p]:[p,i],On(i,ye.ZWJ)&&On(s,ye.ExtPict)&&(r?l=ru(t.substring(0,o)):l=ru(t.substring(0,t.length-o)),!l)||On(i,ye.RI)&&On(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=Bp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&wp(i,s))break;o+=c.length}return o||1},ap=/\s/,ip=/[\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]/,sp=/['\u2018\u2019]/,op=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=zs(t,n),[s,o]=qs(t,i,n);if(up(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},qs=(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)]},up=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ap.test(t))return!1;if(sp.test(t)){var a=zs(n,r),[i,s]=qs(n,a,r);if(e(i,s,r))return!0}return!ip.test(t)},lp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(dp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(cp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},cp=e=>e>=55296&&e<=56319,dp=e=>e>=56320&&e<=57343,ye;(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"})(ye||(ye={}));var fp=/^(?:[\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])$/,hp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,mp=/^(?:[\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])$/,pp=/^[\u1100-\u115F\uA960-\uA97C]$/,gp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,vp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,bp=/^[\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]$/,yp=/^[\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]$/,Dp=/^(?:[\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])$/,Cp=(e,t)=>{var n=ye.Any;return e.search(fp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(hp)!==-1&&(n|=ye.Prepend),e.search(mp)!==-1&&(n|=ye.SpacingMark),e.search(pp)!==-1&&(n|=ye.L),e.search(gp)!==-1&&(n|=ye.V),e.search(vp)!==-1&&(n|=ye.T),e.search(bp)!==-1&&(n|=ye.LV),e.search(yp)!==-1&&(n|=ye.LVT),e.search(Dp)!==-1&&(n|=ye.ExtPict),n};function On(e,t){return(e&t)!==0}var xp=[[ye.L,ye.L|ye.V|ye.LV|ye.LVT],[ye.LV|ye.V,ye.V|ye.T],[ye.LVT|ye.T,ye.T],[ye.Any,ye.Extend|ye.ZWJ],[ye.Any,ye.SpacingMark],[ye.Prepend,ye.Any],[ye.ZWJ,ye.ExtPict],[ye.RI,ye.RI]];function wp(e,t){return xp.findIndex(n=>On(e,n[0])&&On(t,n[1]))===-1}var Ep=/(?:[\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$/,ru=e=>e.search(Ep)!==-1,_p=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Bp=e=>{var t=e.match(_p);if(t===null)return!1;var n=t[0].length/2;return n%2===1},kp={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]:{};y.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Ls(e)}=n;if(j.isPath(a)&&(a=y.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&y.void(e,{at:i}))return;var s=W.start(a),o=y.pointRef(e,s),l=y.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&y.void(e,{at:a})||y.elementReadOnly(e,{at:a}))){var{path:f,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:p,text:t})}})}};function au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?au(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ee=zr(zr(zr(zr({},Vm),Km),Zm),kp),aa=new WeakMap,Ap=e=>aa.get(e)||!1,Fp=(e,t,n)=>{var r=aa.get(e)||!1;aa.set(e,!0);try{t(),n()}finally{aa.set(e,r)}};function Gc(e,t,n){var r=ya.get(e)||[],a=Da.get(e)||new Set,i,s,o=f=>{if(f){var p=f.join(",");s.has(p)||(s.add(p),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);ya.set(e,i),Da.set(e,s)}var Tp=(e,t)=>{for(var n of y.pathRefs(e))Lm.transform(n,t);for(var r of y.pointRefs(e))zm.transform(r,t);for(var a of y.rangeRefs(e))qm.transform(a,t);if(!Ap(e)){var i=j.operationCanTransformPath(t)?s=>j.transform(s,t):void 0;Gc(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),y.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),fr.get(e)||(fr.set(e,!0),Promise.resolve().then(()=>{fr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Sp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return j.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=j.levels(a),s=de.isText(r)?[]:Array.from(se.nodes(r),N=>{var[,O]=N;return a.concat(O)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=j.ancestors(o),u=j.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(j.equals(c,f))return[];var p=[],h=[];for(var g of j.ancestors(c)){var m=j.transform(g,t);p.push(m)}for(var b of j.ancestors(f)){var v=j.transform(b,t);h.push(v)}var x=h[h.length-1],A=f[f.length-1],k=x.concat(A);return[...p,...h,k]}case"remove_node":{var{path:E}=t,B=j.ancestors(E);return[...B]}case"split_node":{var{path:P}=t,z=j.levels(P),I=j.next(P);return[...z,I]}default:return[]}},jp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Op=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=y.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=se.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,p=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(p!==i)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var h={text:""};ee.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Pp=(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},Np=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=y.path(t,i),l=a==="lowest";for(var[u,c]of y.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(W.isRange(i)){if(j.isAncestor(c,i.anchor.path)&&j.isAncestor(c,i.focus.path))return[u,c]}else if(!j.equals(o,c))return[u,c]}}};function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,p)=>{if(!de.isText(f))return!1;var[h,g]=y.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=y.node(e,r);if(o&&a(o,l)){var[u]=y.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=su(su({},y.marks(e)||{}),{},{[t]:n});e.marks=c,fr.get(e)||e.onChange()}}};function ou(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 uu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Mp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.point(t,n,{edge:"end"}),i=y.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,uu(uu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ip=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.start(t,[]),i=y.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,cu(cu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},$p=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Lp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t})},zp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},qp=(e,t)=>[y.start(e,t),y.end(e,t)];function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Wp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,fu(fu({},n),{},{match:r=>ce.isElement(r)&&y.isElementReadOnly(t,r)}))},Hp=(e,t)=>y.point(e,t,{edge:"end"}),Up=(e,t)=>{var n=y.path(e,t,{edge:"start"});return y.node(e,n)},Vp=(e,t)=>{var n=y.range(e,t);return se.fragment(e,n)};function hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,mu(mu({},n),{},{match:r=>ce.isElement(r)&&y.isVoid(t,r)}))},Zp=(e,t)=>t.children.some(n=>ce.isElement(n)&&y.isBlock(e,n)),Yp=(e,t)=>t.children.some(n=>de.isText(n)||y.isInline(e,n)),Gp=(e,t)=>se.has(e,t),Qp=(e,t)=>t.children.every(n=>de.isText(n)),Jp=e=>{ee.splitNodes(e,{always:!0})},Xp=(e,t,n)=>{ee.insertNodes(e,t,n)},eg=e=>{ee.splitNodes(e,{always:!0})};function pu(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 tg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ng=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=tg({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},rg=(e,t)=>!e.isInline(t),ag=(e,t,n)=>y.isStart(e,t,n)||y.isEnd(e,t,n),ig=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},sg=(e,t,n)=>{var r=y.end(e,n);return Ce.equals(t,r)},og=e=>{var t=Zc.get(e);return t===void 0?!0:t},ug=(e,t,n)=>{if(t.offset!==0)return!1;var r=y.start(e,n);return Ce.equals(t,r)},lg=(e,t)=>{var n=y.path(e,t,{edge:"end"});return y.node(e,n)},cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.leaf(t,a);return[i,a]};function dg(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=y.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&y.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var fg=["text"],hg=["text"],mg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(W.isExpanded(r)){var s=y.isEnd(t,a,a.path);if(s){var o=y.after(t,a);o&&(a=o)}var[l]=y.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,fg);return c}else return{}}var{path:f}=a,[p]=y.leaf(t,f);if(a.offset===0){var h=y.previous(t,{at:f,match:de.isText}),g=y.above(t,{match:k=>ce.isElement(k)&&y.isVoid(t,k)&&t.markableVoid(k)});if(!g){var m=y.above(t,{match:k=>ce.isElement(k)&&y.isBlock(t,k)});if(h&&m){var[b,v]=h,[,x]=m;j.isAncestor(x,v)&&(p=b)}}}var A=qt(p,hg);return A},pg=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=y.after(t,s,{voids:a});if(o){var[,l]=y.last(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.get(t,a);return[i,a]};function vg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(tp.isSpan(n))u=n[0],c=n[1];else{var f=y.path(e,n,{edge:"start"}),p=y.path(e,n,{edge:"end"});u=i?p:f,c=i?f:p}var h=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return ce.isElement(E)?!!(!s&&(y.isVoid(e,E)||y.isElementReadOnly(e,E))||o&&!y.isSelectable(e,E)):!1}}),g=[],m;for(var[b,v]of h)if(!(o&&ce.isElement(b)&&!y.isSelectable(e,b))){var x=m&&j.compare(v,m[1])===0;if(!(r==="highest"&&x)){if(!l(b,v)){if(a&&!x&&de.isText(b))return;continue}if(r==="lowest"&&x){m=[b,v];continue}var A=r==="lowest"?m:[b,v];A&&(a?g.push(A):yield A),m=[b,v]}}r==="lowest"&&m&&(a?g.push(m):yield m),a&&(yield*g)}}()}var bg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ya.get(c)||[],s=c=>Da.get(c)||new Set,o=c=>{var f=i(c).pop(),p=f.join(",");return s(c).delete(p),f};if(y.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ya.set(t,l),Da.set(t,u)}i(t).length!==0&&y.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var f=y.node(t,c),[p,h]=f;ce.isElement(p)&&p.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),m=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:m,operation:a}))return;var v=o(t);if(se.has(t,v)){var x=y.node(t,v);t.normalizeNode(x,{operation:a})}b++,g=i(t)}})}},yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=j.parent(a),s=y.node(t,i);return s},Dg=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=y.pathRefs(t);return l.delete(i),i.current=null,o}},s=y.pathRefs(t);return s.add(i),i},Cg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(j.isPath(n)){if(i==="start"){var[,s]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=j.common(n.anchor.path,n.focus.path)),Ce.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},wg=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=y.pointRefs(t);return l.delete(i),i.current=null,o}},s=y.pointRefs(t);return s.add(i),i},Eg=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(j.isPath(n)){var i;if(a==="end"){var[,s]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.get(t,i);if(!de.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(W.isRange(n)){var[u,c]=W.edges(n);return a==="start"?u:c}return n};function Bg(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=y.range(e,n),[l,u]=W.edges(o),c=a?u:l,f=!1,p="",h=0,g=0,m=0;for(var[b,v]of y.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield y.start(e,v);continue}if(e.isInline(b))continue;if(y.hasInlines(e,b)){var x=j.isAncestor(v,u.path)?u:y.end(e,v),A=j.isAncestor(v,l.path)?l:y.start(e,v);p=y.string(e,{anchor:A,focus:x},{voids:i}),f=!0}}if(de.isText(b)){var k=j.equals(v,c.path);for(k?(g=a?c.offset:b.text.length-c.offset,m=c.offset):(g=b.text.length,m=a?g:0),(k||f||r==="offset")&&(yield{path:v,offset:m},f=!1);;){if(h===0){if(p==="")break;h=E(p,r,a),p=qs(p,h,a)[1]}if(m=a?m-h:m+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:m}}}}function E(B,P,z){return P==="character"?zs(B,z):P==="word"?op(B,z):P==="line"||P==="block"?B.length:1}}()}var kg=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=y.before(t,s,{voids:a});if(o){var[,l]=y.first(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},Ag=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=y.rangeRefs(t);return l.delete(i),i.current=null,o}},s=y.rangeRefs(t);return s.add(i),i},Fg=e=>{var t=Vo.get(e);return t||(t=new Set,Vo.set(e,t)),t},Tg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=y.start(e,t),a=y.end(e,n||t);return{anchor:r,focus:a}};function gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!de.isText(c))return!1;var[p,h]=y.parent(e,f);return!e.isVoid(p)||e.markableVoid(p)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=y.node(e,n);if(s&&r(s,o)){var[l]=y.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Sg({},y.marks(e)||{});delete u[t],e.marks=u,fr.get(e)||e.onChange()}}},Og=(e,t)=>{Zc.set(e,t)},Pg=(e,t)=>y.point(e,t,{edge:"start"}),Ng=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=y.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of y.nodes(t,{at:i,match:de.isText,voids:a})){var f=u.text;j.equals(c,o.path)&&(f=f.slice(0,o.offset)),j.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=W.edges(n);if(i.offset!==0||s.offset!==0||W.isCollapsed(n)||j.hasPrevious(s.path))return n;var o=y.above(t,{at:s,match:g=>ce.isElement(g)&&y.isBlock(t,g),voids:a}),l=o?o[1]:[],u=y.start(t,i),c={anchor:u,focus:s},f=!0;for(var[p,h]of y.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(p.text!==""||j.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},Mg=(e,t)=>{var n=y.isNormalizing(e);y.setNormalizing(e,!1);try{t()}finally{y.setNormalizing(e,n)}y.normalize(e)},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var f=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(f=!0,u=u.anchor),Ce.isPoint(u)){var p=y.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},m=i?y.before(t,u,g)||y.start(t,[]):y.after(t,u,g)||y.end(t,[]);u={anchor:u,focus:m},c=!0}}if(j.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,b]=W.edges(u),v=y.end(t,[]);Ce.equals(b,v)||(u=y.unhangRange(t,u,{voids:l}))}var[x,A]=W.edges(u),k=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:x,voids:l}),E=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:A,voids:l}),B=k&&E&&!j.equals(k[1],E[1]),P=j.equals(x.path,A.path),z=l?null:(r=y.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:y.elementReadOnly(t,{at:x,mode:"highest"}),I=l?null:(a=y.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:y.elementReadOnly(t,{at:A,mode:"highest"});if(z){var N=y.before(t,x);N&&k&&j.isAncestor(k[1],N.path)&&(x=N)}if(I){var O=y.after(t,A);O&&E&&j.isAncestor(E[1],O.path)&&(A=O)}var w=[],T;for(var R of y.nodes(t,{at:u,voids:l})){var[M,K]=R;T&&j.compare(K,T)===0||(!l&&ce.isElement(M)&&(y.isVoid(t,M)||y.isElementReadOnly(t,M))||!j.isCommon(K,x.path)&&!j.isCommon(K,A.path))&&(w.push(R),T=K)}var V=Array.from(w,pe=>{var[,_e]=pe;return y.pathRef(t,_e)}),ie=y.pointRef(t,x),Q=y.pointRef(t,A),D="";if(!P&&!z){var U=ie.current,[X]=y.leaf(t,U),{path:_}=U,{offset:F}=x,L=X.text.slice(F);L.length>0&&(t.apply({type:"remove_text",path:_,offset:F,text:L}),D=L)}if(V.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>ee.removeNodes(t,{at:pe,voids:l})),!I){var $=Q.current,[q]=y.leaf(t,$),{path:ne}=$,te=P?x.offset:0,Z=q.text.slice(te,A.offset);Z.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:Z}),D=Z)}!P&&B&&Q.current&&ie.current&&ee.mergeNodes(t,{at:Q.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,D.slice(0,D.length-o));var le=ie.unref(),J=Q.unref(),be=i?le||J:J||le;n.at==null&&be&&ee.select(t,be)}}})},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Ls(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=y.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&y.void(t,{at:l}))return;var u=y.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else j.isPath(s)&&(s=y.start(t,s));if(!(!i&&y.void(t,{at:s}))){var c=y.above(t,{at:s,match:L=>ce.isElement(L)&&y.isInline(t,L),mode:"highest",voids:i});if(c){var[,f]=c;if(y.isEnd(t,s,f)){var p=y.after(t,f);s=p}else if(y.isStart(t,s,f)){var h=y.before(t,f);s=h}}var g=y.above(t,{match:L=>ce.isElement(L)&&y.isBlock(t,L),at:s,voids:i}),[,m]=g,b=y.isStart(t,s,m),v=y.isEnd(t,s,m),x=b&&v,A=!b||b&&v,k=!v,[,E]=se.first({children:n},[]),[,B]=se.last({children:n},[]),P=[],z=L=>{var[$,q]=L,ne=q.length===0;return ne?!1:x?!0:!(A&&j.isAncestor(q,E)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($)||k&&j.isAncestor(q,B)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var I of se.nodes({children:n},{pass:z}))z(I)&&P.push(I);var N=[],O=[],w=[],T=!0,R=!1;for(var[M]of P)ce.isElement(M)&&!t.isInline(M)?(T=!1,R=!0,O.push(M)):T?N.push(M):w.push(M);var[K]=y.nodes(t,{at:s,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i}),[,V]=K,ie=y.isStart(t,s,V),Q=y.isEnd(t,s,V),D=y.pathRef(t,v&&!w.length?j.next(m):m),U=y.pathRef(t,Q?j.next(V):V);ee.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&y.isBlock(t,L):de.isText(L)||y.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!b||N.length>0)&&(!v||w.length>0),voids:i});var X=y.pathRef(t,!ie||ie&&Q?j.next(V):V);if(ee.insertNodes(t,N,{at:X.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!N.length&&O.length&&!w.length&&ee.delete(t,{at:m,voids:i}),ee.insertNodes(t,O,{at:D.current,match:L=>ce.isElement(L)&&y.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,w,{at:U.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(w.length>0&&U.current?_=j.previous(U.current):O.length>0&&D.current?_=j.previous(D.current):X.current&&(_=j.previous(X.current)),_){var F=y.end(t,_);ee.select(t,F)}}X.unref(),D.unref(),U.unref()}}})},Lg=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")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);ee.select(t,s)}}else return},zg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},qg=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=W.isBackward(r)?"focus":"anchor"),o==="end"&&(o=W.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var p=s?y.before(t,l,c):y.after(t,l,c);p&&(f.anchor=p)}if(o==null||o==="focus"){var h=s?y.before(t,u,c):y.after(t,u,c);h&&(f.focus=h)}ee.setSelection(t,f)}},Wg=(e,t)=>{var{selection:n}=e;if(t=y.range(e,t),n){ee.setSelection(e,t);return}if(!W.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(Ye.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hg=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=W.isBackward(a)?"focus":"anchor"),i==="end"&&(i=W.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:bu(bu({},l),n)})}},Ug=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ce.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ce.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})}},Vg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Ls(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=y.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,p]=W.edges(l),h=y.pointRef(t,p);ee.delete(t,{at:l}),l=h.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(f)?u=N=>de.isText(N):t.isInline(f)?u=N=>de.isText(N)||y.isInline(t,N):u=N=>ce.isElement(N)&&y.isBlock(t,N));var[g]=y.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,m]=g,b=y.pathRef(t,m),v=y.isEnd(t,l,m);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=b.unref();l=v?j.next(x):x}else return}var A=j.parent(l),k=l[l.length-1];if(!(!i&&y.void(t,{at:A}))){if(o){var E=[],B=j.levels(A);Fp(t,()=>{var N=function(){var T=A.concat(k);k++;var R={type:"insert_node",path:T,node:O};t.apply(R),l=j.next(l),E.push(R),de.isText?B.push(...Array.from(se.nodes(O),M=>{var[,K]=M;return T.concat(K)})):B.push(T)};for(var O of n)N()},()=>{Gc(t,B,N=>{var O=N;for(var w of E)if(j.operationCanTransformPath(w)&&(O=j.transform(O,w),!O))return null;return O})})}else for(var P of n){var z=A.concat(k);k++,t.apply({type:"insert_node",path:z,node:P}),l=j.next(l)}if(l=j.previous(l),c){var I=y.end(t,l);I&&ee.select(t,I)}}}})},Kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=j.isPath(r)?Jn(t,r):k=>ce.isElement(k)&&y.isBlock(t,k)),!!r){var o=y.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return y.pathRef(t,E)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var f=y.node(t,j.parent(c)),[p,h]=f,g=c[c.length-1],{length:m}=p.children;if(m===1){var b=j.next(h);ee.moveNodes(t,{at:c,to:b,voids:i}),ee.removeNodes(t,{at:h,voids:i})}else if(g===0)ee.moveNodes(t,{at:c,to:h,voids:i});else if(g===m-1){var v=j.next(h);ee.moveNodes(t,{at:c,to:v,voids:i})}else{var x=j.next(c),A=j.next(h);ee.splitNodes(t,{at:x,voids:i}),ee.moveNodes(t,{at:c,to:A,voids:i})}}}})},Zg=["text"],Yg=["children"],Qc=(e,t)=>{if(ce.isElement(t)){var n=t;return y.isVoid(e,t)?!0:n.children.length===1?Qc(e,n.children[0]):!1}else return!y.isEditor(t)},Gg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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(j.isPath(a)){var[l]=y.parent(t,a);r=N=>l.children.includes(N)}else r=N=>ce.isElement(N)&&y.isBlock(t,N);if(!i&&W.isRange(a)&&(a=y.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=y.pointRef(t,u);ee.delete(t,{at:a}),a=c.unref(),n.at==null&&ee.select(t,a)}var[f]=y.nodes(t,{at:a,match:r,voids:s,mode:o}),p=y.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!p)){var[h,g]=f,[m,b]=p;if(!(g.length===0||b.length===0)){var v=j.next(b),x=j.common(g,b),A=j.isSibling(g,b),k=Array.from(y.levels(t,{at:g}),N=>{var[O]=N;return O}).slice(x.length).slice(0,-1),E=y.above(t,{at:g,mode:"highest",match:N=>k.includes(N)&&Qc(t,N)}),B=E&&y.pathRef(t,E[1]),P,z;if(de.isText(h)&&de.isText(m)){var I=qt(h,Zg);z=m.text.length,P=I}else if(ce.isElement(h)&&ce.isElement(m)){var I=qt(h,Yg);z=m.children.length,P=I}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ye.stringify(h)," ").concat(Ye.stringify(m)));A||ee.moveNodes(t,{at:g,to:v,voids:s}),B&&ee.removeNodes(t,{at:B.current,voids:s}),ce.isElement(m)&&y.isEmpty(t,m)||de.isText(m)&&m.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:P}),B&&B.unref()}}}})},Qg=(e,t)=>{y.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=j.isPath(r)?Jn(e,r):h=>ce.isElement(h)&&y.isBlock(e,h));var o=y.pathRef(e,n),l=y.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(e,g)});for(var c of u){var f=c.unref(),p=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:p}),o.current&&j.isSibling(p,f)&&j.isAfter(p,f)&&(o.current=j.next(o.current))}o.unref()}})},Jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),!r&&W.isRange(s)&&(s=y.unhangRange(t,s,{voids:a}));var l=y.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[p]=y.node(t,f);t.apply({type:"remove_node",path:f,node:p})}}}})},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=j.isPath(i)?Jn(t,i):z=>ce.isElement(z)&&y.isBlock(t,z)),!l&&W.isRange(i)&&(i=y.unhangRange(t,i,{voids:f})),c&&W.isRange(i)){if(W.isCollapsed(i)&&y.leaf(t,i.anchor)[0].text.length>0)return;var p=y.rangeRef(t,i,{affinity:"inward"}),[h,g]=W.edges(i),m=u==="lowest"?"lowest":"highest",b=y.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:m,voids:f,always:!b});var v=y.isStart(t,h,h.path);ee.splitNodes(t,{at:h,match:a,mode:m,voids:f,always:!v}),i=p.unref(),r.at==null&&ee.select(t,i)}s||(s=(z,I)=>z!==I);for(var[x,A]of y.nodes(t,{at:i,match:a,mode:u,voids:f})){var k={},E={};if(A.length!==0){var B=!1;for(var P in n)P==="children"||P==="text"||s(n[P],x[P])&&(B=!0,x.hasOwnProperty(P)&&(k[P]=x[P]),o?n[P]!=null&&(E[P]=o(x[P],n[P])):n[P]!=null&&(E[P]=n[P]));B&&t.apply({type:"set_node",path:A,properties:k,newProperties:E})}}}})},ev=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=y.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=Q=>ce.isElement(Q)&&y.isBlock(t,Q)),W.isRange(s)&&(s=ev(t,s)),j.isPath(s)){var u=s,c=y.point(t,u),[f]=y.parent(t,u);i=Q=>Q===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=y.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=y.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var m=y.void(t,{at:s,mode:"highest"}),b=0;if(!a&&m){var[v,x]=m;if(ce.isElement(v)&&t.isInline(v)){var A=y.after(t,x);if(!A){var k={text:""},E=j.next(x);ee.insertNodes(t,k,{at:E,voids:a}),A=y.point(t,E)}s=A,l=!0}var B=s.path.length-x.length;o=B+1,l=!0}h=y.pointRef(t,s);var P=s.path.length-o,[,z]=g,I=s.path.slice(0,P),N=o===0?s.offset:s.path[P]+b;for(var[O,w]of y.levels(t,{at:I,reverse:!0,voids:a})){var T=!1;if(w.length<z.length||w.length===0||!a&&ce.isElement(O)&&y.isVoid(t,O))break;var R=p.current,M=y.isEnd(t,R,w);if(l||!p||!y.isEdge(t,R,w)){T=!0;var K=se.extractProps(O);t.apply({type:"split_node",path:w,position:N,properties:K})}N=w[w.length-1]+(T||M?1:0)}if(n.at==null){var V=h.current||y.end(t,[]);ee.select(t,V)}}finally{var ie;p.unref(),(ie=h)===null||ie===void 0||ie.unref()}}})},nv=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;ee.setNodes(t,a,r)},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),j.isPath(s)&&(s=y.range(t,s));var l=W.isRange(s)?y.rangeRef(t,s):null,u=y.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,h=>{var[,g]=h;return y.pathRef(t,g)}).reverse(),f=function(){var g=p.unref(),[m]=y.node(t,g),b=y.range(t,g);a&&l&&(b=W.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>ce.isAncestor(m)&&m.children.includes(v),voids:i})};for(var p of c)f();l&&l.unref()}})};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.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&&(j.isPath(l)?o=Jn(t,l):t.isInline(n)?o=b=>ce.isElement(b)&&y.isInline(t,b)||de.isText(b):o=b=>ce.isElement(b)&&y.isBlock(t,b)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=y.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:c,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&ee.select(t,l)}var p=Array.from(y.nodes(t,{at:l,match:t.isInline(n)?b=>ce.isElement(b)&&y.isBlock(t,b):b=>y.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=W.isRange(l)?W.intersection(l,y.range(t,m)):l;if(!v)return 0;var x=Array.from(y.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[A]=x,k=x[x.length-1],[,E]=A,[,B]=k;if(E.length===0&&B.length===0)return 0;var P=j.equals(E,B)?j.parent(E):j.common(E,B),z=y.range(t,E,B),I=y.node(t,P),[N]=I,O=P.length+1,w=j.next(B.slice(0,O)),T=Du(Du({},n),{},{children:[]});ee.insertNodes(t,T,{at:w,voids:s}),ee.moveNodes(t,{at:z,match:R=>ce.isAncestor(N)&&N.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,m]of p)g=h()}})},iv=()=>{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 Tp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)}};return e},sv={isHistory(e){return Je(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Yt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Yt.isOperationList(e.undos[0].operations))}},di=new WeakMap,fi=new WeakMap,Pn={isHistoryEditor(e){return sv.isHistory(e.history)&&y.isEditor(e)},isMerging(e){return fi.get(e)},isSaving(e){return di.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Pn.isMerging(e);fi.set(e,!1),t(),fi.set(e,n)},withoutSaving(e,t){var n=Pn.isSaving(e);di.set(e,!1),t(),di.set(e,n)}},ov=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&&ee.setSelection(t,i.selectionBefore),Pn.withoutSaving(t,()=>{y.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];Pn.withoutSaving(t,()=>{y.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.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=Pn.isSaving(t),c=Pn.isMerging(t);if(u==null&&(u=lv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=uv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},uv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&j.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&j.equals(e.path,t.path)),lv=(e,t)=>e.type!=="set_selection",cv=hv,Jc="֑-߿יִ-﷽ﹰ-ﻼ",Xc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",dv=new RegExp("^[^"+Xc+"]*["+Jc+"]"),fv=new RegExp("^[^"+Jc+"]*["+Xc+"]");function hv(e){return e=String(e||""),dv.test(e)?"rtl":fv.test(e)?"ltr":"neutral"}const ed=tn(cv);function mv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ws=mv,pv=typeof Nr=="object"&&Nr&&Nr.Object===Object&&Nr,gv=pv,vv=gv,bv=typeof self=="object"&&self&&self.Object===Object&&self,yv=vv||bv||Function("return this")(),td=yv,Dv=td,Cv=function(){return Dv.Date.now()},xv=Cv,wv=/\s/;function Ev(e){for(var t=e.length;t--&&wv.test(e.charAt(t)););return t}var _v=Ev,Bv=_v,kv=/^\s+/;function Av(e){return e&&e.slice(0,Bv(e)+1).replace(kv,"")}var Fv=Av,Tv=td,Sv=Tv.Symbol,nd=Sv,Cu=nd,rd=Object.prototype,jv=rd.hasOwnProperty,Ov=rd.toString,ar=Cu?Cu.toStringTag:void 0;function Pv(e){var t=jv.call(e,ar),n=e[ar];try{e[ar]=void 0;var r=!0}catch{}var a=Ov.call(e);return r&&(t?e[ar]=n:delete e[ar]),a}var Nv=Pv,Rv=Object.prototype,Mv=Rv.toString;function Iv(e){return Mv.call(e)}var $v=Iv,xu=nd,Lv=Nv,zv=$v,qv="[object Null]",Wv="[object Undefined]",wu=xu?xu.toStringTag:void 0;function Hv(e){return e==null?e===void 0?Wv:qv:wu&&wu in Object(e)?Lv(e):zv(e)}var Uv=Hv;function Vv(e){return e!=null&&typeof e=="object"}var Kv=Vv,Zv=Uv,Yv=Kv,Gv="[object Symbol]";function Qv(e){return typeof e=="symbol"||Yv(e)&&Zv(e)==Gv}var Jv=Qv,Xv=Fv,Eu=Ws,e0=Jv,_u=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,a0=parseInt;function i0(e){if(typeof e=="number")return e;if(e0(e))return _u;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xv(e);var n=n0.test(e);return n||r0.test(e)?a0(e.slice(2),n?2:8):t0.test(e)?_u:+e}var s0=i0,o0=Ws,hi=xv,Bu=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(u0);t=Bu(t)||0,o0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?l0(Bu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var P=r,z=a;return r=a=void 0,u=B,s=e.apply(z,P),s}function g(B){return u=B,o=setTimeout(v,t),c?h(B):s}function m(B){var P=B-l,z=B-u,I=t-P;return f?c0(I,i-z):I}function b(B){var P=B-l,z=B-u;return l===void 0||P>=t||P<0||f&&z>=i}function v(){var B=hi();if(b(B))return x(B);o=setTimeout(v,m(B))}function x(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:x(hi())}function E(){var B=hi(),P=b(B);if(r=arguments,a=this,l=B,P){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return E.cancel=A,E.flush=k,E}var ad=d0;const f0=tn(ad);var h0=ad,m0=Ws,p0="Expected a function";function g0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(p0);return m0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),h0(e,t,{leading:r,maxWait:t,trailing:a})}var v0=g0;const b0=tn(v0),ku=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",mi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Au(n.overflowY,t)||Au(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},qr=(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,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Fu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:K=>K!==u;if(!ku(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;ku(g)&&f(g);){if(g=y0(g),g===p){h.push(g);break}g!=null&&g===document.body&&mi(g)&&!mi(document.documentElement)||g!=null&&mi(g,c)&&h.push(g)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:A,width:k,top:E,right:B,bottom:P,left:z}=e.getBoundingClientRect(),{top:I,right:N,bottom:O,left:w}=(K=>{const V=window.getComputedStyle(K);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let T=o==="start"||o==="nearest"?E-I:o==="end"?P+O:E+A/2-I+O,R=l==="center"?z+k/2-w+N:l==="end"?B+N:z-w;const M=[];for(let K=0;K<h.length;K++){const V=h[K],{height:ie,width:Q,top:D,right:U,bottom:X,left:_}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&P<=b&&B<=m&&E>=D&&P<=X&&z>=_&&B<=U)return M;const F=getComputedStyle(V),L=parseInt(F.borderLeftWidth,10),$=parseInt(F.borderTopWidth,10),q=parseInt(F.borderRightWidth,10),ne=parseInt(F.borderBottomWidth,10);let te=0,Z=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-L-q:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-$-ne:0,be="offsetWidth"in V?V.offsetWidth===0?0:Q/V.offsetWidth:0,pe="offsetHeight"in V?V.offsetHeight===0?0:ie/V.offsetHeight:0;if(p===V)te=o==="start"?T:o==="end"?T-b:o==="nearest"?qr(x,x+b,b,$,ne,x+T,x+T+A,A):T-b/2,Z=l==="start"?R:l==="center"?R-m/2:l==="end"?R-m:qr(v,v+m,m,L,q,v+R,v+R+k,k),te=Math.max(0,te+x),Z=Math.max(0,Z+v);else{te=o==="start"?T-D-$:o==="end"?T-X+ne+J:o==="nearest"?qr(D,X,ie,$,ne+J,T,T+A,A):T-(D+ie/2)+J/2,Z=l==="start"?R-_-L:l==="center"?R-(_+Q/2)+le/2:l==="end"?R-U+q+le:qr(_,U,Q,L,q+le,R,R+k,k);const{scrollLeft:_e,scrollTop:Se}=V;te=pe===0?0:Math.max(0,Math.min(Se+te/pe,V.scrollHeight-ie/pe+J)),Z=be===0?0:Math.max(0,Math.min(_e+Z/be,V.scrollWidth-Q/be+le)),T+=Se-te,R+=_e-Z}M.push({el:V,top:te,left:Z})}return M},D0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function C0(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(Fu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Fu(e,D0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var hn=[],x0=function(){return hn.some(function(e){return e.activeTargets.length>0})},w0=function(){return hn.some(function(e){return e.skippedTargets.length>0})},Tu="ResizeObserver loop completed with undelivered notifications.",E0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Tu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Tu),window.dispatchEvent(e)},Er;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Er||(Er={}));var mn=function(e){return Object.freeze(e)},_0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,mn(this)}return e}(),id=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,mn(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}(),Hs=function(e){return e instanceof SVGElement&&"getBBox"in e},sd=function(e){if(Hs(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)},Su=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)},B0=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},hr=typeof window<"u"?window:{},Wr=new WeakMap,ju=/auto|scroll/,k0=/^tb|vertical/,A0=/msie|trident/i.test(hr.navigator&&hr.navigator.userAgent),kt=function(e){return parseFloat(e||"0")},In=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new _0((n?t:e)||0,(n?e:t)||0)},Ou=mn({devicePixelContentBoxSize:In(),borderBoxSize:In(),contentBoxSize:In(),contentRect:new id(0,0,0,0)}),od=function(e,t){if(t===void 0&&(t=!1),Wr.has(e)&&!t)return Wr.get(e);if(sd(e))return Wr.set(e,Ou),Ou;var n=getComputedStyle(e),r=Hs(e)&&e.ownerSVGElement&&e.getBBox(),a=!A0&&n.boxSizing==="border-box",i=k0.test(n.writingMode||""),s=!r&&ju.test(n.overflowY||""),o=!r&&ju.test(n.overflowX||""),l=r?0:kt(n.paddingTop),u=r?0:kt(n.paddingRight),c=r?0:kt(n.paddingBottom),f=r?0:kt(n.paddingLeft),p=r?0:kt(n.borderTopWidth),h=r?0:kt(n.borderRightWidth),g=r?0:kt(n.borderBottomWidth),m=r?0:kt(n.borderLeftWidth),b=f+u,v=l+c,x=m+h,A=p+g,k=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-x-e.clientWidth:0,B=a?b+x:0,P=a?v+A:0,z=r?r.width:kt(n.width)-B-E,I=r?r.height:kt(n.height)-P-k,N=z+b+E+x,O=I+v+k+A,w=mn({devicePixelContentBoxSize:In(Math.round(z*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:In(N,O,i),contentBoxSize:In(z,I,i),contentRect:new id(f,l,z,I)});return Wr.set(e,w),w},ud=function(e,t,n){var r=od(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Er.DEVICE_PIXEL_CONTENT_BOX:return s;case Er.BORDER_BOX:return a;default:return i}},F0=function(){function e(t){var n=od(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=mn([n.borderBoxSize]),this.contentBoxSize=mn([n.contentBoxSize]),this.devicePixelContentBoxSize=mn([n.devicePixelContentBoxSize])}return e}(),ld=function(e){if(sd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},T0=function(){var e=1/0,t=[];hn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new F0(u.target),f=ld(u.target);o.push(c),u.lastReportedSize=ud(u.target,u.observedBox),f<e&&(e=f)}),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},Pu=function(e){hn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(ld(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},S0=function(){var e=0;for(Pu(e);x0();)e=T0(),Pu(e);return w0()&&E0(),e>0},pi,cd=[],j0=function(){return cd.splice(0).forEach(function(e){return e()})},O0=function(e){if(!pi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return j0()}).observe(n,r),pi=function(){n.textContent="".concat(t?t--:t++)}}cd.push(e),pi()},P0=function(e){O0(function(){requestAnimationFrame(e)})},ia=0,N0=function(){return!!ia},R0=250,M0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Nu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ru=function(e){return e===void 0&&(e=0),Date.now()+e},gi=!1,I0=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=R0),!gi){gi=!0;var r=Ru(t);P0(function(){var a=!1;try{a=S0()}finally{if(gi=!1,t=r-Ru(),!N0())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,M0)};document.body?n():hr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Nu.forEach(function(n){return hr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nu.forEach(function(n){return hr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),os=new I0,Mu=function(e){!ia&&e>0&&os.start(),ia+=e,!ia&&os.stop()},$0=function(e){return!Hs(e)&&!B0(e)&&getComputedStyle(e).display==="inline"},L0=function(){function e(t,n){this.target=t,this.observedBox=n||Er.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=ud(this.target,this.observedBox,!0);return $0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),z0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Hr=new WeakMap,Iu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Ur=function(){function e(){}return e.connect=function(t,n){var r=new z0(t,n);Hr.set(t,r)},e.observe=function(t,n,r){var a=Hr.get(t),i=a.observationTargets.length===0;Iu(a.observationTargets,n)<0&&(i&&hn.push(a),a.observationTargets.push(new L0(n,r&&r.box)),Mu(1),os.schedule())},e.unobserve=function(t,n){var r=Hr.get(t),a=Iu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&hn.splice(hn.indexOf(r),1),r.observationTargets.splice(a,1),Mu(-1))},e.disconnect=function(t){var n=this,r=Hr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),q0=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.");Ur.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(!Su(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.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(!Su(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.unobserve(this,t)},e.prototype.disconnect=function(){Ur.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function W0(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 Hn(e,t){if(e==null)return{};var n=W0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function H0(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function U0(e){var t=H0(e,"string");return _r(t)==="symbol"?t:String(t)}function Ct(e,t,n){return t=U0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Us=C.createContext(null),an=()=>{var e=C.useContext(Us);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},dd=parseInt(C.version.split(".")[0],10),V0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$u=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Nn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),fd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Z0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Y0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),G0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Q0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),J0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),sa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!Z0||!Y0)&&!K0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Vs=new WeakMap,Ks=new WeakMap,hd=new WeakMap,oa=new WeakMap,us=new WeakMap,Br=new WeakMap,pn=new WeakMap,Ca=new WeakMap,qa=new WeakMap,ls=new WeakMap,Gt=new WeakMap,dn=new WeakMap,mr=new WeakMap,cs=new WeakMap,Zs=new WeakMap,Et=new WeakMap,Lt=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,md=new WeakMap,Un=Symbol("placeholder"),pd=Symbol("mark-placeholder"),X0=globalThis.Text,Ys=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,eb=e=>Xt(e)&&e.nodeType===8,Dt=e=>Xt(e)&&e.nodeType===1,Xt=e=>{var t=Ys(e);return!!t&&e instanceof t.Node},ds=e=>{var t=e&&e.anchorNode&&Ys(e.anchorNode);return!!t&&e instanceof t.Selection},gd=e=>Xt(e)&&e.nodeType===3,tb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,nb=e=>{var[t,n]=e;if(Dt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=vd(t,a,r?"backward":"forward"),r=a<n;Dt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=ab(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},rb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},vd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(eb(a)||Dt(a)&&a.childNodes.length===0||Dt(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]},ab=(e,t,n)=>{var[r]=vd(e,t,n);return r},bd=e=>{var t="";if(gd(e)&&e.nodeValue)return e.nodeValue;if(Dt(e)){for(var n of Array.from(e.childNodes))t+=bd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
124
|
+
`)}return t},ib=/data-slate-fragment="(.+?)"/m,sb=e=>{var t=e.getData("text/html"),[,n]=t.match(ib)||[];return n},Gs=(e,t,n)=>{var{target:r}=t;if(Dt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=G.getWindow(e);if(a.contains(r))return G.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:Gs(e,i,n)},ob=0;class ub{constructor(){Ct(this,"id",void 0),this.id="".concat(ob++)}}var G={androidPendingDiffs:e=>ut.get(e),androidScheduleFlush:e=>{var t;(t=Zs.get(e))===null||t===void 0||t()},blur:e=>{var t=G.toDOMNode(e,e),n=G.findDocumentOrShadowRoot(e);Gt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=G.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=G.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=G.toSlateNode(e,t.target),s=G.findPath(e,i);if(ce.isElement(i)&&y.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=y.point(e,s,{edge:l?"start":"end"}),c=l?y.before(e,u):y.after(e,u);if(c){var f=y.range(e,c);return f}}var p,{document:h}=G.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var m=G.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return m},findKey:(e,t)=>{var n=Ca.get(t);return n||(n=new ub,Ca.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Ks.get(r);if(a==null){if(y.isEditor(r))return n;break}var i=Vs.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ye.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!Gt.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(()=>{G.focus(t,{retries:n.retries-1})},10);return}var r=G.toDOMNode(t,t),a=G.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=G.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(ee.select(t,y.start(t,[])),t.onChange()),Gt.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=hd.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=G.toDOMNode(t,t),s;try{s=Dt(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)=>Xt(t)&&G.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return y.hasPath(e,n.path)&&y.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>G.hasEditableTarget(e,t)||G.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Xt(t)&&G.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!dn.get(e),isFocused:e=>!!Gt.get(e),isReadOnly:e=>!!ls.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(ls.get(e))return!1;var n=G.hasTarget(e,t)&&G.toSlateNode(e,t);return ce.isElement(n)&&y.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=qa.get(e),r=y.isEditor(t)?oa.get(e):n==null?void 0:n.get(G.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ye.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=y.node(e,t.path),r=G.toDOMNode(e,n),a;y.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:f}=c.textContent,p=u.getAttribute("data-slate-length"),h=p==null?f:parseInt(p,10),g=o+h,m=s[l+1];if(t.offset===g&&m!==null&&m!==void 0&&m.hasAttribute("data-slate-mark-placeholder")){var b,v=m.childNodes[0];a=[v instanceof X0?v:m,(b=m.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(f,Math.max(0,t.offset-o));a=[c,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ye.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=W.isBackward(t),i=G.toDOMPoint(e,n),s=W.isCollapsed(t)?i:G.toDOMPoint(e,r),o=G.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[f,p]=a?i:s,h=Dt(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),m=Dt(f)?f:f.parentElement,b=!!m.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(f,b?1:p),l},toSlateNode:(e,t)=>{var n=Dt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Br.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:nb(t),o=i.parentNode,l=null,u=0;if(o){var c,f,p=G.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,m=o.closest("[data-slate-leaf]"),b=null;if(m){if(l=m.closest('[data-slate-node="text"]'),l){var v=G.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var A=x.cloneContents(),k=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];k.forEach(R=>{if(at&&!r&&R.hasAttribute("data-slate-zero-width")&&R.textContent.length>0&&R.textContext!=="\uFEFF"){R.textContent.startsWith("\uFEFF")&&(R.textContent=R.textContent.slice(1));return}R.parentNode.removeChild(R)}),u=A.textContent.length,b=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),B=0;B<E.length;B++){var P=E[B];if(G.hasDOMNode(e,P)){m=P;break}}m?(l=m.closest('[data-slate-node="text"]'),b=m,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(R=>{u-=R.textContent.length})):u=1}b&&u===b.textContent.length&&at&&b.getAttribute("data-slate-zero-width")==="z"&&(c=b.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Nn&&(f=b.textContent)!==null&&f!==void 0&&f.endsWith(`
|
|
125
125
|
|
|
126
|
-
`))&&u--}if(at&&!l&&!r){var
|
|
126
|
+
`))&&u--}if(at&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&G.hasDOMNode(e,z,{editable:!0})){var I=G.toSlateNode(e,z),{path:N,offset:O}=y.start(e,G.findPath(e,I));return z.querySelector("[data-slate-leaf]")||(O=s),{path:N,offset:O}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=G.toSlateNode(e,l),T=G.findPath(e,w);return{path:T,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=ds(t)?t.anchorNode:t.startContainer,o,l,u,c,f;if(s)if(ds(t)){if(Nn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),h=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement){let B=function(P){return P.childElementCount>0?B(P.children[0]):P};var g=p.startContainer,m=h.startContainer,b=B(g.children[p.startOffset]),v=B(m.children[h.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=h.endContainer,l=h.endOffset,c=p.startOffset):(o=p.startContainer,l=p.endOffset,c=h.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;fd&&rb(o)||Nn?f=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:f=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,f=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Nn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
127
127
|
|
|
128
|
-
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var A=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=f?A:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var
|
|
128
|
+
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var A=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=f?A:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:A,focus:k};return W.isExpanded(E)&&W.isForward(E)&&Dt(u)&&y.void(e,{at:E.focus,mode:"highest"})&&(E=y.unhangRange(e,E,{voids:!0})),E}};function lb(e,t){var{path:n,diff:r}=t;if(!y.hasPath(e,n))return!1;var a=se.get(e,n);if(!de.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=j.next(n);if(!y.hasPath(e,i))return!1;var s=se.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function yd(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 cb(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 db(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 Dd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=cb(i,a),o=Math.min(i.length-s,a.length-s),l=db(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 fb(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=yd(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 Dd(e,{start:r,end:l,text:o})}function hb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function fs(e,t){var{path:n,offset:r}=t;if(!y.hasPath(e,n))return null;var a=se.get(e,n);if(!de.isText(a))return null;var i=y.above(e,{match:o=>ce.isElement(o)&&y.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=y.next(e,{at:n,match:de.isText});if(!s||!j.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Lu(e,t){var n=fs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=fs(e,t.focus);return r?{anchor:n,focus:r}:null}function hs(e,t,n){var r=ut.get(e),a=r==null?void 0:r.find(c=>{var{path:f}=c;return j.equals(f,t.path)});if(!a||t.offset<=a.diff.start)return Ce.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=Ce.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=Ce.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&j.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 zu(e,t,n){var r=hs(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=hs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function mb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!j.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!j.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!j.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:j.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:j.transform(n,t,{affinity:"forward"})};case"merge_node":return j.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:j.transform(n,t)}:{diff:r,id:a,path:j.transform(n,t)}}var i=j.transform(n,t);return i?{diff:r,path:i,id:a}:null}function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pb=25,gb=200,vb=function(){},bb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function yb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=Kt.get(t);if(Kt.delete(t),w){var{selection:T}=t,R=Lu(t,w);R&&(!T||!W.equals(R,T))&&ee.select(t,R)}},f=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var T=Ce.isPoint(w.at)?fs(t,w.at):Lu(t,w.at);if(!T)return;var R=y.range(t,T);(!t.selection||!W.equals(t.selection,R))&&ee.select(t,T)}w.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var w=t.selection&&y.rangeRef(t,t.selection,{affinity:"forward"});Lt.set(t,t.marks),vb("flush",Vt.get(t),ut.get(t));for(var T=k(),R;R=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,K,V=Et.get(t);V!==void 0&&(Et.delete(t),t.marks=V),V&&u===!1&&(u=null);var ie=hb(R);(!t.selection||!W.equals(t.selection,ie))&&ee.select(t,ie),R.diff.text?y.insertText(t,R.diff.text):y.deleteFragment(t),ut.set(t,(K=ut.get(t))===null||K===void 0?void 0:K.filter(U=>{var{id:X}=U;return X!==R.id})),lb(t,R)||(T=!1,Vt.delete(t),Lt.delete(t),a="action",Kt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var Q=w==null?void 0:w.unref();if(Q&&!Kt.get(t)&&(!t.selection||!W.equals(Q,t.selection))&&ee.select(t,Q),A()){f();return}T&&n(),n.flush(),r.flush(),c();var D=Lt.get(t);Lt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},h=w=>{i&&clearTimeout(i),i=setTimeout(()=>{dn.set(t,!1),p()},pb)},g=w=>{dn.set(t,!0),i&&(clearTimeout(i),i=null)},m=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,R=us.get(t);if(R){if(k()||T){R.style.display="none";return}R.style.removeProperty("display")}},b=(w,T)=>{var R,M=(R=ut.get(t))!==null&&R!==void 0?R:[];ut.set(t,M);var K=se.leaf(t,w),V=M.findIndex(D=>j.equals(D.path,w));if(V<0){var ie=Dd(K.text,T);ie&&M.push({path:w,diff:T,id:l++}),m();return}var Q=fb(K.text,M[V].diff,T);if(!Q){M.splice(V,1),m();return}M[V]=Vr(Vr({},M[V]),{},{diff:Q})},v=function(T){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),A()&&p(),Vt.set(t,{at:R,run:T}),o=setTimeout(p)},x=w=>{var T;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,K=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[V]=w.getTargetRanges();V&&(M=G.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var ie=G.getWindow(t),Q=ie.getSelection();if(!M&&Q&&(V=Q,M=G.toSlateRange(t,Q,{exactMatch:!1,suppressThrow:!0})),M=(T=M)!==null&&T!==void 0?T:t.selection,!!M){var D=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[U,X]=W.edges(M),_=se.leaf(t,U.path);if(_.text.length===U.offset&&X.offset===0){var F=y.next(t,{at:U.path,match:de.isText});F&&j.equals(F[1],X.path)&&(M={anchor:X,focus:X})}}var L=R.endsWith("Backward")?"backward":"forward",[$,q]=W.edges(M),[ne,te]=y.leaf(t,$.path),Z={text:"",start:$.offset,end:q.offset},le=ut.get(t),J=le==null?void 0:le.find(me=>j.equals(me.path,te)),be=J?[J.diff,Z]:[Z],pe=yd(ne.text,...be);if(pe.length===0&&(D=!1),W.isExpanded(M)){if(D&&j.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:$.offset},Se=y.range(t,_e,_e);return P(Se),b(M.anchor.path,{text:"",end:q.offset,start:$.offset})}return v(()=>y.deleteFragment(t,{direction:L}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>y.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(D&&W.isCollapsed(M)){var Ge=se.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return b(Pe.path,{text:"",start:Pe.offset,end:Pe.offset+1})}return v(()=>y.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ke,{anchor:Ze}=M,tt=ds(V)?V.isCollapsed:!!((Ke=V)!==null&&Ke!==void 0&&Ke.collapsed);return D&&tt&&W.isCollapsed(M)&&Ze.offset>0?b(Ze.path,{text:"",start:Ze.offset-1,end:Ze.offset}):v(()=>y.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{y.deleteBackward(t,{unit:"line"}),y.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>y.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>y.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>y.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>y.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>y.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>y.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>y.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>y.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(bb(K))return v(()=>G.insertData(t,K),{at:M});var Ae=K??"";if(Et.get(t)&&(Ae=Ae.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
129
129
|
`))return v(()=>{var me=Ae.split(`
|
|
130
|
-
`);me.forEach((De,Ue)=>{De&&y.insertText(t,De),Ue!==me.length-1&&y.insertSoftBreak(t)})},{at:M});if(j.equals(M.anchor.path,M.focus.path)){var[We,$e]=W.edges(M),H={start:We.offset,end:$e.offset,text:Ae};if(Ae&&u&&R==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),fe=H.start+H.text.search(/\S|$/);fe===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,N()):u=!1}else R==="insertText"?u===null?u=H:u&&W.isCollapsed(M)&&u.end+u.text.length===We.offset?u=Vr(Vr({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(D){b(We.path,H);return}}return v(()=>y.insertText(t,Ae),{at:M})}}}},A=()=>!!Vt.get(t),k=()=>{var
|
|
130
|
+
`);me.forEach((De,Ue)=>{De&&y.insertText(t,De),Ue!==me.length-1&&y.insertSoftBreak(t)})},{at:M});if(j.equals(M.anchor.path,M.focus.path)){var[We,$e]=W.edges(M),H={start:We.offset,end:$e.offset,text:Ae};if(Ae&&u&&R==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),fe=H.start+H.text.search(/\S|$/);fe===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,N()):u=!1}else R==="insertText"?u===null?u=H:u&&W.isCollapsed(M)&&u.end+u.text.length===We.offset?u=Vr(Vr({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(D){b(We.path,H);return}}return v(()=>y.insertText(t,Ae),{at:M})}}}},A=()=>!!Vt.get(t),k=()=>{var w;return!!((w=ut.get(t))!==null&&w!==void 0&&w.length)},E=()=>A()||k(),B=()=>a,P=w=>{Kt.set(t,w),s&&(clearTimeout(s),s=null);var{selection:T}=t;if(w){var R=!T||!j.equals(T.anchor.path,w.anchor.path),M=!T||!j.equals(T.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(R&&u||M)&&(u=!1),(R||k())&&(s=setTimeout(p,gb))}},z=()=>{(A()||!k())&&p()},I=w=>{k()||(m(!0),setTimeout(m))},N=()=>{A()||(o=setTimeout(p))},O=w=>{if(!(k()||A())&&w.some(R=>Gs(t,R,w))){var T;(T=md.get(t))===null||T===void 0||T()}};return{flush:p,scheduleFlush:N,hasPendingDiffs:k,hasPendingAction:A,hasPendingChanges:E,isFlushing:B,handleUserSelect:P,handleCompositionEnd:h,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:I,handleDomMutations:O,handleInput:z}}function Db(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var kr=sa?C.useLayoutEffect:C.useEffect;function Cb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));kr(()=>{r.takeRecords()}),C.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 xb=["node"];function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Eb={subtree:!0,childList:!0,characterData:!0},_b=at?e=>{var{node:t}=e,n=Hn(e,xb);if(!at)return null;var r=an(),a=Db(),[i]=C.useState(()=>yb(wb({editor:r},n)));return Cb(t,i.handleDomMutations,Eb),Zs.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Bb=["anchor","focus"],kb=["anchor","focus"],Ab=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Cd=(e,t)=>{var n=Hn(e,Bb),r=Hn(t,kb);return e[Un]===t[Un]&&Ab(n,r)},Fb=(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(!W.equals(r,a)||!Cd(r,a))return!1}return!0},Tb=(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||!Cd(r,a))return!1}return!0};function Hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=an(),s=G.findPath(i,a),o=j.parent(s),l=!!n[pd];return i.isVoid(r)?C.createElement(vi,{length:se.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&y.string(i,o)===""?C.createElement(vi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(vi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
131
131
|
`?C.createElement(Uu,{isTrailing:!0,text:n.text}):C.createElement(Uu,{text:n.text})},Uu=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
132
|
-
`:""),[i]=C.useState(a);return kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Ob,{ref:r},i)},Ob=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),vi=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),C.createElement("span",Sb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function Vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Pb=at?300:0;function Nb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ku(e){e.current&&(clearTimeout(e.current),e.current=null)}var Rb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Ib,xd({},x))}=e,o=an(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),p=C.useRef(null),h=C.useCallback(x=>{if(Nb(l,x==null),x==null){var A;us.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(us.set(o,x),!l.current){var k=window.ResizeObserver||q0;l.current=new k(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(jb,{isLast:n,leaf:t,parent:a,text:r}),m=!!t[Un];if(C.useEffect(()=>(m?p.current||(p.current=setTimeout(()=>{f(!0),p.current=null},Pb)):(Ku(p),f(!1)),()=>Ku(p)),[m,f]),m&&c){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:cr?"inherit":void 0},contentEditable:!1,ref:h}};g=C.createElement(C.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Mb=C.memo(Rb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Un]===e.leaf[Un]),Ib=e=>{var{attributes:t,children:n}=e;return C.createElement("span",xd({},t),n)},$b=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=an(),l=C.useRef(null),u=de.decorations(s,t),c=G.findKey(o,s),f=[],p=0;p<u.length;p++){var h=u[p];f.push(C.createElement(Mb,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(m=>{var b=qa.get(o);m?(b==null||b.set(c,m),pn.set(s,m),Br.set(m,s)):(b==null||b.delete(c),pn.delete(s),l.current&&Br.delete(l.current)),l.current=m},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},wd=C.memo($b,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Tb(t.decorations,e.decorations));function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ms(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(qb,ms({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=an(),l=Ub(),u=o.isInline(n),c=G.findKey(o,n),f=C.useCallback(x=>{var A=qa.get(o);x?(A==null||A.set(c,x),pn.set(n,x),Br.set(x,n)):(A==null||A.delete(c),pn.delete(n))},[o,c,n]),p=_d({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:f};if(u&&(h["data-slate-inline"]=!0),!u&&y.hasInlines(o,n)){var g=se.string(n),m=ed(g);m==="rtl"&&(h.dir=m)}if(y.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=se.texts(n);p=C.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(wd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Vs.set(v,0),Ks.set(v,n)}return r({attributes:h,children:p,element:n})},zb=C.memo(Lb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Fb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),qb=e=>{var{attributes:t,children:n,element:r}=e,a=an(),i=a.isInline(r)?"span":"div";return C.createElement(i,ms(ms({},t),{},{style:{position:"relative"}}),n)},Ed=C.createContext(()=>[]),Wb=()=>C.useContext(Ed),Hb=C.createContext(!1),_d=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Wb(),l=an(),u=G.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&y.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],m=G.findKey(l,g),b=y.range(l,h),v=s&&W.intersection(b,s),x=o([g,h]);for(var A of t){var k=W.intersection(A,b);k&&x.push(k)}ce.isElement(g)?c.push(C.createElement(Hb.Provider,{key:"provider-".concat(m.id),value:!!v},C.createElement(zb,{decorations:x,element:g,key:m.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(wd,{decorations:x,key:m.id,isLast:f&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Vs.set(g,p),Ks.set(g,n)}return c},Bd=C.createContext(!1),Ub=()=>C.useContext(Bd),kd=C.createContext(null),Xn=()=>{var e=C.useContext(kd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Vb(){var e=an(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=G.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Kb=3,Zb={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"},Yb={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"},Gb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Zb[e],n=Yb[e],r=Gb[e],a=t&&ai(t),i=n&&ai(n),s=r&&ai(r);return o=>!!(a&&a(o)||$u&&i&&i(o)||!$u&&s&&s(o))},Ie={isBold:Me("bold"),isCompose:Me("compose"),isMoveBackward:Me("moveBackward"),isMoveForward:Me("moveForward"),isDeleteBackward:Me("deleteBackward"),isDeleteForward:Me("deleteForward"),isDeleteLineBackward:Me("deleteLineBackward"),isDeleteLineForward:Me("deleteLineForward"),isDeleteWordBackward:Me("deleteWordBackward"),isDeleteWordForward:Me("deleteWordForward"),isExtendBackward:Me("extendBackward"),isExtendForward:Me("extendForward"),isExtendLineBackward:Me("extendLineBackward"),isExtendLineForward:Me("extendLineForward"),isItalic:Me("italic"),isMoveLineBackward:Me("moveLineBackward"),isMoveLineForward:Me("moveLineForward"),isMoveWordBackward:Me("moveWordBackward"),isMoveWordForward:Me("moveWordForward"),isRedo:Me("redo"),isSoftBreak:Me("insertSoftBreak"),isSplitBlock:Me("splitBlock"),isTransposeCharacter:Me("transposeCharacter"),isUndo:Me("undo")},Qb=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Gs(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}},Jb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Ad extends C.Component{constructor(){super(...arguments),Ct(this,"context",null),Ct(this,"manager",null),Ct(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,Jb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Qb(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}}Ct(Ad,"contextType",Us);var Xb=at?Ad:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},ey=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ty=["text"];function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ny=e=>C.createElement(C.Fragment,null,_d(e)),ry=e=>{var t=C.useCallback(F=>C.createElement(ay,Ft({},F)),[]),{autoFocus:n,decorate:r=iy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=sy,style:f={},as:p="div",disableDefaultStyles:h=!1}=e,g=Hn(e,ey),m=Xn(),[b,v]=C.useState(!1),x=C.useRef(null),A=C.useRef([]),[k,w]=C.useState(),{onUserInput:B,receivedUserInput:P}=Vb(),[,q]=C.useReducer(F=>F+1,0);md.set(m,q),ls.set(m,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var N=C.useRef(),O=C.useMemo(()=>b0(()=>{var F=N.current;if((at||!G.isComposing(m))&&(!I.isUpdatingSelection||F!=null&&F.isFlushing())&&!I.isDraggingInternally){var L=G.findDocumentOrShadowRoot(m),{activeElement:$}=L,z=G.toDOMNode(m,m),ne=L.getSelection();if($===z?(I.latestElement=$,Gt.set(m,!0)):Gt.delete(m),!ne)return ee.deselect(m);var{anchorNode:te,focusNode:Z}=ne,le=G.hasEditableTarget(m,te)||G.isTargetInsideNonReadonlyVoid(m,te),J=G.hasEditableTarget(m,Z)||G.isTargetInsideNonReadonlyVoid(m,Z);if(le&&J){var be=G.toSlateRange(m,ne,{exactMatch:!1,suppressThrow:!0});be&&(!G.isComposing(m)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?ee.select(m,be):F==null||F.handleUserSelect(be))}s&&(!le||!J)&&ee.deselect(m)}},100),[m,s,I]),E=C.useMemo(()=>f0(O,0),[O]);N.current=_b({node:x,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:E}),kr(()=>{var F,L,$;x.current&&($=Ys(x.current))?(hd.set(m,$),oa.set(m,x.current),pn.set(m,x.current),Br.set(x.current,m)):pn.delete(m);var{selection:z}=m,ne=G.findDocumentOrShadowRoot(m),te=ne.getSelection();if(!(!te||!G.isFocused(m)||(F=N.current)!==null&&F!==void 0&&F.hasPendingAction())){var Z=pe=>{var _e=te.type!=="None";if(!(!z&&!_e)){var Se=te.focusNode,Pe;if(Nn&&te.rangeCount>1){var Ge=te.getRangeAt(0),Ke=te.getRangeAt(te.rangeCount-1);Ge.startContainer===Se?Pe=Ke.endContainer:Pe=Ge.startContainer}else Pe=te.anchorNode;var Ze=oa.get(m),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&z&&!pe){var Ae=G.toSlateRange(m,te,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,z)){var We;if(!I.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(z&&!G.hasRange(m,z)){m.selection=G.toSlateRange(m,te,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var $e=z&&G.toDOMRange(m,z);return $e?(G.isComposing(m)&&!at?te.collapseToEnd():W.isBackward(z)?te.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):te.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(m,$e)):te.removeAllRanges(),$e}};te.rangeCount<=1&&Z();var le=((L=N.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!le){setTimeout(()=>{I.isUpdatingSelection=!1});return}var J=null,be=requestAnimationFrame(()=>{if(le){var pe=_e=>{try{var Se=G.toDOMNode(m,m);Se.focus(),Z(_e)}catch{}};pe(),J=setTimeout(()=>{pe(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(be),J&&clearTimeout(J)}}});var T=C.useCallback(F=>{if(B(),!s&&G.hasEditableTarget(m,F.target)&&!oy(F,a)){var L;if(N.current)return N.current.handleDOMBeforeInput(F);E.flush(),O.flush();var{selection:$}=m,{inputType:z}=F,ne=F.dataTransfer||F.data||void 0,te=z==="insertCompositionText"||z==="deleteCompositionText";if(te&&G.isComposing(m))return;var Z=!1;if(z==="insertText"&&$&&W.isCollapsed($)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&$.anchor.offset!==0){var le,J;Z=!0,m.marks&&(Z=!1);var{anchor:be}=$,[pe,_e]=G.toDOMPoint(m,be),Se=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Pe=G.getWindow(m);if(Z&&Se&&G.hasDOMNode(m,Se)){var Ge,Ke=Pe==null?void 0:Pe.document.createTreeWalker(Se,NodeFilter.SHOW_TEXT).lastChild();Ke===pe&&((Ge=Ke.textContent)===null||Ge===void 0?void 0:Ge.length)===_e&&(Z=!1)}if(Z&&pe.parentElement&&(Pe==null||(J=Pe.getComputedStyle(pe.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ze=y.above(m,{at:be.path,match:ae=>ce.isElement(ae)&&y.isBlock(m,ae)});Ze&&se.string(Ze[0]).includes(" ")&&(Z=!1)}}if(!z.startsWith("delete")||z.startsWith("deleteBy")){var[tt]=F.getTargetRanges();if(tt){var Ae=G.toSlateRange(m,tt,{exactMatch:!1,suppressThrow:!1});if(!$||!W.equals($,Ae)){Z=!1;var We=!te&&m.selection&&y.rangeRef(m,m.selection);ee.select(m,Ae),We&&mr.set(m,We)}}}if(te)return;if(Z||F.preventDefault(),$&&W.isExpanded($)&&z.startsWith("delete")){var $e=z.endsWith("Backward")?"backward":"forward";y.deleteFragment(m,{direction:$e});return}switch(z){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{y.deleteFragment(m);break}case"deleteContent":case"deleteContentForward":{y.deleteForward(m);break}case"deleteContentBackward":{y.deleteBackward(m);break}case"deleteEntireSoftLine":{y.deleteBackward(m,{unit:"line"}),y.deleteForward(m,{unit:"line"});break}case"deleteHardLineBackward":{y.deleteBackward(m,{unit:"block"});break}case"deleteSoftLineBackward":{y.deleteBackward(m,{unit:"line"});break}case"deleteHardLineForward":{y.deleteForward(m,{unit:"block"});break}case"deleteSoftLineForward":{y.deleteForward(m,{unit:"line"});break}case"deleteWordBackward":{y.deleteBackward(m,{unit:"word"});break}case"deleteWordForward":{y.deleteForward(m,{unit:"word"});break}case"insertLineBreak":y.insertSoftBreak(m);break;case"insertParagraph":{y.insertBreak(m);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{z==="insertFromComposition"&&G.isComposing(m)&&(v(!1),dn.set(m,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?G.insertData(m,ne):typeof ne=="string"&&(Z?A.current.push(()=>y.insertText(m,ne)):y.insertText(m,ne));break}}var H=(L=mr.get(m))===null||L===void 0?void 0:L.unref();mr.delete(m),H&&(!m.selection||!W.equals(m.selection,H))&&ee.select(m,H)}},[m,O,B,a,s,E]),R=C.useCallback(F=>{F==null?(O.cancel(),E.cancel(),oa.delete(m),pn.delete(m),x.current&&Ht&&x.current.removeEventListener("beforeinput",T)):Ht&&F.addEventListener("beforeinput",T),x.current=F},[O,E,m,T]);kr(()=>{var F=G.getWindow(m);return F.document.addEventListener("selectionchange",E),()=>{F.document.removeEventListener("selectionchange",E)}},[E]);var M=r([m,[]]),K=i&&m.children.length===1&&Array.from(se.texts(m)).length===1&&se.string(m)===""&&!b,V=C.useCallback(F=>{if(F&&K){var L;w((L=F.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else w(void 0)},[K]);if(K){var ie=y.start(m,[]);M.push({[Un]:!0,placeholder:i,onPlaceholderResize:V,anchor:ie,focus:ie})}var{marks:Q}=m;if(I.hasMarkPlaceholder=!1,m.selection&&W.isCollapsed(m.selection)&&Q){var{anchor:D}=m.selection,U=se.leaf(m,D.path),X=Hn(U,ty);if(!de.equals(U,Q,{loose:!0})){I.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(F=>[F,null]));M.push(Ft(Ft(Ft({[pd]:!0},_),Q),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:F}=m;if(F){var{anchor:L}=F,$=se.leaf(m,L.path);if(Q&&!de.equals($,Q,{loose:!0})){Et.set(m,Q);return}}Et.delete(m)})}),C.createElement(Bd.Provider,{value:s},C.createElement(Ed.Provider,{value:r},C.createElement(Xb,{node:x,receivedUserInput:P},C.createElement(p,Ft(Ft({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!sa?g.spellCheck:!1,autoCorrect:Ht||!sa?g.autoCorrect:"false",autoCapitalize:Ht||!sa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:Ft(Ft({},h?{}:Ft({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),f),onBeforeInput:C.useCallback(F=>{if(!Ht&&!s&&!rt(F,g.onBeforeInput)&&G.hasSelectableTarget(m,F.target)&&(F.preventDefault(),!G.isComposing(m))){var L=F.data;y.insertText(m,L)}},[g.onBeforeInput,m,s]),onInput:C.useCallback(F=>{if(!rt(F,g.onInput)){if(N.current){N.current.handleInput();return}for(var L of A.current)L();A.current=[]}},[g.onInput]),onBlur:C.useCallback(F=>{if(!(s||I.isUpdatingSelection||!G.hasSelectableTarget(m,F.target)||rt(F,g.onBlur))){var L=G.findDocumentOrShadowRoot(m);if(I.latestElement!==L.activeElement){var{relatedTarget:$}=F,z=G.toDOMNode(m,m);if($!==z&&!(Dt($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&Xt($)&&G.hasDOMNode(m,$)){var ne=G.toSlateNode(m,$);if(ce.isElement(ne)&&!m.isVoid(ne))return}if(cr){var te=L.getSelection();te==null||te.removeAllRanges()}Gt.delete(m)}}}},[s,I.isUpdatingSelection,I.latestElement,m,g.onBlur]),onClick:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onClick)&&Xt(F.target)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L);if(!y.hasPath(m,$)||se.get(m,$)!==L)return;if(F.detail===Kb&&$.length>=1){var z=$;if(!(ce.isElement(L)&&y.isBlock(m,L))){var ne,te=y.above(m,{match:Se=>ce.isElement(Se)&&y.isBlock(m,Se),at:$});z=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:$.slice(0,1)}var Z=y.range(m,z);ee.select(m,Z);return}if(s)return;var le=y.start(m,$),J=y.end(m,$),be=y.void(m,{at:le}),pe=y.void(m,{at:J});if(be&&pe&&j.equals(be[1],pe[1])){var _e=y.range(m,le);ee.select(m,_e)}}},[m,g.onClick,s]),onCompositionEnd:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if(G.isComposing(m)&&Promise.resolve().then(()=>{v(!1),dn.set(m,!1)}),(L=N.current)===null||L===void 0||L.handleCompositionEnd(F),rt(F,g.onCompositionEnd)||at)return;if(!cr&&!G0&&!V0&&!J0&&!Q0&&F.data){var $=Et.get(m);Et.delete(m),$!==void 0&&(Lt.set(m,m.marks),m.marks=$),y.insertText(m,F.data);var z=Lt.get(m);Lt.delete(m),z!==void 0&&(m.marks=z)}}},[g.onCompositionEnd,m]),onCompositionUpdate:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCompositionUpdate)&&(G.isComposing(m)||(v(!0),dn.set(m,!0)))},[g.onCompositionUpdate,m]),onCompositionStart:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if((L=N.current)===null||L===void 0||L.handleCompositionStart(F),rt(F,g.onCompositionStart)||at)return;v(!0);var{selection:$}=m;if($&&W.isExpanded($)){y.deleteFragment(m);return}}},[g.onCompositionStart,m]),onCopy:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCopy)&&!Gu(F)&&(F.preventDefault(),G.setFragmentData(m,F.clipboardData,"copy"))},[g.onCopy,m]),onCut:C.useCallback(F=>{if(!s&&G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCut)&&!Gu(F)){F.preventDefault(),G.setFragmentData(m,F.clipboardData,"cut");var{selection:L}=m;if(L)if(W.isExpanded(L))y.deleteFragment(m);else{var $=se.parent(m,L.anchor.path);y.isVoid(m,$)&&ee.delete(m)}}},[s,m,g.onCut]),onDragOver:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onDragOver)){var L=G.toSlateNode(m,F.target);ce.isElement(L)&&y.isVoid(m,L)&&F.preventDefault()}},[g.onDragOver,m]),onDragStart:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDragStart)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L),z=ce.isElement(L)&&y.isVoid(m,L)||y.void(m,{at:$,voids:!0});if(z){var ne=y.range(m,$);ee.select(m,ne)}I.isDraggingInternally=!0,G.setFragmentData(m,F.dataTransfer,"drag")}},[s,m,g.onDragStart,I]),onDrop:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDrop)){F.preventDefault();var L=m.selection,$=G.findEventRange(m,F),z=F.dataTransfer;ee.select(m,$),I.isDraggingInternally&&L&&!W.equals(L,$)&&!y.void(m,{at:$,voids:!0})&&ee.delete(m,{at:L}),G.insertData(m,z),G.isFocused(m)||G.focus(m)}I.isDraggingInternally=!1},[s,m,g.onDrop,I]),onDragEnd:C.useCallback(F=>{!s&&I.isDraggingInternally&&g.onDragEnd&&G.hasTarget(m,F.target)&&g.onDragEnd(F),I.isDraggingInternally=!1},[s,I,g,m]),onFocus:C.useCallback(F=>{if(!s&&!I.isUpdatingSelection&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onFocus)){var L=G.toDOMNode(m,m),$=G.findDocumentOrShadowRoot(m);if(I.latestElement=$.activeElement,Nn&&F.target!==L){L.focus();return}Gt.set(m,!0)}},[s,I,m,g.onFocus]),onKeyDown:C.useCallback(F=>{if(!s&&G.hasEditableTarget(m,F.target)){var L;(L=N.current)===null||L===void 0||L.handleKeyDown(F);var{nativeEvent:$}=F;if(G.isComposing(m)&&$.isComposing===!1&&(dn.set(m,!1),v(!1)),rt(F,g.onKeyDown)||G.isComposing(m))return;var{selection:z}=m,ne=m.children[z!==null?z.focus.path[0]:0],te=ed(se.string(ne))==="rtl";if(Ie.isRedo($)){F.preventDefault();var Z=m;typeof Z.redo=="function"&&Z.redo();return}if(Ie.isUndo($)){F.preventDefault();var le=m;typeof le.undo=="function"&&le.undo();return}if(Ie.isMoveLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",reverse:!0});return}if(Ie.isMoveLineForward($)){F.preventDefault(),ee.move(m,{unit:"line"});return}if(Ie.isExtendLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus",reverse:!0});return}if(Ie.isExtendLineForward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus"});return}if(Ie.isMoveBackward($)){F.preventDefault(),z&&W.isCollapsed(z)?ee.move(m,{reverse:!te}):ee.collapse(m,{edge:te?"end":"start"});return}if(Ie.isMoveForward($)){F.preventDefault(),z&&W.isCollapsed(z)?ee.move(m,{reverse:te}):ee.collapse(m,{edge:te?"start":"end"});return}if(Ie.isMoveWordBackward($)){F.preventDefault(),z&&W.isExpanded(z)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:!te});return}if(Ie.isMoveWordForward($)){F.preventDefault(),z&&W.isExpanded(z)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:te});return}if(Ht){if((fd||cr)&&z&&(Ie.isDeleteBackward($)||Ie.isDeleteForward($))&&W.isCollapsed(z)){var J=se.parent(m,z.anchor.path);if(ce.isElement(J)&&y.isVoid(m,J)&&(y.isInline(m,J)||y.isBlock(m,J))){F.preventDefault(),y.deleteBackward(m,{unit:"block"});return}}}else{if(Ie.isBold($)||Ie.isItalic($)||Ie.isTransposeCharacter($)){F.preventDefault();return}if(Ie.isSoftBreak($)){F.preventDefault(),y.insertSoftBreak(m);return}if(Ie.isSplitBlock($)){F.preventDefault(),y.insertBreak(m);return}if(Ie.isDeleteBackward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m);return}if(Ie.isDeleteForward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m);return}if(Ie.isDeleteLineBackward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"line"});return}if(Ie.isDeleteLineForward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"line"});return}if(Ie.isDeleteWordBackward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"word"});return}if(Ie.isDeleteWordForward($)){F.preventDefault(),z&&W.isExpanded(z)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"word"});return}}}},[s,m,g.onKeyDown]),onPaste:C.useCallback(F=>{!s&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onPaste)&&(!Ht||tb(F.nativeEvent)||cr)&&(F.preventDefault(),G.insertData(m,F.clipboardData))},[s,m,g.onPaste])}),C.createElement(ny,{decorations:M,node:m,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:m.selection})))))},ay=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Ft({},t),n,at&&C.createElement("br",null))},iy=()=>[],sy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),C0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Gu=e=>Xt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),oy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fd=C.createContext(!1),uy=()=>C.useContext(Fd),ly=C.createContext({});function cy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var dy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],fy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Hn(e,dy),[l,u]=C.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ye.stringify(s)));if(!y.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ye.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:f}=cy(t),p=C.useCallback(m=>{var b;switch(r&&r(t.children),m==null||(b=m.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(cs.set(t,p),()=>{cs.set(t,()=>{})}),[t,p]);var[h,g]=C.useState(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),kr(()=>{var m=()=>g(G.isFocused(t));return dd>=17?(document.addEventListener("focusin",m),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",m)}):(document.addEventListener("focus",m,!0),document.addEventListener("blur",m,!0),()=>{document.removeEventListener("focus",m,!0),document.removeEventListener("blur",m,!0)})},[]),C.createElement(ly.Provider,{value:c},C.createElement(kd.Provider,{value:l},C.createElement(Us.Provider,{value:l.editor},C.createElement(Fd.Provider,{value:h},n))))},Qu=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ju=(e,t,n)=>{var r=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Qu(r,a)&&Qu(a,r)},hy=(e,t)=>{var n=y.range(e,W.end(t)),r=Array.from(y.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ju(e,y.range(e,r[a]),n))return y.range(e,r[a],n);if(r.length<2)return y.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ju(e,y.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return y.range(e,r[i],n)};function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function el(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var my=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 qa.set(r,new WeakMap),r.addMark=(u,c)=>{var f,p;(f=Zs.get(r))===null||f===void 0||f(),!Et.get(r)&&(p=ut.get(r))!==null&&p!==void 0&&p.length&&Et.set(r,null),Lt.delete(r),o(u,c)},r.removeMark=u=>{var c;!Et.get(r)&&(c=ut.get(r))!==null&&c!==void 0&&c.length&&Et.set(r,null),Lt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=y.above(r,{match:g=>ce.isElement(g)&&y.isBlock(r,g),at:r.selection});if(c){var[,f]=c,p=y.range(r,f,r.selection.anchor),h=hy(r,p);W.isCollapsed(h)||ee.delete(r,{at:h})}}},r.apply=u=>{var c=[],f=[],p=ut.get(r);if(p!=null&&p.length){var h=p.map(R=>mb(R,u)).filter(Boolean);ut.set(r,h)}var g=Kt.get(r);g&&Kt.set(r,zu(r,g,u));var m=Vt.get(r);if(m!=null&&m.at){var b=Ce.isPoint(m==null?void 0:m.at)?hs(r,m.at,u):zu(r,m.at,u);Vt.set(r,b?el(el({},m),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Fn(r,u.path));break}case"set_selection":{var v;(v=mr.get(r))===null||v===void 0||v.unref(),mr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Fn(r,j.parent(u.path)));break}case"merge_node":{var x=j.previous(u.path);c.push(...Fn(r,x));break}case"move_node":{var A=j.common(j.parent(u.path),j.parent(u.newPath));c.push(...Fn(r,A));var k;j.isBefore(u.path,u.newPath)?(c.push(...Fn(r,j.parent(u.path))),k=u.newPath):(c.push(...Fn(r,j.parent(u.newPath))),k=u.path);var w=se.get(t,j.parent(k)),B=G.findKey(r,w),P=y.pathRef(r,j.parent(k));f.push([P,B]);break}}a(u);for(var[q,I]of c){var[N]=y.node(r,q);Ca.set(N,I)}for(var[O,E]of f)if(O.current){var[T]=y.node(r,O.current);Ca.set(T,E)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,p]=W.edges(c),h=y.void(r,{at:f.path}),g=y.void(r,{at:p.path});if(!(W.isCollapsed(c)&&!h)){var m=G.toDOMRange(r,c),b=m.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(N=>{N.textContent&&N.textContent.trim()!==""&&(v=N)}),g){var[x]=g,A=m.cloneRange(),k=G.toDOMNode(r,x);A.setEndAfter(k),b=A.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(N=>{var O=N.getAttribute("data-slate-zero-width")==="n";N.textContent=O?`
|
|
133
|
-
`:""}),gd(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),b.appendChild(w),v=w}var B=r.getFragment(),P=JSON.stringify(B),q=window.btoa(encodeURIComponent(P));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var I=b.ownerDocument.createElement("div");return I.appendChild(b),I.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",bd(I)),b.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||sb(u);if(c){var f=decodeURIComponent(window.atob(c)),p=JSON.parse(f);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),p=!1;for(var h of f)p&&ee.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var c=dd<18?Yf.unstable_batchedUpdates:f=>f();c(()=>{var f=cs.get(r);f&&f(u),i(u)})},r},Fn=(e,t)=>{var n=[];for(var[r,a]of y.levels(e,{at:t})){var i=G.findKey(e,r);n.push([a,i])}return n};const py={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,setOpenTooltip:()=>{},showLinkEditor:!1,setShowLinkEditor:()=>{},lastAnchor:null,setLastAnchor:()=>{}},xn=C.createContext(py),gy=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{...e,children:t});case"link":return d.jsx("a",{...e,children:t});case"list_item":return d.jsx("li",{...e,children:t});case"ol_list":return d.jsx("ol",{...e,children:t});case"ul_list":return d.jsx("ul",{...e,children:t});case"span":return d.jsx("span",{...e,children:t});case"paragraph":return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},vy=({attributes:e,children:t,leaf:n})=>{const r=n;return r.bold&&(t=d.jsx("strong",{children:t})),r.italic&&(t=d.jsx("em",{children:t})),r.strikeThrough&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Qs=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=Xn(),{id:u,tabbableOption:c,setFocus:f,openTooltip:p,setOpenTooltip:h,setLastAnchor:g}=C.useContext(xn),m={};return e!==c&&(m.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{h(e)},onMouseLeave:()=>{h(null)},onFocus:()=>{h(e)},onBlur:b=>{b.stopPropagation(),h(null),l.selection&&g(l.selection.anchor)},contentEditable:!1,children:[d.jsxs("button",{...s,...m,className:Y(e,a,{active:t}),onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,x,A,k;if(b.key==="Enter")b.stopPropagation(),b.preventDefault(),r();else if(["ArrowLeft","ArrowRight"].includes(b.key)){b.stopPropagation(),b.preventDefault();const w=b.currentTarget.closest("li");let B=w==null?void 0:w.nextElementSibling;if(b.key==="ArrowLeft"){const q=w==null?void 0:w.previousElementSibling;q?B=q:B=(v=w==null?void 0:w.parentElement)==null?void 0:v.lastElementChild}else B||(B=(x=w==null?void 0:w.parentElement)==null?void 0:x.firstElementChild);const P=B==null?void 0:B.className.split(" ")[0];P&&(f(P),(A=B==null?void 0:B.querySelector("button"))==null||A.focus())}else{const w=b.currentTarget.closest("fieldset");w&&((k=w==null?void 0:w.previousElementSibling)==null||k.focus())}},children:[d.jsx(Le,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Va,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},tl=["ol_list","ul_list"],Td=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(y.nodes(e,{at:y.unhangRange(e,n),match:a=>{const i=a;return!y.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},by=(e,t)=>{const n=Td(e,t),r=tl.includes(t);ee.unwrapNodes(e,{match:s=>{const o=s;return!y.isEditor(s)&&ce.isElement(s)&&tl.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(ee.setNodes(e,i),!n&&r){const s={type:t,children:[]};ee.wrapNodes(e,s)}},yy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Td(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{by(r,e),n(a?null:e)}})},Dy=70,Cy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(xn),i=uy(),s=t==="link-editor"?a:!1,o=(l,u)=>{l.style.top=`${u.top+window.scrollY-l.offsetHeight-Dy}px`,l.style.left=`${u.left+window.scrollX-l.offsetWidth/2+u.width/2}px`};return C.useEffect(()=>{const l=r==null?void 0:r.current;if(!l||!a)return;const{selection:u}=e;if(!u||!i||W.isCollapsed(u)||y.string(e,u)===""){const h=document.getElementById(n);if(!h)return;o(l,h.getBoundingClientRect());return}const c=window.getSelection(),f=c==null?void 0:c.getRangeAt(0),p=f?f==null?void 0:f.getBoundingClientRect():{top:0,left:0,width:0};o(l,p)},[s,e.selection]),r},xy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=y.nodes(e,{at:r,match:i=>i.type==="link"});if(a){let s=a[0].link,o=s;s.includes("//")?o=s.split("//")[1]:s=`http://${s}`,o.includes("/")&&(o=o.split("/")[0]),n({full:s,pretty:o})}else n(null)},[e,e.selection]),t},pr=e=>{const[t]=y.nodes(e,{match:n=>{const r=n;return!y.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},wy=(e,t)=>{e.selection&&Sd(e,t)},Sd=(e,t)=>{pr(e)&&jd(e);const{selection:n}=e,r=n&&W.isCollapsed(n),a={type:"link",link:t,children:r?[{text:t}]:[]};r?ee.insertNodes(e,a):(ee.wrapNodes(e,a,{split:!0}),ee.collapse(e,{edge:"end"}))},jd=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!y.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let bi=null;const Ey=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,setShowLinkEditor:a,setLastAnchor:i}=C.useContext(xn),s=Xn(),{selection:o}=s,l=xy(s),[u,c]=C.useState(pr(s)),f=Cy(s,"link-editor",`${n}-link`),p=C.useRef(null);C.useEffect(()=>{var b;!u&&r&&((b=p.current)==null||b.focus())},[u]),C.useEffect(()=>{bi&&clearTimeout(bi),bi=setTimeout(()=>{c(pr(s))},500)},[s.selection]);const h=o&&W.isCollapsed(o),g=[],m=["open","edit","remove"].map(b=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${b}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:b}),b){case"open":v.href=(l==null?void 0:l.full)||"",v.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),a(!1)},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Le,{children:e.formatMessage({id:`${t}${b}_text`})})]});break;case"edit":v.onClick=()=>{h||c(!1)},h&&(v.disabled=!0);break;case"remove":v.onClick=()=>{pr(s)&&(jd(s),i(null)),a(!1)};break}return v});return d.jsx(Va,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasPointer:"bottom",hasForm:!u},functions:{onBlur:()=>{a(!1)}},callbacks:{onOpen:()=>{setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()})}},children:u?d.jsx(Dn,{wrappers:g,buttons:m}):d.jsx(Qn,{id:`${n}-link-editor`,functions:{onSuccess:async b=>{setTimeout(()=>{b.url&&(wy(s,b.url),i(null)),a(!1)})}},fields:[{id:"url",type:"url",inputRef:p,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}],button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})},_y=()=>{const e=Xn(),{setFocus:t,setShowLinkEditor:n}=C.useContext(xn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(pr(e))},[e.selection]),d.jsx(Qs,{id:"link",active:r,hasDivider:!0,callback:()=>{n(!0),t(r?null:"link"),a(!0)}})},Od=(e,t)=>{const n=y.marks(e);return n?n[t]===!0:!1},Pd=(e,t)=>{Od(e,t)?y.removeMark(e,t):y.addMark(e,t,!0)},By=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Od(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{Pd(r,e),n(a?null:e)}})},xa=["bold","italic","strikeThrough"],ky=["ol_list","ul_list","block_quote"];const Ay=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Le,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[xa.map((n,r)=>d.jsx(By,{format:n,hasDivider:r===xa.length-1},n)),d.jsx(_y,{}),ky.map((n,r)=>d.jsx(yy,{format:n,hasDivider:r===1},n))]})]}),d.jsx(Ey,{})]})};var Fy=Oy,Ty=/^(?:\w+:)?\/\/(\S+)$/,Sy=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,jy=/^[^\s\.]+\.\S{2,}$/;function Oy(e){if(typeof e!="string")return!1;var t=e.match(Ty);if(!t)return!1;var n=t[1];return n?!!(Sy.test(n)||jy.test(n)):!1}const Py=tn(Fy),Ny=e=>{const{insertText:t,isInline:n}=e;return e.isInline=r=>{const a=r;return["link"].includes(a.type)||n(r)},e.insertText=r=>{r&&Py(r)?Sd(e,r):t(r)},e};function nl(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,Nd=Object.prototype.toString,rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,il=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Nd.call(t)==="[object Array]"},sl=function(t){if(!t||Nd.call(t)!=="[object Object]")return!1;var n=ua.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ua.call(t,a)},ol=function(t,n){rl&&n.name==="__proto__"?rl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ul=function(t,n){if(n==="__proto__")if(ua.call(t,n)){if(al)return al(t,n).value}else return;return t[n]},Ry=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=ul(o,n),a=ul(t,n),o!==a&&(c&&a&&(sl(a)||(i=il(a)))?(i?(i=!1,s=r&&il(r)?r:[]):s=r&&sl(r)?r:{},ol(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&ol(o,{name:n,newValue:a}));return o};const yi=tn(Ry);function ps(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 My(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Iy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Iy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function gr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ll(e.position):"start"in e||"end"in e?ll(e):"line"in e||"column"in e?gs(e):""}function gs(e){return cl(e&&e.line)+":"+cl(e&&e.column)}function ll(e){return gs(e&&e.start)+"-"+gs(e&&e.end)}function cl(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=gr(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 Tt={basename:$y,dirname:Ly,extname:zy,join:qy,sep:"/"};function $y(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Tr(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 Ly(e){if(Tr(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 zy(e){Tr(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 qy(...e){let t=-1,n;for(;++t<e.length;)Tr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Wy(n)}function Wy(e){Tr(e);const t=e.codePointAt(0)===47;let n=Hy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Hy(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 Tr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Uy={cwd:Vy};function Vy(){return"/"}function vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ky(e){if(typeof e=="string")e=new URL(e);else if(!vs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Zy(e)}function Zy(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 Di=["history","path","basename","stem","extname","dirname"];class Yy{constructor(t){let n;t?vs(t)?n={path:t}:typeof t=="string"||Gy(t)?n={value:t}:n=t:n={},this.cwd=Uy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Di.length;){const i=Di[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)Di.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Tt.basename(this.path):void 0}set basename(t){xi(t,"basename"),Ci(t,"basename"),this.path=Tt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Tt.dirname(this.path):void 0}set dirname(t){dl(this.basename,"dirname"),this.path=Tt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Tt.extname(this.path):void 0}set extname(t){if(Ci(t,"extname"),dl(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=Tt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vs(t)&&(t=Ky(t)),xi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Tt.basename(this.path,this.extname):void 0}set stem(t){xi(t,"stem"),Ci(t,"stem"),this.path=Tt.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 Ci(e,t){if(e&&e.includes(Tt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Tt.sep+"`")}function xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function dl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Gy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qy=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},Jy={}.hasOwnProperty;class Js extends Qy{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=My()}copy(){const t=new Js;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?(_i("data",this.frozen),this.namespace[t]=n,this):Jy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_i("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=Kr(t),r=this.parser||this.Parser;return wi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),wi("process",this.parser||this.Parser),Ei("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Kr(t),l=r.parse(o);r.run(l,o,function(c,f,p){if(c||!f||!p)return u(c);const h=f,g=r.stringify(h,p);t1(g)?p.value=g:p.result=g,u(c,p)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),wi("processSync",this.parser||this.Parser),Ei("processSync",this.compiler||this.Compiler),this.process(t,a),hl("processSync","process",n),r;function a(i,s){n=!0,nl(i),r=s}}run(t,n,r){fl(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=Kr(n);a.run(t,l,u);function u(c,f,p){const h=f||t;c?o(c):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),hl("runSync","run",r),a;function i(s,o){nl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Kr(n),a=this.compiler||this.Compiler;return Ei("stringify",a),fl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(_i("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}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 c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[h,...g]=c;const m=r[p][1];ps(m)&&ps(h)&&(h=yi(!0,m,h)),r[p]=[u,h,...g]}}}}const Xy=new Js().freeze();function wi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ei(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _i(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 fl(e){if(!ps(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Kr(e){return e1(e)?e:new Yy(e)}function e1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function t1(e){return typeof e=="string"||n1(e)}function n1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r1={};function a1(e,t){const n=t||r1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Rd(e,r,a)}function Rd(e,t,n){if(i1(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 ml(e.children,t,n)}return Array.isArray(e)?ml(e,t,n):""}function ml(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Rd(e[a],t,n);return r.join("")}function i1(e){return!!(e&&typeof e=="object")}const pl=document.createElement("i");function Xs(e){const t="&"+e+";";pl.innerHTML=t;const n=pl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ot(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 yt(e,t){return e.length>0?(Ot(e,e.length,0,t),e):t}const gl={}.hasOwnProperty;function s1(e){const t={};let n=-1;for(;++n<e.length;)o1(t,e[n]);return t}function o1(e,t){let n;for(n in t){const a=(gl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){gl.call(a,s)||(a[s]=[]);const o=i[s];u1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function u1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ot(e,0,0,r)}function Md(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 $n(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const St=sn(/[A-Za-z]/),_t=sn(/[\dA-Za-z]/),l1=sn(/[#-'*+\--9=?A-Z^-~]/);function bs(e){return e!==null&&(e<32||e===127)}const ys=sn(/\d/),c1=sn(/[\dA-Fa-f]/),d1=sn(/[!-/:-@[-`{-~]/);function ge(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ke(e){return e===-2||e===-1||e===32}const f1=sn(/\p{P}|\p{S}/u),h1=sn(/\s/);function sn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return ke(l)?(e.enter(n),o(l)):t(l)}function o(l){return ke(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const m1={tokenize:p1};function p1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ne(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ge(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const g1={tokenize:v1},vl={tokenize:b1};function v1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const k=t.events.length;let w=k,B;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){B=t.events[w][1].end;break}v(r);let P=k;for(;P<t.events.length;)t.events[P][1].end=Object.assign({},B),P++;return Ot(t.events,w+1,0,t.events.slice(k)),t.events.length=P,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return p(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vl,c,f)(A)}function c(A){return a&&x(),v(r),p(A)}function f(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function p(A){return t.containerState={},e.attempt(vl,h,g)(A)}function h(A){return r++,n.push([t.currentConstruct,t.containerState]),p(A)}function g(A){if(A===null){a&&x(),v(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),m(A)}function m(A){if(A===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(A);return}return ge(A)?(e.consume(A),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),m)}function b(A,k){const w=t.sliceStream(A);if(k&&w.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(w),t.parser.lazy[A.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const P=t.events.length;let q=P,I,N;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(I){N=t.events[q][1].end;break}I=!0}for(v(r),B=P;B<t.events.length;)t.events[B][1].end=Object.assign({},N),B++;Ot(t.events,q+1,0,t.events.slice(P)),t.events.length=B}}function v(A){let k=n.length;for(;k-- >A;){const w=n[k];t.containerState=w[1],w[0].exit.call(t,e)}n.length=A}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function b1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bl(e){if(e===null||ct(e)||h1(e))return 1;if(f1(e))return 2}function eo(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 Ds={name:"attention",tokenize:D1,resolveAll:y1};function y1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);yl(f,-l),yl(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,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=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=yt(u,eo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Ot(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function D1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=bl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=bl(l),f=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(c||!f)),t(l)}}function yl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const C1={name:"autolink",tokenize:x1};function x1(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return St(h)?(e.consume(h),s):u(h)}function s(h){return h===43||h===45||h===46||_t(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||_t(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||bs(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),c):l1(h)?(e.consume(h),u):n(h)}function c(h){return _t(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,c):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||_t(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const Wa={tokenize:w1,partial:!0};function w1(e,t,n){return r;function r(i){return ke(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ge(i)?t(i):n(i)}}const Id={name:"blockQuote",tokenize:E1,continuation:{tokenize:_1},exit:B1};function E1(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 ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function _1(e,t,n){const r=this;return a;function a(s){return ke(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Id,t,n)(s)}}function B1(e){e.exit("blockQuote")}const $d={name:"characterEscape",tokenize:k1};function k1(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 d1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Ld={name:"characterReference",tokenize:A1};function A1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=c1,c):(e.enter("characterReferenceValue"),i=7,s=ys,c(f))}function c(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===_t&&!Xs(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Dl={tokenize:T1,partial:!0},Cl={name:"codeFenced",tokenize:F1,concrete:!0};function F1(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const P=r.events[r.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(B)}function c(B){return B===o?(s++,e.consume(B),c):s<3?n(B):(e.exit("codeFencedFenceSequence"),ke(B)?Ne(e,f,"whitespace")(B):f(B))}function f(B){return B===null||ge(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(Dl,m,k)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(B)):ke(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ge(B)?f(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(B)):B===96&&B===o?n(B):(e.consume(B),g)}function m(B){return e.attempt(a,k,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&ke(B)?Ne(e,x,"linePrefix",i+1)(B):x(B)}function x(B){return B===null||ge(B)?e.check(Dl,m,k)(B):(e.enter("codeFlowValue"),A(B))}function A(B){return B===null||ge(B)?(e.exit("codeFlowValue"),x(B)):(e.consume(B),A)}function k(B){return e.exit("codeFenced"),t(B)}function w(B,P,q){let I=0;return N;function N(M){return B.enter("lineEnding"),B.consume(M),B.exit("lineEnding"),O}function O(M){return B.enter("codeFencedFence"),ke(M)?Ne(B,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):E(M)}function E(M){return M===o?(B.enter("codeFencedFenceSequence"),T(M)):q(M)}function T(M){return M===o?(I++,B.consume(M),T):I>=s?(B.exit("codeFencedFenceSequence"),ke(M)?Ne(B,R,"whitespace")(M):R(M)):q(M)}function R(M){return M===null||ge(M)?(B.exit("codeFencedFence"),P(M)):q(M)}}}function T1(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 Bi={name:"codeIndented",tokenize:j1},S1={tokenize:O1,partial:!0};function j1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ge(u)?e.attempt(S1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ge(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function O1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ge(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ne(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ge(s)?a(s):n(s)}}const P1={name:"codeText",tokenize:M1,resolve:N1,previous:R1};function N1(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 R1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ge(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ge(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function zd(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,I1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Ot(e,a,n-a+1,o))}}return!u}function I1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,f,p=-1,h=n,g=0,m=0;const b=[m];for(;h;){for(;e[++a][1]!==h;);i.push(a),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),f&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,b.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),x=i.pop();l.unshift([x,x+v.length-1]),Ot(e,x,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const $1={tokenize:q1,resolve:z1},L1={tokenize:W1,partial:!0};function z1(e){return zd(e),e}function q1(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):ge(o)?e.check(L1,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 W1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(e,i,"linePrefix")}function i(s){if(s===null||ge(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 qd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||bs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ge(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function m(v){return!c&&(v===null||v===41||ct(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,m):v===41?(e.consume(v),c--,m):v===null||v===32||v===40||bs(v)?n(v):(e.consume(v),v===92?b:m)}function b(v){return v===40||v===41||v===92?(e.consume(v),m):m(v)}}function Wd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),c}function c(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ge(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||ge(h)||o++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!ke(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function Hd(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):ge(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ge(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(e.consume(p),c):c(p)}}function vr(e,t){let n;return r;function r(a){return ge(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ke(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const H1={name:"definition",tokenize:V1},U1={tokenize:K1,partial:!0};function V1(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Wd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ct(h)?vr(e,u)(h):u(h)}function u(h){return qd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(U1,f,f)(h)}function f(h){return ke(h)?Ne(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ge(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function K1(e,t,n){return r;function r(o){return ct(o)?vr(e,a)(o):n(o)}function a(o){return Hd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ke(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ge(o)?t(o):n(o)}}const Z1={name:"hardBreakEscape",tokenize:Y1};function Y1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ge(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const G1={name:"headingAtx",tokenize:J1,resolve:Q1};function Q1(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"},Ot(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function J1(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ct(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ge(c)?(e.exit("atxHeading"),t(c)):ke(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ct(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const X1=["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"],xl=["pre","script","style","textarea"],eD={name:"htmlFlow",tokenize:aD,resolveTo:rD,concrete:!0},tD={tokenize:sD,partial:!0},nD={tokenize:iD,partial:!0};function rD(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 aD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,m):_===63?(e.consume(_),a=3,r.interrupt?t:D):St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,h):_===91?(e.consume(_),a=5,o=0,g):St(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function h(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const F="CDATA[";return _===F.charCodeAt(o++)?(e.consume(_),o===F.length?r.interrupt?t:E:g):n(_)}function m(_){return St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||ct(_)){const F=_===47,L=s.toLowerCase();return!F&&!i&&xl.includes(L)?(a=1,r.interrupt?t(_):E(_)):X1.includes(s.toLowerCase())?(a=6,F?(e.consume(_),v):r.interrupt?t(_):E(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?x(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:E):n(_)}function x(_){return ke(_)?(e.consume(_),x):N(_)}function A(_){return _===47?(e.consume(_),N):_===58||_===95||St(_)?(e.consume(_),k):ke(_)?(e.consume(_),A):N(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):w(_)}function w(_){return _===61?(e.consume(_),B):ke(_)?(e.consume(_),w):A(_)}function B(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,P):ke(_)?(e.consume(_),B):q(_)}function P(_){return _===l?(e.consume(_),l=null,I):_===null||ge(_)?n(_):(e.consume(_),P)}function q(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ct(_)?w(_):(e.consume(_),q)}function I(_){return _===47||_===62||ke(_)?A(_):n(_)}function N(_){return _===62?(e.consume(_),O):n(_)}function O(_){return _===null||ge(_)?E(_):ke(_)?(e.consume(_),O):n(_)}function E(_){return _===45&&a===2?(e.consume(_),K):_===60&&a===1?(e.consume(_),V):_===62&&a===4?(e.consume(_),U):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),Q):ge(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(tD,X,T)(_)):_===null||ge(_)?(e.exit("htmlFlowData"),T(_)):(e.consume(_),E)}function T(_){return e.check(nD,R,X)(_)}function R(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||ge(_)?T(_):(e.enter("htmlFlowData"),E(_))}function K(_){return _===45?(e.consume(_),D):E(_)}function V(_){return _===47?(e.consume(_),s="",ie):E(_)}function ie(_){if(_===62){const F=s.toLowerCase();return xl.includes(F)?(e.consume(_),U):E(_)}return St(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):E(_)}function Q(_){return _===93?(e.consume(_),D):E(_)}function D(_){return _===62?(e.consume(_),U):_===45&&a===2?(e.consume(_),D):E(_)}function U(_){return _===null||ge(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),U)}function X(_){return e.exit("htmlFlow"),t(_)}}function iD(e,t,n){const r=this;return a;function a(s){return ge(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 sD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const oD={name:"htmlText",tokenize:uD};function uD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),w):D===63?(e.consume(D),A):St(D)?(e.consume(D),q):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):St(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),h):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),p):ge(D)?(s=f,V(D)):(e.consume(D),f)}function p(D){return D===45?(e.consume(D),h):f(D)}function h(D){return D===62?K(D):D===45?p(D):f(D)}function g(D){const U="CDATA[";return D===U.charCodeAt(i++)?(e.consume(D),i===U.length?m:g):n(D)}function m(D){return D===null?n(D):D===93?(e.consume(D),b):ge(D)?(s=m,V(D)):(e.consume(D),m)}function b(D){return D===93?(e.consume(D),v):m(D)}function v(D){return D===62?K(D):D===93?(e.consume(D),v):m(D)}function x(D){return D===null||D===62?K(D):ge(D)?(s=x,V(D)):(e.consume(D),x)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):ge(D)?(s=A,V(D)):(e.consume(D),A)}function k(D){return D===62?K(D):A(D)}function w(D){return St(D)?(e.consume(D),B):n(D)}function B(D){return D===45||_t(D)?(e.consume(D),B):P(D)}function P(D){return ge(D)?(s=P,V(D)):ke(D)?(e.consume(D),P):K(D)}function q(D){return D===45||_t(D)?(e.consume(D),q):D===47||D===62||ct(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),K):D===58||D===95||St(D)?(e.consume(D),N):ge(D)?(s=I,V(D)):ke(D)?(e.consume(D),I):K(D)}function N(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),N):O(D)}function O(D){return D===61?(e.consume(D),E):ge(D)?(s=O,V(D)):ke(D)?(e.consume(D),O):I(D)}function E(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,T):ge(D)?(s=E,V(D)):ke(D)?(e.consume(D),E):(e.consume(D),R)}function T(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ge(D)?(s=T,V(D)):(e.consume(D),T)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?I(D):(e.consume(D),R)}function M(D){return D===47||D===62||ct(D)?I(D):n(D)}function K(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ie}function ie(D){return ke(D)?Ne(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Q(D)}function Q(D){return e.enter("htmlTextData"),s(D)}}const to={name:"labelEnd",tokenize:mD,resolveTo:hD,resolveAll:fD},lD={tokenize:pD},cD={tokenize:gD},dD={tokenize:vD};function fD(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)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=yt(o,e.slice(i+1,i+r+3)),o=yt(o,[["enter",c,t]]),o=yt(o,eo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=yt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=yt(o,e.slice(s+1)),o=yt(o,[["exit",l,t]]),Ot(e,i,e.length,o),e}function mD(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?f(p):(s=r.parser.defined.includes($n(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(lD,c,s?c:f)(p):p===91?e.attempt(cD,c,s?u:f)(p):s?c(p):f(p)}function u(p){return e.attempt(dD,c,f)(p)}function c(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function pD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?vr(e,i)(f):i(f)}function i(f){return f===41?c(f):qd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?vr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Hd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?vr(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function gD(e,t,n){const r=this;return a;function a(o){return Wd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function vD(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 bD={name:"labelStartImage",tokenize:yD,resolveAll:to.resolveAll};function yD(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 DD={name:"labelStartLink",tokenize:CD,resolveAll:to.resolveAll};function CD(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 ki={name:"lineEnding",tokenize:xD};function xD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const la={name:"thematicBreak",tokenize:wD};function wD(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||ge(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),ke(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:BD,continuation:{tokenize:kD},exit:FD},ED={tokenize:TD,partial:!0},_D={tokenize:AD,partial:!0};function BD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ys(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(la,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return ys(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Wa,r.interrupt?n:c,e.attempt(ED,p,f))}function c(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return ke(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function kD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wa,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!ke(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(_D,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(ot,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function AD(e,t,n){const r=this;return Ne(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function FD(e){e.exit(this.containerState.type)}function TD(e,t,n){const r=this;return Ne(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!ke(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wl={name:"setextUnderline",tokenize:jD,resolveTo:SD};function SD(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 jD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),ke(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ge(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const OD={tokenize:PD};function PD(e){const t=this,n=e.attempt(Wa,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt($1,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 ND={resolveAll:Vd()},RD=Ud("string"),MD=Ud("text");function Ud(e){return{tokenize:t,resolveAll:Vd(e==="text"?ID:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=a[c];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Vd(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 ID(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 $D(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:A,exit:k,attempt:P(w),check:P(B),interrupt:P(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:m,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(O){return s=yt(s,O),b(),s[s.length-1]!==null?[]:(q(t,0),u.events=eo(i,u.events,u),u.events)}function p(O,E){return zD(h(O),E)}function h(O){return LD(s,O)}function g(){const{line:O,column:E,offset:T,_index:R,_bufferIndex:M}=r;return{line:O,column:E,offset:T,_index:R,_bufferIndex:M}}function m(O){a[O.line]=O.column,N()}function b(){let O;for(;r._index<s.length;){const E=s[r._index];if(typeof E=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<E.length;)v(E.charCodeAt(r._bufferIndex));else v(E)}}function v(O){c=c(O)}function x(O){ge(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,N()):O!==-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=O}function A(O,E){const T=E||{};return T.type=O,T.start=g(),u.events.push(["enter",T,u]),o.push(T),T}function k(O){const E=o.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function w(O,E){q(O,E.from)}function B(O,E){E.restore()}function P(O,E){return T;function T(R,M,K){let V,ie,Q,D;return Array.isArray(R)?X(R):"tokenize"in R?X([R]):U(R);function U($){return z;function z(ne){const te=ne!==null&&$[ne],Z=ne!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(le)(ne)}}function X($){return V=$,ie=0,$.length===0?K:_($[ie])}function _($){return z;function z(ne){return D=I(),Q=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?L():$.tokenize.call(E?Object.assign(Object.create(u),E):u,l,F,L)(ne)}}function F($){return O(Q,D),M}function L($){return D.restore(),++ie<V.length?_(V[ie]):K}}}function q(O,E){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ot(u.events,E,u.events.length-E,O.resolve(u.events.slice(E),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function I(){const O=g(),E=u.previous,T=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:K,from:R};function K(){r=O,u.previous=E,u.currentConstruct=T,u.events.length=R,o=M,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function LD(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 zD(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=`
|
|
132
|
+
`:""),[i]=C.useState(a);return kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Ob,{ref:r},i)},Ob=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),vi=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),C.createElement("span",Sb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function Vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Pb=at?300:0;function Nb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ku(e){e.current&&(clearTimeout(e.current),e.current=null)}var Rb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Ib,xd({},x))}=e,o=an(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),p=C.useRef(null),h=C.useCallback(x=>{if(Nb(l,x==null),x==null){var A;us.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(us.set(o,x),!l.current){var k=window.ResizeObserver||q0;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(jb,{isLast:n,leaf:t,parent:a,text:r}),m=!!t[Un];if(C.useEffect(()=>(m?p.current||(p.current=setTimeout(()=>{f(!0),p.current=null},Pb)):(Ku(p),f(!1)),()=>Ku(p)),[m,f]),m&&c){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:cr?"inherit":void 0},contentEditable:!1,ref:h}};g=C.createElement(C.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Mb=C.memo(Rb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Un]===e.leaf[Un]),Ib=e=>{var{attributes:t,children:n}=e;return C.createElement("span",xd({},t),n)},$b=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=an(),l=C.useRef(null),u=de.decorations(s,t),c=G.findKey(o,s),f=[],p=0;p<u.length;p++){var h=u[p];f.push(C.createElement(Mb,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(m=>{var b=qa.get(o);m?(b==null||b.set(c,m),pn.set(s,m),Br.set(m,s)):(b==null||b.delete(c),pn.delete(s),l.current&&Br.delete(l.current)),l.current=m},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},wd=C.memo($b,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Tb(t.decorations,e.decorations));function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ms(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(qb,ms({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=an(),l=Ub(),u=o.isInline(n),c=G.findKey(o,n),f=C.useCallback(x=>{var A=qa.get(o);x?(A==null||A.set(c,x),pn.set(n,x),Br.set(x,n)):(A==null||A.delete(c),pn.delete(n))},[o,c,n]),p=_d({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:f};if(u&&(h["data-slate-inline"]=!0),!u&&y.hasInlines(o,n)){var g=se.string(n),m=ed(g);m==="rtl"&&(h.dir=m)}if(y.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=se.texts(n);p=C.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(wd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Vs.set(v,0),Ks.set(v,n)}return r({attributes:h,children:p,element:n})},zb=C.memo(Lb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Fb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),qb=e=>{var{attributes:t,children:n,element:r}=e,a=an(),i=a.isInline(r)?"span":"div";return C.createElement(i,ms(ms({},t),{},{style:{position:"relative"}}),n)},Ed=C.createContext(()=>[]),Wb=()=>C.useContext(Ed),Hb=C.createContext(!1),_d=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Wb(),l=an(),u=G.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&y.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],m=G.findKey(l,g),b=y.range(l,h),v=s&&W.intersection(b,s),x=o([g,h]);for(var A of t){var k=W.intersection(A,b);k&&x.push(k)}ce.isElement(g)?c.push(C.createElement(Hb.Provider,{key:"provider-".concat(m.id),value:!!v},C.createElement(zb,{decorations:x,element:g,key:m.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(wd,{decorations:x,key:m.id,isLast:f&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Vs.set(g,p),Ks.set(g,n)}return c},Bd=C.createContext(!1),Ub=()=>C.useContext(Bd),kd=C.createContext(null),Xn=()=>{var e=C.useContext(kd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Vb(){var e=an(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=G.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Kb=3,Zb={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"},Yb={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"},Gb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Zb[e],n=Yb[e],r=Gb[e],a=t&&ai(t),i=n&&ai(n),s=r&&ai(r);return o=>!!(a&&a(o)||$u&&i&&i(o)||!$u&&s&&s(o))},Ie={isBold:Me("bold"),isCompose:Me("compose"),isMoveBackward:Me("moveBackward"),isMoveForward:Me("moveForward"),isDeleteBackward:Me("deleteBackward"),isDeleteForward:Me("deleteForward"),isDeleteLineBackward:Me("deleteLineBackward"),isDeleteLineForward:Me("deleteLineForward"),isDeleteWordBackward:Me("deleteWordBackward"),isDeleteWordForward:Me("deleteWordForward"),isExtendBackward:Me("extendBackward"),isExtendForward:Me("extendForward"),isExtendLineBackward:Me("extendLineBackward"),isExtendLineForward:Me("extendLineForward"),isItalic:Me("italic"),isMoveLineBackward:Me("moveLineBackward"),isMoveLineForward:Me("moveLineForward"),isMoveWordBackward:Me("moveWordBackward"),isMoveWordForward:Me("moveWordForward"),isRedo:Me("redo"),isSoftBreak:Me("insertSoftBreak"),isSplitBlock:Me("splitBlock"),isTransposeCharacter:Me("transposeCharacter"),isUndo:Me("undo")},Qb=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Gs(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}},Jb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Ad extends C.Component{constructor(){super(...arguments),Ct(this,"context",null),Ct(this,"manager",null),Ct(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,Jb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Qb(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}}Ct(Ad,"contextType",Us);var Xb=at?Ad:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},ey=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ty=["text"];function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ny=e=>C.createElement(C.Fragment,null,_d(e)),ry=e=>{var t=C.useCallback(F=>C.createElement(ay,Ft({},F)),[]),{autoFocus:n,decorate:r=iy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=sy,style:f={},as:p="div",disableDefaultStyles:h=!1}=e,g=Hn(e,ey),m=Xn(),[b,v]=C.useState(!1),x=C.useRef(null),A=C.useRef([]),[k,E]=C.useState(),{onUserInput:B,receivedUserInput:P}=Vb(),[,z]=C.useReducer(F=>F+1,0);md.set(m,z),ls.set(m,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var N=C.useRef(),O=C.useMemo(()=>b0(()=>{var F=N.current;if((at||!G.isComposing(m))&&(!I.isUpdatingSelection||F!=null&&F.isFlushing())&&!I.isDraggingInternally){var L=G.findDocumentOrShadowRoot(m),{activeElement:$}=L,q=G.toDOMNode(m,m),ne=L.getSelection();if($===q?(I.latestElement=$,Gt.set(m,!0)):Gt.delete(m),!ne)return ee.deselect(m);var{anchorNode:te,focusNode:Z}=ne,le=G.hasEditableTarget(m,te)||G.isTargetInsideNonReadonlyVoid(m,te),J=G.hasEditableTarget(m,Z)||G.isTargetInsideNonReadonlyVoid(m,Z);if(le&&J){var be=G.toSlateRange(m,ne,{exactMatch:!1,suppressThrow:!0});be&&(!G.isComposing(m)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?ee.select(m,be):F==null||F.handleUserSelect(be))}s&&(!le||!J)&&ee.deselect(m)}},100),[m,s,I]),w=C.useMemo(()=>f0(O,0),[O]);N.current=_b({node:x,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:w}),kr(()=>{var F,L,$;x.current&&($=Ys(x.current))?(hd.set(m,$),oa.set(m,x.current),pn.set(m,x.current),Br.set(x.current,m)):pn.delete(m);var{selection:q}=m,ne=G.findDocumentOrShadowRoot(m),te=ne.getSelection();if(!(!te||!G.isFocused(m)||(F=N.current)!==null&&F!==void 0&&F.hasPendingAction())){var Z=pe=>{var _e=te.type!=="None";if(!(!q&&!_e)){var Se=te.focusNode,Pe;if(Nn&&te.rangeCount>1){var Ge=te.getRangeAt(0),Ke=te.getRangeAt(te.rangeCount-1);Ge.startContainer===Se?Pe=Ke.endContainer:Pe=Ge.startContainer}else Pe=te.anchorNode;var Ze=oa.get(m),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&q&&!pe){var Ae=G.toSlateRange(m,te,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,q)){var We;if(!I.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(q&&!G.hasRange(m,q)){m.selection=G.toSlateRange(m,te,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var $e=q&&G.toDOMRange(m,q);return $e?(G.isComposing(m)&&!at?te.collapseToEnd():W.isBackward(q)?te.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):te.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(m,$e)):te.removeAllRanges(),$e}};te.rangeCount<=1&&Z();var le=((L=N.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!le){setTimeout(()=>{I.isUpdatingSelection=!1});return}var J=null,be=requestAnimationFrame(()=>{if(le){var pe=_e=>{try{var Se=G.toDOMNode(m,m);Se.focus(),Z(_e)}catch{}};pe(),J=setTimeout(()=>{pe(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(be),J&&clearTimeout(J)}}});var T=C.useCallback(F=>{if(B(),!s&&G.hasEditableTarget(m,F.target)&&!oy(F,a)){var L;if(N.current)return N.current.handleDOMBeforeInput(F);w.flush(),O.flush();var{selection:$}=m,{inputType:q}=F,ne=F.dataTransfer||F.data||void 0,te=q==="insertCompositionText"||q==="deleteCompositionText";if(te&&G.isComposing(m))return;var Z=!1;if(q==="insertText"&&$&&W.isCollapsed($)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&$.anchor.offset!==0){var le,J;Z=!0,m.marks&&(Z=!1);var{anchor:be}=$,[pe,_e]=G.toDOMPoint(m,be),Se=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Pe=G.getWindow(m);if(Z&&Se&&G.hasDOMNode(m,Se)){var Ge,Ke=Pe==null?void 0:Pe.document.createTreeWalker(Se,NodeFilter.SHOW_TEXT).lastChild();Ke===pe&&((Ge=Ke.textContent)===null||Ge===void 0?void 0:Ge.length)===_e&&(Z=!1)}if(Z&&pe.parentElement&&(Pe==null||(J=Pe.getComputedStyle(pe.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ze=y.above(m,{at:be.path,match:ae=>ce.isElement(ae)&&y.isBlock(m,ae)});Ze&&se.string(Ze[0]).includes(" ")&&(Z=!1)}}if(!q.startsWith("delete")||q.startsWith("deleteBy")){var[tt]=F.getTargetRanges();if(tt){var Ae=G.toSlateRange(m,tt,{exactMatch:!1,suppressThrow:!1});if(!$||!W.equals($,Ae)){Z=!1;var We=!te&&m.selection&&y.rangeRef(m,m.selection);ee.select(m,Ae),We&&mr.set(m,We)}}}if(te)return;if(Z||F.preventDefault(),$&&W.isExpanded($)&&q.startsWith("delete")){var $e=q.endsWith("Backward")?"backward":"forward";y.deleteFragment(m,{direction:$e});return}switch(q){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{y.deleteFragment(m);break}case"deleteContent":case"deleteContentForward":{y.deleteForward(m);break}case"deleteContentBackward":{y.deleteBackward(m);break}case"deleteEntireSoftLine":{y.deleteBackward(m,{unit:"line"}),y.deleteForward(m,{unit:"line"});break}case"deleteHardLineBackward":{y.deleteBackward(m,{unit:"block"});break}case"deleteSoftLineBackward":{y.deleteBackward(m,{unit:"line"});break}case"deleteHardLineForward":{y.deleteForward(m,{unit:"block"});break}case"deleteSoftLineForward":{y.deleteForward(m,{unit:"line"});break}case"deleteWordBackward":{y.deleteBackward(m,{unit:"word"});break}case"deleteWordForward":{y.deleteForward(m,{unit:"word"});break}case"insertLineBreak":y.insertSoftBreak(m);break;case"insertParagraph":{y.insertBreak(m);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{q==="insertFromComposition"&&G.isComposing(m)&&(v(!1),dn.set(m,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?G.insertData(m,ne):typeof ne=="string"&&(Z?A.current.push(()=>y.insertText(m,ne)):y.insertText(m,ne));break}}var H=(L=mr.get(m))===null||L===void 0?void 0:L.unref();mr.delete(m),H&&(!m.selection||!W.equals(m.selection,H))&&ee.select(m,H)}},[m,O,B,a,s,w]),R=C.useCallback(F=>{F==null?(O.cancel(),w.cancel(),oa.delete(m),pn.delete(m),x.current&&Ht&&x.current.removeEventListener("beforeinput",T)):Ht&&F.addEventListener("beforeinput",T),x.current=F},[O,w,m,T]);kr(()=>{var F=G.getWindow(m);return F.document.addEventListener("selectionchange",w),()=>{F.document.removeEventListener("selectionchange",w)}},[w]);var M=r([m,[]]),K=i&&m.children.length===1&&Array.from(se.texts(m)).length===1&&se.string(m)===""&&!b,V=C.useCallback(F=>{if(F&&K){var L;E((L=F.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else E(void 0)},[K]);if(K){var ie=y.start(m,[]);M.push({[Un]:!0,placeholder:i,onPlaceholderResize:V,anchor:ie,focus:ie})}var{marks:Q}=m;if(I.hasMarkPlaceholder=!1,m.selection&&W.isCollapsed(m.selection)&&Q){var{anchor:D}=m.selection,U=se.leaf(m,D.path),X=Hn(U,ty);if(!de.equals(U,Q,{loose:!0})){I.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(F=>[F,null]));M.push(Ft(Ft(Ft({[pd]:!0},_),Q),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:F}=m;if(F){var{anchor:L}=F,$=se.leaf(m,L.path);if(Q&&!de.equals($,Q,{loose:!0})){Et.set(m,Q);return}}Et.delete(m)})}),C.createElement(Bd.Provider,{value:s},C.createElement(Ed.Provider,{value:r},C.createElement(Xb,{node:x,receivedUserInput:P},C.createElement(p,Ft(Ft({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!sa?g.spellCheck:!1,autoCorrect:Ht||!sa?g.autoCorrect:"false",autoCapitalize:Ht||!sa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:Ft(Ft({},h?{}:Ft({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),f),onBeforeInput:C.useCallback(F=>{if(!Ht&&!s&&!rt(F,g.onBeforeInput)&&G.hasSelectableTarget(m,F.target)&&(F.preventDefault(),!G.isComposing(m))){var L=F.data;y.insertText(m,L)}},[g.onBeforeInput,m,s]),onInput:C.useCallback(F=>{if(!rt(F,g.onInput)){if(N.current){N.current.handleInput();return}for(var L of A.current)L();A.current=[]}},[g.onInput]),onBlur:C.useCallback(F=>{if(!(s||I.isUpdatingSelection||!G.hasSelectableTarget(m,F.target)||rt(F,g.onBlur))){var L=G.findDocumentOrShadowRoot(m);if(I.latestElement!==L.activeElement){var{relatedTarget:$}=F,q=G.toDOMNode(m,m);if($!==q&&!(Dt($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&Xt($)&&G.hasDOMNode(m,$)){var ne=G.toSlateNode(m,$);if(ce.isElement(ne)&&!m.isVoid(ne))return}if(cr){var te=L.getSelection();te==null||te.removeAllRanges()}Gt.delete(m)}}}},[s,I.isUpdatingSelection,I.latestElement,m,g.onBlur]),onClick:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onClick)&&Xt(F.target)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L);if(!y.hasPath(m,$)||se.get(m,$)!==L)return;if(F.detail===Kb&&$.length>=1){var q=$;if(!(ce.isElement(L)&&y.isBlock(m,L))){var ne,te=y.above(m,{match:Se=>ce.isElement(Se)&&y.isBlock(m,Se),at:$});q=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:$.slice(0,1)}var Z=y.range(m,q);ee.select(m,Z);return}if(s)return;var le=y.start(m,$),J=y.end(m,$),be=y.void(m,{at:le}),pe=y.void(m,{at:J});if(be&&pe&&j.equals(be[1],pe[1])){var _e=y.range(m,le);ee.select(m,_e)}}},[m,g.onClick,s]),onCompositionEnd:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if(G.isComposing(m)&&Promise.resolve().then(()=>{v(!1),dn.set(m,!1)}),(L=N.current)===null||L===void 0||L.handleCompositionEnd(F),rt(F,g.onCompositionEnd)||at)return;if(!cr&&!G0&&!V0&&!J0&&!Q0&&F.data){var $=Et.get(m);Et.delete(m),$!==void 0&&(Lt.set(m,m.marks),m.marks=$),y.insertText(m,F.data);var q=Lt.get(m);Lt.delete(m),q!==void 0&&(m.marks=q)}}},[g.onCompositionEnd,m]),onCompositionUpdate:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCompositionUpdate)&&(G.isComposing(m)||(v(!0),dn.set(m,!0)))},[g.onCompositionUpdate,m]),onCompositionStart:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if((L=N.current)===null||L===void 0||L.handleCompositionStart(F),rt(F,g.onCompositionStart)||at)return;v(!0);var{selection:$}=m;if($&&W.isExpanded($)){y.deleteFragment(m);return}}},[g.onCompositionStart,m]),onCopy:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCopy)&&!Gu(F)&&(F.preventDefault(),G.setFragmentData(m,F.clipboardData,"copy"))},[g.onCopy,m]),onCut:C.useCallback(F=>{if(!s&&G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCut)&&!Gu(F)){F.preventDefault(),G.setFragmentData(m,F.clipboardData,"cut");var{selection:L}=m;if(L)if(W.isExpanded(L))y.deleteFragment(m);else{var $=se.parent(m,L.anchor.path);y.isVoid(m,$)&&ee.delete(m)}}},[s,m,g.onCut]),onDragOver:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onDragOver)){var L=G.toSlateNode(m,F.target);ce.isElement(L)&&y.isVoid(m,L)&&F.preventDefault()}},[g.onDragOver,m]),onDragStart:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDragStart)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L),q=ce.isElement(L)&&y.isVoid(m,L)||y.void(m,{at:$,voids:!0});if(q){var ne=y.range(m,$);ee.select(m,ne)}I.isDraggingInternally=!0,G.setFragmentData(m,F.dataTransfer,"drag")}},[s,m,g.onDragStart,I]),onDrop:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDrop)){F.preventDefault();var L=m.selection,$=G.findEventRange(m,F),q=F.dataTransfer;ee.select(m,$),I.isDraggingInternally&&L&&!W.equals(L,$)&&!y.void(m,{at:$,voids:!0})&&ee.delete(m,{at:L}),G.insertData(m,q),G.isFocused(m)||G.focus(m)}I.isDraggingInternally=!1},[s,m,g.onDrop,I]),onDragEnd:C.useCallback(F=>{!s&&I.isDraggingInternally&&g.onDragEnd&&G.hasTarget(m,F.target)&&g.onDragEnd(F),I.isDraggingInternally=!1},[s,I,g,m]),onFocus:C.useCallback(F=>{if(!s&&!I.isUpdatingSelection&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onFocus)){var L=G.toDOMNode(m,m),$=G.findDocumentOrShadowRoot(m);if(I.latestElement=$.activeElement,Nn&&F.target!==L){L.focus();return}Gt.set(m,!0)}},[s,I,m,g.onFocus]),onKeyDown:C.useCallback(F=>{if(!s&&G.hasEditableTarget(m,F.target)){var L;(L=N.current)===null||L===void 0||L.handleKeyDown(F);var{nativeEvent:$}=F;if(G.isComposing(m)&&$.isComposing===!1&&(dn.set(m,!1),v(!1)),rt(F,g.onKeyDown)||G.isComposing(m))return;var{selection:q}=m,ne=m.children[q!==null?q.focus.path[0]:0],te=ed(se.string(ne))==="rtl";if(Ie.isRedo($)){F.preventDefault();var Z=m;typeof Z.redo=="function"&&Z.redo();return}if(Ie.isUndo($)){F.preventDefault();var le=m;typeof le.undo=="function"&&le.undo();return}if(Ie.isMoveLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",reverse:!0});return}if(Ie.isMoveLineForward($)){F.preventDefault(),ee.move(m,{unit:"line"});return}if(Ie.isExtendLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus",reverse:!0});return}if(Ie.isExtendLineForward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus"});return}if(Ie.isMoveBackward($)){F.preventDefault(),q&&W.isCollapsed(q)?ee.move(m,{reverse:!te}):ee.collapse(m,{edge:te?"end":"start"});return}if(Ie.isMoveForward($)){F.preventDefault(),q&&W.isCollapsed(q)?ee.move(m,{reverse:te}):ee.collapse(m,{edge:te?"start":"end"});return}if(Ie.isMoveWordBackward($)){F.preventDefault(),q&&W.isExpanded(q)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:!te});return}if(Ie.isMoveWordForward($)){F.preventDefault(),q&&W.isExpanded(q)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:te});return}if(Ht){if((fd||cr)&&q&&(Ie.isDeleteBackward($)||Ie.isDeleteForward($))&&W.isCollapsed(q)){var J=se.parent(m,q.anchor.path);if(ce.isElement(J)&&y.isVoid(m,J)&&(y.isInline(m,J)||y.isBlock(m,J))){F.preventDefault(),y.deleteBackward(m,{unit:"block"});return}}}else{if(Ie.isBold($)||Ie.isItalic($)||Ie.isTransposeCharacter($)){F.preventDefault();return}if(Ie.isSoftBreak($)){F.preventDefault(),y.insertSoftBreak(m);return}if(Ie.isSplitBlock($)){F.preventDefault(),y.insertBreak(m);return}if(Ie.isDeleteBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m);return}if(Ie.isDeleteForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m);return}if(Ie.isDeleteLineBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"line"});return}if(Ie.isDeleteLineForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"line"});return}if(Ie.isDeleteWordBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"word"});return}if(Ie.isDeleteWordForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"word"});return}}}},[s,m,g.onKeyDown]),onPaste:C.useCallback(F=>{!s&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onPaste)&&(!Ht||tb(F.nativeEvent)||cr)&&(F.preventDefault(),G.insertData(m,F.clipboardData))},[s,m,g.onPaste])}),C.createElement(ny,{decorations:M,node:m,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:m.selection})))))},ay=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Ft({},t),n,at&&C.createElement("br",null))},iy=()=>[],sy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),C0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Gu=e=>Xt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),oy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fd=C.createContext(!1),uy=()=>C.useContext(Fd),ly=C.createContext({});function cy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var dy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],fy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Hn(e,dy),[l,u]=C.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ye.stringify(s)));if(!y.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ye.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:f}=cy(t),p=C.useCallback(m=>{var b;switch(r&&r(t.children),m==null||(b=m.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(cs.set(t,p),()=>{cs.set(t,()=>{})}),[t,p]);var[h,g]=C.useState(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),kr(()=>{var m=()=>g(G.isFocused(t));return dd>=17?(document.addEventListener("focusin",m),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",m)}):(document.addEventListener("focus",m,!0),document.addEventListener("blur",m,!0),()=>{document.removeEventListener("focus",m,!0),document.removeEventListener("blur",m,!0)})},[]),C.createElement(ly.Provider,{value:c},C.createElement(kd.Provider,{value:l},C.createElement(Us.Provider,{value:l.editor},C.createElement(Fd.Provider,{value:h},n))))},Qu=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ju=(e,t,n)=>{var r=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Qu(r,a)&&Qu(a,r)},hy=(e,t)=>{var n=y.range(e,W.end(t)),r=Array.from(y.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ju(e,y.range(e,r[a]),n))return y.range(e,r[a],n);if(r.length<2)return y.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ju(e,y.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return y.range(e,r[i],n)};function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function el(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var my=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 qa.set(r,new WeakMap),r.addMark=(u,c)=>{var f,p;(f=Zs.get(r))===null||f===void 0||f(),!Et.get(r)&&(p=ut.get(r))!==null&&p!==void 0&&p.length&&Et.set(r,null),Lt.delete(r),o(u,c)},r.removeMark=u=>{var c;!Et.get(r)&&(c=ut.get(r))!==null&&c!==void 0&&c.length&&Et.set(r,null),Lt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=y.above(r,{match:g=>ce.isElement(g)&&y.isBlock(r,g),at:r.selection});if(c){var[,f]=c,p=y.range(r,f,r.selection.anchor),h=hy(r,p);W.isCollapsed(h)||ee.delete(r,{at:h})}}},r.apply=u=>{var c=[],f=[],p=ut.get(r);if(p!=null&&p.length){var h=p.map(R=>mb(R,u)).filter(Boolean);ut.set(r,h)}var g=Kt.get(r);g&&Kt.set(r,zu(r,g,u));var m=Vt.get(r);if(m!=null&&m.at){var b=Ce.isPoint(m==null?void 0:m.at)?hs(r,m.at,u):zu(r,m.at,u);Vt.set(r,b?el(el({},m),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Fn(r,u.path));break}case"set_selection":{var v;(v=mr.get(r))===null||v===void 0||v.unref(),mr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Fn(r,j.parent(u.path)));break}case"merge_node":{var x=j.previous(u.path);c.push(...Fn(r,x));break}case"move_node":{var A=j.common(j.parent(u.path),j.parent(u.newPath));c.push(...Fn(r,A));var k;j.isBefore(u.path,u.newPath)?(c.push(...Fn(r,j.parent(u.path))),k=u.newPath):(c.push(...Fn(r,j.parent(u.newPath))),k=u.path);var E=se.get(t,j.parent(k)),B=G.findKey(r,E),P=y.pathRef(r,j.parent(k));f.push([P,B]);break}}a(u);for(var[z,I]of c){var[N]=y.node(r,z);Ca.set(N,I)}for(var[O,w]of f)if(O.current){var[T]=y.node(r,O.current);Ca.set(T,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,p]=W.edges(c),h=y.void(r,{at:f.path}),g=y.void(r,{at:p.path});if(!(W.isCollapsed(c)&&!h)){var m=G.toDOMRange(r,c),b=m.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(N=>{N.textContent&&N.textContent.trim()!==""&&(v=N)}),g){var[x]=g,A=m.cloneRange(),k=G.toDOMNode(r,x);A.setEndAfter(k),b=A.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(N=>{var O=N.getAttribute("data-slate-zero-width")==="n";N.textContent=O?`
|
|
133
|
+
`:""}),gd(v)){var E=v.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(v),b.appendChild(E),v=E}var B=r.getFragment(),P=JSON.stringify(B),z=window.btoa(encodeURIComponent(P));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var I=b.ownerDocument.createElement("div");return I.appendChild(b),I.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",bd(I)),b.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||sb(u);if(c){var f=decodeURIComponent(window.atob(c)),p=JSON.parse(f);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),p=!1;for(var h of f)p&&ee.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var c=dd<18?Yf.unstable_batchedUpdates:f=>f();c(()=>{var f=cs.get(r);f&&f(u),i(u)})},r},Fn=(e,t)=>{var n=[];for(var[r,a]of y.levels(e,{at:t})){var i=G.findKey(e,r);n.push([a,i])}return n};const py={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,setOpenTooltip:()=>{},showLinkEditor:!1,setShowLinkEditor:()=>{},lastAnchor:null,setLastAnchor:()=>{}},xn=C.createContext(py),gy=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{...e,children:t});case"link":return d.jsx("a",{...e,children:t});case"list_item":return d.jsx("li",{...e,children:t});case"ol_list":return d.jsx("ol",{...e,children:t});case"ul_list":return d.jsx("ul",{...e,children:t});case"span":return d.jsx("span",{...e,children:t});case"paragraph":return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},vy=({attributes:e,children:t,leaf:n})=>{const r=n;return r.bold&&(t=d.jsx("strong",{children:t})),r.italic&&(t=d.jsx("em",{children:t})),r.strikeThrough&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Qs=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=Xn(),{id:u,tabbableOption:c,setFocus:f,openTooltip:p,setOpenTooltip:h,setLastAnchor:g}=C.useContext(xn),m={};return e!==c&&(m.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{h(e)},onMouseLeave:()=>{h(null)},onFocus:()=>{h(e)},onBlur:b=>{b.stopPropagation(),h(null),l.selection&&g(l.selection.anchor)},contentEditable:!1,children:[d.jsxs("button",{...s,...m,className:Y(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,x,A,k;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const E=b.currentTarget.closest("li");let B=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const I=E==null?void 0:E.previousElementSibling;I?B=I:B=(v=E==null?void 0:E.parentElement)==null?void 0:v.lastElementChild}else B||(B=(x=E==null?void 0:E.parentElement)==null?void 0:x.firstElementChild);const P=B==null?void 0:B.className.split(" ")[0];P&&(f(P),(A=B==null?void 0:B.querySelector("button"))==null||A.focus());break;default:const z=b.currentTarget.closest("fieldset");if(z){(k=z==null?void 0:z.previousElementSibling)==null||k.focus();break}}},children:[d.jsx(Le,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Va,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},tl=["ol_list","ul_list"],Td=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(y.nodes(e,{at:y.unhangRange(e,n),match:a=>{const i=a;return!y.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},by=(e,t)=>{const n=Td(e,t),r=tl.includes(t);ee.unwrapNodes(e,{match:s=>{const o=s;return!y.isEditor(s)&&ce.isElement(s)&&tl.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(ee.setNodes(e,i),!n&&r){const s={type:t,children:[]};ee.wrapNodes(e,s)}},yy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Td(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{by(r,e),n(a?null:e)}})},Dy=70,Cy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(xn),i=uy(),s=t==="link-editor"?a:!1,o=(l,u)=>{l.style.top=`${u.top+window.scrollY-l.offsetHeight-Dy}px`,l.style.left=`${u.left+window.scrollX-l.offsetWidth/2+u.width/2}px`};return C.useEffect(()=>{const l=r==null?void 0:r.current;if(!l||!a)return;const{selection:u}=e;if(!u||!i||W.isCollapsed(u)||y.string(e,u)===""){const h=document.getElementById(n);if(!h)return;o(l,h.getBoundingClientRect());return}const c=window.getSelection(),f=c==null?void 0:c.getRangeAt(0),p=f?f==null?void 0:f.getBoundingClientRect():{top:0,left:0,width:0};o(l,p)},[s,e.selection]),r},xy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=y.nodes(e,{at:r,match:i=>i.type==="link"});if(a){let s=a[0].link,o=s;s.includes("//")?o=s.split("//")[1]:s=`http://${s}`,o.includes("/")&&(o=o.split("/")[0]),n({full:s,pretty:o})}else n(null)},[e,e.selection]),t},pr=e=>{const[t]=y.nodes(e,{match:n=>{const r=n;return!y.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},wy=(e,t)=>{e.selection&&Sd(e,t)},Sd=(e,t)=>{pr(e)&&jd(e);const{selection:n}=e,r=n&&W.isCollapsed(n),a={type:"link",link:t,children:r?[{text:t}]:[]};r?ee.insertNodes(e,a):(ee.wrapNodes(e,a,{split:!0}),ee.collapse(e,{edge:"end"}))},jd=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!y.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let bi=null;const Ey=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,setShowLinkEditor:a,setLastAnchor:i}=C.useContext(xn),s=Xn(),{selection:o}=s,l=xy(s),[u,c]=C.useState(pr(s)),f=Cy(s,"link-editor",`${n}-link`),p=C.useRef(null);C.useEffect(()=>{var b;!u&&r&&((b=p.current)==null||b.focus())},[u]),C.useEffect(()=>{bi&&clearTimeout(bi),bi=setTimeout(()=>{c(pr(s))},500)},[s.selection]);const h=o&&W.isCollapsed(o),g=[],m=["open","edit","remove"].map(b=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${b}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:b}),b){case"open":v.href=(l==null?void 0:l.full)||"",v.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),a(!1)},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Le,{children:e.formatMessage({id:`${t}${b}_text`})})]});break;case"edit":v.onClick=()=>{h||c(!1)},h&&(v.disabled=!0);break;case"remove":v.onClick=()=>{pr(s)&&(jd(s),i(null)),a(!1)};break}return v});return d.jsx(Va,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasPointer:"bottom",hasForm:!u},functions:{onBlur:()=>{a(!1)}},callbacks:{onOpen:()=>{setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()})}},children:r?u?d.jsx(Dn,{wrappers:g,buttons:m}):d.jsx(Qn,{id:`${n}-link-editor`,functions:{onSuccess:async b=>{setTimeout(()=>{b.url&&(wy(s,b.url),i(null)),a(!1)})}},fields:[{id:"url",type:"url",inputRef:p,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}],button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}}):null})},_y=()=>{const e=Xn(),{setFocus:t,setShowLinkEditor:n}=C.useContext(xn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(pr(e))},[e.selection]),d.jsx(Qs,{id:"link",active:r,hasDivider:!0,callback:()=>{n(!0),t(r?null:"link"),a(!0)}})},Od=(e,t)=>{const n=y.marks(e);return n?n[t]===!0:!1},Pd=(e,t)=>{Od(e,t)?y.removeMark(e,t):y.addMark(e,t,!0)},By=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Od(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{Pd(r,e),n(a?null:e)}})},xa=["bold","italic","strikeThrough"],ky=["ol_list","ul_list","block_quote"];const Ay=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Le,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[xa.map((n,r)=>d.jsx(By,{format:n,hasDivider:r===xa.length-1},n)),d.jsx(_y,{}),ky.map((n,r)=>d.jsx(yy,{format:n,hasDivider:r===1},n))]})]}),d.jsx(Ey,{})]})};var Fy=Oy,Ty=/^(?:\w+:)?\/\/(\S+)$/,Sy=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,jy=/^[^\s\.]+\.\S{2,}$/;function Oy(e){if(typeof e!="string")return!1;var t=e.match(Ty);if(!t)return!1;var n=t[1];return n?!!(Sy.test(n)||jy.test(n)):!1}const Py=tn(Fy),Ny=e=>{const{insertText:t,isInline:n}=e;return e.isInline=r=>{const a=r;return["link"].includes(a.type)||n(r)},e.insertText=r=>{r&&Py(r)?Sd(e,r):t(r)},e};function nl(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,Nd=Object.prototype.toString,rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,il=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Nd.call(t)==="[object Array]"},sl=function(t){if(!t||Nd.call(t)!=="[object Object]")return!1;var n=ua.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ua.call(t,a)},ol=function(t,n){rl&&n.name==="__proto__"?rl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ul=function(t,n){if(n==="__proto__")if(ua.call(t,n)){if(al)return al(t,n).value}else return;return t[n]},Ry=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=ul(o,n),a=ul(t,n),o!==a&&(c&&a&&(sl(a)||(i=il(a)))?(i?(i=!1,s=r&&il(r)?r:[]):s=r&&sl(r)?r:{},ol(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&ol(o,{name:n,newValue:a}));return o};const yi=tn(Ry);function ps(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 My(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Iy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Iy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function gr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ll(e.position):"start"in e||"end"in e?ll(e):"line"in e||"column"in e?gs(e):""}function gs(e){return cl(e&&e.line)+":"+cl(e&&e.column)}function ll(e){return gs(e&&e.start)+"-"+gs(e&&e.end)}function cl(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=gr(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 Tt={basename:$y,dirname:Ly,extname:zy,join:qy,sep:"/"};function $y(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Tr(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 Ly(e){if(Tr(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 zy(e){Tr(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 qy(...e){let t=-1,n;for(;++t<e.length;)Tr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Wy(n)}function Wy(e){Tr(e);const t=e.codePointAt(0)===47;let n=Hy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Hy(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 Tr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Uy={cwd:Vy};function Vy(){return"/"}function vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ky(e){if(typeof e=="string")e=new URL(e);else if(!vs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Zy(e)}function Zy(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 Di=["history","path","basename","stem","extname","dirname"];class Yy{constructor(t){let n;t?vs(t)?n={path:t}:typeof t=="string"||Gy(t)?n={value:t}:n=t:n={},this.cwd=Uy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Di.length;){const i=Di[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)Di.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Tt.basename(this.path):void 0}set basename(t){xi(t,"basename"),Ci(t,"basename"),this.path=Tt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Tt.dirname(this.path):void 0}set dirname(t){dl(this.basename,"dirname"),this.path=Tt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Tt.extname(this.path):void 0}set extname(t){if(Ci(t,"extname"),dl(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=Tt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vs(t)&&(t=Ky(t)),xi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Tt.basename(this.path,this.extname):void 0}set stem(t){xi(t,"stem"),Ci(t,"stem"),this.path=Tt.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 Ci(e,t){if(e&&e.includes(Tt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Tt.sep+"`")}function xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function dl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Gy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qy=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},Jy={}.hasOwnProperty;class Js extends Qy{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=My()}copy(){const t=new Js;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?(_i("data",this.frozen),this.namespace[t]=n,this):Jy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_i("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=Kr(t),r=this.parser||this.Parser;return wi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),wi("process",this.parser||this.Parser),Ei("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Kr(t),l=r.parse(o);r.run(l,o,function(c,f,p){if(c||!f||!p)return u(c);const h=f,g=r.stringify(h,p);t1(g)?p.value=g:p.result=g,u(c,p)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),wi("processSync",this.parser||this.Parser),Ei("processSync",this.compiler||this.Compiler),this.process(t,a),hl("processSync","process",n),r;function a(i,s){n=!0,nl(i),r=s}}run(t,n,r){fl(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=Kr(n);a.run(t,l,u);function u(c,f,p){const h=f||t;c?o(c):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),hl("runSync","run",r),a;function i(s,o){nl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Kr(n),a=this.compiler||this.Compiler;return Ei("stringify",a),fl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(_i("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}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 c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[h,...g]=c;const m=r[p][1];ps(m)&&ps(h)&&(h=yi(!0,m,h)),r[p]=[u,h,...g]}}}}const Xy=new Js().freeze();function wi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ei(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _i(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 fl(e){if(!ps(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Kr(e){return e1(e)?e:new Yy(e)}function e1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function t1(e){return typeof e=="string"||n1(e)}function n1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r1={};function a1(e,t){const n=t||r1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Rd(e,r,a)}function Rd(e,t,n){if(i1(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 ml(e.children,t,n)}return Array.isArray(e)?ml(e,t,n):""}function ml(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Rd(e[a],t,n);return r.join("")}function i1(e){return!!(e&&typeof e=="object")}const pl=document.createElement("i");function Xs(e){const t="&"+e+";";pl.innerHTML=t;const n=pl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ot(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 yt(e,t){return e.length>0?(Ot(e,e.length,0,t),e):t}const gl={}.hasOwnProperty;function s1(e){const t={};let n=-1;for(;++n<e.length;)o1(t,e[n]);return t}function o1(e,t){let n;for(n in t){const a=(gl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){gl.call(a,s)||(a[s]=[]);const o=i[s];u1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function u1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ot(e,0,0,r)}function Md(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 $n(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const St=sn(/[A-Za-z]/),_t=sn(/[\dA-Za-z]/),l1=sn(/[#-'*+\--9=?A-Z^-~]/);function bs(e){return e!==null&&(e<32||e===127)}const ys=sn(/\d/),c1=sn(/[\dA-Fa-f]/),d1=sn(/[!-/:-@[-`{-~]/);function ge(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ke(e){return e===-2||e===-1||e===32}const f1=sn(/\p{P}|\p{S}/u),h1=sn(/\s/);function sn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return ke(l)?(e.enter(n),o(l)):t(l)}function o(l){return ke(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const m1={tokenize:p1};function p1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ne(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ge(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const g1={tokenize:v1},vl={tokenize:b1};function v1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const k=t.events.length;let E=k,B;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){B=t.events[E][1].end;break}v(r);let P=k;for(;P<t.events.length;)t.events[P][1].end=Object.assign({},B),P++;return Ot(t.events,E+1,0,t.events.slice(k)),t.events.length=P,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return p(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vl,c,f)(A)}function c(A){return a&&x(),v(r),p(A)}function f(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function p(A){return t.containerState={},e.attempt(vl,h,g)(A)}function h(A){return r++,n.push([t.currentConstruct,t.containerState]),p(A)}function g(A){if(A===null){a&&x(),v(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),m(A)}function m(A){if(A===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(A);return}return ge(A)?(e.consume(A),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),m)}function b(A,k){const E=t.sliceStream(A);if(k&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const P=t.events.length;let z=P,I,N;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(I){N=t.events[z][1].end;break}I=!0}for(v(r),B=P;B<t.events.length;)t.events[B][1].end=Object.assign({},N),B++;Ot(t.events,z+1,0,t.events.slice(P)),t.events.length=B}}function v(A){let k=n.length;for(;k-- >A;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function b1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bl(e){if(e===null||ct(e)||h1(e))return 1;if(f1(e))return 2}function eo(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 Ds={name:"attention",tokenize:D1,resolveAll:y1};function y1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);yl(f,-l),yl(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,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=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=yt(u,eo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Ot(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function D1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=bl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=bl(l),f=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(c||!f)),t(l)}}function yl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const C1={name:"autolink",tokenize:x1};function x1(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return St(h)?(e.consume(h),s):u(h)}function s(h){return h===43||h===45||h===46||_t(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||_t(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||bs(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),c):l1(h)?(e.consume(h),u):n(h)}function c(h){return _t(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,c):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||_t(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const Wa={tokenize:w1,partial:!0};function w1(e,t,n){return r;function r(i){return ke(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ge(i)?t(i):n(i)}}const Id={name:"blockQuote",tokenize:E1,continuation:{tokenize:_1},exit:B1};function E1(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 ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function _1(e,t,n){const r=this;return a;function a(s){return ke(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Id,t,n)(s)}}function B1(e){e.exit("blockQuote")}const $d={name:"characterEscape",tokenize:k1};function k1(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 d1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Ld={name:"characterReference",tokenize:A1};function A1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=c1,c):(e.enter("characterReferenceValue"),i=7,s=ys,c(f))}function c(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===_t&&!Xs(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Dl={tokenize:T1,partial:!0},Cl={name:"codeFenced",tokenize:F1,concrete:!0};function F1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const P=r.events[r.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(B)}function c(B){return B===o?(s++,e.consume(B),c):s<3?n(B):(e.exit("codeFencedFenceSequence"),ke(B)?Ne(e,f,"whitespace")(B):f(B))}function f(B){return B===null||ge(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(Dl,m,k)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(B)):ke(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ge(B)?f(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(B)):B===96&&B===o?n(B):(e.consume(B),g)}function m(B){return e.attempt(a,k,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&ke(B)?Ne(e,x,"linePrefix",i+1)(B):x(B)}function x(B){return B===null||ge(B)?e.check(Dl,m,k)(B):(e.enter("codeFlowValue"),A(B))}function A(B){return B===null||ge(B)?(e.exit("codeFlowValue"),x(B)):(e.consume(B),A)}function k(B){return e.exit("codeFenced"),t(B)}function E(B,P,z){let I=0;return N;function N(M){return B.enter("lineEnding"),B.consume(M),B.exit("lineEnding"),O}function O(M){return B.enter("codeFencedFence"),ke(M)?Ne(B,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(B.enter("codeFencedFenceSequence"),T(M)):z(M)}function T(M){return M===o?(I++,B.consume(M),T):I>=s?(B.exit("codeFencedFenceSequence"),ke(M)?Ne(B,R,"whitespace")(M):R(M)):z(M)}function R(M){return M===null||ge(M)?(B.exit("codeFencedFence"),P(M)):z(M)}}}function T1(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 Bi={name:"codeIndented",tokenize:j1},S1={tokenize:O1,partial:!0};function j1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ge(u)?e.attempt(S1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ge(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function O1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ge(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ne(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ge(s)?a(s):n(s)}}const P1={name:"codeText",tokenize:M1,resolve:N1,previous:R1};function N1(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 R1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ge(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ge(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function zd(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,I1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Ot(e,a,n-a+1,o))}}return!u}function I1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,f,p=-1,h=n,g=0,m=0;const b=[m];for(;h;){for(;e[++a][1]!==h;);i.push(a),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),f&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,b.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),x=i.pop();l.unshift([x,x+v.length-1]),Ot(e,x,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const $1={tokenize:q1,resolve:z1},L1={tokenize:W1,partial:!0};function z1(e){return zd(e),e}function q1(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):ge(o)?e.check(L1,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 W1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(e,i,"linePrefix")}function i(s){if(s===null||ge(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 qd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||bs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ge(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function m(v){return!c&&(v===null||v===41||ct(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,m):v===41?(e.consume(v),c--,m):v===null||v===32||v===40||bs(v)?n(v):(e.consume(v),v===92?b:m)}function b(v){return v===40||v===41||v===92?(e.consume(v),m):m(v)}}function Wd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),c}function c(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ge(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||ge(h)||o++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!ke(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function Hd(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):ge(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ge(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(e.consume(p),c):c(p)}}function vr(e,t){let n;return r;function r(a){return ge(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ke(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const H1={name:"definition",tokenize:V1},U1={tokenize:K1,partial:!0};function V1(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Wd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ct(h)?vr(e,u)(h):u(h)}function u(h){return qd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(U1,f,f)(h)}function f(h){return ke(h)?Ne(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ge(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function K1(e,t,n){return r;function r(o){return ct(o)?vr(e,a)(o):n(o)}function a(o){return Hd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ke(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ge(o)?t(o):n(o)}}const Z1={name:"hardBreakEscape",tokenize:Y1};function Y1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ge(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const G1={name:"headingAtx",tokenize:J1,resolve:Q1};function Q1(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"},Ot(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function J1(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ct(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ge(c)?(e.exit("atxHeading"),t(c)):ke(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ct(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const X1=["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"],xl=["pre","script","style","textarea"],eD={name:"htmlFlow",tokenize:aD,resolveTo:rD,concrete:!0},tD={tokenize:sD,partial:!0},nD={tokenize:iD,partial:!0};function rD(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 aD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,m):_===63?(e.consume(_),a=3,r.interrupt?t:D):St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,h):_===91?(e.consume(_),a=5,o=0,g):St(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function h(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const F="CDATA[";return _===F.charCodeAt(o++)?(e.consume(_),o===F.length?r.interrupt?t:w:g):n(_)}function m(_){return St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||ct(_)){const F=_===47,L=s.toLowerCase();return!F&&!i&&xl.includes(L)?(a=1,r.interrupt?t(_):w(_)):X1.includes(s.toLowerCase())?(a=6,F?(e.consume(_),v):r.interrupt?t(_):w(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?x(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:w):n(_)}function x(_){return ke(_)?(e.consume(_),x):N(_)}function A(_){return _===47?(e.consume(_),N):_===58||_===95||St(_)?(e.consume(_),k):ke(_)?(e.consume(_),A):N(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),B):ke(_)?(e.consume(_),E):A(_)}function B(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,P):ke(_)?(e.consume(_),B):z(_)}function P(_){return _===l?(e.consume(_),l=null,I):_===null||ge(_)?n(_):(e.consume(_),P)}function z(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ct(_)?E(_):(e.consume(_),z)}function I(_){return _===47||_===62||ke(_)?A(_):n(_)}function N(_){return _===62?(e.consume(_),O):n(_)}function O(_){return _===null||ge(_)?w(_):ke(_)?(e.consume(_),O):n(_)}function w(_){return _===45&&a===2?(e.consume(_),K):_===60&&a===1?(e.consume(_),V):_===62&&a===4?(e.consume(_),U):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),Q):ge(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(tD,X,T)(_)):_===null||ge(_)?(e.exit("htmlFlowData"),T(_)):(e.consume(_),w)}function T(_){return e.check(nD,R,X)(_)}function R(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||ge(_)?T(_):(e.enter("htmlFlowData"),w(_))}function K(_){return _===45?(e.consume(_),D):w(_)}function V(_){return _===47?(e.consume(_),s="",ie):w(_)}function ie(_){if(_===62){const F=s.toLowerCase();return xl.includes(F)?(e.consume(_),U):w(_)}return St(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):w(_)}function Q(_){return _===93?(e.consume(_),D):w(_)}function D(_){return _===62?(e.consume(_),U):_===45&&a===2?(e.consume(_),D):w(_)}function U(_){return _===null||ge(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),U)}function X(_){return e.exit("htmlFlow"),t(_)}}function iD(e,t,n){const r=this;return a;function a(s){return ge(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 sD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const oD={name:"htmlText",tokenize:uD};function uD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),E):D===63?(e.consume(D),A):St(D)?(e.consume(D),z):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):St(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),h):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),p):ge(D)?(s=f,V(D)):(e.consume(D),f)}function p(D){return D===45?(e.consume(D),h):f(D)}function h(D){return D===62?K(D):D===45?p(D):f(D)}function g(D){const U="CDATA[";return D===U.charCodeAt(i++)?(e.consume(D),i===U.length?m:g):n(D)}function m(D){return D===null?n(D):D===93?(e.consume(D),b):ge(D)?(s=m,V(D)):(e.consume(D),m)}function b(D){return D===93?(e.consume(D),v):m(D)}function v(D){return D===62?K(D):D===93?(e.consume(D),v):m(D)}function x(D){return D===null||D===62?K(D):ge(D)?(s=x,V(D)):(e.consume(D),x)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):ge(D)?(s=A,V(D)):(e.consume(D),A)}function k(D){return D===62?K(D):A(D)}function E(D){return St(D)?(e.consume(D),B):n(D)}function B(D){return D===45||_t(D)?(e.consume(D),B):P(D)}function P(D){return ge(D)?(s=P,V(D)):ke(D)?(e.consume(D),P):K(D)}function z(D){return D===45||_t(D)?(e.consume(D),z):D===47||D===62||ct(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),K):D===58||D===95||St(D)?(e.consume(D),N):ge(D)?(s=I,V(D)):ke(D)?(e.consume(D),I):K(D)}function N(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),N):O(D)}function O(D){return D===61?(e.consume(D),w):ge(D)?(s=O,V(D)):ke(D)?(e.consume(D),O):I(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,T):ge(D)?(s=w,V(D)):ke(D)?(e.consume(D),w):(e.consume(D),R)}function T(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ge(D)?(s=T,V(D)):(e.consume(D),T)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?I(D):(e.consume(D),R)}function M(D){return D===47||D===62||ct(D)?I(D):n(D)}function K(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ie}function ie(D){return ke(D)?Ne(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Q(D)}function Q(D){return e.enter("htmlTextData"),s(D)}}const to={name:"labelEnd",tokenize:mD,resolveTo:hD,resolveAll:fD},lD={tokenize:pD},cD={tokenize:gD},dD={tokenize:vD};function fD(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)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=yt(o,e.slice(i+1,i+r+3)),o=yt(o,[["enter",c,t]]),o=yt(o,eo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=yt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=yt(o,e.slice(s+1)),o=yt(o,[["exit",l,t]]),Ot(e,i,e.length,o),e}function mD(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?f(p):(s=r.parser.defined.includes($n(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(lD,c,s?c:f)(p):p===91?e.attempt(cD,c,s?u:f)(p):s?c(p):f(p)}function u(p){return e.attempt(dD,c,f)(p)}function c(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function pD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?vr(e,i)(f):i(f)}function i(f){return f===41?c(f):qd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?vr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Hd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?vr(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function gD(e,t,n){const r=this;return a;function a(o){return Wd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function vD(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 bD={name:"labelStartImage",tokenize:yD,resolveAll:to.resolveAll};function yD(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 DD={name:"labelStartLink",tokenize:CD,resolveAll:to.resolveAll};function CD(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 ki={name:"lineEnding",tokenize:xD};function xD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const la={name:"thematicBreak",tokenize:wD};function wD(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||ge(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),ke(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:BD,continuation:{tokenize:kD},exit:FD},ED={tokenize:TD,partial:!0},_D={tokenize:AD,partial:!0};function BD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ys(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(la,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return ys(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Wa,r.interrupt?n:c,e.attempt(ED,p,f))}function c(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return ke(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function kD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wa,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!ke(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(_D,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(ot,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function AD(e,t,n){const r=this;return Ne(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function FD(e){e.exit(this.containerState.type)}function TD(e,t,n){const r=this;return Ne(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!ke(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wl={name:"setextUnderline",tokenize:jD,resolveTo:SD};function SD(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 jD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),ke(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ge(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const OD={tokenize:PD};function PD(e){const t=this,n=e.attempt(Wa,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt($1,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 ND={resolveAll:Vd()},RD=Ud("string"),MD=Ud("text");function Ud(e){return{tokenize:t,resolveAll:Vd(e==="text"?ID:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=a[c];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Vd(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 ID(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 $D(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:A,exit:k,attempt:P(E),check:P(B),interrupt:P(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:m,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(O){return s=yt(s,O),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=eo(i,u.events,u),u.events)}function p(O,w){return zD(h(O),w)}function h(O){return LD(s,O)}function g(){const{line:O,column:w,offset:T,_index:R,_bufferIndex:M}=r;return{line:O,column:w,offset:T,_index:R,_bufferIndex:M}}function m(O){a[O.line]=O.column,N()}function b(){let O;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(O){c=c(O)}function x(O){ge(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,N()):O!==-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=O}function A(O,w){const T=w||{};return T.type=O,T.start=g(),u.events.push(["enter",T,u]),o.push(T),T}function k(O){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function E(O,w){z(O,w.from)}function B(O,w){w.restore()}function P(O,w){return T;function T(R,M,K){let V,ie,Q,D;return Array.isArray(R)?X(R):"tokenize"in R?X([R]):U(R);function U($){return q;function q(ne){const te=ne!==null&&$[ne],Z=ne!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(le)(ne)}}function X($){return V=$,ie=0,$.length===0?K:_($[ie])}function _($){return q;function q(ne){return D=I(),Q=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?L():$.tokenize.call(w?Object.assign(Object.create(u),w):u,l,F,L)(ne)}}function F($){return O(Q,D),M}function L($){return D.restore(),++ie<V.length?_(V[ie]):K}}}function z(O,w){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ot(u.events,w,u.events.length-w,O.resolve(u.events.slice(w),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function I(){const O=g(),w=u.previous,T=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:K,from:R};function K(){r=O,u.previous=w,u.currentConstruct=T,u.events.length=R,o=M,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function LD(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 zD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
134
134
|
`;break}case-3:{s=`\r
|
|
135
|
-
`;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 qD={42:ot,43:ot,45:ot,48:ot,49:ot,50:ot,51:ot,52:ot,53:ot,54:ot,55:ot,56:ot,57:ot,62:Id},WD={91:H1},HD={[-2]:Bi,[-1]:Bi,32:Bi},UD={35:G1,42:la,45:[wl,la],60:eD,61:wl,95:la,96:Cl,126:Cl},VD={38:Ld,92:$d},KD={[-5]:ki,[-4]:ki,[-3]:ki,33:bD,38:Ld,42:Ds,60:[C1,oD],91:DD,92:[Z1,$d],93:to,95:Ds,96:P1},ZD={null:[Ds,ND]},YD={null:[42,95]},GD={null:[]},QD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YD,contentInitial:WD,disable:GD,document:qD,flow:UD,flowInitial:HD,insideSpan:ZD,string:VD,text:KD},Symbol.toStringTag,{value:"Module"}));function JD(e){const n=s1([QD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(m1),document:a(g1),flow:a(OD),string:a(RD),text:a(MD)};return r;function a(i){return s;function s(o){return $D(r,i,o)}}}function XD(e){for(;!zd(e););return e}const El=/[\0\t\n\r]/g;function eC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(El.lastIndex=f,u=El.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(f);break}if(h===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(i.slice(f,p)),e+=p-f),h){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const tC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nC(e){return e.replace(tC,rC)}function rC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Md(n.slice(i?2:1),i?16:10)}return Xs(n)||e}const Kd={}.hasOwnProperty;function aC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),iC(n)(XD(JD(n).document().write(eC()(e,t,!0))))}function iC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(pe),blockQuote:i(te),characterEscape:I,characterReference:I,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(le,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(be),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:I,htmlText:i(Se,s),htmlTextData:I,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:p,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Ae),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:ne,autolinkProtocol:z,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:$,codeFenced:l(b),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:l(v),codeText:l(M),codeTextData:N,data:N,definition:l(),definitionDestinationString:k,definitionLabelString:x,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(E),hardBreakTrailing:l(E),htmlFlow:l(T),htmlFlowData:N,htmlText:l(R),htmlTextData:N,image:l(V),label:Q,labelText:ie,lineEnding:O,link:l(K),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:D,resourceTitleString:U,resource:X,setextHeading:l(q),setextHeadingLineSequence:P,setextHeadingText:B,strong:l(),thematicBreak:l()}};Zd(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const fe={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},me=[];let De=-1;for(;++De<H.length;)if(H[De][1].type==="listOrdered"||H[De][1].type==="listUnordered")if(H[De][0]==="enter")me.push(De);else{const Ue=me.pop();De=a(H,Ue,De)}for(De=-1;++De<H.length;){const Ue=t[H[De][0]];Kd.call(Ue,H[De][1].type)&&Ue[H[De][1].type].call(Object.assign({sliceSerialize:H[De][2].sliceSerialize},fe),H[De][1])}if(fe.tokenStack.length>0){const Ue=fe.tokenStack[fe.tokenStack.length-1];(Ue[1]||_l).call(fe,void 0,Ue[0])}for(ae.position={start:Ut(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ut(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<t.transforms.length;)ae=t.transforms[De](ae)||ae;return ae}function a(H,ae,fe){let me=ae-1,De=-1,Ue=!1,Ve,ft,Nt,wt;for(;++me<=fe;){const Qe=H[me];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?De++:De--,wt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ve&&!wt&&!De&&!Nt&&(Nt=me),wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wt=void 0}if(!De&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||De===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ve){let Bt=me;for(ft=void 0;Bt--;){const ht=H[Bt];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;ft&&(H[ft][1].type="lineEndingBlank",Ue=!0),ht[1].type="lineEnding",ft=Bt}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Nt&&(!ft||Nt<ft)&&(Ve._spread=!0),Ve.end=Object.assign({},ft?H[ft][1].start:Qe[1].end),H.splice(ft||me,0,["exit",Ve,Qe[2]]),me++,fe++}if(Qe[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ve=Bt,H.splice(me,0,["enter",Bt,Qe[2]]),me++,fe++,Nt=void 0,wt=!0}}}return H[ae][1]._spread=Ue,fe}function i(H,ae){return fe;function fe(me){o.call(this,H(me),me),ae&&ae.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,fe]),H.position={start:Ut(ae.start),end:void 0}}function l(H){return ae;function ae(fe){H&&H.call(this,fe),u.call(this,fe)}}function u(H,ae){const fe=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==H.type&&(ae?ae.call(this,H,me[0]):(me[1]||_l).call(this,H,me[0]));else throw new Error("Cannot close `"+H.type+"` ("+gr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return a1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function h(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function x(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=$n(this.sliceSerialize(H)).toLowerCase()}function A(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function k(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function w(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function P(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function I(H){const fe=this.stack[this.stack.length-1].children;let me=fe[fe.length-1];(!me||me.type!=="text")&&(me=We(),me.position={start:Ut(H.start),end:void 0},fe.push(me)),this.stack.push(me)}function N(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=Ut(H.end)}function O(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=ae.children[ae.children.length-1];fe.position.end=Ut(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(I.call(this,H),N.call(this,H))}function E(){this.data.atHardBreak=!0}function T(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function R(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function M(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function K(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ie(H){const ae=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=nC(ae),fe.identifier=$n(ae).toLowerCase()}function Q(){const H=this.stack[this.stack.length-1],ae=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const me=H.children;fe.children=me}else fe.alt=ae}function D(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function U(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function F(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=$n(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function $(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let me;fe?(me=Md(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Xs(ae);const De=this.stack.pop();De.value+=me,De.position.end=Ut(H.end)}function z(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function ne(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function be(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Ge(){return{type:"link",title:null,url:"",children:[]}}function Ke(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ze(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Zd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Zd(e,r):sC(e,r)}}function sC(e,t){let n;for(n in t)if(Kd.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 _l(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is still open")}function oC(e){const t=this;t.parser=n;function n(r){return aC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}const Bl={"mod+b":"bold","mod+i":"italic","mod+s":"strikeThrough"},uC=(e,t=n=>{})=>{Xy().use(oC).use(Am).process(e).then(n=>{const r=fn(n.result);r.map(a=>{"children"in a&&a.children&&a.children.map((i,s)=>{if("text"in i&&i.text){const o=i.text.match(/~~(.*?)~~/g);o&&o.map(l=>{const u=l.replace(/~~/g,""),c=i.text.indexOf(l),f=i.text.substring(0,c),p=i.text.substring(c+l.length),h=[{text:f},{text:u,strikeThrough:!0},{text:p}];a.children.splice(s,1,...h)})}})}),t(r)})};const Yd=C.forwardRef(({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i},s)=>{const o=oe.useIntl(),l=C.useRef(null),u=s||l,[c,f]=C.useState(t?null:[{children:[{text:""}]}]),[p,h]=C.useState(xa[0]),[g,m]=C.useState(null),[b,v]=C.useState(!1),[x,A]=C.useState(null),k=q=>{h(q||xa[0])};C.useEffect(()=>{if(t){let q=fn(t);q.includes("<")&&(q=new pa().turndown(q)),uC(q,I=>{f(I)})}},[]);const w=C.useCallback(q=>d.jsx(gy,{...q}),[]),B=C.useCallback(q=>d.jsx(vy,{...q}),[]),P=C.useMemo(()=>Ny(ov(my(iv()))),[]);return c?d.jsx("div",{className:"rich-text-editor",children:d.jsx(xn.Provider,{value:{id:e,tabbableOption:p,setFocus:k,openTooltip:g,setOpenTooltip:m,showLinkEditor:b,setShowLinkEditor:v,lastAnchor:x,setLastAnchor:A},children:d.jsxs(fy,{editor:P,initialValue:c,onChange:q=>{if(P.operations.some(N=>N.type!=="set_selection")){const N=q.map(O=>zc(O)).join("");r(N),u.current=N}},...i,children:[d.jsx(ry,{className:"input",renderElement:w,renderLeaf:B,placeholder:n||o.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:1,onKeyDown:q=>{for(const I in Bl)if(Qh(I,q)){q.stopPropagation(),q.preventDefault();const N=Bl[I];Pd(P,N)}},onBlur:()=>{P.selection&&A(P.selection.anchor)},onFocus:()=>{x&&y.hasPath(P,x.path)&&ee.select(P,{anchor:x,focus:x})}}),d.jsx(Ay,{})]})})}):null});const lC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function cC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async p=>{o(!0),u(!1);try{const h=p.target.files&&p.target.files[0];if(!h||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:h,userId:t});a(m=>({...m,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(rn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(oe.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(we,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(oe.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Gd=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Qn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Qd=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[p,h]=C.useState(!0),[g,m]=C.useState(u),{formatMessage:b}=oe.useIntl(),v=async k=>{k.preventDefault();try{await l(c),f([]),m("SUCCESS")}catch(w){m("ERROR"),o(w)}},x=k=>{k.preventDefault(),m("NOT_SUBMITTED"),h(!0),f([])},A=k=>{k.preventDefault(),s(),m("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),d.jsx(Jt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"secondary",onClick:x,children:b({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(we,{onClick:A,children:b({id:"inviteForm_ctaDone"})})]}):d.jsx(we,{onClick:x,children:b({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Gf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{f(k),h(!k.length)},autoFocus:!1,getLabel:(k,w,B)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(w),h(!c.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),d.jsx(Jt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(we,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ca=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},dC=({functions:e,...t})=>{const{formatMessage:n}=oe.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[vt.NEW_PASSWORD]!==h[vt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=h=>!Gi(h[vt.NEW_PASSWORD]).isValid,f=[{"data-testid":vt.NEW_PASSWORD,id:vt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ca(["required",c]),functions:{onChange:h=>l(Gi(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":vt.CONFIRMED_PASSWORD,id:vt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ca(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ca(["required"])}),i&&f.push({component:Ac,props:{matchingRules:o}});const p={id:vt.FORM_ID,fields:f,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(vt.NEW_PASSWORD)||g.includes(vt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Qn,{...p}),r&&d.jsx(nn,{variant:"error",text:r})]})};const Jd=({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=oe.useIntl(),u=C.useRef(null);zn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Le,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Le,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Le,{children:l.formatMessage({id:"search_cta"})})})]})})})},kl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},fC=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"]}},hC=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=fC(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}])},mC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{kl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:wc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(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:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>d.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>d.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:h}),privacy:h=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(m=>{s.validFields[m]!==i[m].current.validity.valid&&(g.push({type:`validFields.${m}`,value:i[m].current.validity.valid}),m==="email"&&kl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const pC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(oe.FormattedMessage,{id:"signup_success_title"})}),d.jsx(oe.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const gC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},vC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=oe.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:c,url:f,logInButton:p,successMessage:h},[m,b]=C.useReducer(Bs,gC),{validFields:v,emailDetails:x,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:w,showError:B}=m,[P,q]=_s.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[A]),C.useEffect(()=>{P["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[P]),C.useEffect(()=>{w&&P["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const N=C.useMemo(()=>mC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:m,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,I,g,m]),O=k?!0:A?!Object.values(v).every(E=>E===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&w?d.jsx(pC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(oe.FormattedMessage,{id:"signup_title"})}),B&&d.jsx(nn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Qn,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:O?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await hC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:m})},onCatch:E=>{r.handleError(E),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var Cs={exports:{}},Zr={exports:{}},Fe={};/** @license React v16.13.1
|
|
135
|
+
`;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 qD={42:ot,43:ot,45:ot,48:ot,49:ot,50:ot,51:ot,52:ot,53:ot,54:ot,55:ot,56:ot,57:ot,62:Id},WD={91:H1},HD={[-2]:Bi,[-1]:Bi,32:Bi},UD={35:G1,42:la,45:[wl,la],60:eD,61:wl,95:la,96:Cl,126:Cl},VD={38:Ld,92:$d},KD={[-5]:ki,[-4]:ki,[-3]:ki,33:bD,38:Ld,42:Ds,60:[C1,oD],91:DD,92:[Z1,$d],93:to,95:Ds,96:P1},ZD={null:[Ds,ND]},YD={null:[42,95]},GD={null:[]},QD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YD,contentInitial:WD,disable:GD,document:qD,flow:UD,flowInitial:HD,insideSpan:ZD,string:VD,text:KD},Symbol.toStringTag,{value:"Module"}));function JD(e){const n=s1([QD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(m1),document:a(g1),flow:a(OD),string:a(RD),text:a(MD)};return r;function a(i){return s;function s(o){return $D(r,i,o)}}}function XD(e){for(;!zd(e););return e}const El=/[\0\t\n\r]/g;function eC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(El.lastIndex=f,u=El.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(f);break}if(h===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(i.slice(f,p)),e+=p-f),h){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const tC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nC(e){return e.replace(tC,rC)}function rC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Md(n.slice(i?2:1),i?16:10)}return Xs(n)||e}const Kd={}.hasOwnProperty;function aC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),iC(n)(XD(JD(n).document().write(eC()(e,t,!0))))}function iC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(pe),blockQuote:i(te),characterEscape:I,characterReference:I,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(le,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(be),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:I,htmlText:i(Se,s),htmlTextData:I,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:p,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Ae),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:ne,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:$,codeFenced:l(b),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:l(v),codeText:l(M),codeTextData:N,data:N,definition:l(),definitionDestinationString:k,definitionLabelString:x,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(T),htmlFlowData:N,htmlText:l(R),htmlTextData:N,image:l(V),label:Q,labelText:ie,lineEnding:O,link:l(K),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:D,resourceTitleString:U,resource:X,setextHeading:l(z),setextHeadingLineSequence:P,setextHeadingText:B,strong:l(),thematicBreak:l()}};Zd(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const fe={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},me=[];let De=-1;for(;++De<H.length;)if(H[De][1].type==="listOrdered"||H[De][1].type==="listUnordered")if(H[De][0]==="enter")me.push(De);else{const Ue=me.pop();De=a(H,Ue,De)}for(De=-1;++De<H.length;){const Ue=t[H[De][0]];Kd.call(Ue,H[De][1].type)&&Ue[H[De][1].type].call(Object.assign({sliceSerialize:H[De][2].sliceSerialize},fe),H[De][1])}if(fe.tokenStack.length>0){const Ue=fe.tokenStack[fe.tokenStack.length-1];(Ue[1]||_l).call(fe,void 0,Ue[0])}for(ae.position={start:Ut(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ut(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<t.transforms.length;)ae=t.transforms[De](ae)||ae;return ae}function a(H,ae,fe){let me=ae-1,De=-1,Ue=!1,Ve,ft,Nt,wt;for(;++me<=fe;){const Qe=H[me];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?De++:De--,wt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ve&&!wt&&!De&&!Nt&&(Nt=me),wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wt=void 0}if(!De&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||De===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ve){let Bt=me;for(ft=void 0;Bt--;){const ht=H[Bt];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;ft&&(H[ft][1].type="lineEndingBlank",Ue=!0),ht[1].type="lineEnding",ft=Bt}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Nt&&(!ft||Nt<ft)&&(Ve._spread=!0),Ve.end=Object.assign({},ft?H[ft][1].start:Qe[1].end),H.splice(ft||me,0,["exit",Ve,Qe[2]]),me++,fe++}if(Qe[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ve=Bt,H.splice(me,0,["enter",Bt,Qe[2]]),me++,fe++,Nt=void 0,wt=!0}}}return H[ae][1]._spread=Ue,fe}function i(H,ae){return fe;function fe(me){o.call(this,H(me),me),ae&&ae.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,fe]),H.position={start:Ut(ae.start),end:void 0}}function l(H){return ae;function ae(fe){H&&H.call(this,fe),u.call(this,fe)}}function u(H,ae){const fe=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==H.type&&(ae?ae.call(this,H,me[0]):(me[1]||_l).call(this,H,me[0]));else throw new Error("Cannot close `"+H.type+"` ("+gr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return a1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function h(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function x(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=$n(this.sliceSerialize(H)).toLowerCase()}function A(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function k(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function E(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function P(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function I(H){const fe=this.stack[this.stack.length-1].children;let me=fe[fe.length-1];(!me||me.type!=="text")&&(me=We(),me.position={start:Ut(H.start),end:void 0},fe.push(me)),this.stack.push(me)}function N(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=Ut(H.end)}function O(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=ae.children[ae.children.length-1];fe.position.end=Ut(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(I.call(this,H),N.call(this,H))}function w(){this.data.atHardBreak=!0}function T(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function R(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function M(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function K(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ie(H){const ae=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=nC(ae),fe.identifier=$n(ae).toLowerCase()}function Q(){const H=this.stack[this.stack.length-1],ae=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const me=H.children;fe.children=me}else fe.alt=ae}function D(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function U(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function F(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=$n(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function $(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let me;fe?(me=Md(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Xs(ae);const De=this.stack.pop();De.value+=me,De.position.end=Ut(H.end)}function q(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function ne(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function be(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Ge(){return{type:"link",title:null,url:"",children:[]}}function Ke(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ze(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Zd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Zd(e,r):sC(e,r)}}function sC(e,t){let n;for(n in t)if(Kd.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 _l(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is still open")}function oC(e){const t=this;t.parser=n;function n(r){return aC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}const Bl={"mod+b":"bold","mod+i":"italic","mod+s":"strikeThrough"},uC=(e,t=n=>{})=>{Xy().use(oC).use(Am).process(e).then(n=>{const r=fn(n.result);r.map(a=>{"children"in a&&a.children&&a.children.map((i,s)=>{if("text"in i&&i.text){const o=i.text.match(/~~(.*?)~~/g);o&&o.map(l=>{const u=l.replace(/~~/g,""),c=i.text.indexOf(l),f=i.text.substring(0,c),p=i.text.substring(c+l.length),h=[{text:f},{text:u,strikeThrough:!0},{text:p}];a.children.splice(s,1,...h)})}})}),t(r)})};const Yd=C.forwardRef(({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i},s)=>{const o=oe.useIntl(),l=C.useRef(null),u=s||l,[c,f]=C.useState(t?null:[{children:[{text:""}]}]),[p,h]=C.useState(xa[0]),[g,m]=C.useState(null),[b,v]=C.useState(!1),[x,A]=C.useState(null),k=z=>{h(z||xa[0])};C.useEffect(()=>{if(t){let z=fn(t);z.includes("<")&&(z=new pa().turndown(z)),uC(z,I=>{f(I)})}},[]);const E=C.useCallback(z=>d.jsx(gy,{...z}),[]),B=C.useCallback(z=>d.jsx(vy,{...z}),[]),P=C.useMemo(()=>Ny(ov(my(iv()))),[]);return c?d.jsx("div",{className:"rich-text-editor",children:d.jsx(xn.Provider,{value:{id:e,tabbableOption:p,setFocus:k,openTooltip:g,setOpenTooltip:m,showLinkEditor:b,setShowLinkEditor:v,lastAnchor:x,setLastAnchor:A},children:d.jsxs(fy,{editor:P,initialValue:c,onChange:z=>{if(P.operations.some(N=>N.type!=="set_selection")){const N=z.map(O=>zc(O)).join("");r(N),u.current=N}},...i,children:[d.jsx(ry,{className:"input",renderElement:E,renderLeaf:B,placeholder:n||o.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:z=>{for(const I in Bl)if(Qh(I,z)){z.stopPropagation(),z.preventDefault();const N=Bl[I];Pd(P,N)}},onBlur:()=>{P.selection&&A(P.selection.anchor)},onFocus:()=>{x&&y.hasPath(P,x.path)&&ee.select(P,{anchor:x,focus:x})}}),d.jsx(Ay,{})]})})}):null});const lC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function cC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async p=>{o(!0),u(!1);try{const h=p.target.files&&p.target.files[0];if(!h||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:h,userId:t});a(m=>({...m,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(rn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(oe.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(we,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(oe.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Gd=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Qn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Qd=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[p,h]=C.useState(!0),[g,m]=C.useState(u),{formatMessage:b}=oe.useIntl(),v=async k=>{k.preventDefault();try{await l(c),f([]),m("SUCCESS")}catch(E){m("ERROR"),o(E)}},x=k=>{k.preventDefault(),m("NOT_SUBMITTED"),h(!0),f([])},A=k=>{k.preventDefault(),s(),m("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),d.jsx(Jt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"secondary",onClick:x,children:b({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(we,{onClick:A,children:b({id:"inviteForm_ctaDone"})})]}):d.jsx(we,{onClick:x,children:b({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Gf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{f(k),h(!k.length)},autoFocus:!1,getLabel:(k,E,B)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(E),h(!c.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},E)})]}),d.jsx(Jt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(we,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ca=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},dC=({functions:e,...t})=>{const{formatMessage:n}=oe.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[vt.NEW_PASSWORD]!==h[vt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=h=>!Gi(h[vt.NEW_PASSWORD]).isValid,f=[{"data-testid":vt.NEW_PASSWORD,id:vt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ca(["required",c]),functions:{onChange:h=>l(Gi(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":vt.CONFIRMED_PASSWORD,id:vt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ca(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ca(["required"])}),i&&f.push({component:Ac,props:{matchingRules:o}});const p={id:vt.FORM_ID,fields:f,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(vt.NEW_PASSWORD)||g.includes(vt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Qn,{...p}),r&&d.jsx(nn,{variant:"error",text:r})]})};const Jd=({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=oe.useIntl(),u=C.useRef(null);zn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Le,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Le,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Le,{children:l.formatMessage({id:"search_cta"})})})]})})})},kl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},fC=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"]}},hC=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=fC(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}])},mC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{kl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:wc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(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:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>d.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>d.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:h}),privacy:h=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(m=>{s.validFields[m]!==i[m].current.validity.valid&&(g.push({type:`validFields.${m}`,value:i[m].current.validity.valid}),m==="email"&&kl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const pC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(oe.FormattedMessage,{id:"signup_success_title"})}),d.jsx(oe.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const gC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},vC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=oe.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:c,url:f,logInButton:p,successMessage:h},[m,b]=C.useReducer(Bs,gC),{validFields:v,emailDetails:x,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:E,showError:B}=m,[P,z]=_s.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[A]),C.useEffect(()=>{P["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[P]),C.useEffect(()=>{E&&P["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const N=C.useMemo(()=>mC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:m,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,I,g,m]),O=k?!0:A?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?d.jsx(pC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(oe.FormattedMessage,{id:"signup_title"})}),B&&d.jsx(nn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Qn,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:O?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await hC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:m})},onCatch:w=>{r.handleError(w),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var Cs={exports:{}},Zr={exports:{}},Fe={};/** @license React v16.13.1
|
|
136
136
|
* react-is.production.min.js
|
|
137
137
|
*
|
|
138
138
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
139
139
|
*
|
|
140
140
|
* This source code is licensed under the MIT license found in the
|
|
141
141
|
* LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/var Al;function bC(){if(Al)return Fe;Al=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(
|
|
142
|
+
*/var Al;function bC(){if(Al)return Fe;Al=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(E){if(typeof E=="object"&&E!==null){var B=E.$$typeof;switch(B){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case f:return E;default:switch(E=E&&E.$$typeof,E){case o:case c:case g:case h:case s:return E;default:return B}}case n:return B}}}function k(E){return A(E)===u}return Fe.AsyncMode=l,Fe.ConcurrentMode=u,Fe.ContextConsumer=o,Fe.ContextProvider=s,Fe.Element=t,Fe.ForwardRef=c,Fe.Fragment=r,Fe.Lazy=g,Fe.Memo=h,Fe.Portal=n,Fe.Profiler=i,Fe.StrictMode=a,Fe.Suspense=f,Fe.isAsyncMode=function(E){return k(E)||A(E)===l},Fe.isConcurrentMode=k,Fe.isContextConsumer=function(E){return A(E)===o},Fe.isContextProvider=function(E){return A(E)===s},Fe.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Fe.isForwardRef=function(E){return A(E)===c},Fe.isFragment=function(E){return A(E)===r},Fe.isLazy=function(E){return A(E)===g},Fe.isMemo=function(E){return A(E)===h},Fe.isPortal=function(E){return A(E)===n},Fe.isProfiler=function(E){return A(E)===i},Fe.isStrictMode=function(E){return A(E)===a},Fe.isSuspense=function(E){return A(E)===f},Fe.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===f||E===p||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===h||E.$$typeof===s||E.$$typeof===o||E.$$typeof===c||E.$$typeof===b||E.$$typeof===v||E.$$typeof===x||E.$$typeof===m)},Fe.typeOf=A,Fe}var Te={};/** @license React v16.13.1
|
|
143
143
|
* react-is.development.js
|
|
144
144
|
*
|
|
145
145
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
146
146
|
*
|
|
147
147
|
* This source code is licensed under the MIT license found in the
|
|
148
148
|
* LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/var Fl;function yC(){return Fl||(Fl=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===f||J===p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===h||J.$$typeof===s||J.$$typeof===o||J.$$typeof===c||J.$$typeof===b||J.$$typeof===v||J.$$typeof===x||J.$$typeof===m)}function k(J){if(typeof J=="object"&&J!==null){var be=J.$$typeof;switch(be){case t:var pe=J.type;switch(pe){case l:case u:case r:case i:case a:case f:return pe;default:var _e=pe&&pe.$$typeof;switch(_e){case o:case c:case g:case h:case s:return _e;default:return be}}case n:return be}}}var
|
|
149
|
+
*/var Fl;function yC(){return Fl||(Fl=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===f||J===p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===h||J.$$typeof===s||J.$$typeof===o||J.$$typeof===c||J.$$typeof===b||J.$$typeof===v||J.$$typeof===x||J.$$typeof===m)}function k(J){if(typeof J=="object"&&J!==null){var be=J.$$typeof;switch(be){case t:var pe=J.type;switch(pe){case l:case u:case r:case i:case a:case f:return pe;default:var _e=pe&&pe.$$typeof;switch(_e){case o:case c:case g:case h:case s:return _e;default:return be}}case n:return be}}}var E=l,B=u,P=o,z=s,I=t,N=c,O=r,w=g,T=h,R=n,M=i,K=a,V=f,ie=!1;function Q(J){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.")),D(J)||k(J)===l}function D(J){return k(J)===u}function U(J){return k(J)===o}function X(J){return k(J)===s}function _(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function F(J){return k(J)===c}function L(J){return k(J)===r}function $(J){return k(J)===g}function q(J){return k(J)===h}function ne(J){return k(J)===n}function te(J){return k(J)===i}function Z(J){return k(J)===a}function le(J){return k(J)===f}Te.AsyncMode=E,Te.ConcurrentMode=B,Te.ContextConsumer=P,Te.ContextProvider=z,Te.Element=I,Te.ForwardRef=N,Te.Fragment=O,Te.Lazy=w,Te.Memo=T,Te.Portal=R,Te.Profiler=M,Te.StrictMode=K,Te.Suspense=V,Te.isAsyncMode=Q,Te.isConcurrentMode=D,Te.isContextConsumer=U,Te.isContextProvider=X,Te.isElement=_,Te.isForwardRef=F,Te.isFragment=L,Te.isLazy=$,Te.isMemo=q,Te.isPortal=ne,Te.isProfiler=te,Te.isStrictMode=Z,Te.isSuspense=le,Te.isValidElementType=A,Te.typeOf=k}()),Te}var Tl;function Xd(){return Tl||(Tl=1,process.env.NODE_ENV==="production"?Zr.exports=bC():Zr.exports=yC()),Zr.exports}/*
|
|
150
150
|
object-assign
|
|
151
151
|
(c) Sindre Sorhus
|
|
152
152
|
@license MIT
|
|
153
|
-
*/var Ai,Sl;function DC(){if(Sl)return Ai;Sl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var f in o)t.call(o,f)&&(l[f]=o[f]);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},Ai}var Fi,jl;function no(){if(jl)return Fi;jl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Fi=e,Fi}var Ti,Ol;function ef(){return Ol||(Ol=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Pl;function CC(){if(Pl)return Si;Pl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=no(),n={},r=ef();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var f;try{if(typeof i[c]!="function"){var p=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=i[c](s,c,l,o,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+f.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Nl;function xC(){if(Nl)return ji;Nl=1;var e=Xd(),t=DC(),n=no(),r=ef(),a=CC(),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 ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function f(D){var U=D&&(u&&D[u]||D[c]);if(typeof U=="function")return U}var p="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:A,element:k(),elementType:
|
|
154
|
-
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var J=le(
|
|
153
|
+
*/var Ai,Sl;function DC(){if(Sl)return Ai;Sl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var f in o)t.call(o,f)&&(l[f]=o[f]);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},Ai}var Fi,jl;function no(){if(jl)return Fi;jl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Fi=e,Fi}var Ti,Ol;function ef(){return Ol||(Ol=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Pl;function CC(){if(Pl)return Si;Pl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=no(),n={},r=ef();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var f;try{if(typeof i[c]!="function"){var p=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=i[c](s,c,l,o,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+f.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Nl;function xC(){if(Nl)return ji;Nl=1;var e=Xd(),t=DC(),n=no(),r=ef(),a=CC(),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 ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function f(D){var U=D&&(u&&D[u]||D[c]);if(typeof U=="function")return U}var p="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:A,element:k(),elementType:E(),instanceOf:B,node:N(),objectOf:z,oneOf:P,oneOfType:I,shape:w,exact:T};function g(D,U){return D===U?D!==0||1/D===1/U:D!==D&&U!==U}function m(D,U){this.message=D,this.data=U&&typeof U=="object"?U:{},this.stack=""}m.prototype=Error.prototype;function b(D){if(process.env.NODE_ENV!=="production")var U={},X=0;function _(L,$,q,ne,te,Z,le){if(ne=ne||p,Z=Z||q,le!==n){if(l){var J=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var be=ne+":"+q;!U[be]&&X<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Z+"` prop on `"+ne+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),U[be]=!0,X++)}}return $[q]==null?L?$[q]===null?new m("The "+te+" `"+Z+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new m("The "+te+" `"+Z+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:D($,q,ne,te,Z)}var F=_.bind(null,!1);return F.isRequired=_.bind(null,!0),F}function v(D){function U(X,_,F,L,$,q){var ne=X[_],te=K(ne);if(te!==D){var Z=V(ne);return new m("Invalid "+L+" `"+$+"` of type "+("`"+Z+"` supplied to `"+F+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return b(U)}function x(){return b(s)}function A(D){function U(X,_,F,L,$){if(typeof D!="function")return new m("Property `"+$+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var q=X[_];if(!Array.isArray(q)){var ne=K(q);return new m("Invalid "+L+" `"+$+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected an array."))}for(var te=0;te<q.length;te++){var Z=D(q,te,F,L,$+"["+te+"]",n);if(Z instanceof Error)return Z}return null}return b(U)}function k(){function D(U,X,_,F,L){var $=U[X];if(!o($)){var q=K($);return new m("Invalid "+F+" `"+L+"` of type "+("`"+q+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(D)}function E(){function D(U,X,_,F,L){var $=U[X];if(!e.isValidElementType($)){var q=K($);return new m("Invalid "+F+" `"+L+"` of type "+("`"+q+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(D)}function B(D){function U(X,_,F,L,$){if(!(X[_]instanceof D)){var q=D.name||p,ne=Q(X[_]);return new m("Invalid "+L+" `"+$+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected ")+("instance of `"+q+"`."))}return null}return b(U)}function P(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function U(X,_,F,L,$){for(var q=X[_],ne=0;ne<D.length;ne++)if(g(q,D[ne]))return null;var te=JSON.stringify(D,function(le,J){var be=V(J);return be==="symbol"?String(J):J});return new m("Invalid "+L+" `"+$+"` of value `"+String(q)+"` "+("supplied to `"+F+"`, expected one of "+te+"."))}return b(U)}function z(D){function U(X,_,F,L,$){if(typeof D!="function")return new m("Property `"+$+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var q=X[_],ne=K(q);if(ne!=="object")return new m("Invalid "+L+" `"+$+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected an object."));for(var te in q)if(r(q,te)){var Z=D(q,te,F,L,$+"."+te,n);if(Z instanceof Error)return Z}return null}return b(U)}function I(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var U=0;U<D.length;U++){var X=D[U];if(typeof X!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ie(X)+" at index "+U+"."),s}function _(F,L,$,q,ne){for(var te=[],Z=0;Z<D.length;Z++){var le=D[Z],J=le(F,L,$,q,ne,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&te.push(J.data.expectedType)}var be=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new m("Invalid "+q+" `"+ne+"` supplied to "+("`"+$+"`"+be+"."))}return b(_)}function N(){function D(U,X,_,F,L){return R(U[X])?null:new m("Invalid "+F+" `"+L+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(D)}function O(D,U,X,_,F){return new m((D||"React class")+": "+U+" type `"+X+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function w(D){function U(X,_,F,L,$){var q=X[_],ne=K(q);if(ne!=="object")return new m("Invalid "+L+" `"+$+"` of type `"+ne+"` "+("supplied to `"+F+"`, expected `object`."));for(var te in D){var Z=D[te];if(typeof Z!="function")return O(F,L,$,te,V(Z));var le=Z(q,te,F,L,$+"."+te,n);if(le)return le}return null}return b(U)}function T(D){function U(X,_,F,L,$){var q=X[_],ne=K(q);if(ne!=="object")return new m("Invalid "+L+" `"+$+"` of type `"+ne+"` "+("supplied to `"+F+"`, expected `object`."));var te=t({},X[_],D);for(var Z in te){var le=D[Z];if(r(D,Z)&&typeof le!="function")return O(F,L,$,Z,V(le));if(!le)return new m("Invalid "+L+" `"+$+"` key `"+Z+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(X[_],null," ")+`
|
|
154
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var J=le(q,Z,F,L,$+"."+Z,n);if(J)return J}return null}return b(U)}function R(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(R);if(D===null||o(D))return!0;var U=f(D);if(U){var X=U.call(D),_;if(U!==D.entries){for(;!(_=X.next()).done;)if(!R(_.value))return!1}else for(;!(_=X.next()).done;){var F=_.value;if(F&&!R(F[1]))return!1}}else return!1;return!0;default:return!1}}function M(D,U){return D==="symbol"?!0:U?U["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&U instanceof Symbol:!1}function K(D){var U=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":M(U,D)?"symbol":U}function V(D){if(typeof D>"u"||D===null)return""+D;var U=K(D);if(U==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return U}function ie(D){var U=V(D);switch(U){case"array":case"object":return"an "+U;case"boolean":case"date":case"regexp":return"a "+U;default:return U}}function Q(D){return!D.constructor||!D.constructor.name?p:D.constructor.name}return h.checkPropTypes=a,h.resetWarningCache=a.resetWarningCache,h.PropTypes=h,h},ji}var Oi,Rl;function wC(){if(Rl)return Oi;Rl=1;var e=no();function t(){}function n(){}return n.resetWarningCache=t,Oi=function(){function r(s,o,l,u,c,f){if(f!==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},Oi}if(process.env.NODE_ENV!=="production"){var EC=Xd(),_C=!0;Cs.exports=xC()(EC.isElement,_C)}else Cs.exports=wC()();var BC=Cs.exports;/*!
|
|
155
155
|
* tabbable 6.2.0
|
|
156
156
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
157
157
|
*/var tf=["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])"],wa=tf.join(","),nf=typeof Element>"u",yn=nf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ea=!nf&&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},_a=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},kC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},rf=function(t,n,r){if(_a(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(wa));return n&&yn.call(t,wa)&&a.unshift(t),a=a.filter(r),a},af=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!_a(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=yn.call(s,wa);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!_a(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&p){var h=e(f===!0?s.children:f.children,!0,r);r.flatten?a.push.apply(a,h):a.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return a},sf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Zt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||kC(t))&&!sf(t)?0:t.tabIndex},AC=function(t,n){var r=Zt(t);return r<0&&n&&!sf(t)?0:r},FC=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},of=function(t){return t.tagName==="INPUT"},TC=function(t){return of(t)&&t.type==="hidden"},SC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},jC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},OC=function(t){if(!t.name)return!0;var n=t.form||Ea(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=jC(a,t.form);return!i||i===t},PC=function(t){return of(t)&&t.type==="radio"},NC=function(t){return PC(t)&&!OC(t)},RC=function(t){var n,r=t&&Ea(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,f;r=Ea(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(a))}}return i},Ml=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},MC=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=yn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(yn.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=Ea(t);if(l&&!l.shadowRoot&&a(l)===!0)return Ml(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(RC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ml(t);return!1},IC=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 yn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ba=function(t,n){return!(n.disabled||_a(n)||TC(n)||MC(n,t)||SC(n)||IC(n))},xs=function(t,n){return!(NC(n)||Zt(n)<0||!Ba(t,n))},$C=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},LC=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=AC(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(FC).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},uf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=af([t],n.includeContainer,{filter:xs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:$C}):r=rf(t,n.includeContainer,xs.bind(null,n)),LC(r)},lf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=af([t],n.includeContainer,{filter:Ba.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=rf(t,n.includeContainer,Ba.bind(null,n)),r},ln=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return yn.call(t,wa)===!1?!1:xs(n,t)},zC=tf.concat("iframe").join(","),da=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return yn.call(t,zC)===!1?!1:Ba(n,t)};const qC=Object.freeze(Object.defineProperty({__proto__:null,focusable:lf,getTabIndex:Zt,isFocusable:da,isTabbable:ln,tabbable:uf},Symbol.toStringTag,{value:"Module"}));/*!
|
|
158
158
|
* focus-trap 7.5.4
|
|
159
159
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
160
|
-
*/function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){WC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function WC(e,t,n){return t=UC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HC(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 UC(e){var t=HC(e,"string");return typeof t=="symbol"?t:String(t)}var Ll={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()}},VC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},KC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},br=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},ZC=function(t){return br(t)&&!t.shiftKey},YC=function(t){return br(t)&&t.shiftKey},zl=function(t){return setTimeout(t,0)},ql=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ir=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},Yr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},GC=[],QC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||GC,i=$l({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ZC,isKeyBackward:YC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(E,T,R){return E&&E[T]!==void 0?E[T]:i[R||T]},u=function(E,T){var R=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return s.containerGroups.findIndex(function(M){var K=M.container,V=M.tabbableNodes;return K.contains(E)||(R==null?void 0:R.includes(K))||V.find(function(ie){return ie===E})})},c=function(E){var T=i[E];if(typeof T=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),K=1;K<R;K++)M[K-1]=arguments[K];T=T.apply(void 0,M)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var V=T;if(typeof T=="string"&&(V=r.querySelector(T),!V))throw new Error("`".concat(E,"` as selector refers to no known node"));return V},f=function(){var E=c("initialFocus");if(E===!1)return!1;if(E===void 0||!da(E,i.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var T=s.tabbableGroups[0],R=T&&T.firstTabbableNode;E=R||c("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},p=function(){if(s.containerGroups=s.containers.map(function(E){var T=uf(E,i.tabbableOptions),R=lf(E,i.tabbableOptions),M=T.length>0?T[0]:void 0,K=T.length>0?T[T.length-1]:void 0,V=R.find(function(D){return ln(D)}),ie=R.slice().reverse().find(function(D){return ln(D)}),Q=!!T.find(function(D){return Zt(D)>0});return{container:E,tabbableNodes:T,focusableNodes:R,posTabIndexesFound:Q,firstTabbableNode:M,lastTabbableNode:K,firstDomTabbableNode:V,lastDomTabbableNode:ie,nextTabbableNode:function(U){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=T.indexOf(U);return _<0?X?R.slice(R.indexOf(U)+1).find(function(F){return ln(F)}):R.slice(0,R.indexOf(U)).reverse().find(function(F){return ln(F)}):T[_+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(E){return E.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(E){return E.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function O(E){var T=E.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?O(T.shadowRoot):T},g=function O(E){if(E!==!1&&E!==h(document)){if(!E||!E.focus){O(f());return}E.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=E,VC(E)&&E.select()}},m=function(E){var T=c("setReturnFocus",E);return T||(T===!1?!1:E)},b=function(E){var T=E.target,R=E.event,M=E.isBackward,K=M===void 0?!1:M;T=T||Yr(R),p();var V=null;if(s.tabbableGroups.length>0){var ie=u(T,R),Q=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)K?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(K){var D=ql(s.tabbableGroups,function($){var z=$.firstTabbableNode;return T===z});if(D<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T,!1))&&(D=ie),D>=0){var U=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[U];V=Zt(T)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T,!1))}else{var _=ql(s.tabbableGroups,function($){var z=$.lastTabbableNode;return T===z});if(_<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T))&&(_=ie),_>=0){var F=_===s.tabbableGroups.length-1?0:_+1,L=s.tabbableGroups[F];V=Zt(T)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T))}}else V=c("fallbackFocus");return V},v=function(E){var T=Yr(E);if(!(u(T,E)>=0)){if(ir(i.clickOutsideDeactivates,E)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ir(i.allowOutsideClick,E)||E.preventDefault()}},x=function(E){var T=Yr(E),R=u(T,E)>=0;if(R||T instanceof Document)R&&(s.mostRecentlyFocusedNode=T);else{E.stopImmediatePropagation();var M,K=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[V].tabbableNodes;if(ie.length>0){var Q=ie.findIndex(function(D){return D===s.mostRecentlyFocusedNode});Q>=0&&(i.isKeyForward(s.recentNavEvent)?Q+1<ie.length&&(M=ie[Q+1],K=!1):Q-1>=0&&(M=ie[Q-1],K=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(U){return Zt(U)>0})})||(K=!1);else K=!1;K&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},A=function(E){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=E;var R=b({event:E,isBackward:T});R&&(br(E)&&E.preventDefault(),g(R))},k=function(E){if(KC(E)&&ir(i.escapeDeactivates,E)!==!1){E.preventDefault(),o.deactivate();return}(i.isKeyForward(E)||i.isKeyBackward(E))&&A(E,i.isKeyBackward(E))},w=function(E){var T=Yr(E);u(T,E)>=0||ir(i.clickOutsideDeactivates,E)||ir(i.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},B=function(){if(s.active)return Ll.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?zl(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},P=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",k,!0),o},q=function(E){var T=E.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(K){return K===s.mostRecentlyFocusedNode})});T&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,N=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(E){I.observe(E,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(E){if(s.active)return this;var T=l(E,"onActivate"),R=l(E,"onPostActivate"),M=l(E,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var K=function(){M&&p(),B(),N(),R==null||R()};return M?(M(s.containers.concat()).then(K,K),this):(K(),this)},deactivate:function(E){if(!s.active)return this;var T=$l({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},E);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,P(),s.active=!1,s.paused=!1,N(),Ll.deactivateTrap(a,o);var R=l(T,"onDeactivate"),M=l(T,"onPostDeactivate"),K=l(T,"checkCanReturnFocus"),V=l(T,"returnFocus","returnFocusOnDeactivate");R==null||R();var ie=function(){zl(function(){V&&g(m(s.nodeFocusedBeforeActivation)),M==null||M()})};return V&&K?(K(m(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(E){if(s.paused||!s.active)return this;var T=l(E,"onPause"),R=l(E,"onPostPause");return s.paused=!0,T==null||T(),P(),N(),R==null||R(),this},unpause:function(E){if(!s.paused||!s.active)return this;var T=l(E,"onUnpause"),R=l(E,"onPostUnpause");return s.paused=!1,T==null||T(),p(),B(),N(),R==null||R(),this},updateContainerElements:function(E){var T=[].concat(E).filter(Boolean);return s.containers=T.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&p(),N(),this}},o.updateContainerElements(t),o};const JC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:QC},Symbol.toStringTag,{value:"Module"})),XC=tc(JC),ex=tc(qC);function Vn(e){"@babel/helpers - typeof";return Vn=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},Vn(e)}function tx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wl(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,cf(r.key),r)}}function nx(e,t,n){return t&&Wl(e.prototype,t),n&&Wl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rx(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&&ws(e,t)}function ws(e,t){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ws(e,t)}function ax(e){var t=sx();return function(){var r=ka(e),a;if(t){var i=ka(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return ix(this,a)}}function ix(e,t){if(t&&(Vn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dr(e)}function dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sx(){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 ka(e){return ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ka(e)}function ox(e,t,n){return t=cf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cf(e){var t=ux(e,"string");return Vn(t)==="symbol"?t:String(t)}function ux(e,t){if(Vn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gr=C,he=BC,lx=XC,cx=lx.createFocusTrap,dx=ex,fx=dx.isFocusable,ro=function(e){rx(n,e);var t=ax(n);function n(r){var a;tx(this,n),a=t.call(this,r),ox(dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,f=new Array(c>1?c-1:0),p=1;p<c;p++)f[p-1]=arguments[p];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(dr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return nx(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&&!fx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Gr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Gr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Gr.cloneElement(i,{ref:s});return o}return null}}]),n}(Gr.Component),sr=typeof Element>"u"?Function:Element;ro.propTypes={active:he.bool,paused:he.bool,focusTrapOptions:he.shape({document:he.object,onActivate:he.func,onPostActivate:he.func,checkCanFocusTrap:he.func,onPause:he.func,onPostPause:he.func,onUnpause:he.func,onPostUnpause:he.func,onDeactivate:he.func,onPostDeactivate:he.func,checkCanReturnFocus:he.func,initialFocus:he.oneOfType([he.instanceOf(sr),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(sr),he.string,he.func]),escapeDeactivates:he.oneOfType([he.bool,he.func]),clickOutsideDeactivates:he.oneOfType([he.bool,he.func]),returnFocusOnDeactivate:he.bool,setReturnFocus:he.oneOfType([he.instanceOf(sr),he.string,he.bool,he.func]),allowOutsideClick:he.oneOfType([he.bool,he.func]),preventScroll:he.bool,tabbableOptions:he.shape({displayCheck:he.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:he.oneOfType([he.bool,he.func])}),trapStack:he.array,isKeyForward:he.func,isKeyBackward:he.func}),containerElements:he.arrayOf(he.instanceOf(sr)),children:he.oneOfType([he.element,he.instanceOf(sr)])};ro.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:cx};var hx=ro;const mx=tn(hx),df=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Zf.ReactQueryDevtools,{initialIsOpen:!1})]})};var px=C.createContext({client:na});function gx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.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&&(na.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),na.init(r,a)),na)},[n,r]);return C.createElement(px.Provider,{value:{client:i}},t)}const ff=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(gx,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),hf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...fh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},ao=C.createContext({}),fa={en:"English",es:"Español",fr:"Français",pt:"Português"},Pt=C.createContext({isLoading:!0});function Ha(){return C.useContext(Pt)}const mf=({children:e,user:t})=>d.jsx(Pt.Provider,{value:t,children:e}),io=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),pf=()=>C.useContext(io),gf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(io.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},vx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),pc(5e3)}).catch(c=>{c.message===fc&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(ao.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(hf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(_s.CookiesProvider,{children:d.jsx(mf,{user:a,children:d.jsx(gf,{children:d.jsx(df,{showDevTools:r,children:d.jsx(ff,{user:a,children:t})})})})})})})};const so=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Sr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const p=oe.useIntl(),{registerOverlay:h,unregisterOverlay:g}=pf(),[m,b]=C.useState(t),v=k=>{k.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=k=>{b(k),k?(a(),h(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{m&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:m}),role:"dialog",children:d.jsx(so,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!m,style:A,children:t&&d.jsx(mx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Jt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Jt,{}),d.jsx(Dn,{buttons:u})]}),s&&d.jsx(Dr,{className:"error",children:s})]})})})})},vf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const bx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=oe.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Sr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Qd,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const yx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(rn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Sr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(qn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Dx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Qt,{className:"testimonial",children:n}),r?d.jsx(Fr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Cx=C.memo(Dx);const xx=({items:e=[],selector:t="",className:n=""})=>{const r=oe.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(jt,{variant:"subtle",className:Y("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ua=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=oe.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,p=Math.floor(f),h=(f-p)*60,g=Math.round(h),m=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};let or=!1;const Va=C.forwardRef(({styling:e={},isOpen:t=!1,isLoading:n=!1,children:r,className:a="",functions:i={},callbacks:s={},...o},l)=>{const u=oe.useIntl(),c=C.useRef(null),f=l||c,[p,h]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:m=!1,hasForm:b=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const B=f==null?void 0:f.current;if(B)return B.addEventListener("transitionend",A),B.addEventListener("keydown",k),()=>{B.removeEventListener("transitionend",A),B.removeEventListener("keydown",k)}},[]);const A=({propertyName:B})=>{B==="opacity"&&(or!==!1&&clearTimeout(or),h(P=>(P==="open"?v():P==="closed"&&x(),P==="opening"?"open":P==="closing"?"closed":P==="closed"?"hidden":P)))},k=B=>{B.key==="Escape"&&(B.stopPropagation(),B.preventDefault(),h("closing"))};zn(()=>{or!==!1&&clearTimeout(or);let B="open";t?h("opening"):(h("closing"),B="hidden"),or=setTimeout(()=>{h(B)},300)},[t]);const w={...o};return i&&i.onBlur&&(w.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:Y("tooltip text-medium",p,a,{loading:n,"extra-padding":g,"has-pointer":m,bottom:m==="bottom","has-form":b}),hidden:p==="hidden",...w,children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})});const wx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Gn,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const on=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Ex=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(on,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(Dn,{buttons:r})]})})};function bf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const _x=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:hc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>bf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Bx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,f=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Y("edit-section-modal"),children:d.jsx(Qn,{...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 p=>{var h,g;(h=n==null?void 0:n.functions)!=null&&h.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(we,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>bf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(_x,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Jt,{})]})};const kx=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:p=!1,description:h=!1},g)=>{if(!c||!c.url)return null;const m=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),h&&d.jsx("small",{children:h})]},window.btoa(`${c.url}_${g}`))})})]})};const Ax=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Fx=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,m;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},p={};c.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:x}=t[b];if(x&&Ax.includes(x.toLowerCase()))return;p[b]={text:v,element:f[b]};return}p[b]={text:t[b],element:f[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(on,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?d.jsx(qn,{overrideType:"text-only",className:"text",children:v},b):C.createElement(x,{key:b,className:b},v)}return null}),l,h&&d.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&d.jsx(Gn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Tx=C.memo(Fx);const Sx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(on,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const jx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(qn,{children:n}):n;return d.jsxs(on,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Gn,{image:r})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},Ox=C.memo(jx);const Px=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(we,{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})]}),Nx=({type:e,data:t})=>{const n=oe.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=a&&Yi(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ks(c)});if(o)return d.jsx(Mn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&Yi(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},Aa={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"}},Rx=({data:e,cta:t,link:n,gtmContext:r})=>{var m,b;const a=oe.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:f}=e,p=e.contentType;let h="";if((m=Aa[p])!=null&&m.gtmEvent&&(h=Aa[p].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async A=>{if(A.preventDefault(),A.stopPropagation(),!(v||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(we,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${f}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Mx={title:66,text:3e3,secondaryText:1e3,partner:25},oo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var P,q,I;const o=oe.useIntl(),l=C.useContext(Pt),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:p,isLoading:h}=c,g=C.useCallback(()=>{n(t,u).then(N=>{f(()=>({data:N,isLoading:!1}))}).catch(()=>f(N=>({...N,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),h||!p)return d.jsx(xt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:m}=p;if(!m||!Aa[m])return d.jsx(xt,{element:"li",className:"card-wrapper"});const{basePath:b="",className:v,length:x,gtmEvent:A}=Aa[m];let k=p.slug?`${b}${p.slug}`:!1;p.slug&&(p.slug.slice(0,4)==="http"||p.slug.slice(0,2)==="//"||p.slug.slice(0,6)==="mailto"||p.slug.slice(0,3)==="tel")&&(k=p.slug);const w={...Mx,...x};let B={className:"card"};return k&&(B={href:k,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},p.openInNewTab&&(B.target="_blank")),d.jsx("li",{className:Y("card-wrapper text-medium",v,i,{"has-link":k,"no-link":!k,"has-image":p.banner}),"data-testid":`${m}-card`,children:C.createElement(k?"a":"div",B,d.jsxs(d.Fragment,{children:[d.jsx(gc,{className:"card-label",contentType:m,customIcon:p.customIcon,customLabel:p.customLabel}),p.startDate&&!p.isOngoingEvent&&d.jsx(Mn,{size:"small",variant:p.dateHasPassed?"default":"information","data-testid":"date",children:p.dateHasPassed?o.formatMessage({id:"card_ended"}):mc(p.startDate)}),p.banner?d.jsxs("p",{className:"img",children:[p.registered&&d.jsx(Mn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Gn,{image:p.banner})]}):v==="people"?d.jsx(rn,{name:p.title||"",src:p.profile,"data-testid":"people-profile-picture"}):null,p.contributors&&d.jsx(Ss,{contributors:{data:p.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(m)?o.formatMessage({id:`card_contributors_${m}`}):void 0,"data-testid":"contributors"}),p.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:p.partner.length>1?o.formatMessage({id:"card_partner"},{partner:p.partner[0],number:p.partner.length-1}):Ln(p.partner[0],w.partner)}),["title","text","secondaryText"].map(N=>{const O=p[N];if(!O)return null;const E=lc(N);return d.jsx("p",{className:E,"data-testid":E,children:Ln(O,w[N])},N)}),(l==null?void 0:l.id)&&(p==null?void 0:p.members)&&d.jsxs("span",{className:"member-information",children:[((P=p==null?void 0:p.members)==null?void 0:P.isMember)&&d.jsx(Mn,{size:"small",variant:"registered",icon:((q=p==null?void 0:p.members)==null?void 0:q.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(I=p==null?void 0:p.members)==null?void 0:I.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:p==null?void 0:p.members.count})})]}),d.jsx(Nx,{type:v||"",data:p}),d.jsx(Rx,{data:p,cta:r,link:k||"",gtmContext:a})]}))})};const yf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(oo,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Ix=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},$x=({id:e,title:t})=>{const n=oe.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Pi={fourCards:1024,threeCards:769,twoCards:480};let Qr=null;const Lx=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=oe.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:p}=u,[h,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:m,loadedPages:b}=h,v=t.length,x=Math.ceil(v/f),A=C.useRef(null),k=Zn(!0,!0,A==null?void 0:A.current);C.useEffect(()=>{let N=1;k&&(k>=Pi.fourCards?N=4:k>=Pi.threeCards?N=3:k>=Pi.twoCards&&(N=2),N>v&&(N=v)),c(O=>({...O,cardsPerPage:N,isLoading:!1}))},[k,v]);const w=(N="next")=>{let O=m;if(typeof N=="string")if(N==="next")if(m<x-1)O=m+1;else return;else if(m>0)O=m-1;else return;else O=N;g(E=>({...E,currentPage:O,loadedPages:[...new Set([...b,O])]}))},B=N=>{Qr=N.touches[0].clientX},P=N=>{if(Qr===null)return;const O=N.touches[0].clientX,E=Qr-O;E>5?w("next"):E<-5&&w("previous"),Qr=null},q={"--width":`${k||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":m};if(p)return d.jsx(Fs,{layout:`carousel${a?"-with-title":""}`});const I=(N,O)=>{var T;let E=null;return(T=N==null?void 0:N.sys)!=null&&T.id?E=`card-${N.sys.id}`:N!=null&&N.slug?E=`card-${N.slug}`:[n[O],N.contentType].includes("customCard")&&(E=`card-${window.btoa(`${N.title} ${N.createdAt}`)}-${O}`),E};return d.jsxs("section",{ref:A,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx($x,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:B,onTouchMove:P,style:q,"data-testid":"carousel-list",children:t.map((N,O)=>{let E=I(N,O);return E&&Ix(O,f,m,b)?d.jsx(oo,{id:E,card:{...N,contentType:n[O]},buildCardData:r,gtmContext:s,...o},E):(E=E||`${e}-card-${O}`,d.jsx(xt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},E))})}),x<=1?null:d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:N=>{N.preventDefault(),N.stopPropagation(),w("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:m<=0})}),[...Array(x)].map((N,O)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:O===m}),onClick:E=>{E.preventDefault(),E.stopPropagation(),w(O)},children:d.jsx(Le,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:O+1,total:x})})})},`page-indicator-${O}`)),d.jsx("li",{className:"arrow next",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:N=>{N.preventDefault(),N.stopPropagation(),w("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:m>=x-1})})]})]})},zx=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Fs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Jt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Lx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Jt,{})]},`carousel-${c}`)});const Ni="joinCommunityButton",uo=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=oe.useIntl(),i=C.useContext(Pt),s=i&&typeof i.id=="string",[o,l]=C.useState(e),[u,c]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{u==="joining"?c("joined"):u==="leaving"&&c("notJoined")},[o]);const f={},p={};return o&&u!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${Ni}_leave`}),f["aria-label"]=a.formatMessage({id:`${Ni}_member_aria`}),p["aria-hidden"]="true"),d.jsx(we,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async h=>{s&&(h.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:Y("join-community-button",u,{active:u==="joining"}),disabled:!s,...f,children:d.jsx("span",{className:"text",...p,children:a.formatMessage({id:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",qx=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:a=[]}={number:0,data:[]},functions:{invite:i,...s}})=>{const o=oe.useIntl(),l=5,u=r||a.length,c=a.length?a:Array(l).fill({}),f=`/communities/${n}/members`===window.location.pathname;return d.jsxs("div",{className:Y("community-details",e),children:[d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[o.formatMessage({id:`${Ri}members`}),d.jsx("span",{className:"count",children:u})]}),!f&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Ri}viewAll`})})})]}),d.jsx(Ss,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(uo,{isMember:t,functions:{...s}}),t&&d.jsx(we,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Ri}invite`})})]})};const Wx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Le,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Le,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Cn,{href:s?void 0:i,...l,children:Ln(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Hx=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=oe.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,f)=>{let p=[];o.includes(c)?p=o.filter(h=>h!==c):c==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),c]:p=[c],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:f,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:m=>{m.preventDefault(),m.stopPropagation(),u(c,h)},...g,children:f})},c)})})},Ux=(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 Jr="languageSwitcher_",Vx=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=oe.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(ao),[f,p]=C.useState(e);if(C.useEffect(()=>{e!==f&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),m=f!==e;return d.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${Jr}label`})}),d.jsx("ul",{children:g.map(b=>{var A;if(!fa[b])return null;const v=(A=r[b])==null?void 0:A.post_name;let x={className:b};if(f===b)x["aria-label"]=u.formatMessage({id:`${Jr}selected`},{language:fa[b]});else{const k=Ux(b,v,i);x={...x,href:typeof k=="string"?k:k.url,onClick:w=>{p(b),c(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Cn,{...x,fallbackElement:"span",children:fa[b]})},b)})}),s!=="short"&&!m&&d.jsx("p",{children:u.formatMessage({id:`${Jr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Jr}disclaimer`},{email:Tn.support,link:b=>{const v=`mailto:${b}`;return d.jsx("a",{href:v,children:b})}})})]})};const Mi=oe.createIntl({locale:"en",messages:Yn}),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:Mi.formatMessage({id:"loadMore_button"}),endOfFeed:Mi.formatMessage({id:"loadMore_endOfFeed"}),error:Mi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,f]=C.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(we,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const lo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Le,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Xr=!1;const Df=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=oe.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:f,icon:p,...h},g)=>{const m={...h,onClick:b=>{o(!1),typeof c=="function"&&c(b)},onFocus:()=>{Xr&&(clearTimeout(Xr),Xr=!1)},onBlur:()=>{Xr=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(we,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...m,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Kx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Zx=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Cf=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Zx.map(({key:a,href:i})=>{const s=Kx(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(rn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ur=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Yx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ur(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(`${ur(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(`${ur(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
160
|
+
*/function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){WC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function WC(e,t,n){return t=UC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HC(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 UC(e){var t=HC(e,"string");return typeof t=="symbol"?t:String(t)}var Ll={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()}},VC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},KC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},br=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},ZC=function(t){return br(t)&&!t.shiftKey},YC=function(t){return br(t)&&t.shiftKey},zl=function(t){return setTimeout(t,0)},ql=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ir=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},Yr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},GC=[],QC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||GC,i=$l({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ZC,isKeyBackward:YC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,T,R){return w&&w[T]!==void 0?w[T]:i[R||T]},u=function(w,T){var R=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return s.containerGroups.findIndex(function(M){var K=M.container,V=M.tabbableNodes;return K.contains(w)||(R==null?void 0:R.includes(K))||V.find(function(ie){return ie===w})})},c=function(w){var T=i[w];if(typeof T=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),K=1;K<R;K++)M[K-1]=arguments[K];T=T.apply(void 0,M)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var V=T;if(typeof T=="string"&&(V=r.querySelector(T),!V))throw new Error("`".concat(w,"` as selector refers to no known node"));return V},f=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!da(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var T=s.tabbableGroups[0],R=T&&T.firstTabbableNode;w=R||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},p=function(){if(s.containerGroups=s.containers.map(function(w){var T=uf(w,i.tabbableOptions),R=lf(w,i.tabbableOptions),M=T.length>0?T[0]:void 0,K=T.length>0?T[T.length-1]:void 0,V=R.find(function(D){return ln(D)}),ie=R.slice().reverse().find(function(D){return ln(D)}),Q=!!T.find(function(D){return Zt(D)>0});return{container:w,tabbableNodes:T,focusableNodes:R,posTabIndexesFound:Q,firstTabbableNode:M,lastTabbableNode:K,firstDomTabbableNode:V,lastDomTabbableNode:ie,nextTabbableNode:function(U){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=T.indexOf(U);return _<0?X?R.slice(R.indexOf(U)+1).find(function(F){return ln(F)}):R.slice(0,R.indexOf(U)).reverse().find(function(F){return ln(F)}):T[_+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(w){return w.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function O(w){var T=w.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?O(T.shadowRoot):T},g=function O(w){if(w!==!1&&w!==h(document)){if(!w||!w.focus){O(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,VC(w)&&w.select()}},m=function(w){var T=c("setReturnFocus",w);return T||(T===!1?!1:w)},b=function(w){var T=w.target,R=w.event,M=w.isBackward,K=M===void 0?!1:M;T=T||Yr(R),p();var V=null;if(s.tabbableGroups.length>0){var ie=u(T,R),Q=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)K?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(K){var D=ql(s.tabbableGroups,function($){var q=$.firstTabbableNode;return T===q});if(D<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T,!1))&&(D=ie),D>=0){var U=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[U];V=Zt(T)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T,!1))}else{var _=ql(s.tabbableGroups,function($){var q=$.lastTabbableNode;return T===q});if(_<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T))&&(_=ie),_>=0){var F=_===s.tabbableGroups.length-1?0:_+1,L=s.tabbableGroups[F];V=Zt(T)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T))}}else V=c("fallbackFocus");return V},v=function(w){var T=Yr(w);if(!(u(T,w)>=0)){if(ir(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ir(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var T=Yr(w),R=u(T,w)>=0;if(R||T instanceof Document)R&&(s.mostRecentlyFocusedNode=T);else{w.stopImmediatePropagation();var M,K=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[V].tabbableNodes;if(ie.length>0){var Q=ie.findIndex(function(D){return D===s.mostRecentlyFocusedNode});Q>=0&&(i.isKeyForward(s.recentNavEvent)?Q+1<ie.length&&(M=ie[Q+1],K=!1):Q-1>=0&&(M=ie[Q-1],K=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(U){return Zt(U)>0})})||(K=!1);else K=!1;K&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},A=function(w){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=b({event:w,isBackward:T});R&&(br(w)&&w.preventDefault(),g(R))},k=function(w){if(KC(w)&&ir(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&A(w,i.isKeyBackward(w))},E=function(w){var T=Yr(w);u(T,w)>=0||ir(i.clickOutsideDeactivates,w)||ir(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},B=function(){if(s.active)return Ll.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?zl(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},P=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},z=function(w){var T=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(K){return K===s.mostRecentlyFocusedNode})});T&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,N=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){I.observe(w,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(w){if(s.active)return this;var T=l(w,"onActivate"),R=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var K=function(){M&&p(),B(),N(),R==null||R()};return M?(M(s.containers.concat()).then(K,K),this):(K(),this)},deactivate:function(w){if(!s.active)return this;var T=$l({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,P(),s.active=!1,s.paused=!1,N(),Ll.deactivateTrap(a,o);var R=l(T,"onDeactivate"),M=l(T,"onPostDeactivate"),K=l(T,"checkCanReturnFocus"),V=l(T,"returnFocus","returnFocusOnDeactivate");R==null||R();var ie=function(){zl(function(){V&&g(m(s.nodeFocusedBeforeActivation)),M==null||M()})};return V&&K?(K(m(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(w){if(s.paused||!s.active)return this;var T=l(w,"onPause"),R=l(w,"onPostPause");return s.paused=!0,T==null||T(),P(),N(),R==null||R(),this},unpause:function(w){if(!s.paused||!s.active)return this;var T=l(w,"onUnpause"),R=l(w,"onPostUnpause");return s.paused=!1,T==null||T(),p(),B(),N(),R==null||R(),this},updateContainerElements:function(w){var T=[].concat(w).filter(Boolean);return s.containers=T.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&p(),N(),this}},o.updateContainerElements(t),o};const JC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:QC},Symbol.toStringTag,{value:"Module"})),XC=tc(JC),ex=tc(qC);function Vn(e){"@babel/helpers - typeof";return Vn=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},Vn(e)}function tx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wl(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,cf(r.key),r)}}function nx(e,t,n){return t&&Wl(e.prototype,t),n&&Wl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rx(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&&ws(e,t)}function ws(e,t){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ws(e,t)}function ax(e){var t=sx();return function(){var r=ka(e),a;if(t){var i=ka(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return ix(this,a)}}function ix(e,t){if(t&&(Vn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dr(e)}function dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sx(){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 ka(e){return ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ka(e)}function ox(e,t,n){return t=cf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cf(e){var t=ux(e,"string");return Vn(t)==="symbol"?t:String(t)}function ux(e,t){if(Vn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gr=C,he=BC,lx=XC,cx=lx.createFocusTrap,dx=ex,fx=dx.isFocusable,ro=function(e){rx(n,e);var t=ax(n);function n(r){var a;tx(this,n),a=t.call(this,r),ox(dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,f=new Array(c>1?c-1:0),p=1;p<c;p++)f[p-1]=arguments[p];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(dr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return nx(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&&!fx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Gr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Gr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Gr.cloneElement(i,{ref:s});return o}return null}}]),n}(Gr.Component),sr=typeof Element>"u"?Function:Element;ro.propTypes={active:he.bool,paused:he.bool,focusTrapOptions:he.shape({document:he.object,onActivate:he.func,onPostActivate:he.func,checkCanFocusTrap:he.func,onPause:he.func,onPostPause:he.func,onUnpause:he.func,onPostUnpause:he.func,onDeactivate:he.func,onPostDeactivate:he.func,checkCanReturnFocus:he.func,initialFocus:he.oneOfType([he.instanceOf(sr),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(sr),he.string,he.func]),escapeDeactivates:he.oneOfType([he.bool,he.func]),clickOutsideDeactivates:he.oneOfType([he.bool,he.func]),returnFocusOnDeactivate:he.bool,setReturnFocus:he.oneOfType([he.instanceOf(sr),he.string,he.bool,he.func]),allowOutsideClick:he.oneOfType([he.bool,he.func]),preventScroll:he.bool,tabbableOptions:he.shape({displayCheck:he.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:he.oneOfType([he.bool,he.func])}),trapStack:he.array,isKeyForward:he.func,isKeyBackward:he.func}),containerElements:he.arrayOf(he.instanceOf(sr)),children:he.oneOfType([he.element,he.instanceOf(sr)])};ro.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:cx};var hx=ro;const mx=tn(hx),df=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Zf.ReactQueryDevtools,{initialIsOpen:!1})]})};var px=C.createContext({client:na});function gx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.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&&(na.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),na.init(r,a)),na)},[n,r]);return C.createElement(px.Provider,{value:{client:i}},t)}const ff=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(gx,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),hf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...fh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},ao=C.createContext({}),fa={en:"English",es:"Español",fr:"Français",pt:"Português"},Pt=C.createContext({isLoading:!0});function Ha(){return C.useContext(Pt)}const mf=({children:e,user:t})=>d.jsx(Pt.Provider,{value:t,children:e}),io=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),pf=()=>C.useContext(io),gf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(io.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},vx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),pc(5e3)}).catch(c=>{c.message===fc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(ao.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(hf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(_s.CookiesProvider,{children:d.jsx(mf,{user:a,children:d.jsx(gf,{children:d.jsx(df,{showDevTools:r,children:d.jsx(ff,{user:a,children:t})})})})})})})};const so=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Sr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const p=oe.useIntl(),{registerOverlay:h,unregisterOverlay:g}=pf(),[m,b]=C.useState(t),v=k=>{k.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=k=>{b(k),k?(a(),h(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{m&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:m}),role:"dialog",children:d.jsx(so,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!m,style:A,children:t&&d.jsx(mx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Jt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Jt,{}),d.jsx(Dn,{buttons:u})]}),s&&d.jsx(Dr,{className:"error",children:s})]})})})})},vf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const bx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=oe.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Sr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Qd,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const yx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(rn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Sr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(qn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Dx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Qt,{className:"testimonial",children:n}),r?d.jsx(Fr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Cx=C.memo(Dx);const xx=({items:e=[],selector:t="",className:n=""})=>{const r=oe.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(jt,{variant:"subtle",className:Y("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ua=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=oe.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,p=Math.floor(f),h=(f-p)*60,g=Math.round(h),m=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};let or=!1;const Va=C.forwardRef(({styling:e={},isOpen:t=!1,isLoading:n=!1,children:r,className:a="",functions:i={},callbacks:s={},...o},l)=>{const u=oe.useIntl(),c=C.useRef(null),f=l||c,[p,h]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:m=!1,hasForm:b=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const B=f==null?void 0:f.current;if(B)return B.addEventListener("transitionend",A),B.addEventListener("keydown",k),()=>{B.removeEventListener("transitionend",A),B.removeEventListener("keydown",k)}},[]);const A=({propertyName:B})=>{B==="opacity"&&(or!==!1&&clearTimeout(or),h(P=>(P==="open"?v():P==="closed"&&x(),P==="opening"?"open":P==="closing"?"closed":P==="closed"?"hidden":P)))},k=B=>{B.key==="Escape"&&(B.stopPropagation(),B.preventDefault(),h("closing"))};zn(()=>{or!==!1&&clearTimeout(or);let B="open";t?h("opening"):(h("closing"),B="hidden"),or=setTimeout(()=>{h(B)},300)},[t]);const E={...o};return i&&i.onBlur&&(E.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:Y("tooltip text-medium",p,a,{loading:n,"extra-padding":g,"has-pointer":m,bottom:m==="bottom","has-form":b}),hidden:p==="hidden",...E,children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})});const wx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Gn,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const on=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Ex=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(on,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(Dn,{buttons:r})]})})};function bf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const _x=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:hc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>bf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Bx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,f=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Y("edit-section-modal"),children:d.jsx(Qn,{...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 p=>{var h,g;(h=n==null?void 0:n.functions)!=null&&h.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(we,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>bf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(_x,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Jt,{})]})};const kx=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:p=!1,description:h=!1},g)=>{if(!c||!c.url)return null;const m=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),h&&d.jsx("small",{children:h})]},window.btoa(`${c.url}_${g}`))})})]})};const Ax=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Fx=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,m;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},p={};c.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:x}=t[b];if(x&&Ax.includes(x.toLowerCase()))return;p[b]={text:v,element:f[b]};return}p[b]={text:t[b],element:f[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(on,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?d.jsx(qn,{overrideType:"text-only",className:"text",children:v},b):C.createElement(x,{key:b,className:b},v)}return null}),l,h&&d.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&d.jsx(Gn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Tx=C.memo(Fx);const Sx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(on,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const jx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(qn,{children:n}):n;return d.jsxs(on,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Gn,{image:r})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},Ox=C.memo(jx);const Px=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(we,{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})]}),Nx=({type:e,data:t})=>{const n=oe.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=a&&Yi(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ks(c)});if(o)return d.jsx(Mn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&Yi(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},Aa={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"}},Rx=({data:e,cta:t,link:n,gtmContext:r})=>{var m,b;const a=oe.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:f}=e,p=e.contentType;let h="";if((m=Aa[p])!=null&&m.gtmEvent&&(h=Aa[p].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async A=>{if(A.preventDefault(),A.stopPropagation(),!(v||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(we,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${f}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Mx={title:66,text:3e3,secondaryText:1e3,partner:25},oo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var P,z,I;const o=oe.useIntl(),l=C.useContext(Pt),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:p,isLoading:h}=c,g=C.useCallback(()=>{n(t,u).then(N=>{f(()=>({data:N,isLoading:!1}))}).catch(()=>f(N=>({...N,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),h||!p)return d.jsx(xt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:m}=p;if(!m||!Aa[m])return d.jsx(xt,{element:"li",className:"card-wrapper"});const{basePath:b="",className:v,length:x,gtmEvent:A}=Aa[m];let k=p.slug?`${b}${p.slug}`:!1;p.slug&&(p.slug.slice(0,4)==="http"||p.slug.slice(0,2)==="//"||p.slug.slice(0,6)==="mailto"||p.slug.slice(0,3)==="tel")&&(k=p.slug);const E={...Mx,...x};let B={className:"card"};return k&&(B={href:k,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},p.openInNewTab&&(B.target="_blank")),d.jsx("li",{className:Y("card-wrapper text-medium",v,i,{"has-link":k,"no-link":!k,"has-image":p.banner}),"data-testid":`${m}-card`,children:C.createElement(k?"a":"div",B,d.jsxs(d.Fragment,{children:[d.jsx(gc,{className:"card-label",contentType:m,customIcon:p.customIcon,customLabel:p.customLabel}),p.startDate&&!p.isOngoingEvent&&d.jsx(Mn,{size:"small",variant:p.dateHasPassed?"default":"information","data-testid":"date",children:p.dateHasPassed?o.formatMessage({id:"card_ended"}):mc(p.startDate)}),p.banner?d.jsxs("p",{className:"img",children:[p.registered&&d.jsx(Mn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Gn,{image:p.banner})]}):v==="people"?d.jsx(rn,{name:p.title||"",src:p.profile,"data-testid":"people-profile-picture"}):null,p.contributors&&d.jsx(Ss,{contributors:{data:p.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(m)?o.formatMessage({id:`card_contributors_${m}`}):void 0,"data-testid":"contributors"}),p.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:p.partner.length>1?o.formatMessage({id:"card_partner"},{partner:p.partner[0],number:p.partner.length-1}):Ln(p.partner[0],E.partner)}),["title","text","secondaryText"].map(N=>{const O=p[N];if(!O)return null;const w=lc(N);return d.jsx("p",{className:w,"data-testid":w,children:Ln(O,E[N])},N)}),(l==null?void 0:l.id)&&(p==null?void 0:p.members)&&d.jsxs("span",{className:"member-information",children:[((P=p==null?void 0:p.members)==null?void 0:P.isMember)&&d.jsx(Mn,{size:"small",variant:"registered",icon:((z=p==null?void 0:p.members)==null?void 0:z.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(I=p==null?void 0:p.members)==null?void 0:I.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:p==null?void 0:p.members.count})})]}),d.jsx(Nx,{type:v||"",data:p}),d.jsx(Rx,{data:p,cta:r,link:k||"",gtmContext:a})]}))})};const yf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(oo,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Ix=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},$x=({id:e,title:t})=>{const n=oe.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Pi={fourCards:1024,threeCards:769,twoCards:480};let Qr=null;const Lx=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=oe.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:p}=u,[h,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:m,loadedPages:b}=h,v=t.length,x=Math.ceil(v/f),A=C.useRef(null),k=Zn(!0,!0,A==null?void 0:A.current);C.useEffect(()=>{let N=1;k&&(k>=Pi.fourCards?N=4:k>=Pi.threeCards?N=3:k>=Pi.twoCards&&(N=2),N>v&&(N=v)),c(O=>({...O,cardsPerPage:N,isLoading:!1}))},[k,v]);const E=(N="next")=>{let O=m;if(typeof N=="string")if(N==="next")if(m<x-1)O=m+1;else return;else if(m>0)O=m-1;else return;else O=N;g(w=>({...w,currentPage:O,loadedPages:[...new Set([...b,O])]}))},B=N=>{Qr=N.touches[0].clientX},P=N=>{if(Qr===null)return;const O=N.touches[0].clientX,w=Qr-O;w>5?E("next"):w<-5&&E("previous"),Qr=null},z={"--width":`${k||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":m};if(p)return d.jsx(Fs,{layout:`carousel${a?"-with-title":""}`});const I=(N,O)=>{var T;let w=null;return(T=N==null?void 0:N.sys)!=null&&T.id?w=`card-${N.sys.id}`:N!=null&&N.slug?w=`card-${N.slug}`:[n[O],N.contentType].includes("customCard")&&(w=`card-${window.btoa(`${N.title} ${N.createdAt}`)}-${O}`),w};return d.jsxs("section",{ref:A,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx($x,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:B,onTouchMove:P,style:z,"data-testid":"carousel-list",children:t.map((N,O)=>{let w=I(N,O);return w&&Ix(O,f,m,b)?d.jsx(oo,{id:w,card:{...N,contentType:n[O]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${O}`,d.jsx(xt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},w))})}),x<=1?null:d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:N=>{N.preventDefault(),N.stopPropagation(),E("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:m<=0})}),[...Array(x)].map((N,O)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:O===m}),onClick:w=>{w.preventDefault(),w.stopPropagation(),E(O)},children:d.jsx(Le,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:O+1,total:x})})})},`page-indicator-${O}`)),d.jsx("li",{className:"arrow next",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:N=>{N.preventDefault(),N.stopPropagation(),E("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:m>=x-1})})]})]})},zx=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Fs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Jt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Lx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Jt,{})]},`carousel-${c}`)});const Ni="joinCommunityButton",uo=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=oe.useIntl(),i=C.useContext(Pt),s=i&&typeof i.id=="string",[o,l]=C.useState(e),[u,c]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{u==="joining"?c("joined"):u==="leaving"&&c("notJoined")},[o]);const f={},p={};return o&&u!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${Ni}_leave`}),f["aria-label"]=a.formatMessage({id:`${Ni}_member_aria`}),p["aria-hidden"]="true"),d.jsx(we,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async h=>{s&&(h.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:Y("join-community-button",u,{active:u==="joining"}),disabled:!s,...f,children:d.jsx("span",{className:"text",...p,children:a.formatMessage({id:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",qx=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:a=[]}={number:0,data:[]},functions:{invite:i,...s}})=>{const o=oe.useIntl(),l=5,u=r||a.length,c=a.length?a:Array(l).fill({}),f=`/communities/${n}/members`===window.location.pathname;return d.jsxs("div",{className:Y("community-details",e),children:[d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[o.formatMessage({id:`${Ri}members`}),d.jsx("span",{className:"count",children:u})]}),!f&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Ri}viewAll`})})})]}),d.jsx(Ss,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(uo,{isMember:t,functions:{...s}}),t&&d.jsx(we,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Ri}invite`})})]})};const Wx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Le,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Le,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Cn,{href:s?void 0:i,...l,children:Ln(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Hx=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=oe.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,f)=>{let p=[];o.includes(c)?p=o.filter(h=>h!==c):c==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),c]:p=[c],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:f,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:m=>{m.preventDefault(),m.stopPropagation(),u(c,h)},...g,children:f})},c)})})},Ux=(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 Jr="languageSwitcher_",Vx=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=oe.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(ao),[f,p]=C.useState(e);if(C.useEffect(()=>{e!==f&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),m=f!==e;return d.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${Jr}label`})}),d.jsx("ul",{children:g.map(b=>{var A;if(!fa[b])return null;const v=(A=r[b])==null?void 0:A.post_name;let x={className:b};if(f===b)x["aria-label"]=u.formatMessage({id:`${Jr}selected`},{language:fa[b]});else{const k=Ux(b,v,i);x={...x,href:typeof k=="string"?k:k.url,onClick:E=>{p(b),c(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Cn,{...x,fallbackElement:"span",children:fa[b]})},b)})}),s!=="short"&&!m&&d.jsx("p",{children:u.formatMessage({id:`${Jr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Jr}disclaimer`},{email:Tn.support,link:b=>{const v=`mailto:${b}`;return d.jsx("a",{href:v,children:b})}})})]})};const Mi=oe.createIntl({locale:"en",messages:Yn}),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:Mi.formatMessage({id:"loadMore_button"}),endOfFeed:Mi.formatMessage({id:"loadMore_endOfFeed"}),error:Mi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,f]=C.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(we,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const lo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Le,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Xr=!1;const Df=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=oe.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:f,icon:p,...h},g)=>{const m={...h,onClick:b=>{o(!1),typeof c=="function"&&c(b)},onFocus:()=>{Xr&&(clearTimeout(Xr),Xr=!1)},onBlur:()=>{Xr=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(we,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...m,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Kx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Zx=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Cf=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Zx.map(({key:a,href:i})=>{const s=Kx(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(rn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ur=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Yx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ur(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(`${ur(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(`${ur(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
161
161
|
|
|
162
|
-
${ur(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ur(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Gx="shareLinks_",Qx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Yx({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:f,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=m=>h(m,f)),d.jsx("li",{children:d.jsx(we,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,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:`${Gx}link_${u}`}),...g})},u)})})]})};const Jx=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,p)=>(c||(c=`panel-${window.btoa(f)}-${p}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(p=>p.id===c)){for(let p=0;p<e.length;p++)if(r(e[p].id,e[p].text,p)===c){a=p;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:f,content:p,href:h,hasCarousel:g},m)=>{c=r(c,f,m);const b=i===c,v={};h||(v["aria-controls"]=c,v.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!b,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":b?"assertive":"off",children:typeof p=="string"?d.jsx("p",{children:p}):p},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:h||`#${c}`,id:`tab-${c}`,className:Y({selected:b}),role:"tab","aria-selected":b,...v,children:f})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Xx={"2-1":901,"1-3":769,"1-1":769},xf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Zn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Xx[e]?null:o)})};let Ii;const $i="contactFooter_",ew=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Ii),Ii=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ii),window.removeEventListener("resize",l)}),[]),d.jsx(on,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(oe.FormattedMessage,{id:`${$i}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(oe.FormattedMessage,{id:`${$i}text`})}),d.jsx(Cn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(Gd,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},tw=({activeLink:e,...t})=>d.jsx(on,{children:d.jsx(xf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Cf,{activeLink:e}),d.jsx(Dc,{...t})]})})});const Li="cookieBanner_",zi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],qi=new Date(Date.now()+12*30*24*60*60*1e3),wf=()=>{const e=oe.useIntl(),[t,n,r]=_s.useCookies(zi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{zi.forEach(c=>{n(c,!0,{path:"/",expires:qi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:qi}),zi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:qi});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Li}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Li}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Li}text`})}),d.jsx(Dn,{buttons:u})]})},$t={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],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"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Tn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Tn["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:Tn.support,gtmType:"concierge-email-click"},business:{email:Tn.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 Rn="footer_",Fa="SiteFooter",Hl=({group:e})=>{const t=$t[e].order||[];let n=!1;return"text"in $t[e]&&(n=$t[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=$t[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},co=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Pa,{element:"hr"}),d.jsx(lo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Hl,{group:e}),Object.keys($t[e]).includes("child")&&d.jsx(Hl,{group:$t[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray($t.social.order)&&$t.social.order.map(e=>{const t=$t.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${Rn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),je={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&je.handlerCalled[e]&&i-je.handlerCalled[e]<500)return;je.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=ec(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?je.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=je.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=je.findFirstChild(u.children,"href")}else s=je.findFirstChild(t.current.children,"href");break;case"account":if(o=je.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=je.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(je.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(je.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(je.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{je.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ar={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Ta=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=ec(Ar,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const A=x.split("."),k=A[A.length-2];x=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,m=p&&window.location.pathname===o.href;let b={},v={};if(m&&(b={...b,"aria-current":"page"}),h){const x=o.menuId||e,A={onClick:k=>je.events.onClick(k,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>je.events.onFocus({id:x}),onBlur:()=>je.events.onBlur({id:x,callback:a}),onMouseLeave:()=>je.events.onBlur({id:x,callback:a}),onMouseEnter:()=>je.events.onMouseEnter({id:x,callback:a})};n&&(g&&(b={...A,onKeyPress:k=>{k.key==="Enter"&&je.events.onClick(k,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),v={hidden:x in r?!r[x]:!0}),g||(v={...v,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":h,parent:g,active:m}),...b,children:[p?C.createElement(c?we:"a",p,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:Y({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(k=>d.jsx(Ta,{id:`${e}.${x}.${k}`,...A},k))})]},x):d.jsx(Ta,{id:`${e}.${x}`,...A},x)})})]},e)};const nw={height:67,height_desktop:83},fo=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=Zn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Bs,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),ic({scrollPosition:nw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!0,m,o)},scrollDown:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!1,m,o)}}});const p=(m,b,v=!1)=>{je.handleMenus({id:m,value:b,menus:f.current.menus,dispatch:o,forceHandle:v})},h=C.useRef(null),g=m=>{m.key==="Escape"&&["navigation","search","account"].forEach(b=>{f.current.menus[b]&&p(b,!1,!0)})};return C.useEffect(()=>{var m;return(m=document.getElementById("header"))==null||m.addEventListener("keydown",g),()=>{var b;(b=document.getElementById("header"))==null||b.removeEventListener("keydown",g)}},[]),zn(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),zn(()=>{u.account&&je.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Le,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(lo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Le,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Ar.order.map(m=>d.jsx(Ta,{id:m,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:p},m))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Le,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Jd,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:m=>je.events.onClick(m,{id:"account",callback:p,isOpen:u.account}),onMouseEnter:()=>je.events.onMouseEnter({id:"account",callback:p}),onMouseLeave:()=>je.events.onBlur({id:"account",callback:p}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Le,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(rn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Ar.buttons.order.map(m=>d.jsx(Ta,{id:`buttons.${m}`},m))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const rw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(fo,{}),d.jsx("div",{id:"content",children:d.jsx(nn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(co,{})]})},Ef=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:f="default",circle:p="default",modal:h="default"}=i,g=rc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const m=ra(e,{locale:o}),b=ra(t,{locale:o}),v=ra(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),p!=="default"&&(x[p]=!0),d.jsx(Qf.ErrorBoundary,{onError:r,fallback:d.jsx(rw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Y(s,x,{"has-footer":u}),children:[d.jsx(fo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[b&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":h==="large"}),children:b}),C.createElement(c==="bold"?so:"div",{id:"content",children:m,className:Y({"large-modal":h==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(co,{}),d.jsx(wf,{})]})})})},Ul={default:"tags_",headerTopics:"header_topics_topics_"},Wi={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"},aw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=Ar.topics.topics[e].href;return t?{id:e,href:t,text:`${Ul.headerTopics}${e}`}:null}return null}return Wi[e]?(e=Wi[e],{id:e,text:`${Ul.default}${e}`}):null}};const iw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=oe.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=aw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const sw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl();return e.length===0?null:d.jsxs("div",{className:Y("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(Fr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(jr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const ow=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=oe.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Ua,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(As,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const _f=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Bf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=Na(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):dc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(Ua,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const uw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=oe.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return d.jsxs(Ra,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${p}time_completed`}):d.jsx(Ua,{time:s,appendedText:a?f.formatMessage({id:`${p}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:m,contentType:b,icon:v,image:x,isIntroduction:A,optional:k,slug:w,subsectionId:B,title:P,type:q})=>{const I=a&&t||A,N={};return x&&(N.style={"--image":`url(${x})`}),d.jsx("li",{className:Y({article:b===lr.ARTICLE,discussion:b===lr.DISCUSSION,quiz:b===lr.QUIZ,completed:g&&b===lr.ARTICLE,locked:!I}),...N,children:d.jsx(Cn,{href:I?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${cc(P)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(_f,{sectionId:i,subsectionId:B,title:P,className:"course-title"})," ",d.jsx(Bf,{completionTime:m,icon:v,optional:k,type:q,children:c&&c[w]&&d.jsx("span",{className:"quiz-score",children:`${c[w]}%`})})]})})},w)})})]})};const lw=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(we,{...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:Y("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let ea=null;const st="discussion_form_",Ka=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},editorRef:r,placeholder:a,maxLength:i=1e11,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var I,N,O;const u=oe.useIntl(),c=C.useContext(Pt),[f,p]=C.useState(n.isEditing&&n.isEditing.text||""),[h,g]=C.useState(s.error||!1),[m,b]=C.useState(!1),v=C.useRef(null);if(r||(r=v),n.isLoading)return d.jsx(xt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const x=E=>{p(E);let T;!c||!c.id?T=At(u.formatMessage,`${st}error_loggedOut`,e.type,"action"):t?E.length>=i&&(T=`${st}error_tooLong`):T=At(u.formatMessage,`${st}error_noPermission`,e.type,"action"),T?g(T):h&&g(!1)};let A=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const E=((I=e.slugs)==null?void 0:I.reply)||((N=e.slugs)==null?void 0:N.answer)||((O=e.slugs)==null?void 0:O.question)||"";E&&(A=`${A}-${E.slice(-15)}`)}const k=async E=>{var R;if(E.preventDefault(),E.stopPropagation(),!c||!c.id||!t||B)return;ea&&clearTimeout(ea),b("submitting");const T=window.location.pathname;try{let M;switch(e.type){case"post":M=await o.create({content:f});break;case"question":M=await o.create({title:f,authorId:c&&c.id,...(R=o.props)==null?void 0:R.create});break;case"response":M=await o.create({questionSlug:e.slugs.question},{body:f,authorId:c&&c.id,contentPath:T});break;case"reply":M=await o.create({questionSlug:e.slugs.question,answerSlug:e.slugs.answer},{body:f,authorId:c&&c.id,contentPath:T});break;default:break}await uh(1e3),o.callback&&await o.callback(M),ea=setTimeout(()=>{p(""),b("submitted");const K=new Event("discussionFormSubmitted");document.dispatchEvent(K),w()},500)}catch(M){const K=M;let V=`${st}error`;K!=null&&K.message.includes("entry already exists")&&(V=At(u.formatMessage,`${st}error_alreadyExists`,e.type,"action")),K!=null&&K.message.includes("429")?V=At(u.formatMessage,`${st}error_tooMany`,e.type,"action"):K!=null&&K.message.includes("400")&&(V=`${st}error`),g(V),w()}},w=()=>{ea=setTimeout(()=>{g(!1),b(!1)},5e3)},B=!f||!mh(f),P=m==="submitting",q=[];return(n.isEditing&&!P||s.cancel)&&q.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${st}cancel`})}),q.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:E=>{if(n.isEditing){b("submitting");const T=r!=null&&r.current&&(r!=null&&r.current)?r==null?void 0:r.current:"";o.handleSaveEdit&&o.handleSaveEdit(T);return}k(E)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!t||B||P||n.isEditing&&f===n.isEditing.text,children:u.formatMessage({id:`${st}${P?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:Y("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&d.jsx("h2",{children:At(u.formatMessage,`${st}title`,e.type,"action")}),d.jsx(Fr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Le,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:At(u.formatMessage,`${st}label`,e.type,"action")}),d.jsx(Yd,{ref:r,id:`${A}-input`,value:m==="submitting"&&!h?"":f,placeholder:a||At(u.formatMessage,`${st}placeholder`,e.type,"action"),onChange:x,autoFocus:!!n.isEditing,"aria-invalid":!!h,"aria-errormessage":"error-message"}),d.jsx("small",{children:At(u.formatMessage,`${st}explainer`,e.type,"action",{a:E=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:E})})}),d.jsx(Dn,{buttons:q}),m==="submitted"&&n.showSuccessMessage&&d.jsx(Dr,{className:"success","data-testid":"success",children:At(u.formatMessage,`${st}success`,e.type,"action")}),h&&d.jsx(Dr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof h=="string"?h.includes(" ")?h:u.formatMessage({id:h},{action:u.formatMessage({id:`discussion_action_${e.type}`}),maxLength:i}):h})]})},ho=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(nn,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(uo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ka,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u})},cw={showForm:!1},Za=C.createContext(cw),kf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},dw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),fw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Es=({icon:e,...t})=>d.jsx(we,{className:"discussion-button",variant:"tertiary",icon:e,...t});let yr=!1;const Hi=()=>{yr!==!1&&(clearTimeout(yr),yr=!1)},Ui=5,Af=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=oe.useIntl();C.useEffect(()=>{h(a)},[a]);const[c,f]=C.useState(t),[p,h]=C.useState(a),[g,m]=C.useState(!1),[b,v]=C.useState(!1),x=C.useMemo(()=>fw(n,Ui),[n]),A=w=>{if(w.preventDefault(),w.stopPropagation(),v(!1),yr)return Hi(),!1;if(Hi(),g||!s)return!1;yr=setTimeout(k,350)},k=async()=>{if(Hi(),g||!s)return!1;let w=p?c-1:c+1;w<0&&(w=0),m(!0),f(w),h(!p);try{if(i&&i.slugs){const B=dw(i.slugs);p?await l(B):await o({...B,payload:{contentPath:window.location.pathname}})}}catch{f(t),h(a)}finally{m(!1)}};return d.jsxs("div",{className:"likes-wrapper",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onFocus:()=>{v(!0)},onBlur:()=>{v(!1)},children:[d.jsx(Es,{className:Y("discussion-button text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!s}),icon:{icon:p?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":p,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:c})})}),n&&d.jsx(Va,{isOpen:b,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map(w=>typeof w=="string"||!w.name?null:d.jsx("li",{children:d.jsx(Cn,{href:w.id?`/profiles/${w.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:B=>B==null?void 0:B.stopPropagation(),children:w.name})},w.id||window.btoa(w.name))),t>Ui&&d.jsx("li",{children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ui})})]})})]})},Vl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ya=(e,t)=>e&&!t;const It="discussion_",hw=280,Or=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:f}={openComments:()=>{}}},links:p={},className:h,gtmContext:g="DiscussionAnswer",children:m,isTruncated:b=!1})=>{const v=oe.useIntl(),x=C.useContext(Pt),A=C.useContext(Za),{author:k,canLike:w,createdAt:B,id:P,likes:q=0,userLiked:I,comments:N=0}=t,O=x&&x.id&&typeof k!="string"&&k.id&&k.id===x.id||!1,E=typeof w=="boolean"?w:n?!O:!1,T=O&&(!t.createdAt||oh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,K]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[V,ie]=C.useState(!1),[Q,D]=C.useState(T?"highlighted":"default"),[U,X]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||Q==="default"))return document.addEventListener("discussionFormSubmitted",_),Z.addEventListener("transitionend",F),()=>{document.removeEventListener("discussionFormSubmitted",_),Z.removeEventListener("transitionend",F)}},[]),C.useEffect(()=>{K({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const _=()=>{setTimeout(()=>{D("fading")},1e3)},F=({propertyName:Z})=>{Z==="background-color"&&D(le=>(le==="default"&&(document.removeEventListener("discussionFormSubmitted",_),R.current&&R.current.removeEventListener("transitionend",F)),le==="fading"?"default":le))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(xt,{className:"discussion-card discussion-post"});const L=b?Ln(M.body,hw):M.body,$=async Z=>{Z||(Z=""),X("");try{if(!Jf(Z,M.body)){const le=t.type==="question"?{title:Z}:{body:Z};await l(Vl(t.slugs),le)}K({body:Z,isEditing:!1,didEdit:!0})}catch{X(`${It}form_error`)}},z=()=>{A&&A.updateConversation&&A.updateConversation({showForm:!0}),setTimeout(()=>{var pe,_e,Se;const le=`reply-form-${(t.type==="answer"?t.slug:((pe=t.slugs)==null?void 0:pe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Se=t.slugs)==null?void 0:Se.question)||"").toLowerCase().slice(-15)}`,J=document.getElementById(le),be=document.getElementById(`${le}-input`);be&&be.focus(),J&&J.scrollIntoView({behavior:"smooth"})},0)},ne=async()=>{ie(!1);try{await o(Vl(t.slugs))}catch{X("delete-error")}},te=[{text:v.formatMessage({id:`${It}moreMenu_report`}),onClick:Z=>{Z.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${It}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&O&&te.push({text:v.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>K({...M,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${It}moreMenu_delete`}),onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),ie(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...vf(`delete-${t.slug}-modal`,V)}),C.createElement(e,{className:Y("discussion-post",h,{[Q]:!h||!h.includes("highlighted-text-box"),"has-link":p.post&&!M.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!p.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:P||t.slug,className:Y("discussion-card",t.type,{editing:M.isEditing,"has-link":p.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Fr,{member:k,additionalContent:{createdAt:B,didEdit:M.didEdit},className:typeof k!="string"&&k.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ka,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:M.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:U!==""&&U!=="delete-error"?v.formatMessage({id:U},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:$,handleCancel:()=>{X(""),K({...M,isEditing:!1})}},gtmContext:`${g}Form`}):p.post?d.jsxs("a",{href:p.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t.title}),t!=null&&t.body&&(t==null?void 0:t.body.length)>195?d.jsx(yc,{text:t==null?void 0:t.body,markdownOptions:{overrides:{a:Ji}}}):d.jsx(qn,{options:{overrides:{a:Ji}},children:L})]}):d.jsx(qn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Af,{element:"li",likes:q,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:E,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof f=="function")&&d.jsx(Es,{onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${It}comments_screenReader`},{count:N}),children:v.formatMessage({id:`${It}comments`},{count:N})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Es,{styling:{muted:!0},onClick:z,children:v.formatMessage({id:`${It}reply`})})}),d.jsx(Df,{element:"li",id:`more-${t.slug}`,options:te})]})]}),m,d.jsx(Sr,{id:`delete-${t.slug}-modal`,isOpen:V,functions:{onOpen:()=>{},onClose:()=>ie(!1)},forceShow:{error:U==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>ie(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ne,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(oe.FormattedMessage,{id:"discussion_delete_text",values:{p:Z=>d.jsx("p",{children:Z}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Vi="discussion_responses_",Ff=({type:e="answer",responses:t=0})=>{const n=oe.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Vi}title`},{action:n.formatMessage({id:`${Vi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:At(n.formatMessage,`${Vi}empty`,e,e)})]})};const Tf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Za),o=ra(a,{element:"li"});return d.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.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&&d.jsx(Ka,{...r})]})},mw="post",pw="reply",Sf="00000000-0000-0000-0000-000000000000";function mo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function po({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 gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function jf(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 bw({content:e}){return{content:e,id:Sf,time:new Date().toISOString(),verb:mw}}function Kl({activity:e,user:t}){return{...e,actor:jf(t),...gw()}}function Sa({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 Of({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 yw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Sf,kind:pw,parent:t||""}}function Zl({reply:e,user:t}){const n=jf(t);return{...e,user_id:n.id,user:n,...vw()}}function Yl({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 Dw({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Pf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Gl,Ki=0;const Nf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Gl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Ki=0;return}Ki++,!(Ki>10)&&(Gl=setTimeout(()=>{e(t)},50))}},Kn=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}),en=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}),Rf=Object.freeze({actor:`SU:${Kn.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"}),Cw=Object.freeze({actor:`SU:${en.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"}),xw=Object.freeze({actor:`SU:${Kn.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"}),ww=Object.freeze({actor:`SU:${en.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:Rf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:en.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:en.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:en.id,user:{id:en.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Rf.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:Kn.id,user:{id:Kn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Cw.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:en.id,user:{id:en.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xw.id,data:{content:"Some content 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:Kn.id,user:{id:Kn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ww.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Ew({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Kl({activity:bw(o),user:i});return Ql(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Kl({activity:o,user:i});r.setQueryData(a,Ql(c,u,!0)),setTimeout(()=>{Pf(c.id)},0)}});return s}function _w({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.content=i),s}),onError:n});return r}function Bw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:mo(u),mutate:po(u)},user:l,...u},f=Ew({...c,mutationFn:e}),p=_w({...c,mutationFn:t}),h=kw({...c,mutationFn:n}),g=Fw({...c,mutationFn:a}),m=Tw({...c,mutationFn:i}),{activities:b,...v}=Aw({queryKey:s,queryFn:r});return{activities:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},user:l,...v}}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=ja(s,o);return l&&Sa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=ja(o,l);u&&Sa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Aw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:jw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Sw(a,i)),onError:n});return r}function Tw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=ja(i,s);return o&&Of({activity:o,user:r}),s}),onError:n});return a}function Ql(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function ja(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Sw(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 jw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Ow=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=oe.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:p,edit:h,remove:g,like:m,unlike:b},user:v}=Bw({queryKey:[e,t,"activities"],queryFns:r});return Nf(),l?d.jsx(nn,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(ho,{form:{content:{type:"post",slugs:{}},functions:{create:p},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((x,A)=>{var R,M,K,V,ie,Q,D,U;const{id:k,own_reactions:w,latest_reactions:B,reaction_counts:P}=x,q=(((R=B==null?void 0:B.like)==null?void 0:R.length)||0)>0,I=(((M=w==null?void 0:w.like)==null?void 0:M.length)||0)>0,N=I?w==null?void 0:w.like[0].id:"",O=q?(K=B==null?void 0:B.like)==null?void 0:K.map(X=>{var _,F,L;return{id:(_=X==null?void 0:X.user)==null?void 0:_.id,name:(L=(F=X==null?void 0:X.user)==null?void 0:F.data)==null?void 0:L.name}}):!1,E=x==null?void 0:x.actor,T=(E==null?void 0:E.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(Or,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ya(n,T),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:k},slug:k,author:{id:E==null?void 0:E.id,name:(V=E==null?void 0:E.data)==null?void 0:V.name,organization:(ie=E==null?void 0:E.data)==null?void 0:ie.organization,jobTitle:(Q=E==null?void 0:E.data)==null?void 0:Q.jobTitle,location:(D=E==null?void 0:E.data)==null?void 0:D.location,image:{thumbnail:((U=E==null?void 0:E.data)==null?void 0:U.thumbnail)||void 0}},userLiked:I,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:O},links:{post:`${e}/${t}/${k}`,comments:`${e}/${t}/${k}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:k}),updateContent:(X,{body:_})=>h({activityId:k,content:_})},likes:{createLike:()=>m({activityId:k}),deleteLike:()=>b({activityId:k,reactionId:N})},comments:{openComments:()=>null}},isTruncated:!0})},k)}),!f&&d.jsx(jr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Pw={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Nw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Zl({reply:yw(o),user:i});return Jl(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Zl({reply:o,user:i});r.setQueryData(a,Jl(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Pf(c.id)},0)}});return s}function Rw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Oa(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Mf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:mo(u),mutate:po(u)},user:l,...u},f=Nw({...c,mutationFn:e}),p=Rw({...c,mutationFn:t}),h=Mw({...c,mutationFn:n}),g=$w({...c,mutationFn:a}),m=Lw({...c,mutationFn:i}),{replies:b,...v}=Iw({queryKey:s,queryFn:r});return{replies:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},user:l,...v}}function Mw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Oa(s,o);return l&&Yl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Oa(o,l);u&&Yl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Iw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=Uw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function $w({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Hw(a,i)),onError:n});return r}function Lw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Oa(i,s);return o&&Dw({reply:o,user:r}),s}),onError:n});return a}function zw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function qw(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 Ww(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 Jl(e,t,n){return t?n!=null&&n.append?qw(e,t,n):Ww(e,t,n):zw(e)}function Oa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Hw(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 Uw(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 Vw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const{replies:s,fetchNextPage:o,hasNextPage:l,isLoading:u,mutations:{create:c,edit:f,like:p,remove:h,unlike:g},user:m}=Mf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:b=>i.list({...b,reactionId:r})}});return d.jsx(Tf,{loadMore:{isLoading:u,hasNextPage:l,loadNextPage:()=>o()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(b,{body:v})=>c({activityId:n,replyId:r,content:v})},meta:{isEditing:!1,showSuccessMessage:!1}},children:s&&s.length>0?s==null?void 0:s.map(b=>{var M,K,V,ie,Q,D,U,X,_,F,L,$;const{id:v,own_children:x,latest_children:A,children_counts:k}=b,B=(((M=x==null?void 0:x.like)==null?void 0:M.length)||0)>0?(K=x==null?void 0:x.like)==null?void 0:K.find(z=>{var ne;return((ne=z==null?void 0:z.user)==null?void 0:ne.id)===(m==null?void 0:m.id)}):!1,P=B?B==null?void 0:B.id:"",q=!!B,N=(((V=A==null?void 0:A.like)==null?void 0:V.length)||0)>0?(ie=A==null?void 0:A.like)==null?void 0:ie.map(z=>{var ne,te,Z;return{id:(ne=z==null?void 0:z.user)==null?void 0:ne.id,name:(Z=(te=z==null?void 0:z.user)==null?void 0:te.data)==null?void 0:Z.name}}):!1,O=b==null?void 0:b.user,E=(O==null?void 0:O.id)===(m==null?void 0:m.id),T=Ya(a,E),R=typeof b.data.content=="string"?(Q=b==null?void 0:b.data)==null?void 0:Q.content:((U=(D=b==null?void 0:b.data)==null?void 0:D.content)==null?void 0:U.text)||"";return d.jsx(Or,{content:{id:v,type:"reply",body:R,canLike:T,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:b==null?void 0:b.parent},slug:"",author:{id:O==null?void 0:O.id,name:(X=O.data)==null?void 0:X.name,organization:(_=O.data)==null?void 0:_.organization,jobTitle:(F=O.data)==null?void 0:F.jobTitle,location:(L=O.data)==null?void 0:L.location,image:{thumbnail:(($=O.data)==null?void 0:$.thumbnail)||void 0}},userLiked:q,likes:(k==null?void 0:k.like)||0,peopleWhoLiked:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:v}),updateContent:(z,{body:ne})=>f({replyId:v,content:ne})},likes:{createLike:()=>p({replyId:v}),deleteLike:()=>g({replyId:v,reactionId:P})},comments:{}}},v)}):null})};const If=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=oe.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:p,mutations:{create:h,edit:g,like:m,remove:b,unlike:v},user:x}=Mf({queryKey:[e,t,n,"replies"],queryFns:a});return sc(),Nf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Ff,{type:"comment",responses:u}),d.jsx(ho,{form:{content:{type:"reply",slugs:{}},functions:{create:(A,{body:k})=>h({activityId:n,content:k})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(A=>{var ie,Q,D,U,X,_,F,L,$,z,ne,te;const{id:k,own_children:w,latest_children:B,children_counts:P}=A,I=(((ie=w==null?void 0:w.like)==null?void 0:ie.length)||0)>0?(Q=w==null?void 0:w.like)==null?void 0:Q.find(Z=>{var le;return((le=Z==null?void 0:Z.user)==null?void 0:le.id)===(x==null?void 0:x.id)}):!1,N=I?I==null?void 0:I.id:"",O=!!I,T=(((D=B==null?void 0:B.like)==null?void 0:D.length)||0)>0?(U=B==null?void 0:B.like)==null?void 0:U.map(Z=>{var le,J,be;return{id:(le=Z==null?void 0:Z.user)==null?void 0:le.id,name:(be=(J=Z==null?void 0:Z.user)==null?void 0:J.data)==null?void 0:be.name}}):!1,R=A==null?void 0:A.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),K=Ya(r,M),V=typeof A.data.content=="string"?(X=A==null?void 0:A.data)==null?void 0:X.content:((F=(_=A==null?void 0:A.data)==null?void 0:_.content)==null?void 0:F.text)||"";return d.jsx(kf,{children:d.jsx(Or,{content:{id:k,type:"reply",body:V,canLike:K,createdAt:A==null?void 0:A.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k},slug:k,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:($=R.data)==null?void 0:$.organization,jobTitle:(z=R.data)==null?void 0:z.jobTitle,location:(ne=R.data)==null?void 0:ne.location,image:{thumbnail:((te=R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:O,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:k}),updateContent:(Z,{body:le})=>g({replyId:k,content:le})},likes:{createLike:()=>m({replyId:k}),deleteLike:()=>v({replyId:k,reactionId:N})},comments:{}},children:d.jsx(Vw,{basePath:e,parentId:t,activityId:n,replyId:k,isMember:r,functions:{...a}})},k)},k)}),!p&&d.jsx(jr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Kw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function Zw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function Yw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=qe.useQueryClient(),s=Ha(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:mo(o),mutate:po(o)},user:s,...o},u=Kw({...l,mutationFn:t}),c=Gw({...l,mutationFn:n}),f=Qw({...l,mutationFn:r}),{activity:p,...h}=Zw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:c,unlike:f},user:s,...h}}function Gw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Sa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Sa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function Qw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Of({activity:s,user:r}),s)),onError:n});return a}const Jw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var I,N,O,E,T,R,M,K,V,ie;const u=oe.useIntl(),c=C.useContext(Pt),{activity:f,error:p,isLoading:h,mutations:{edit:g,like:m,unlike:b}}=Yw({queryFns:i,queryKey:[e,t,n]});if(h)return d.jsx(xt,{style:{height:"400px"}});if(p||!f)return d.jsx(nn,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=f,A=(((I=x==null?void 0:x.like)==null?void 0:I.length)||0)>0,k=(((N=v==null?void 0:v.like)==null?void 0:N.length)||0)>0,w=k?v==null?void 0:v.like[0].id:"",B=A?(O=x==null?void 0:x.like)==null?void 0:O.map(Q=>{var D,U,X;return{id:(D=Q==null?void 0:Q.user)==null?void 0:D.id,name:(X=(U=Q==null?void 0:Q.user)==null?void 0:U.data)==null?void 0:X.name}}):!1,P=f==null?void 0:f.actor,q=(P==null?void 0:P.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Or,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Ya(r,q),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:P.id,name:(E=P.data)==null?void 0:E.name,organization:(T=P.data)==null?void 0:T.organization,jobTitle:(R=P.data)==null?void 0:R.jobTitle,location:(M=P.data)==null?void 0:M.location,image:{thumbnail:((K=P.data)==null?void 0:K.thumbnail)||void 0}},userLiked:k,likes:((V=f==null?void 0:f.reaction_counts)==null?void 0:V.like)||0,comments:((ie=f==null?void 0:f.reaction_counts)==null?void 0:ie.reply)||0,peopleWhoLiked:B},originalAuthorId:P==null?void 0:P.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(Q,{body:D})=>g({content:D})},likes:{createLike:()=>m({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:w})},comments:{openComments:()=>{}}}},n),d.jsx(If,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Xw=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Xl=[{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 ta="notFoundError_",eE=()=>{const e=oe.useIntl(),t=[];return Xl.forEach((n,r)=>{n.title=e.formatMessage({id:`${ta}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Ef,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(on,{children:[d.jsx(yf,{cards:Xl,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(we,{href:"/solution-articles/",children:e.formatMessage({id:`${ta}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ta}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ta}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=Ow;exports.ActivitySection=Jw;exports.AddPost=ho;exports.Banner=wx;exports.BannerSection=Tx;exports.Breadcrumbs=Wx;exports.Buckets=Dh;exports.Button=we;exports.ButtonWrapper=Dn;exports.COURSE_CONTENT_TYPES=lr;exports.CacheProvider=df;exports.Card=oo;exports.CardBlock=yf;exports.Carousel=zx;exports.CollapsibleSection=Ra;exports.Columns=xf;exports.CommunityDetails=qx;exports.ContactFooter=ew;exports.ContactForm=Gd;exports.ContentTypeLabel=gc;exports.Contributors=Ss;exports.ConversationContext=Za;exports.CookieBanner=wf;exports.CourseProgression=ow;exports.CourseStructure=uw;exports.CustomContentBanner=Sx;exports.Directory=yx;exports.DiscussionConversation=kf;exports.DiscussionForm=Ka;exports.DiscussionLikes=Af;exports.DiscussionPost=Or;exports.DiscussionThread=Tf;exports.Divider=Jt;exports.DownloadSection=Ex;exports.EMAILS=Tn;exports.EditSection=Bx;exports.EmailHelperTextBox=wc;exports.EmptyStateBox=nn;exports.Filters=Hx;exports.FlagsProvider=ff;exports.Footer=co;exports.Form=Qn;exports.FullWidthSection=on;exports.GlobalProviders=vx;exports.Header=fo;exports.HelperTextBox=bc;exports.HiddenFromScreenReaders=Pa;exports.HideShowTextBox=yc;exports.HighlightSection=Ox;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=fc;exports.IconBulletedList=wh;exports.ImageContainer=vh;exports.IntlProvider=hf;exports.InviteForm=Qd;exports.InviteModal=bx;exports.JoinButton=uo;exports.LanguageContext=ao;exports.LanguageSwitcher=Vx;exports.LessonName=_f;exports.LessonType=Bf;exports.Link=Cn;exports.LoadMore=jr;exports.LoadingBlock=Ph;exports.LoadingPlaceholder=xt;exports.LoadingState=Fs;exports.Logo=lo;exports.LogoSection=kx;exports.MarkCompleteButton=lw;exports.MarkdownText=qn;exports.MarketingBlock=Px;exports.Member=Fr;exports.MembersList=sw;exports.Modal=so;exports.MoreMenu=Df;exports.NUMBER_OF_COUNTRIES=sh;exports.NUMBER_OF_USERS=ih;exports.NavigationMenu=Cf;exports.NotFoundError=eE;exports.Overlay=Sr;exports.OverlayContext=io;exports.OverlayProvider=gf;exports.PageHeading=Dc;exports.PageLayout=Ef;exports.PasswordForm=dC;exports.PasswordRules=Ac;exports.Pill=Mn;exports.ProfileImageChange=cC;exports.ProfilePicture=rn;exports.ProgressBar=As;exports.ProgressTracker=bh;exports.Rating=Kh;exports.RepliesFeed=If;exports.ResponsesHeading=Ff;exports.ResponsiveImage=Gn;exports.ReturnToNavButton=yh;exports.RichTextEditor=Yd;exports.SearchForm=Jd;exports.ShareLinks=Qx;exports.SignupForm=vC;exports.Span=Ji;exports.StatusBanner=Dr;exports.TableOfContents=xx;exports.Tabs=Jx;exports.Tags=iw;exports.TestimonialBlock=Cx;exports.TimeToComplete=Ua;exports.Toggle=lC;exports.Tooltip=Va;exports.TopLevelPage=tw;exports.UserContext=Pt;exports.UserProvider=mf;exports.VisuallyHidden=Le;exports.addAriaProps=vf;exports.basicReducer=Bs;exports.camelCaseToDashCase=lc;exports.checkIntlPathExists=Na;exports.generateConditions=ca;exports.generateCssIcon=hc;exports.getLongDate=ks;exports.getMember=Ts;exports.getShortDate=mc;exports.headerData=Ar;exports.mapGetStreamData=Xw;exports.pageReady=pc;exports.passwordValidator=Gi;exports.repliesFeedMock=Pw;exports.supportedLanguages=fa;exports.toCamelCase=cc;exports.toSentenceCase=dc;exports.useCurrentPath=rc;exports.useEffectAfterMount=zn;exports.useElementWidth=Zn;exports.useOverlay=pf;exports.useScrollListener=ic;exports.useScrollToHash=sc;exports.useUser=Ha;
|
|
162
|
+
${ur(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ur(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Gx="shareLinks_",Qx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Yx({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:f,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=m=>h(m,f)),d.jsx("li",{children:d.jsx(we,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,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:`${Gx}link_${u}`}),...g})},u)})})]})};const Jx=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,p)=>(c||(c=`panel-${window.btoa(f)}-${p}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(p=>p.id===c)){for(let p=0;p<e.length;p++)if(r(e[p].id,e[p].text,p)===c){a=p;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:f,content:p,href:h,hasCarousel:g},m)=>{c=r(c,f,m);const b=i===c,v={};h||(v["aria-controls"]=c,v.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!b,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":b?"assertive":"off",children:typeof p=="string"?d.jsx("p",{children:p}):p},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:h||`#${c}`,id:`tab-${c}`,className:Y({selected:b}),role:"tab","aria-selected":b,...v,children:f})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Xx={"2-1":901,"1-3":769,"1-1":769},xf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Zn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Xx[e]?null:o)})};let Ii;const $i="contactFooter_",ew=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Ii),Ii=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ii),window.removeEventListener("resize",l)}),[]),d.jsx(on,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(oe.FormattedMessage,{id:`${$i}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(oe.FormattedMessage,{id:`${$i}text`})}),d.jsx(Cn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(Gd,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},tw=({activeLink:e,...t})=>d.jsx(on,{children:d.jsx(xf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Cf,{activeLink:e}),d.jsx(Dc,{...t})]})})});const Li="cookieBanner_",zi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],qi=new Date(Date.now()+12*30*24*60*60*1e3),wf=()=>{const e=oe.useIntl(),[t,n,r]=_s.useCookies(zi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{zi.forEach(c=>{n(c,!0,{path:"/",expires:qi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:qi}),zi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:qi});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Li}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Li}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Li}text`})}),d.jsx(Dn,{buttons:u})]})},$t={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],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"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Tn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Tn["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:Tn.support,gtmType:"concierge-email-click"},business:{email:Tn.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 Rn="footer_",Fa="SiteFooter",Hl=({group:e})=>{const t=$t[e].order||[];let n=!1;return"text"in $t[e]&&(n=$t[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=$t[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},co=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Pa,{element:"hr"}),d.jsx(lo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Hl,{group:e}),Object.keys($t[e]).includes("child")&&d.jsx(Hl,{group:$t[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray($t.social.order)&&$t.social.order.map(e=>{const t=$t.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${Rn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),je={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&je.handlerCalled[e]&&i-je.handlerCalled[e]<500)return;je.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=ec(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?je.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=je.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=je.findFirstChild(u.children,"href")}else s=je.findFirstChild(t.current.children,"href");break;case"account":if(o=je.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=je.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(je.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(je.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(je.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{je.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ar={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Ta=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=ec(Ar,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const A=x.split("."),k=A[A.length-2];x=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,m=p&&window.location.pathname===o.href;let b={},v={};if(m&&(b={...b,"aria-current":"page"}),h){const x=o.menuId||e,A={onClick:k=>je.events.onClick(k,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>je.events.onFocus({id:x}),onBlur:()=>je.events.onBlur({id:x,callback:a}),onMouseLeave:()=>je.events.onBlur({id:x,callback:a}),onMouseEnter:()=>je.events.onMouseEnter({id:x,callback:a})};n&&(g&&(b={...A,onKeyPress:k=>{k.key==="Enter"&&je.events.onClick(k,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),v={hidden:x in r?!r[x]:!0}),g||(v={...v,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":h,parent:g,active:m}),...b,children:[p?C.createElement(c?we:"a",p,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:Y({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(k=>d.jsx(Ta,{id:`${e}.${x}.${k}`,...A},k))})]},x):d.jsx(Ta,{id:`${e}.${x}`,...A},x)})})]},e)};const nw={height:67,height_desktop:83},fo=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=Zn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Bs,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),ic({scrollPosition:nw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!0,m,o)},scrollDown:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!1,m,o)}}});const p=(m,b,v=!1)=>{je.handleMenus({id:m,value:b,menus:f.current.menus,dispatch:o,forceHandle:v})},h=C.useRef(null),g=m=>{m.key==="Escape"&&["navigation","search","account"].forEach(b=>{f.current.menus[b]&&p(b,!1,!0)})};return C.useEffect(()=>{var m;return(m=document.getElementById("header"))==null||m.addEventListener("keydown",g),()=>{var b;(b=document.getElementById("header"))==null||b.removeEventListener("keydown",g)}},[]),zn(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),zn(()=>{u.account&&je.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Le,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(lo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Le,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Ar.order.map(m=>d.jsx(Ta,{id:m,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:p},m))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Le,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Jd,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:m=>je.events.onClick(m,{id:"account",callback:p,isOpen:u.account}),onMouseEnter:()=>je.events.onMouseEnter({id:"account",callback:p}),onMouseLeave:()=>je.events.onBlur({id:"account",callback:p}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Le,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(rn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Ar.buttons.order.map(m=>d.jsx(Ta,{id:`buttons.${m}`},m))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const rw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(fo,{}),d.jsx("div",{id:"content",children:d.jsx(nn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(co,{})]})},Ef=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:f="default",circle:p="default",modal:h="default"}=i,g=rc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const m=ra(e,{locale:o}),b=ra(t,{locale:o}),v=ra(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),p!=="default"&&(x[p]=!0),d.jsx(Qf.ErrorBoundary,{onError:r,fallback:d.jsx(rw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Y(s,x,{"has-footer":u}),children:[d.jsx(fo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[b&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":h==="large"}),children:b}),C.createElement(c==="bold"?so:"div",{id:"content",children:m,className:Y({"large-modal":h==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(co,{}),d.jsx(wf,{})]})})})},Ul={default:"tags_",headerTopics:"header_topics_topics_"},Wi={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"},aw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=Ar.topics.topics[e].href;return t?{id:e,href:t,text:`${Ul.headerTopics}${e}`}:null}return null}return Wi[e]?(e=Wi[e],{id:e,text:`${Ul.default}${e}`}):null}};const iw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=oe.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=aw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const sw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl();return e.length===0?null:d.jsxs("div",{className:Y("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(Fr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(jr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const ow=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=oe.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Ua,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(As,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const _f=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Bf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=Na(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):dc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(Ua,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const uw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=oe.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return d.jsxs(Ra,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${p}time_completed`}):d.jsx(Ua,{time:s,appendedText:a?f.formatMessage({id:`${p}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:m,contentType:b,icon:v,image:x,isIntroduction:A,optional:k,slug:E,subsectionId:B,title:P,type:z})=>{const I=a&&t||A,N={};return x&&(N.style={"--image":`url(${x})`}),d.jsx("li",{className:Y({article:b===lr.ARTICLE,discussion:b===lr.DISCUSSION,quiz:b===lr.QUIZ,completed:g&&b===lr.ARTICLE,locked:!I}),...N,children:d.jsx(Cn,{href:I?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${cc(P)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(_f,{sectionId:i,subsectionId:B,title:P,className:"course-title"})," ",d.jsx(Bf,{completionTime:m,icon:v,optional:k,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const lw=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(we,{...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:Y("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let ea=null;const st="discussion_form_",Ka=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},editorRef:r,placeholder:a,maxLength:i=1e11,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var I,N,O;const u=oe.useIntl(),c=C.useContext(Pt),[f,p]=C.useState(n.isEditing&&n.isEditing.text||""),[h,g]=C.useState(s.error||!1),[m,b]=C.useState(!1),v=C.useRef(null);if(r||(r=v),n.isLoading)return d.jsx(xt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const x=w=>{p(w);let T;!c||!c.id?T=At(u.formatMessage,`${st}error_loggedOut`,e.type,"action"):t?w.length>=i&&(T=`${st}error_tooLong`):T=At(u.formatMessage,`${st}error_noPermission`,e.type,"action"),T?g(T):h&&g(!1)};let A=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const w=((I=e.slugs)==null?void 0:I.reply)||((N=e.slugs)==null?void 0:N.answer)||((O=e.slugs)==null?void 0:O.question)||"";w&&(A=`${A}-${w.slice(-15)}`)}const k=async w=>{var R;if(w.preventDefault(),w.stopPropagation(),!c||!c.id||!t||B)return;ea&&clearTimeout(ea),b("submitting");const T=window.location.pathname;try{let M;switch(e.type){case"post":M=await o.create({content:f});break;case"question":M=await o.create({title:f,authorId:c&&c.id,...(R=o.props)==null?void 0:R.create});break;case"response":M=await o.create({questionSlug:e.slugs.question},{body:f,authorId:c&&c.id,contentPath:T});break;case"reply":M=await o.create({questionSlug:e.slugs.question,answerSlug:e.slugs.answer},{body:f,authorId:c&&c.id,contentPath:T});break;default:break}await uh(1e3),o.callback&&await o.callback(M),ea=setTimeout(()=>{p(""),b("submitted");const K=new Event("discussionFormSubmitted");document.dispatchEvent(K),E()},500)}catch(M){const K=M;let V=`${st}error`;K!=null&&K.message.includes("entry already exists")&&(V=At(u.formatMessage,`${st}error_alreadyExists`,e.type,"action")),K!=null&&K.message.includes("429")?V=At(u.formatMessage,`${st}error_tooMany`,e.type,"action"):K!=null&&K.message.includes("400")&&(V=`${st}error`),g(V),E()}},E=()=>{ea=setTimeout(()=>{g(!1),b(!1)},5e3)},B=!f||!mh(f),P=m==="submitting",z=[];return(n.isEditing&&!P||s.cancel)&&z.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${st}cancel`})}),z.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:w=>{if(n.isEditing){b("submitting");const T=r!=null&&r.current&&(r!=null&&r.current)?r==null?void 0:r.current:"";o.handleSaveEdit&&o.handleSaveEdit(T);return}k(w)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!t||B||P||n.isEditing&&f===n.isEditing.text,children:u.formatMessage({id:`${st}${P?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:Y("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&d.jsx("h2",{children:At(u.formatMessage,`${st}title`,e.type,"action")}),d.jsx(Fr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Le,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:At(u.formatMessage,`${st}label`,e.type,"action")}),d.jsx(Yd,{ref:r,id:`${A}-input`,value:m==="submitting"&&!h?"":f,placeholder:a||At(u.formatMessage,`${st}placeholder`,e.type,"action"),onChange:x,autoFocus:!!n.isEditing,"aria-invalid":!!h,"aria-errormessage":"error-message"}),d.jsx("small",{children:At(u.formatMessage,`${st}explainer`,e.type,"action",{a:w=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:w})})}),d.jsx(Dn,{buttons:z}),m==="submitted"&&n.showSuccessMessage&&d.jsx(Dr,{className:"success","data-testid":"success",children:At(u.formatMessage,`${st}success`,e.type,"action")}),h&&d.jsx(Dr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof h=="string"?h.includes(" ")?h:u.formatMessage({id:h},{action:u.formatMessage({id:`discussion_action_${e.type}`}),maxLength:i}):h})]})},ho=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(nn,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(uo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ka,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u})},cw={showForm:!1},Za=C.createContext(cw),kf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},dw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),fw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Es=({icon:e,...t})=>d.jsx(we,{className:"discussion-button",variant:"tertiary",icon:e,...t});let yr=!1;const Hi=()=>{yr!==!1&&(clearTimeout(yr),yr=!1)},Ui=5,Af=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=oe.useIntl();C.useEffect(()=>{h(a)},[a]);const[c,f]=C.useState(t),[p,h]=C.useState(a),[g,m]=C.useState(!1),[b,v]=C.useState(!1),x=C.useMemo(()=>fw(n,Ui),[n]),A=E=>{if(E.preventDefault(),E.stopPropagation(),v(!1),yr)return Hi(),!1;if(Hi(),g||!s)return!1;yr=setTimeout(k,350)},k=async()=>{if(Hi(),g||!s)return!1;let E=p?c-1:c+1;E<0&&(E=0),m(!0),f(E),h(!p);try{if(i&&i.slugs){const B=dw(i.slugs);p?await l(B):await o({...B,payload:{contentPath:window.location.pathname}})}}catch{f(t),h(a)}finally{m(!1)}};return d.jsxs("div",{className:"likes-wrapper",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onFocus:()=>{v(!0)},onBlur:()=>{v(!1)},children:[d.jsx(Es,{className:Y("discussion-button text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!s}),icon:{icon:p?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":p,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:c})})}),n&&d.jsx(Va,{isOpen:b,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map(E=>typeof E=="string"||!E.name?null:d.jsx("li",{children:d.jsx(Cn,{href:E.id?`/profiles/${E.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:B=>B==null?void 0:B.stopPropagation(),children:E.name})},E.id||window.btoa(E.name))),t>Ui&&d.jsx("li",{children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ui})})]})})]})},Vl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ya=(e,t)=>e&&!t;const It="discussion_",hw=280,Or=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:f}={openComments:()=>{}}},links:p={},className:h,gtmContext:g="DiscussionAnswer",children:m,isTruncated:b=!1})=>{const v=oe.useIntl(),x=C.useContext(Pt),A=C.useContext(Za),{author:k,canLike:E,createdAt:B,id:P,likes:z=0,userLiked:I,comments:N=0}=t,O=x&&x.id&&typeof k!="string"&&k.id&&k.id===x.id||!1,w=typeof E=="boolean"?E:n?!O:!1,T=O&&(!t.createdAt||oh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,K]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[V,ie]=C.useState(!1),[Q,D]=C.useState(T?"highlighted":"default"),[U,X]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||Q==="default"))return document.addEventListener("discussionFormSubmitted",_),Z.addEventListener("transitionend",F),()=>{document.removeEventListener("discussionFormSubmitted",_),Z.removeEventListener("transitionend",F)}},[]),C.useEffect(()=>{K({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const _=()=>{setTimeout(()=>{D("fading")},1e3)},F=({propertyName:Z})=>{Z==="background-color"&&D(le=>(le==="default"&&(document.removeEventListener("discussionFormSubmitted",_),R.current&&R.current.removeEventListener("transitionend",F)),le==="fading"?"default":le))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(xt,{className:"discussion-card discussion-post"});const L=b?Ln(M.body,hw):M.body,$=async Z=>{Z||(Z=""),X("");try{if(!Jf(Z,M.body)){const le=t.type==="question"?{title:Z}:{body:Z};await l(Vl(t.slugs),le)}K({body:Z,isEditing:!1,didEdit:!0})}catch{X(`${It}form_error`)}},q=()=>{A&&A.updateConversation&&A.updateConversation({showForm:!0}),setTimeout(()=>{var pe,_e,Se;const le=`reply-form-${(t.type==="answer"?t.slug:((pe=t.slugs)==null?void 0:pe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Se=t.slugs)==null?void 0:Se.question)||"").toLowerCase().slice(-15)}`,J=document.getElementById(le),be=document.getElementById(`${le}-input`);be&&be.focus(),J&&J.scrollIntoView({behavior:"smooth"})},0)},ne=async()=>{ie(!1);try{await o(Vl(t.slugs))}catch{X("delete-error")}},te=[{text:v.formatMessage({id:`${It}moreMenu_report`}),onClick:Z=>{Z.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${It}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&O&&te.push({text:v.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>K({...M,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${It}moreMenu_delete`}),onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),ie(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...vf(`delete-${t.slug}-modal`,V)}),C.createElement(e,{className:Y("discussion-post",h,{[Q]:!h||!h.includes("highlighted-text-box"),"has-link":p.post&&!M.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!p.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:P||t.slug,className:Y("discussion-card",t.type,{editing:M.isEditing,"has-link":p.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Fr,{member:k,additionalContent:{createdAt:B,didEdit:M.didEdit},className:typeof k!="string"&&k.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ka,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:M.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:U!==""&&U!=="delete-error"?v.formatMessage({id:U},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:$,handleCancel:()=>{X(""),K({...M,isEditing:!1})}},gtmContext:`${g}Form`}):p.post?d.jsxs("a",{href:p.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t.title}),t!=null&&t.body&&(t==null?void 0:t.body.length)>195?d.jsx(yc,{text:t==null?void 0:t.body,markdownOptions:{overrides:{a:Ji}}}):d.jsx(qn,{options:{overrides:{a:Ji}},children:L})]}):d.jsx(qn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Af,{element:"li",likes:z,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:w,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof f=="function")&&d.jsx(Es,{onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${It}comments_screenReader`},{count:N}),children:v.formatMessage({id:`${It}comments`},{count:N})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Es,{styling:{muted:!0},onClick:q,children:v.formatMessage({id:`${It}reply`})})}),d.jsx(Df,{element:"li",id:`more-${t.slug}`,options:te})]})]}),m,d.jsx(Sr,{id:`delete-${t.slug}-modal`,isOpen:V,functions:{onOpen:()=>{},onClose:()=>ie(!1)},forceShow:{error:U==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>ie(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ne,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(oe.FormattedMessage,{id:"discussion_delete_text",values:{p:Z=>d.jsx("p",{children:Z}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Vi="discussion_responses_",Ff=({type:e="answer",responses:t=0})=>{const n=oe.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Vi}title`},{action:n.formatMessage({id:`${Vi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:At(n.formatMessage,`${Vi}empty`,e,e)})]})};const Tf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Za),o=ra(a,{element:"li"});return d.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.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&&d.jsx(Ka,{...r})]})},mw="post",pw="reply",Sf="00000000-0000-0000-0000-000000000000";function mo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function po({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 gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function jf(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 bw({content:e}){return{content:e,id:Sf,time:new Date().toISOString(),verb:mw}}function Kl({activity:e,user:t}){return{...e,actor:jf(t),...gw()}}function Sa({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 Of({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 yw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Sf,kind:pw,parent:t||""}}function Zl({reply:e,user:t}){const n=jf(t);return{...e,user_id:n.id,user:n,...vw()}}function Yl({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 Dw({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Pf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Gl,Ki=0;const Nf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Gl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Ki=0;return}Ki++,!(Ki>10)&&(Gl=setTimeout(()=>{e(t)},50))}},Kn=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}),en=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}),Rf=Object.freeze({actor:`SU:${Kn.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"}),Cw=Object.freeze({actor:`SU:${en.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"}),xw=Object.freeze({actor:`SU:${Kn.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"}),ww=Object.freeze({actor:`SU:${en.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:Rf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:en.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:en.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:en.id,user:{id:en.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Rf.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:Kn.id,user:{id:Kn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Cw.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:en.id,user:{id:en.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xw.id,data:{content:"Some content 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:Kn.id,user:{id:Kn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ww.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Ew({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Kl({activity:bw(o),user:i});return Ql(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Kl({activity:o,user:i});r.setQueryData(a,Ql(c,u,!0)),setTimeout(()=>{Pf(c.id)},0)}});return s}function _w({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.content=i),s}),onError:n});return r}function Bw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:mo(u),mutate:po(u)},user:l,...u},f=Ew({...c,mutationFn:e}),p=_w({...c,mutationFn:t}),h=kw({...c,mutationFn:n}),g=Fw({...c,mutationFn:a}),m=Tw({...c,mutationFn:i}),{activities:b,...v}=Aw({queryKey:s,queryFn:r});return{activities:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},user:l,...v}}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=ja(s,o);return l&&Sa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=ja(o,l);u&&Sa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Aw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:jw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Sw(a,i)),onError:n});return r}function Tw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=ja(i,s);return o&&Of({activity:o,user:r}),s}),onError:n});return a}function Ql(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function ja(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Sw(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 jw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Ow=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=oe.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:p,edit:h,remove:g,like:m,unlike:b},user:v}=Bw({queryKey:[e,t,"activities"],queryFns:r});return Nf(),l?d.jsx(nn,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(ho,{form:{content:{type:"post",slugs:{}},functions:{create:p},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((x,A)=>{var R,M,K,V,ie,Q,D,U;const{id:k,own_reactions:E,latest_reactions:B,reaction_counts:P}=x,z=(((R=B==null?void 0:B.like)==null?void 0:R.length)||0)>0,I=(((M=E==null?void 0:E.like)==null?void 0:M.length)||0)>0,N=I?E==null?void 0:E.like[0].id:"",O=z?(K=B==null?void 0:B.like)==null?void 0:K.map(X=>{var _,F,L;return{id:(_=X==null?void 0:X.user)==null?void 0:_.id,name:(L=(F=X==null?void 0:X.user)==null?void 0:F.data)==null?void 0:L.name}}):!1,w=x==null?void 0:x.actor,T=(w==null?void 0:w.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(Or,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ya(n,T),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:k},slug:k,author:{id:w==null?void 0:w.id,name:(V=w==null?void 0:w.data)==null?void 0:V.name,organization:(ie=w==null?void 0:w.data)==null?void 0:ie.organization,jobTitle:(Q=w==null?void 0:w.data)==null?void 0:Q.jobTitle,location:(D=w==null?void 0:w.data)==null?void 0:D.location,image:{thumbnail:((U=w==null?void 0:w.data)==null?void 0:U.thumbnail)||void 0}},userLiked:I,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:O},links:{post:`${e}/${t}/${k}`,comments:`${e}/${t}/${k}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:k}),updateContent:(X,{body:_})=>h({activityId:k,content:_})},likes:{createLike:()=>m({activityId:k}),deleteLike:()=>b({activityId:k,reactionId:N})},comments:{openComments:()=>null}},isTruncated:!0})},k)}),!f&&d.jsx(jr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Pw={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Nw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Zl({reply:yw(o),user:i});return Jl(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Zl({reply:o,user:i});r.setQueryData(a,Jl(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Pf(c.id)},0)}});return s}function Rw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Oa(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Mf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:mo(u),mutate:po(u)},user:l,...u},f=Nw({...c,mutationFn:e}),p=Rw({...c,mutationFn:t}),h=Mw({...c,mutationFn:n}),g=$w({...c,mutationFn:a}),m=Lw({...c,mutationFn:i}),{replies:b,...v}=Iw({queryKey:s,queryFn:r});return{replies:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},user:l,...v}}function Mw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Oa(s,o);return l&&Yl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Oa(o,l);u&&Yl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Iw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=Uw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function $w({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Hw(a,i)),onError:n});return r}function Lw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Oa(i,s);return o&&Dw({reply:o,user:r}),s}),onError:n});return a}function zw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function qw(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 Ww(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 Jl(e,t,n){return t?n!=null&&n.append?qw(e,t,n):Ww(e,t,n):zw(e)}function Oa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Hw(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 Uw(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 Vw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const{replies:s,fetchNextPage:o,hasNextPage:l,isLoading:u,mutations:{create:c,edit:f,like:p,remove:h,unlike:g},user:m}=Mf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:b=>i.list({...b,reactionId:r})}});return d.jsx(Tf,{loadMore:{isLoading:u,hasNextPage:l,loadNextPage:()=>o()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(b,{body:v})=>c({activityId:n,replyId:r,content:v})},meta:{isEditing:!1,showSuccessMessage:!1}},children:s&&s.length>0?s==null?void 0:s.map(b=>{var M,K,V,ie,Q,D,U,X,_,F,L,$;const{id:v,own_children:x,latest_children:A,children_counts:k}=b,B=(((M=x==null?void 0:x.like)==null?void 0:M.length)||0)>0?(K=x==null?void 0:x.like)==null?void 0:K.find(q=>{var ne;return((ne=q==null?void 0:q.user)==null?void 0:ne.id)===(m==null?void 0:m.id)}):!1,P=B?B==null?void 0:B.id:"",z=!!B,N=(((V=A==null?void 0:A.like)==null?void 0:V.length)||0)>0?(ie=A==null?void 0:A.like)==null?void 0:ie.map(q=>{var ne,te,Z;return{id:(ne=q==null?void 0:q.user)==null?void 0:ne.id,name:(Z=(te=q==null?void 0:q.user)==null?void 0:te.data)==null?void 0:Z.name}}):!1,O=b==null?void 0:b.user,w=(O==null?void 0:O.id)===(m==null?void 0:m.id),T=Ya(a,w),R=typeof b.data.content=="string"?(Q=b==null?void 0:b.data)==null?void 0:Q.content:((U=(D=b==null?void 0:b.data)==null?void 0:D.content)==null?void 0:U.text)||"";return d.jsx(Or,{content:{id:v,type:"reply",body:R,canLike:T,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:b==null?void 0:b.parent},slug:"",author:{id:O==null?void 0:O.id,name:(X=O.data)==null?void 0:X.name,organization:(_=O.data)==null?void 0:_.organization,jobTitle:(F=O.data)==null?void 0:F.jobTitle,location:(L=O.data)==null?void 0:L.location,image:{thumbnail:(($=O.data)==null?void 0:$.thumbnail)||void 0}},userLiked:z,likes:(k==null?void 0:k.like)||0,peopleWhoLiked:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:v}),updateContent:(q,{body:ne})=>f({replyId:v,content:ne})},likes:{createLike:()=>p({replyId:v}),deleteLike:()=>g({replyId:v,reactionId:P})},comments:{}}},v)}):null})};const If=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=oe.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:p,mutations:{create:h,edit:g,like:m,remove:b,unlike:v},user:x}=Mf({queryKey:[e,t,n,"replies"],queryFns:a});return sc(),Nf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Ff,{type:"comment",responses:u}),d.jsx(ho,{form:{content:{type:"reply",slugs:{}},functions:{create:(A,{body:k})=>h({activityId:n,content:k})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(A=>{var ie,Q,D,U,X,_,F,L,$,q,ne,te;const{id:k,own_children:E,latest_children:B,children_counts:P}=A,I=(((ie=E==null?void 0:E.like)==null?void 0:ie.length)||0)>0?(Q=E==null?void 0:E.like)==null?void 0:Q.find(Z=>{var le;return((le=Z==null?void 0:Z.user)==null?void 0:le.id)===(x==null?void 0:x.id)}):!1,N=I?I==null?void 0:I.id:"",O=!!I,T=(((D=B==null?void 0:B.like)==null?void 0:D.length)||0)>0?(U=B==null?void 0:B.like)==null?void 0:U.map(Z=>{var le,J,be;return{id:(le=Z==null?void 0:Z.user)==null?void 0:le.id,name:(be=(J=Z==null?void 0:Z.user)==null?void 0:J.data)==null?void 0:be.name}}):!1,R=A==null?void 0:A.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),K=Ya(r,M),V=typeof A.data.content=="string"?(X=A==null?void 0:A.data)==null?void 0:X.content:((F=(_=A==null?void 0:A.data)==null?void 0:_.content)==null?void 0:F.text)||"";return d.jsx(kf,{children:d.jsx(Or,{content:{id:k,type:"reply",body:V,canLike:K,createdAt:A==null?void 0:A.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k},slug:k,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:($=R.data)==null?void 0:$.organization,jobTitle:(q=R.data)==null?void 0:q.jobTitle,location:(ne=R.data)==null?void 0:ne.location,image:{thumbnail:((te=R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:O,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:k}),updateContent:(Z,{body:le})=>g({replyId:k,content:le})},likes:{createLike:()=>m({replyId:k}),deleteLike:()=>v({replyId:k,reactionId:N})},comments:{}},children:d.jsx(Vw,{basePath:e,parentId:t,activityId:n,replyId:k,isMember:r,functions:{...a}})},k)},k)}),!p&&d.jsx(jr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Kw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function Zw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function Yw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=qe.useQueryClient(),s=Ha(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:mo(o),mutate:po(o)},user:s,...o},u=Kw({...l,mutationFn:t}),c=Gw({...l,mutationFn:n}),f=Qw({...l,mutationFn:r}),{activity:p,...h}=Zw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:c,unlike:f},user:s,...h}}function Gw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Sa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Sa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function Qw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Of({activity:s,user:r}),s)),onError:n});return a}const Jw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var I,N,O,w,T,R,M,K,V,ie;const u=oe.useIntl(),c=C.useContext(Pt),{activity:f,error:p,isLoading:h,mutations:{edit:g,like:m,unlike:b}}=Yw({queryFns:i,queryKey:[e,t,n]});if(h)return d.jsx(xt,{style:{height:"400px"}});if(p||!f)return d.jsx(nn,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=f,A=(((I=x==null?void 0:x.like)==null?void 0:I.length)||0)>0,k=(((N=v==null?void 0:v.like)==null?void 0:N.length)||0)>0,E=k?v==null?void 0:v.like[0].id:"",B=A?(O=x==null?void 0:x.like)==null?void 0:O.map(Q=>{var D,U,X;return{id:(D=Q==null?void 0:Q.user)==null?void 0:D.id,name:(X=(U=Q==null?void 0:Q.user)==null?void 0:U.data)==null?void 0:X.name}}):!1,P=f==null?void 0:f.actor,z=(P==null?void 0:P.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Or,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Ya(r,z),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:P.id,name:(w=P.data)==null?void 0:w.name,organization:(T=P.data)==null?void 0:T.organization,jobTitle:(R=P.data)==null?void 0:R.jobTitle,location:(M=P.data)==null?void 0:M.location,image:{thumbnail:((K=P.data)==null?void 0:K.thumbnail)||void 0}},userLiked:k,likes:((V=f==null?void 0:f.reaction_counts)==null?void 0:V.like)||0,comments:((ie=f==null?void 0:f.reaction_counts)==null?void 0:ie.reply)||0,peopleWhoLiked:B},originalAuthorId:P==null?void 0:P.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(Q,{body:D})=>g({content:D})},likes:{createLike:()=>m({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:E})},comments:{openComments:()=>{}}}},n),d.jsx(If,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Xw=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Xl=[{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 ta="notFoundError_",eE=()=>{const e=oe.useIntl(),t=[];return Xl.forEach((n,r)=>{n.title=e.formatMessage({id:`${ta}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Ef,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(on,{children:[d.jsx(yf,{cards:Xl,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(we,{href:"/solution-articles/",children:e.formatMessage({id:`${ta}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ta}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ta}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=Ow;exports.ActivitySection=Jw;exports.AddPost=ho;exports.Banner=wx;exports.BannerSection=Tx;exports.Breadcrumbs=Wx;exports.Buckets=Dh;exports.Button=we;exports.ButtonWrapper=Dn;exports.COURSE_CONTENT_TYPES=lr;exports.CacheProvider=df;exports.Card=oo;exports.CardBlock=yf;exports.Carousel=zx;exports.CollapsibleSection=Ra;exports.Columns=xf;exports.CommunityDetails=qx;exports.ContactFooter=ew;exports.ContactForm=Gd;exports.ContentTypeLabel=gc;exports.Contributors=Ss;exports.ConversationContext=Za;exports.CookieBanner=wf;exports.CourseProgression=ow;exports.CourseStructure=uw;exports.CustomContentBanner=Sx;exports.Directory=yx;exports.DiscussionConversation=kf;exports.DiscussionForm=Ka;exports.DiscussionLikes=Af;exports.DiscussionPost=Or;exports.DiscussionThread=Tf;exports.Divider=Jt;exports.DownloadSection=Ex;exports.EMAILS=Tn;exports.EditSection=Bx;exports.EmailHelperTextBox=wc;exports.EmptyStateBox=nn;exports.Filters=Hx;exports.FlagsProvider=ff;exports.Footer=co;exports.Form=Qn;exports.FullWidthSection=on;exports.GlobalProviders=vx;exports.Header=fo;exports.HelperTextBox=bc;exports.HiddenFromScreenReaders=Pa;exports.HideShowTextBox=yc;exports.HighlightSection=Ox;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=fc;exports.IconBulletedList=wh;exports.ImageContainer=vh;exports.IntlProvider=hf;exports.InviteForm=Qd;exports.InviteModal=bx;exports.JoinButton=uo;exports.LanguageContext=ao;exports.LanguageSwitcher=Vx;exports.LessonName=_f;exports.LessonType=Bf;exports.Link=Cn;exports.LoadMore=jr;exports.LoadingBlock=Ph;exports.LoadingPlaceholder=xt;exports.LoadingState=Fs;exports.Logo=lo;exports.LogoSection=kx;exports.MarkCompleteButton=lw;exports.MarkdownText=qn;exports.MarketingBlock=Px;exports.Member=Fr;exports.MembersList=sw;exports.Modal=so;exports.MoreMenu=Df;exports.NUMBER_OF_COUNTRIES=sh;exports.NUMBER_OF_USERS=ih;exports.NavigationMenu=Cf;exports.NotFoundError=eE;exports.Overlay=Sr;exports.OverlayContext=io;exports.OverlayProvider=gf;exports.PageHeading=Dc;exports.PageLayout=Ef;exports.PasswordForm=dC;exports.PasswordRules=Ac;exports.Pill=Mn;exports.ProfileImageChange=cC;exports.ProfilePicture=rn;exports.ProgressBar=As;exports.ProgressTracker=bh;exports.Rating=Kh;exports.RepliesFeed=If;exports.ResponsesHeading=Ff;exports.ResponsiveImage=Gn;exports.ReturnToNavButton=yh;exports.RichTextEditor=Yd;exports.SearchForm=Jd;exports.ShareLinks=Qx;exports.SignupForm=vC;exports.Span=Ji;exports.StatusBanner=Dr;exports.TableOfContents=xx;exports.Tabs=Jx;exports.Tags=iw;exports.TestimonialBlock=Cx;exports.TimeToComplete=Ua;exports.Toggle=lC;exports.Tooltip=Va;exports.TopLevelPage=tw;exports.UserContext=Pt;exports.UserProvider=mf;exports.VisuallyHidden=Le;exports.addAriaProps=vf;exports.basicReducer=Bs;exports.camelCaseToDashCase=lc;exports.checkIntlPathExists=Na;exports.generateConditions=ca;exports.generateCssIcon=hc;exports.getLongDate=ks;exports.getMember=Ts;exports.getShortDate=mc;exports.headerData=Ar;exports.mapGetStreamData=Xw;exports.pageReady=pc;exports.passwordValidator=Gi;exports.repliesFeedMock=Pw;exports.supportedLanguages=fa;exports.toCamelCase=cc;exports.toSentenceCase=dc;exports.useCurrentPath=rc;exports.useEffectAfterMount=zn;exports.useElementWidth=Zn;exports.useOverlay=pf;exports.useScrollListener=ic;exports.useScrollToHash=sc;exports.useUser=Ha;
|