@apolitical/component-library 6.5.0-SW.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/discussion/components/conversation/conversation.d.ts +1 -1
  2. package/discussion/components/discussion-form-card/discussion-form-card.d.ts +2 -2
  3. package/discussion/components/form/components/guidelines/guidelines.d.ts +1 -1
  4. package/discussion/components/form/components/label/label.d.ts +1 -1
  5. package/discussion/components/form/form.constants.d.ts +2 -0
  6. package/discussion/components/form/form.d.ts +1 -1
  7. package/discussion/components/form/form.helpers.d.ts +4 -0
  8. package/discussion/components/form/form.type.d.ts +17 -8
  9. package/discussion/components/post/components/index.d.ts +0 -4
  10. package/discussion/components/post/post.d.ts +5 -13
  11. package/discussion/components/post/post.helpers.d.ts +1 -5
  12. package/discussion/discussion.mock.d.ts +4 -0
  13. package/discussion/feeds/activities-feed/activities-feed.d.ts +2 -6
  14. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +0 -2
  15. package/discussion/feeds/replies-feed/components/nested-replies-feed/nested-replies-feed.d.ts +1 -1
  16. package/discussion/feeds/replies-feed/components/reply-item/reply-item.d.ts +1 -1
  17. package/discussion/feeds/replies-feed/replies-feed.d.ts +1 -1
  18. package/discussion/index.d.ts +2 -1
  19. package/discussion/sections/activity-section/activity-section.d.ts +2 -2
  20. package/discussion/shared/constants.d.ts +0 -1
  21. package/discussion/shared/helpers/index.d.ts +1 -2
  22. package/discussion/shared/interfaces/activity.interface.d.ts +1 -16
  23. package/discussion/shared/interfaces/discussion.interface.d.ts +24 -21
  24. package/discussion/shared/interfaces/reaction.interface.d.ts +1 -1
  25. package/form/components/form/form.types.d.ts +2 -0
  26. package/form/components/rich-text-editor/components/context/context.d.ts +1 -1
  27. package/form/components/rich-text-editor/rich-text-editor.types.d.ts +1 -1
  28. package/helpers/intl.d.ts +7 -3
  29. package/helpers/replace-mention-data.d.ts +1 -1
  30. package/index.js +63 -63
  31. package/index.mjs +8322 -8438
  32. package/navigation/action-bar/action-bar.d.ts +2 -1
  33. package/navigation/action-bar/components/likes/likes.d.ts +2 -2
  34. package/package.json +1 -1
  35. package/polls/poll/index.d.ts +1 -1
  36. package/polls/poll/poll.d.ts +9 -8
  37. package/polls/poll/poll.mocks.d.ts +0 -1
  38. package/polls/poll/poll.types.d.ts +0 -9
  39. package/style.css +1 -1
  40. package/discussion/components/post/components/author-section/author-section.d.ts +0 -14
  41. package/discussion/components/post/components/author-section/index.d.ts +0 -1
  42. package/discussion/components/post/components/categories/categories.d.ts +0 -5
  43. package/discussion/components/post/components/categories/index.d.ts +0 -1
  44. package/discussion/components/post/components/poll-content/index.d.ts +0 -1
  45. package/discussion/components/post/components/poll-content/poll-content.d.ts +0 -11
  46. package/discussion/components/post/components/post-content/index.d.ts +0 -1
  47. package/discussion/components/post/components/post-content/post-content.d.ts +0 -15
  48. package/discussion/feeds/activities-feed/cache/hooks/create-vote/create-vote.hook.d.ts +0 -8
  49. package/discussion/feeds/activities-feed/cache/hooks/create-vote/index.d.ts +0 -1
  50. package/discussion/feeds/activities-feed/cache/hooks/remove-vote/index.d.ts +0 -1
  51. package/discussion/feeds/activities-feed/cache/hooks/remove-vote/remove-vote.hook.d.ts +0 -8
  52. package/discussion/shared/helpers/poll.helper.d.ts +0 -23
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ae=require("react-intl"),Rt=require("lodash.clonedeep"),pm=require("lodash.set"),Gc=require("react-dom"),Kt=require("markdown-to-jsx"),rr=require("truncate"),Ue=require("@tanstack/react-query"),gm=require("@tanstack/react-query-devtools"),ka=require("posthog-js"),io=require("react-cookie"),Ia=require("lodash.isequal"),Qc=require("lodash.get"),vm=require("react-error-boundary"),bm=require("react-multi-email");var ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Xc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ae=require("react-intl"),Ot=require("lodash.clonedeep"),hh=require("lodash.set"),Yc=require("react-dom"),Zt=require("markdown-to-jsx"),sr=require("truncate"),Ke=require("@tanstack/react-query"),ph=require("@tanstack/react-query-devtools"),Fa=require("posthog-js"),ro=require("react-cookie"),Ia=require("lodash.isequal"),Gc=require("lodash.get"),gh=require("react-error-boundary"),vh=require("react-multi-email");var ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function In(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Jc={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Xc);var ym=Xc.exports;const H=Mn(ym),xm=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:H("hidden",r,{"show-on-focus":t}),children:n}),Pe=y.memo(xm),Cm=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),si=y.memo(Cm);var _s={exports:{}},vr={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Jc);var bh=Jc.exports;const V=In(bh),yh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Pe=y.memo(yh),xh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),oi=y.memo(xh);var ws={exports:{}},yr={};/**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.min.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var mu;function wm(){if(mu)return vr;mu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:a.current}}return vr.Fragment=n,vr.jsx=s,vr.jsxs=s,vr}var br={};/**
13
+ */var fu;function Ch(){if(fu)return yr;fu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},h=null,p=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:h,ref:p,props:m,_owner:a.current}}return yr.Fragment=n,yr.jsx=s,yr.jsxs=s,yr}var xr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,137 +18,137 @@
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 pu;function Dm(){return pu||(pu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var oe=v&&N[v]||N[f];return typeof oe=="function"?oe:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(N){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),we=1;we<oe;we++)ce[we-1]=arguments[we];E("error",N,ce)}}function E(N,oe,ce){{var we=g.ReactDebugCurrentFrame,Me=we.getStackAddendum();Me!==""&&(oe+="%s",ce=ce.concat([Me]));var We=ce.map(function(je){return String(je)});We.unshift("Warning: "+oe),Function.prototype.apply.call(console[N],console,We)}}var B=!1,D=!1,k=!1,T=!1,$=!1,P;P=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||$||N===a||N===u||N===d||T||N===m||B||D||k||typeof N=="object"&&N!==null&&(N.$$typeof===p||N.$$typeof===h||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===P||N.getModuleId!==void 0))}function R(N,oe,ce){var we=N.displayName;if(we)return we;var Me=oe.displayName||oe.name||"";return Me!==""?ce+"("+Me+")":ce}function A(N){return N.displayName||"Context"}function F(N){if(N==null)return null;if(typeof N.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var oe=N;return A(oe)+".Consumer";case s:var ce=N;return A(ce._context)+".Provider";case l:return R(N,N.render,"ForwardRef");case h:var we=N.displayName||null;return we!==null?we:F(N.type)||"Memo";case p:{var Me=N,We=Me._payload,je=Me._init;try{return F(je(We))}catch{return null}}}return null}var O=Object.assign,M=0,U,W,ie,se,C,G,ne;function _(){}_.__reactDisabledLog=!0;function S(){{if(M===0){U=console.log,W=console.info,ie=console.warn,se=console.error,C=console.group,G=console.groupCollapsed,ne=console.groupEnd;var N={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}M++}}function q(){{if(M--,M===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},N,{value:U}),info:O({},N,{value:W}),warn:O({},N,{value:ie}),error:O({},N,{value:se}),group:O({},N,{value:C}),groupCollapsed:O({},N,{value:G}),groupEnd:O({},N,{value:ne})})}M<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var j=g.ReactCurrentDispatcher,L;function Q(N,oe,ce){{if(L===void 0)try{throw Error()}catch(Me){var we=Me.stack.trim().match(/\n( *(at )?)/);L=we&&we[1]||""}return`
22
- `+L+N}}var Z=!1,X;{var le=typeof WeakMap=="function"?WeakMap:Map;X=new le}function te(N,oe){if(!N||Z)return"";{var ce=X.get(N);if(ce!==void 0)return ce}var we;Z=!0;var Me=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var We;We=j.current,j.current=null,S();try{if(oe){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(Jt){we=Jt}Reflect.construct(N,[],je)}else{try{je.call()}catch(Jt){we=Jt}N.call(je.prototype)}}else{try{throw Error()}catch(Jt){we=Jt}N()}}catch(Jt){if(Jt&&we&&typeof Jt.stack=="string"){for(var Te=Jt.stack.split(`
23
- `),ct=we.stack.split(`
24
- `),Ge=Te.length-1,et=ct.length-1;Ge>=1&&et>=0&&Te[Ge]!==ct[et];)et--;for(;Ge>=1&&et>=0;Ge--,et--)if(Te[Ge]!==ct[et]){if(Ge!==1||et!==1)do if(Ge--,et--,et<0||Te[Ge]!==ct[et]){var Bt=`
25
- `+Te[Ge].replace(" at new "," at ");return N.displayName&&Bt.includes("<anonymous>")&&(Bt=Bt.replace("<anonymous>",N.displayName)),typeof N=="function"&&X.set(N,Bt),Bt}while(Ge>=1&&et>=0);break}}}finally{Z=!1,j.current=We,q(),Error.prepareStackTrace=Me}var zn=N?N.displayName||N.name:"",hu=zn?Q(zn):"";return typeof N=="function"&&X.set(N,hu),hu}function pe(N,oe,ce){return te(N,!1)}function fe(N){var oe=N.prototype;return!!(oe&&oe.isReactComponent)}function Ae(N,oe,ce){if(N==null)return"";if(typeof N=="function")return te(N,fe(N));if(typeof N=="string")return Q(N);switch(N){case u:return Q("Suspense");case d:return Q("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return pe(N.render);case h:return Ae(N.type,oe,ce);case p:{var we=N,Me=we._payload,We=we._init;try{return Ae(We(Me),oe,ce)}catch{}}}return""}var ye=Object.prototype.hasOwnProperty,Ee={},Le=g.ReactDebugCurrentFrame;function Oe(N){if(N){var oe=N._owner,ce=Ae(N.type,N._source,oe?oe.type:null);Le.setExtraStackFrame(ce)}else Le.setExtraStackFrame(null)}function ze(N,oe,ce,we,Me){{var We=Function.call.bind(ye);for(var je in N)if(We(N,je)){var Te=void 0;try{if(typeof N[je]!="function"){var ct=Error((we||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ct.name="Invariant Violation",ct}Te=N[je](oe,je,we,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){Te=Ge}Te&&!(Te instanceof Error)&&(Oe(Me),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",we||"React class",ce,je,typeof Te),Oe(null)),Te instanceof Error&&!(Te.message in Ee)&&(Ee[Te.message]=!0,Oe(Me),w("Failed %s type: %s",ce,Te.message),Oe(null))}}}var Je=Array.isArray;function Se(N){return Je(N)}function qe(N){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&N[Symbol.toStringTag]||N.constructor.name||"Object";return ce}}function xe(N){try{return V(N),!1}catch{return!0}}function V(N){return""+N}function re(N){if(xe(N))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(N)),V(N)}var me=g.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},ke,ge,_e;_e={};function Ye(N){if(ye.call(N,"ref")){var oe=Object.getOwnPropertyDescriptor(N,"ref").get;if(oe&&oe.isReactWarning)return!1}return N.ref!==void 0}function nt(N){if(ye.call(N,"key")){var oe=Object.getOwnPropertyDescriptor(N,"key").get;if(oe&&oe.isReactWarning)return!1}return N.key!==void 0}function pt(N,oe){if(typeof N.ref=="string"&&me.current&&oe&&me.current.stateNode!==oe){var ce=F(me.current.type);_e[ce]||(w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(me.current.type),N.ref),_e[ce]=!0)}}function Xe(N,oe){{var ce=function(){ke||(ke=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ce.isReactWarning=!0,Object.defineProperty(N,"key",{get:ce,configurable:!0})}}function wt(N,oe){{var ce=function(){ge||(ge=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ce.isReactWarning=!0,Object.defineProperty(N,"ref",{get:ce,configurable:!0})}}var Dt=function(N,oe,ce,we,Me,We,je){var Te={$$typeof:t,type:N,key:oe,ref:ce,props:je,_owner:We};return Te._store={},Object.defineProperty(Te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.defineProperty(Te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Me}),Object.freeze&&(Object.freeze(Te.props),Object.freeze(Te)),Te};function Ei(N,oe,ce,we,Me){{var We,je={},Te=null,ct=null;ce!==void 0&&(re(ce),Te=""+ce),nt(oe)&&(re(oe.key),Te=""+oe.key),Ye(oe)&&(ct=oe.ref,pt(oe,Me));for(We in oe)ye.call(oe,We)&&!ve.hasOwnProperty(We)&&(je[We]=oe[We]);if(N&&N.defaultProps){var Ge=N.defaultProps;for(We in Ge)je[We]===void 0&&(je[We]=Ge[We])}if(Te||ct){var et=typeof N=="function"?N.displayName||N.name||"Unknown":N;Te&&Xe(je,et),ct&&wt(je,et)}return Dt(N,Te,ct,Me,we,me.current,je)}}var gr=g.ReactCurrentOwner,na=g.ReactDebugCurrentFrame;function Ln(N){if(N){var oe=N._owner,ce=Ae(N.type,N._source,oe?oe.type:null);na.setExtraStackFrame(ce)}else na.setExtraStackFrame(null)}var _i;_i=!1;function ki(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function uu(){{if(gr.current){var N=F(gr.current.type);if(N)return`
21
+ */var mu;function Dh(){return mu||(mu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var ue=v&&N[v]||N[f];return typeof ue=="function"?ue:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(N){{for(var ue=arguments.length,de=new Array(ue>1?ue-1:0),Ce=1;Ce<ue;Ce++)de[Ce-1]=arguments[Ce];D("error",N,de)}}function D(N,ue,de){{var Ce=g.ReactDebugCurrentFrame,Ne=Ce.getStackAddendum();Ne!==""&&(ue+="%s",de=de.concat([Ne]));var Ve=de.map(function(Se){return String(Se)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[N],console,Ve)}}var F=!1,E=!1,_=!1,T=!1,I=!1,P;P=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||I||N===a||N===u||N===d||T||N===p||F||E||_||typeof N=="object"&&N!==null&&(N.$$typeof===h||N.$$typeof===m||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===P||N.getModuleId!==void 0))}function $(N,ue,de){var Ce=N.displayName;if(Ce)return Ce;var Ne=ue.displayName||ue.name||"";return Ne!==""?de+"("+Ne+")":de}function B(N){return N.displayName||"Context"}function A(N){if(N==null)return null;if(typeof N.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var ue=N;return B(ue)+".Consumer";case s:var de=N;return B(de._context)+".Provider";case l:return $(N,N.render,"ForwardRef");case m:var Ce=N.displayName||null;return Ce!==null?Ce:A(N.type)||"Memo";case h:{var Ne=N,Ve=Ne._payload,Se=Ne._init;try{return A(Se(Ve))}catch{return null}}}return null}var O=Object.assign,j=0,U,W,re,ne,w,Q,se;function k(){}k.__reactDisabledLog=!0;function M(){{if(j===0){U=console.log,W=console.info,re=console.warn,ne=console.error,w=console.group,Q=console.groupCollapsed,se=console.groupEnd;var N={configurable:!0,enumerable:!0,value:k,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}j++}}function q(){{if(j--,j===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},N,{value:U}),info:O({},N,{value:W}),warn:O({},N,{value:re}),error:O({},N,{value:ne}),group:O({},N,{value:w}),groupCollapsed:O({},N,{value:Q}),groupEnd:O({},N,{value:se})})}j<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=g.ReactCurrentDispatcher,L;function G(N,ue,de){{if(L===void 0)try{throw Error()}catch(Ne){var Ce=Ne.stack.trim().match(/\n( *(at )?)/);L=Ce&&Ce[1]||""}return`
22
+ `+L+N}}var K=!1,te;{var ce=typeof WeakMap=="function"?WeakMap:Map;te=new ce}function J(N,ue){if(!N||K)return"";{var de=te.get(N);if(de!==void 0)return de}var Ce;K=!0;var Ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ve;Ve=S.current,S.current=null,M();try{if(ue){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(en){Ce=en}Reflect.construct(N,[],Se)}else{try{Se.call()}catch(en){Ce=en}N.call(Se.prototype)}}else{try{throw Error()}catch(en){Ce=en}N()}}catch(en){if(en&&Ce&&typeof en.stack=="string"){for(var Te=en.stack.split(`
23
+ `),ft=Ce.stack.split(`
24
+ `),et=Te.length-1,nt=ft.length-1;et>=1&&nt>=0&&Te[et]!==ft[nt];)nt--;for(;et>=1&&nt>=0;et--,nt--)if(Te[et]!==ft[nt]){if(et!==1||nt!==1)do if(et--,nt--,nt<0||Te[et]!==ft[nt]){var Bt=`
25
+ `+Te[et].replace(" at new "," at ");return N.displayName&&Bt.includes("<anonymous>")&&(Bt=Bt.replace("<anonymous>",N.displayName)),typeof N=="function"&&te.set(N,Bt),Bt}while(et>=1&&nt>=0);break}}}finally{K=!1,S.current=Ve,q(),Error.prepareStackTrace=Ne}var Wn=N?N.displayName||N.name:"",du=Wn?G(Wn):"";return typeof N=="function"&&te.set(N,du),du}function he(N,ue,de){return J(N,!1)}function pe(N){var ue=N.prototype;return!!(ue&&ue.isReactComponent)}function we(N,ue,de){if(N==null)return"";if(typeof N=="function")return J(N,pe(N));if(typeof N=="string")return G(N);switch(N){case u:return G("Suspense");case d:return G("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return he(N.render);case m:return we(N.type,ue,de);case h:{var Ce=N,Ne=Ce._payload,Ve=Ce._init;try{return we(Ve(Ne),ue,de)}catch{}}}return""}var Me=Object.prototype.hasOwnProperty,je={},Je=g.ReactDebugCurrentFrame;function Ue(N){if(N){var ue=N._owner,de=we(N.type,N._source,ue?ue.type:null);Je.setExtraStackFrame(de)}else Je.setExtraStackFrame(null)}function Le(N,ue,de,Ce,Ne){{var Ve=Function.call.bind(Me);for(var Se in N)if(Ve(N,Se)){var Te=void 0;try{if(typeof N[Se]!="function"){var ft=Error((Ce||"React class")+": "+de+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ft.name="Invariant Violation",ft}Te=N[Se](ue,Se,Ce,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(et){Te=et}Te&&!(Te instanceof Error)&&(Ue(Ne),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Ce||"React class",de,Se,typeof Te),Ue(null)),Te instanceof Error&&!(Te.message in je)&&(je[Te.message]=!0,Ue(Ne),C("Failed %s type: %s",de,Te.message),Ue(null))}}}var Xe=Array.isArray;function _e(N){return Xe(N)}function Oe(N){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,de=ue&&N[Symbol.toStringTag]||N.constructor.name||"Object";return de}}function We(N){try{return Z(N),!1}catch{return!0}}function Z(N){return""+N}function oe(N){if(We(N))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Oe(N)),Z(N)}var ie=g.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},ve,ke,ze;ze={};function ot(N){if(Me.call(N,"ref")){var ue=Object.getOwnPropertyDescriptor(N,"ref").get;if(ue&&ue.isReactWarning)return!1}return N.ref!==void 0}function At(N){if(Me.call(N,"key")){var ue=Object.getOwnPropertyDescriptor(N,"key").get;if(ue&&ue.isReactWarning)return!1}return N.key!==void 0}function vt(N,ue){if(typeof N.ref=="string"&&ie.current&&ue&&ie.current.stateNode!==ue){var de=A(ie.current.type);ze[de]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(ie.current.type),N.ref),ze[de]=!0)}}function tt(N,ue){{var de=function(){ve||(ve=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};de.isReactWarning=!0,Object.defineProperty(N,"key",{get:de,configurable:!0})}}function xe(N,ue){{var de=function(){ke||(ke=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};de.isReactWarning=!0,Object.defineProperty(N,"ref",{get:de,configurable:!0})}}var Be=function(N,ue,de,Ce,Ne,Ve,Se){var Te={$$typeof:t,type:N,key:ue,ref:de,props:Se,_owner:Ve};return Te._store={},Object.defineProperty(Te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ce}),Object.defineProperty(Te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ne}),Object.freeze&&(Object.freeze(Te.props),Object.freeze(Te)),Te};function Rt(N,ue,de,Ce,Ne){{var Ve,Se={},Te=null,ft=null;de!==void 0&&(oe(de),Te=""+de),At(ue)&&(oe(ue.key),Te=""+ue.key),ot(ue)&&(ft=ue.ref,vt(ue,Ne));for(Ve in ue)Me.call(ue,Ve)&&!me.hasOwnProperty(Ve)&&(Se[Ve]=ue[Ve]);if(N&&N.defaultProps){var et=N.defaultProps;for(Ve in et)Se[Ve]===void 0&&(Se[Ve]=et[Ve])}if(Te||ft){var nt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Te&&tt(Se,nt),ft&&xe(Se,nt)}return Be(N,Te,ft,Ne,Ce,ie.current,Se)}}var bt=g.ReactCurrentOwner,_n=g.ReactDebugCurrentFrame;function Xt(N){if(N){var ue=N._owner,de=we(N.type,N._source,ue?ue.type:null);_n.setExtraStackFrame(de)}else _n.setExtraStackFrame(null)}var Un;Un=!1;function Ei(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function su(){{if(bt.current){var N=A(bt.current.type);if(N)return`
26
26
 
27
- Check the render method of \``+N+"`."}return""}}function om(N){{if(N!==void 0){var oe=N.fileName.replace(/^.*[\\\/]/,""),ce=N.lineNumber;return`
27
+ Check the render method of \``+N+"`."}return""}}function sh(N){{if(N!==void 0){var ue=N.fileName.replace(/^.*[\\\/]/,""),de=N.lineNumber;return`
28
28
 
29
- Check your code at `+oe+":"+ce+"."}return""}}var lu={};function um(N){{var oe=uu();if(!oe){var ce=typeof N=="string"?N:N.displayName||N.name;ce&&(oe=`
29
+ Check your code at `+ue+":"+de+"."}return""}}var ou={};function oh(N){{var ue=su();if(!ue){var de=typeof N=="string"?N:N.displayName||N.name;de&&(ue=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return oe}}function cu(N,oe){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var ce=um(oe);if(lu[ce])return;lu[ce]=!0;var we="";N&&N._owner&&N._owner!==gr.current&&(we=" It was passed a child from "+F(N._owner.type)+"."),Ln(N),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,we),Ln(null)}}function du(N,oe){{if(typeof N!="object")return;if(Se(N))for(var ce=0;ce<N.length;ce++){var we=N[ce];ki(we)&&cu(we,oe)}else if(ki(N))N._store&&(N._store.validated=!0);else if(N){var Me=b(N);if(typeof Me=="function"&&Me!==N.entries)for(var We=Me.call(N),je;!(je=We.next()).done;)ki(je.value)&&cu(je.value,oe)}}}function lm(N){{var oe=N.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===h))ce=oe.propTypes;else return;if(ce){var we=F(oe);ze(ce,N.props,"prop",we,N)}else if(oe.PropTypes!==void 0&&!_i){_i=!0;var Me=F(oe);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Me||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cm(N){{for(var oe=Object.keys(N.props),ce=0;ce<oe.length;ce++){var we=oe[ce];if(we!=="children"&&we!=="key"){Ln(N),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",we),Ln(null);break}}N.ref!==null&&(Ln(N),w("Invalid attribute `ref` supplied to `React.Fragment`."),Ln(null))}}function fu(N,oe,ce,we,Me,We){{var je=z(N);if(!je){var Te="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Te+=" 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 ct=om(Me);ct?Te+=ct:Te+=uu();var Ge;N===null?Ge="null":Se(N)?Ge="array":N!==void 0&&N.$$typeof===t?(Ge="<"+(F(N.type)||"Unknown")+" />",Te=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof N,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,Te)}var et=Ei(N,oe,ce,Me,We);if(et==null)return et;if(je){var Bt=oe.children;if(Bt!==void 0)if(we)if(Se(Bt)){for(var zn=0;zn<Bt.length;zn++)du(Bt[zn],N);Object.freeze&&Object.freeze(Bt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else du(Bt,N)}return N===r?cm(et):lm(et),et}}function dm(N,oe,ce){return fu(N,oe,ce,!0)}function fm(N,oe,ce){return fu(N,oe,ce,!1)}var hm=fm,mm=dm;br.Fragment=r,br.jsx=hm,br.jsxs=mm}()),br}process.env.NODE_ENV==="production"?_s.exports=wm():_s.exports=Dm();var c=_s.exports;const ed=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},ar=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function td(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,w=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var E=y.useMemo(function(){var B=function(z){var R=o.current,A=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(A,R)},D=function(z,R){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(z):setTimeout(z,R)},k=function(z){if(!h.current)return!1;var R=z-a.current;return!a.current||R>=t||R<0||b&&z-i.current>=w},T=function(z){return s.current=null,f&&o.current?B(z):(o.current=l.current=null,u.current)},$=function z(){var R=Date.now();if(k(R))return T(R);if(h.current){var A=t-(R-a.current),F=b?Math.min(A,w-(R-i.current)):A;D(z,F)}},P=function(){if(p||g){var z=Date.now(),R=k(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,R){if(!s.current&&h.current)return i.current=a.current,D($,t),v?B(a.current):u.current;if(b)return D($,t),B(a.current)}return s.current||D($,t),u.current}};return P.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?T(Date.now()):u.current},P},[v,b,t,w,f,m,p,g]);return E}function nd(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return td(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Fi;const Nn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Fi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=nd(()=>{s()!==r&&(t&&(clearTimeout(Fi),document.body.classList.add("is-resizing"),Fi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},rd=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=nd(()=>{l()},250);return a},so=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);ar(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},oo=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const gu={},In=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=ae.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),v=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:w=!1,hasForm:E=!1}=t,{onOpen:B=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...T}=l,$=gu[p];y.useEffect(()=>{const A=v==null?void 0:v.current;if(A)return A.addEventListener("transitionend",P),()=>{A.removeEventListener("transitionend",P)}},[]),y.useEffect(()=>{if(f!=="open")return;const A=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",A),()=>{document.removeEventListener("keyup",A)}},[f]);const P=({propertyName:A})=>{A==="opacity"&&($!==!1&&clearTimeout($),b(F=>(F==="open"?B():F==="closed"&&D(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};ar(()=>{$!==!1&&clearTimeout($);let A="open";n?b("opening"):(b("closing"),A="hidden"),gu[p||""]=setTimeout(()=>{b(A)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const R={className:"content"};return k?R.className=H("content",{hidden:f==="hidden"}):R.hidden=f==="hidden",c.jsx("aside",{ref:v,id:p,className:H("tooltip text-medium",f,i,{loading:r,"extra-padding":g,"has-pointer":w,bottom:w==="bottom","has-form":E}),...z,children:c.jsx("div",{...R,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Qr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Rt(e);return t.forEach(({type:r,value:a})=>{pm(n,r,a)}),n},ad=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},id=(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},sd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),od=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),ud=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Em=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Yt="https://storage.googleapis.com/apolitical-assets/",Zn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},kr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ks="SU:",Rr="DELETED",ld="Invalid token error: Logging user out...",_m="200,000+",km="160+",$r=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,cd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Fm(e){return e?{"--icon":`url(${Yt}icons/${e}.svg)`}:{}}const _n={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},dd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),uo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Fs=e=>{let t;const n=Ra(),r=Ra(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/_n.milliseconds.inHour,i=Math.floor(t/_n.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<=_n.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/_n.year.days)}},Ra=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Am=(e,t,n)=>{let r;const a=Ra(),i=Ra(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/_n.milliseconds.inSecond<=t;case"minutes":return r/_n.milliseconds.inMinute<=t;case"hours":return r/_n.milliseconds.inHour<=t}return!1},Bm=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Tm=e=>new Promise(t=>setTimeout(t,e)),Sm=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},dr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_poll:"poll",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_pinned_post:"Pinned Post",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 <`+de+">.")}return ue}}function uu(N,ue){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var de=oh(ue);if(ou[de])return;ou[de]=!0;var Ce="";N&&N._owner&&N._owner!==bt.current&&(Ce=" It was passed a child from "+A(N._owner.type)+"."),Xt(N),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,Ce),Xt(null)}}function lu(N,ue){{if(typeof N!="object")return;if(_e(N))for(var de=0;de<N.length;de++){var Ce=N[de];Ei(Ce)&&uu(Ce,ue)}else if(Ei(N))N._store&&(N._store.validated=!0);else if(N){var Ne=b(N);if(typeof Ne=="function"&&Ne!==N.entries)for(var Ve=Ne.call(N),Se;!(Se=Ve.next()).done;)Ei(Se.value)&&uu(Se.value,ue)}}}function uh(N){{var ue=N.type;if(ue==null||typeof ue=="string")return;var de;if(typeof ue=="function")de=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===l||ue.$$typeof===m))de=ue.propTypes;else return;if(de){var Ce=A(ue);Le(de,N.props,"prop",Ce,N)}else if(ue.PropTypes!==void 0&&!Un){Un=!0;var Ne=A(ue);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lh(N){{for(var ue=Object.keys(N.props),de=0;de<ue.length;de++){var Ce=ue[de];if(Ce!=="children"&&Ce!=="key"){Xt(N),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ce),Xt(null);break}}N.ref!==null&&(Xt(N),C("Invalid attribute `ref` supplied to `React.Fragment`."),Xt(null))}}function cu(N,ue,de,Ce,Ne,Ve){{var Se=z(N);if(!Se){var Te="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Te+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ft=sh(Ne);ft?Te+=ft:Te+=su();var et;N===null?et="null":_e(N)?et="array":N!==void 0&&N.$$typeof===t?(et="<"+(A(N.type)||"Unknown")+" />",Te=" Did you accidentally export a JSX literal instead of a component?"):et=typeof N,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",et,Te)}var nt=Rt(N,ue,de,Ne,Ve);if(nt==null)return nt;if(Se){var Bt=ue.children;if(Bt!==void 0)if(Ce)if(_e(Bt)){for(var Wn=0;Wn<Bt.length;Wn++)lu(Bt[Wn],N);Object.freeze&&Object.freeze(Bt)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else lu(Bt,N)}return N===r?lh(nt):uh(nt),nt}}function ch(N,ue,de){return cu(N,ue,de,!0)}function dh(N,ue,de){return cu(N,ue,de,!1)}var fh=dh,mh=ch;xr.Fragment=r,xr.jsx=fh,xr.jsxs=mh}()),xr}process.env.NODE_ENV==="production"?ws.exports=Ch():ws.exports=Dh();var c=ws.exports;const Xc=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},or=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function ed(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),m=y.useRef(!0);d.current=e;var h=typeof window<"u",p=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,C=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var D=y.useMemo(function(){var F=function(z){var $=o.current,B=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(B,$)},E=function(z,$){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,$)},_=function(z){if(!m.current)return!1;var $=z-a.current;return!a.current||$>=t||$<0||b&&z-i.current>=C},T=function(z){return s.current=null,f&&o.current?F(z):(o.current=l.current=null,u.current)},I=function z(){var $=Date.now();if(_($))return T($);if(m.current){var B=t-($-a.current),A=b?Math.min(B,C-($-i.current)):B;E(z,A)}},P=function(){if(h||g){var z=Date.now(),$=_(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,$){if(!s.current&&m.current)return i.current=a.current,E(I,t),v?F(a.current):u.current;if(b)return E(I,t),F(a.current)}return s.current||E(I,t),u.current}};return P.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?T(Date.now()):u.current},P},[v,b,t,C,f,p,h,g]);return D}function td(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return ed(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let _i;const $n=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(_i),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=td(()=>{s()!==r&&(t&&(clearTimeout(_i),document.body.classList.add("is-resizing"),_i=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},nd=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,m=a.current,h=d-m,p=h>0?"down":"up";if(i({current:d,past:m}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=td(()=>{l()},250);return a},ao=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);or(()=>{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)},io=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const hu={},Ln=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const m=ae.useIntl(),[h]=y.useState(e||Date.now().toString()),p=y.useRef(null),v=d||p,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:C=!1,hasForm:D=!1}=t,{onOpen:F=()=>{},onClose:E=()=>{}}=o,{readToScreenreadersWhenClosed:_=!1,...T}=l,I=hu[h];y.useEffect(()=>{const B=v==null?void 0:v.current;if(B)return B.addEventListener("transitionend",P),()=>{B.removeEventListener("transitionend",P)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=A=>{A.key==="Escape"&&(A.stopPropagation(),A.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const P=({propertyName:B})=>{B==="opacity"&&(I!==!1&&clearTimeout(I),b(A=>(A==="open"?F():A==="closed"&&E(),A==="opening"?"open":A==="closing"?"closed":A==="closed"?"hidden":A)))};or(()=>{I!==!1&&clearTimeout(I);let B="open";n?b("opening"):(b("closing"),B="hidden"),hu[h||""]=setTimeout(()=>{b(B)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const $={className:"content"};return _?$.className=V("content",{hidden:f==="hidden"}):$.hidden=f==="hidden",c.jsx("aside",{ref:v,id:h,className:V("tooltip text-medium",f,i,{loading:r,"extra-padding":g,"has-pointer":C,bottom:C==="bottom","has-form":D}),...z,children:c.jsx("div",{...$,children:r?c.jsx("p",{children:m.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ot(e);return t.forEach(({type:r,value:a})=>{hh(n,r,a)}),n},rd=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},ad=(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},id=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),sd=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),od=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),wh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://storage.googleapis.com/apolitical-assets/",Qn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ar={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Es="SU:",Lr="DELETED",ud="Invalid token error: Logging user out...",Eh="200,000+",_h="160+",zr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,ld=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function kh(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const An={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},cd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),so=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),_s=e=>{let t;const n=$a(),r=$a(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/An.milliseconds.inHour,i=Math.floor(t/An.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<=An.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/An.year.days)}},$a=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Fh=(e,t,n)=>{let r;const a=$a(),i=$a(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/An.milliseconds.inSecond<=t;case"minutes":return r/An.milliseconds.inMinute<=t;case"hours":return r/An.milliseconds.inHour<=t}return!1},Ah=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Bh=e=>new Promise(t=>setTimeout(t,e)),Th=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},hr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",form_multipleInputs_label:"Input {number}",form_multipleInputs_filledInCount:"{number}/{total}",form_multipleInputs_filledInCount_aria:"{number} out of {total} available inputs have been filled in",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_title_error:"Please enter a title and body for your article.",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allow_multiple_votes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},jm={...dr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Om={...dr,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Pm={...dr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Mm=Object.freeze(Object.defineProperty({__proto__:null,en:dr,es:jm,fr:Om,pt:Pm},Symbol.toStringTag,{value:"Module"})),oi=(e,t=dr)=>e in t,It=(e,t,n,r,a={})=>{let i="";return oi(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Nm=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},Fa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),fd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Im=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},Rm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Rr).replace(/{{id}}/g,Rr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),hd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match($r);if(!a)return e;for(const s of a){const o=s.replace($r,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(ks))try{const h=d.replace(ks,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:v}=p;u.name=v||m||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Rm(e,u,t):s)}return e},lo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},md=e=>new URLSearchParams(window.location.search).get(e),$a=(e="")=>e.replace(/\s+/g,"").length>0,As=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Fe=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const v=Nn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=oo(!!u);if(typeof t=="object"&&typeof v=="number"){const B=Object.assign({},t),D=ad(Object.keys(B));t=id(v,D,B)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const w={...p,className:H(e,o,g,{"no-text":!h,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:B=>{(!a||a[0]==="#")&&s&&(B.preventDefault(),B.stopPropagation()),s&&s(B)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const E=y.createElement(i,w,h||(d?c.jsx(Pe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(In,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),E]}):E},fr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Fe,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Fe,{...s})},o)});return y.createElement(a,{className:H("button-wrapper",n),...r,children:i})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:H(e,{"has-max-width":t}),style:n})},vu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},$m=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?vu[e]:vu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Lm=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},Ai=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Lm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Rn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=$m(e),v=Ai({format:"avif",query:s,range:p,url:o}),f=Ai({format:"webp",query:s,range:p,url:o}),b=Ai({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const zm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(Rn,{image:{...e},className:"image"})}),bn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:H("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const pd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:H("popover",e),"aria-live":"polite",children:t})}),hr=({parent:e=document.body,children:t})=>typeof document=="object"?Gc.createPortal(t,e):null,qm=Object.freeze(Object.defineProperty({__proto__:null,default:hr},Symbol.toStringTag,{value:"Module"}));const Um=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:H("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:H("line",{active:a<e})})]},r)})})})]});const Wm=({elementId:e,offset:t=20})=>{const n=ae.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Fe,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Vm=({items:e,className:t="",...n})=>c.jsx("ul",{className:H("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),bu=300,yu="ease-in-out";class Hm{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:bu,easing:yu}),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:bu,easing:yu}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const ui=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ae.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Hm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:H("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},xu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Km=e=>{let t=e;return Object.keys(xu).includes(e)&&(t=xu[e]),`url(${Yt}icons/${t}.svg)`};const Cu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},gd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ae.useIntl(),i=t?{"--custom-icon":Km(t)}:{},s=oi(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:H("content-type-label text-small",e in Cu?Cu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Yt}icons/${t}.svg)`}:{};return c.jsx("div",{className:H("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const yn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Nn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=ad(Object.keys(h));a=id(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(_t,{variant:"subtle",className:H("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Kt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Fe,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Bs=({children:e,...t})=>c.jsx("p",{...t,children:e}),vd={q:Bs,blockquote:Bs};for(let e=1;e<=6;e++)vd[`h${e}`]={component:Bs,props:{className:"title"}};const bd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:H("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Kt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:vd},children:r}):c.jsx("p",{children:r})]});const yd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ae.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
- `);h(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const v=({propertyName:b})=>{b==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(p);return c.jsxs(_t,{variant:"subtle",className:H("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:H("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Kt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Fe,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:H({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Zm=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:H("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${Yt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Kt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Kt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Kt,{options:d,children:l.text}):l.text},u)})})},ot=()=>y.Fragment,Ym=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Gm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Qm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Jm=({children:e})=>{const t=ae.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Qm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(ui,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Xm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(_t,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(_t,{variant:"primary",children:e});case"pink-textbox":return c.jsx(_t,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},St=({children:e})=>c.jsx(c.Fragment,{children:e}),ep=e=>{const t=ae.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},wu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},tp=({children:e,...t})=>{const n=ae.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||wu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&wu(a)==="button"&&(i=!0);else break}const s=`@${Rr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Fe,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Ts=({children:e,...t})=>c.jsx("span",{className:H({url:t==null?void 0:t.href}),children:e});const np={default:{a:tp,CollapsibleSection:ui,TextBox:_t,CaseStudy:Ym,style:ot,details:Jm,div:Xm,iframe:ep,center:Gm},"text-only":{h1:ot,h2:ot,h3:ot,h4:ot,h5:ot,h6:ot,style:ot,details:ot,div:ot,TextBox:ot,CollapsibleSection:ot,CaseStudy:ot,blockquote:ot,iframe:ot,button:ot}},Tn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=np[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:H("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Kt,{options:{...o,...n,overrides:l},children:r})})};const xd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a="",ctaButton:i})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:H("page-heading",a),children:[c.jsxs("div",{className:H("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:H("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),i&&c.jsx(Fe,{...i,className:H("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:i.text})]}),r]})};const Zt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Yt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=oo(!!a),h={},p=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,m=a?typeof a=="string"?a:a.text:void 0;a&&p&&(h["aria-describedby"]=p);const v=y.createElement(a?"button":s,{className:H("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...h,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx(In,{id:p,isOpen:u,children:m})]})):v};const ir=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:H("status-banner text-small",n),"aria-live":"assertive"},t),co=y.createContext({badges:[],isLoading:!0});function Cd(){return y.useContext(co)}const wd=({children:e,badges:t})=>c.jsx(co.Provider,{value:t,children:e}),Dd=({showDevTools:e=!0,children:t})=>{const n=new Ue.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ue.QueryClientProvider,{client:n,children:[t,e&&c.jsx(gm.ReactQueryDevtools,{initialIsOpen:!1})]})};var rp=y.createContext({client:ka});function ap(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ka.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ka.init(r,a)),ka)},[n,r]);return y.createElement(rp.Provider,{value:{client:i}},t)}const Ed=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(ap,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var _d=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(_d||{});const kd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Mm[r],...n||{}};return c.jsx(ae.IntlProvider,{locale:r,messages:a,children:e})},fo=y.createContext({}),Aa={en:"English",es:"Español",fr:"Français",pt:"Português"},at=y.createContext({isLoading:!0});function li(){return y.useContext(at)}const Fd=({children:e,user:t,updateDetails:n})=>c.jsx(at.Provider,{value:{...t,updateDetails:n},children:e}),ho=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Ad=()=>y.useContext(ho),Bd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(ho.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},ip=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),fd(5e3)}).catch(p=>{p.message===ld&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(fo.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(kd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(io.CookiesProvider,{children:c.jsx(Fd,{user:a,updateDetails:i,children:c.jsx(wd,{badges:s,children:c.jsx(Bd,{children:c.jsx(Dd,{showDevTools:r,children:c.jsx(Ed,{user:a,children:t})})})})})})})})},sp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Td=({slug:e})=>{const{badges:t}=Cd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Zt,{className:H("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&sp[a],element:"li",tooltip:s,children:r})};var ut=(e=>(e.Communities="communities",e.Platform="platform",e))(ut||{});const Sd=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Td,{slug:s},o))}))})};const op=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ae.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:H(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Pe,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},mo=y.memo(op);const Bi="loadingBlock_",up=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ae.useIntl();t||(t={0:{text:r.formatMessage({id:`${Bi}loading`})},75:{text:r.formatMessage({id:`${Bi}almostDone`})},100:{text:r.formatMessage({id:`${Bi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Yt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(_t,{className:H("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(mo,{progress:e})]})},jd=y.memo(up);const Mt=({element:e="div",className:t="",...n})=>c.jsx(si,{element:e,className:H("loading-placeholder",t),...n});const Ss={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Od=(e,t)=>e in Ss?c.jsx("div",{className:e,children:Ss[e].map((n,r)=>Od(n,r))},t):c.jsx(Mt,{className:e},t),ci=({layout:e="overview-page",...t})=>c.jsx("div",{className:H("loading-state",e),...t,children:Ss[e].map((n,r)=>Od(n,r))}),Pd=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):""},aa=["#5AB6A3","#A2D7AF","#806056","#3962B3"],lp=e=>{const t=Math.ceil(26/aa.length),n=Pd(e).toLowerCase();if(n==="")return aa[0];const r=n.charCodeAt(0)-96;for(let a=0;a<aa.length;a++)if(r<=t*(a+1))return aa[a]};const Du=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Du,height:i=Du,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const v=m.getContext("2d");if(!v)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=lp(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(Pd(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:H("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var tt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(tt||{});const di=e=>e==="apolitical"?{image:`${Yt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Yt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},cp=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=rr(l,r)),l};const dp=y.lazy(()=>Promise.resolve().then(()=>qm)),fp=y.lazy(()=>Promise.resolve().then(()=>J_));let ia=null;const nn=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var F,O,M,U,W;const h=ae.useIntl(),{profile:p,...m}=i,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=a,w=y.useContext(at),E=p&&w&&typeof w.id=="string",[B,D]=y.useState(!1),k=di(t);k.name||(k.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:$}=k;let{url:P}=k;typeof t=="object"&&t.link!==void 0&&(t.link===!1?P=void 0:P=t.link);const z=cp(k),R=r&&r.createdAt?Fs(r.createdAt):!1,A=r&&r.createdAt?uo(r.createdAt):"";return y.createElement(e,{...d,className:H("member text-medium",v,f,l,{"has-profile-link":E}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(bn,{href:P,gtmType:o,gtmContext:s,onClick:ie=>{if(ie==null||ie.preventDefault(),ie==null||ie.stopPropagation(),!P)return;ia&&clearTimeout(ia),ia=setTimeout(()=>{window.location.href=P},150);const se=new CustomEvent(tt.MEMBER_CLICKED,{detail:{link:P,timeout:ia}});document.dispatchEvent(se)},children:[c.jsx(sn,{name:T,src:$,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:H("name",{"new-line":g}),"data-testid":"member-name",children:[c.jsx("span",{children:T}),(u==null?void 0:u.showBadges)&&(k==null?void 0:k.badges)&&c.jsx(Sd,{userBadges:k.badges,badgeOptions:u}),r&&c.jsxs("span",{className:H("additional-content",{"new-line":g}),children:[r.createdAt&&R&&!((F=r==null?void 0:r.customMessage)!=null&&F.text)&&c.jsx("span",{className:"date",title:A,"aria-label":A,"data-testid":"date",children:h.formatMessage({id:`dates_${R.path}`},{number:R.number})}),r.createdAt&&R&&((O=r==null?void 0:r.customMessage)==null?void 0:O.text)&&c.jsx("span",{children:h.formatMessage({id:(M=r.customMessage)==null?void 0:M.text},{time:h.formatMessage({id:`dates_${R.path}`},{number:R.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:ie=>{var se,C;return c.jsx("a",{href:`${(C=(se=r.customMessage)==null?void 0:se.link)==null?void 0:C.url}`,onClick:G=>G.stopPropagation(),children:ie})}})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),z&&!g&&c.jsx("small",{className:H({"text-medium":v==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[k.role,k.organisation?` — ${k.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:k.country})]})})]})]}),z&&p&&E?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"tertiary",size:"small",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),D(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(dp,{children:c.jsx(fp,{form:p,showModal:B,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{D(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},hp=Object.freeze(Object.defineProperty({__proto__:null,default:nn},Symbol.toStringTag,{value:"Module"}));const Eu={small:24,medium:48},po=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const h=ae.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:H("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let v,f="";if(m<o){const{name:b="",image:g=""}=di(p);if(s)return c.jsx(Mt,{element:"li",className:"contributor"},m);v=c.jsx(sn,{name:b,src:g,width:Eu[a||"medium"],height:Eu[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:H({"large-number":b>99}),children:["+",Nm(b,0)]}),f="number-left"}return v?c.jsx("li",{className:H("contributor",f),children:v},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):rr(n[0].name||"",20):l||null})]})})};const go=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:H("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var js={exports:{}},sa={exports:{}},Ie={};/** @license React v16.13.1
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_question_label:"Question",discussion_form_question_placeholder:"Question",discussion_form_option_label:"Options",discussion_form_option_placeholder:"Option {number}",discussion_form_option_cta:"Add option",discussion_form_multiplePollAnswers:"Allow multiple answers",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Create post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",form_multipleInputs_label:"Input {number}",form_multipleInputs_filledInCount:"{number}/{total}",form_multipleInputs_filledInCount_aria:"{number} out of {total} available inputs have been filled in",form_multipleInputs_remove:"Remove this input",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allowMultipleVotes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Sh={...hr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},jh={...hr,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Oh={...hr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Ph=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:Sh,fr:jh,pt:Oh},Symbol.toStringTag,{value:"Module"})),ui=(e,t=hr)=>e in t,It=(e,t,n,r,a={})=>{let i="";return ui(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Mh=(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},Aa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),dd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Nh=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},Rh=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Lr).replace(/{{id}}/g,Lr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),fd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(zr);if(!a)return e;for(const s of a){const o=s.replace(zr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(Es))try{const m=d.replace(Es,"");u.id=m,await r({id:m}).then(h=>{const{name:p,error:v}=h;u.name=v||p||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Rh(e,u,t):s)}return e},oo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},md=e=>new URLSearchParams(window.location.search).get(e),La=(e="")=>e.replace(/\s+/g,"").length>0,ks=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:m=!1,...h})=>{const v=$n(typeof t=="object"),{showTooltip:f,tooltipProps:b}=io(!!u);if(typeof t=="object"&&typeof v=="number"){const F=Object.assign({},t),E=rd(Object.keys(F));t=ad(v,E,F)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const C={...h,className:V(e,o,g,{"no-text":!m,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:F=>{(!a||a[0]==="#")&&s&&(F.preventDefault(),F.stopPropagation()),s&&s(F)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",C.href=a);const D=y.createElement(i,C,m||(d?c.jsx(Pe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Ln,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),D]}):D},pr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},pu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},Ih=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?pu[e]:pu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},$h=({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},ki=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${$h({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const zn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:h,sizes:p}=Ih(e),v=ki({format:"avif",query:s,range:h,url:o}),f=ki({format:"webp",query:s,range:h,url:o}),b=ki({format:"",query:s,range:h,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,sizes:p,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Lh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(zn,{image:{...e},className:"image"})}),xn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const hd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),gr=({parent:e=document.body,children:t})=>typeof document=="object"?Yc.createPortal(t,e):null,zh=Object.freeze(Object.defineProperty({__proto__:null,default:gr},Symbol.toStringTag,{value:"Module"}));const qh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Uh=({elementId:e,offset:t=20})=>{const n=ae.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Wh=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),gu=300,vu="ease-in-out";class Vh{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:gu,easing:vu}),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:gu,easing:vu}),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 li=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ae.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Vh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},bu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Hh=e=>{let t=e;return Object.keys(bu).includes(e)&&(t=bu[e]),`url(${Gt}icons/${t}.svg)`};const yu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},pd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ae.useIntl(),i=t?{"--custom-icon":Hh(t)}:{},s=ui(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in yu?yu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Gt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const Cn=({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=$n(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=rd(Object.keys(m));a=ad(s,h,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(_t,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Zt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Fs=({children:e,...t})=>c.jsx("p",{...t,children:e}),gd={q:Fs,blockquote:Fs};for(let e=1;e<=6;e++)gd[`h${e}`]={component:Fs,props:{className:"title"}};const vd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Zt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:gd},children:r}):c.jsx("p",{children:r})]});const bd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ae.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,m]=y.useState(""),[h,p]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
+ `);m(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
+ `))},[a]),y.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const v=({propertyName:b})=>{b==="max-height"&&p(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(h);return c.jsxs(_t,{variant:"subtle",className:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",h,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...i},children:h==="closed"?d:a}),h!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{p(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Kh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:V("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${Gt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Zt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},u)})})},ut=()=>y.Fragment,Zh=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Yh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Gh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Qh=({children:e})=>{const t=ae.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Gh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(li,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Jh=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(_t,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(_t,{variant:"primary",children:e});case"pink-textbox":return c.jsx(_t,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},St=({children:e})=>c.jsx(c.Fragment,{children:e}),Xh=e=>{const t=ae.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},xu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},ep=({children:e,...t})=>{const n=ae.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||xu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&xu(a)==="button"&&(i=!0);else break}const s=`@${Lr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},As=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const tp={default:{a:ep,CollapsibleSection:li,TextBox:_t,CaseStudy:Zh,style:ut,details:Qh,div:Jh,iframe:Xh,center:Yh},"text-only":{h1:ut,h2:ut,h3:ut,h4:ut,h5:ut,h6:ut,style:ut,details:ut,div:ut,TextBox:ut,CollapsibleSection:ut,CaseStudy:ut,blockquote:ut,iframe:ut,button:ut}},On=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=tp[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:V("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Zt,{options:{...o,...n,overrides:l},children:r})})};const yd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a="",ctaButton:i})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",a),children:[c.jsxs("div",{className:V("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:V("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),i&&c.jsx(Ee,{...i,className:V("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:i.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=io(!!a),m={},h=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,p=a?typeof a=="string"?a:a.text:void 0;a&&h&&(m["aria-describedby"]=h);const v=y.createElement(a?"button":s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...m,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx(Ln,{id:h,isOpen:u,children:p})]})):v};const ur=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t),uo=y.createContext({badges:[],isLoading:!0});function xd(){return y.useContext(uo)}const Cd=({children:e,badges:t})=>c.jsx(uo.Provider,{value:t,children:e}),Dd=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&c.jsx(ph.ReactQueryDevtools,{initialIsOpen:!1})]})};var np=y.createContext({client:Fa});function rp(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Fa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Fa.init(r,a)),Fa)},[n,r]);return y.createElement(np.Provider,{value:{client:i}},t)}const wd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(rp,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Ed=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Ed||{});const _d=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ph[r],...n||{}};return c.jsx(ae.IntlProvider,{locale:r,messages:a,children:e})},lo=y.createContext({}),Ba={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ci(){return y.useContext(it)}const kd=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),co=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Fd=()=>y.useContext(co),Ad=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(co.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},ap=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),m=h=>{localStorage.setItem("language",h),d(h)};return y.useEffect(()=>{e().then(h=>{Array.isArray(h)?(i({...h[0],isLoading:!1}),o({badges:h[1],isLoading:!1})):i({...h,isLoading:!1}),dd(5e3)}).catch(h=>{h.message===ud&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(lo.Provider,{value:{language:u,updateLanguage:m},children:c.jsx(_d,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(ro.CookiesProvider,{children:c.jsx(kd,{user:a,updateDetails:i,children:c.jsx(Cd,{badges:s,children:c.jsx(Ad,{children:c.jsx(Dd,{showDevTools:r,children:c.jsx(wd,{user:a,children:t})})})})})})})})},ip={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Bd=({slug:e})=>{const{badges:t}=xd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Yt,{className:V("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&ip[a],element:"li",tooltip:s,children:r})};var ct=(e=>(e.Communities="communities",e.Platform="platform",e))(ct||{});const Td=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Bd,{slug:s},o))}))})};const sp=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ae.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Pe,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},fo=y.memo(sp);const Fi="loadingBlock_",op=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ae.useIntl();t||(t={0:{text:r.formatMessage({id:`${Fi}loading`})},75:{text:r.formatMessage({id:`${Fi}almostDone`})},100:{text:r.formatMessage({id:`${Fi}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(${Gt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(_t,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(fo,{progress:e})]})},Sd=y.memo(op);const Nt=({element:e="div",className:t="",...n})=>c.jsx(oi,{element:e,className:V("loading-placeholder",t),...n});const Bs={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},jd=(e,t)=>e in Bs?c.jsx("div",{className:e,children:Bs[e].map((n,r)=>jd(n,r))},t):c.jsx(Nt,{className:e},t),di=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:Bs[e].map((n,r)=>jd(n,r))}),Od=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):""},aa=["#5AB6A3","#A2D7AF","#806056","#3962B3"],up=e=>{const t=Math.ceil(26/aa.length),n=Od(e).toLowerCase();if(n==="")return aa[0];const r=n.charCodeAt(0)-96;for(let a=0;a<aa.length;a++)if(r<=t*(a+1))return aa[a]};const Cu=256,un=({className:e="",src:t="",name:n,alt:r,width:a=Cu,height:i=Cu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const p=d.current;if(!p)return;const v=p.getContext("2d");if(!v)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=up(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(Od(n),f/2,b/1.6)},[n]);let h=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:h?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var rt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(rt||{});const fi=e=>e==="apolitical"?{image:`${Gt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Gt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},lp=({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=sr(l,r)),l};const cp=y.lazy(()=>Promise.resolve().then(()=>zh)),dp=y.lazy(()=>Promise.resolve().then(()=>R_));let ia=null;const an=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var A,O,j,U,W;const m=ae.useIntl(),{profile:h,...p}=i,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=a,C=y.useContext(it),D=h&&C&&typeof C.id=="string",[F,E]=y.useState(!1),_=fi(t);_.name||(_.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:I}=_;let{url:P}=_;typeof t=="object"&&t.link!==void 0&&(t.link===!1?P=void 0:P=t.link);const z=lp(_),$=r&&r.createdAt?_s(r.createdAt):!1,B=r&&r.createdAt?so(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",v,f,l,{"has-profile-link":D}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(xn,{href:P,gtmType:o,gtmContext:s,onClick:re=>{if(re==null||re.preventDefault(),re==null||re.stopPropagation(),!P)return;ia&&clearTimeout(ia),ia=setTimeout(()=>{window.location.href=P},150);const ne=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:P,timeout:ia}});document.dispatchEvent(ne)},children:[c.jsx(un,{name:T,src:I,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":g}),"data-testid":"member-name",children:[c.jsx("span",{children:T}),(u==null?void 0:u.showBadges)&&(_==null?void 0:_.badges)&&c.jsx(Td,{userBadges:_.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":g}),children:[r.createdAt&&$&&!((A=r==null?void 0:r.customMessage)!=null&&A.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:m.formatMessage({id:`dates_${$.path}`},{number:$.number})}),r.createdAt&&$&&((O=r==null?void 0:r.customMessage)==null?void 0:O.text)&&c.jsx("span",{children:m.formatMessage({id:(j=r.customMessage)==null?void 0:j.text},{time:m.formatMessage({id:`dates_${$.path}`},{number:$.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:re=>{var ne,w;return c.jsx("a",{href:`${(w=(ne=r.customMessage)==null?void 0:ne.link)==null?void 0:w.url}`,onClick:Q=>Q.stopPropagation(),children:re})}})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),z&&!g&&c.jsx("small",{className:V({"text-medium":v==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[_.role,_.organisation?` — ${_.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:_.country})]})})]})]}),z&&h&&D?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:re=>{re.preventDefault(),re.stopPropagation(),E(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(cp,{children:c.jsx(dp,{form:h,showModal:F,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{E(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},fp=Object.freeze(Object.defineProperty({__proto__:null,default:an},Symbol.toStringTag,{value:"Module"}));const Du={small:24,medium:48},mo=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=ae.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((h,p)=>{let v,f="";if(p<o){const{name:b="",image:g=""}=fi(h);if(s)return c.jsx(Nt,{element:"li",className:"contributor"},p);v=c.jsx(un,{name:b,src:g,width:Du[a||"medium"],height:Du[a||"medium"]})}else if(p===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",Mh(b,0)]}),f="number-left"}return v?c.jsx("li",{className:V("contributor",f),children:v},p):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):sr(n[0].name||"",20):l||null})]})})};const ho=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:V("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var Ts={exports:{}},sa={exports:{}},Ie={};/** @license React v16.13.1
38
38
  * react-is.production.min.js
39
39
  *
40
40
  * Copyright (c) Facebook, Inc. and its affiliates.
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var _u;function mp(){if(_u)return Ie;_u=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function E(D){if(typeof D=="object"&&D!==null){var k=D.$$typeof;switch(k){case t:switch(D=D.type,D){case l:case u:case r:case i:case a:case h:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case v:case m:case s:return D;default:return k}}case n:return k}}}function B(D){return E(D)===u}return Ie.AsyncMode=l,Ie.ConcurrentMode=u,Ie.ContextConsumer=o,Ie.ContextProvider=s,Ie.Element=t,Ie.ForwardRef=d,Ie.Fragment=r,Ie.Lazy=v,Ie.Memo=m,Ie.Portal=n,Ie.Profiler=i,Ie.StrictMode=a,Ie.Suspense=h,Ie.isAsyncMode=function(D){return B(D)||E(D)===l},Ie.isConcurrentMode=B,Ie.isContextConsumer=function(D){return E(D)===o},Ie.isContextProvider=function(D){return E(D)===s},Ie.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},Ie.isForwardRef=function(D){return E(D)===d},Ie.isFragment=function(D){return E(D)===r},Ie.isLazy=function(D){return E(D)===v},Ie.isMemo=function(D){return E(D)===m},Ie.isPortal=function(D){return E(D)===n},Ie.isProfiler=function(D){return E(D)===i},Ie.isStrictMode=function(D){return E(D)===a},Ie.isSuspense=function(D){return E(D)===h},Ie.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===u||D===i||D===a||D===h||D===p||typeof D=="object"&&D!==null&&(D.$$typeof===v||D.$$typeof===m||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===b||D.$$typeof===g||D.$$typeof===w||D.$$typeof===f)},Ie.typeOf=E,Ie}var Re={};/** @license React v16.13.1
44
+ */var wu;function mp(){if(wu)return Ie;wu=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function D(E){if(typeof E=="object"&&E!==null){var _=E.$$typeof;switch(_){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case d:case v:case p:case s:return E;default:return _}}case n:return _}}}function F(E){return D(E)===u}return Ie.AsyncMode=l,Ie.ConcurrentMode=u,Ie.ContextConsumer=o,Ie.ContextProvider=s,Ie.Element=t,Ie.ForwardRef=d,Ie.Fragment=r,Ie.Lazy=v,Ie.Memo=p,Ie.Portal=n,Ie.Profiler=i,Ie.StrictMode=a,Ie.Suspense=m,Ie.isAsyncMode=function(E){return F(E)||D(E)===l},Ie.isConcurrentMode=F,Ie.isContextConsumer=function(E){return D(E)===o},Ie.isContextProvider=function(E){return D(E)===s},Ie.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Ie.isForwardRef=function(E){return D(E)===d},Ie.isFragment=function(E){return D(E)===r},Ie.isLazy=function(E){return D(E)===v},Ie.isMemo=function(E){return D(E)===p},Ie.isPortal=function(E){return D(E)===n},Ie.isProfiler=function(E){return D(E)===i},Ie.isStrictMode=function(E){return D(E)===a},Ie.isSuspense=function(E){return D(E)===m},Ie.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===v||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===d||E.$$typeof===b||E.$$typeof===g||E.$$typeof===C||E.$$typeof===f)},Ie.typeOf=D,Ie}var $e={};/** @license React v16.13.1
45
45
  * react-is.development.js
46
46
  *
47
47
  * Copyright (c) Facebook, Inc. and its affiliates.
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var ku;function pp(){return ku||(ku=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function E(te){return typeof te=="string"||typeof te=="function"||te===r||te===u||te===i||te===a||te===h||te===p||typeof te=="object"&&te!==null&&(te.$$typeof===v||te.$$typeof===m||te.$$typeof===s||te.$$typeof===o||te.$$typeof===d||te.$$typeof===b||te.$$typeof===g||te.$$typeof===w||te.$$typeof===f)}function B(te){if(typeof te=="object"&&te!==null){var pe=te.$$typeof;switch(pe){case t:var fe=te.type;switch(fe){case l:case u:case r:case i:case a:case h:return fe;default:var Ae=fe&&fe.$$typeof;switch(Ae){case o:case d:case v:case m:case s:return Ae;default:return pe}}case n:return pe}}}var D=l,k=u,T=o,$=s,P=t,z=d,R=r,A=v,F=m,O=n,M=i,U=a,W=h,ie=!1;function se(te){return ie||(ie=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(te)||B(te)===l}function C(te){return B(te)===u}function G(te){return B(te)===o}function ne(te){return B(te)===s}function _(te){return typeof te=="object"&&te!==null&&te.$$typeof===t}function S(te){return B(te)===d}function q(te){return B(te)===r}function j(te){return B(te)===v}function L(te){return B(te)===m}function Q(te){return B(te)===n}function Z(te){return B(te)===i}function X(te){return B(te)===a}function le(te){return B(te)===h}Re.AsyncMode=D,Re.ConcurrentMode=k,Re.ContextConsumer=T,Re.ContextProvider=$,Re.Element=P,Re.ForwardRef=z,Re.Fragment=R,Re.Lazy=A,Re.Memo=F,Re.Portal=O,Re.Profiler=M,Re.StrictMode=U,Re.Suspense=W,Re.isAsyncMode=se,Re.isConcurrentMode=C,Re.isContextConsumer=G,Re.isContextProvider=ne,Re.isElement=_,Re.isForwardRef=S,Re.isFragment=q,Re.isLazy=j,Re.isMemo=L,Re.isPortal=Q,Re.isProfiler=Z,Re.isStrictMode=X,Re.isSuspense=le,Re.isValidElementType=E,Re.typeOf=B}()),Re}var Fu;function Md(){return Fu||(Fu=1,process.env.NODE_ENV==="production"?sa.exports=mp():sa.exports=pp()),sa.exports}/*
51
+ */var Eu;function hp(){return Eu||(Eu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function D(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===m||J===h||typeof J=="object"&&J!==null&&(J.$$typeof===v||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===b||J.$$typeof===g||J.$$typeof===C||J.$$typeof===f)}function F(J){if(typeof J=="object"&&J!==null){var he=J.$$typeof;switch(he){case t:var pe=J.type;switch(pe){case l:case u:case r:case i:case a:case m:return pe;default:var we=pe&&pe.$$typeof;switch(we){case o:case d:case v:case p:case s:return we;default:return he}}case n:return he}}}var E=l,_=u,T=o,I=s,P=t,z=d,$=r,B=v,A=p,O=n,j=i,U=a,W=m,re=!1;function ne(J){return re||(re=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),w(J)||F(J)===l}function w(J){return F(J)===u}function Q(J){return F(J)===o}function se(J){return F(J)===s}function k(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function M(J){return F(J)===d}function q(J){return F(J)===r}function S(J){return F(J)===v}function L(J){return F(J)===p}function G(J){return F(J)===n}function K(J){return F(J)===i}function te(J){return F(J)===a}function ce(J){return F(J)===m}$e.AsyncMode=E,$e.ConcurrentMode=_,$e.ContextConsumer=T,$e.ContextProvider=I,$e.Element=P,$e.ForwardRef=z,$e.Fragment=$,$e.Lazy=B,$e.Memo=A,$e.Portal=O,$e.Profiler=j,$e.StrictMode=U,$e.Suspense=W,$e.isAsyncMode=ne,$e.isConcurrentMode=w,$e.isContextConsumer=Q,$e.isContextProvider=se,$e.isElement=k,$e.isForwardRef=M,$e.isFragment=q,$e.isLazy=S,$e.isMemo=L,$e.isPortal=G,$e.isProfiler=K,$e.isStrictMode=te,$e.isSuspense=ce,$e.isValidElementType=D,$e.typeOf=F}()),$e}var _u;function Pd(){return _u||(_u=1,process.env.NODE_ENV==="production"?sa.exports=mp():sa.exports=hp()),sa.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var Ti,Au;function gp(){if(Au)return Ti;Au=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ti=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Ti}var Si,Bu;function vo(){if(Bu)return Si;Bu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Si=e,Si}var ji,Tu;function Nd(){return Tu||(Tu=1,ji=Function.call.bind(Object.prototype.hasOwnProperty)),ji}var Oi,Su;function vp(){if(Su)return Oi;Su=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=vo(),n={},r=Nd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var h;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[d](s,d,l,o,null,t)}catch(v){h=v}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Oi=a,Oi}var Pi,ju;function bp(){if(ju)return Pi;ju=1;var e=Md(),t=gp(),n=vo(),r=Nd(),a=vp(),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 Pi=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(C){var G=C&&(u&&C[u]||C[d]);if(typeof G=="function")return G}var p="<<anonymous>>",m={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:w(),arrayOf:E,element:B(),elementType:D(),instanceOf:k,node:z(),objectOf:$,oneOf:T,oneOfType:P,shape:A,exact:F};function v(C,G){return C===G?C!==0||1/C===1/G:C!==C&&G!==G}function f(C,G){this.message=C,this.data=G&&typeof G=="object"?G:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var G={},ne=0;function _(q,j,L,Q,Z,X,le){if(Q=Q||p,X=X||L,le!==n){if(l){var te=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 te.name="Invariant Violation",te}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=Q+":"+L;!G[pe]&&ne<3&&(i("You are manually calling a React.PropTypes validation function for the `"+X+"` prop on `"+Q+"`. 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."),G[pe]=!0,ne++)}}return j[L]==null?q?j[L]===null?new f("The "+Z+" `"+X+"` is marked as required "+("in `"+Q+"`, but its value is `null`.")):new f("The "+Z+" `"+X+"` is marked as required in "+("`"+Q+"`, but its value is `undefined`.")):null:C(j,L,Q,Z,X)}var S=_.bind(null,!1);return S.isRequired=_.bind(null,!0),S}function g(C){function G(ne,_,S,q,j,L){var Q=ne[_],Z=U(Q);if(Z!==C){var X=W(Q);return new f("Invalid "+q+" `"+j+"` of type "+("`"+X+"` supplied to `"+S+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(G)}function w(){return b(s)}function E(C){function G(ne,_,S,q,j){if(typeof C!="function")return new f("Property `"+j+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var L=ne[_];if(!Array.isArray(L)){var Q=U(L);return new f("Invalid "+q+" `"+j+"` of type "+("`"+Q+"` supplied to `"+S+"`, expected an array."))}for(var Z=0;Z<L.length;Z++){var X=C(L,Z,S,q,j+"["+Z+"]",n);if(X instanceof Error)return X}return null}return b(G)}function B(){function C(G,ne,_,S,q){var j=G[ne];if(!o(j)){var L=U(j);return new f("Invalid "+S+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(C)}function D(){function C(G,ne,_,S,q){var j=G[ne];if(!e.isValidElementType(j)){var L=U(j);return new f("Invalid "+S+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(C)}function k(C){function G(ne,_,S,q,j){if(!(ne[_]instanceof C)){var L=C.name||p,Q=se(ne[_]);return new f("Invalid "+q+" `"+j+"` of type "+("`"+Q+"` supplied to `"+S+"`, expected ")+("instance of `"+L+"`."))}return null}return b(G)}function T(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function G(ne,_,S,q,j){for(var L=ne[_],Q=0;Q<C.length;Q++)if(v(L,C[Q]))return null;var Z=JSON.stringify(C,function(le,te){var pe=W(te);return pe==="symbol"?String(te):te});return new f("Invalid "+q+" `"+j+"` of value `"+String(L)+"` "+("supplied to `"+S+"`, expected one of "+Z+"."))}return b(G)}function $(C){function G(ne,_,S,q,j){if(typeof C!="function")return new f("Property `"+j+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+j+"` of type "+("`"+Q+"` supplied to `"+S+"`, expected an object."));for(var Z in L)if(r(L,Z)){var X=C(L,Z,S,q,j+"."+Z,n);if(X instanceof Error)return X}return null}return b(G)}function P(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var G=0;G<C.length;G++){var ne=C[G];if(typeof ne!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ie(ne)+" at index "+G+"."),s}function _(S,q,j,L,Q){for(var Z=[],X=0;X<C.length;X++){var le=C[X],te=le(S,q,j,L,Q,n);if(te==null)return null;te.data&&r(te.data,"expectedType")&&Z.push(te.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new f("Invalid "+L+" `"+Q+"` supplied to "+("`"+j+"`"+pe+"."))}return b(_)}function z(){function C(G,ne,_,S,q){return O(G[ne])?null:new f("Invalid "+S+" `"+q+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(C)}function R(C,G,ne,_,S){return new f((C||"React class")+": "+G+" type `"+ne+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function A(C){function G(ne,_,S,q,j){var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+j+"` of type `"+Q+"` "+("supplied to `"+S+"`, expected `object`."));for(var Z in C){var X=C[Z];if(typeof X!="function")return R(S,q,j,Z,W(X));var le=X(L,Z,S,q,j+"."+Z,n);if(le)return le}return null}return b(G)}function F(C){function G(ne,_,S,q,j){var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+j+"` of type `"+Q+"` "+("supplied to `"+S+"`, expected `object`."));var Z=t({},ne[_],C);for(var X in Z){var le=C[X];if(r(C,X)&&typeof le!="function")return R(S,q,j,X,W(le));if(!le)return new f("Invalid "+q+" `"+j+"` key `"+X+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(ne[_],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var te=le(L,X,S,q,j+"."+X,n);if(te)return te}return null}return b(G)}function O(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(O);if(C===null||o(C))return!0;var G=h(C);if(G){var ne=G.call(C),_;if(G!==C.entries){for(;!(_=ne.next()).done;)if(!O(_.value))return!1}else for(;!(_=ne.next()).done;){var S=_.value;if(S&&!O(S[1]))return!1}}else return!1;return!0;default:return!1}}function M(C,G){return C==="symbol"?!0:G?G["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&G instanceof Symbol:!1}function U(C){var G=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":M(G,C)?"symbol":G}function W(C){if(typeof C>"u"||C===null)return""+C;var G=U(C);if(G==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return G}function ie(C){var G=W(C);switch(G){case"array":case"object":return"an "+G;case"boolean":case"date":case"regexp":return"a "+G;default:return G}}function se(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},Pi}var Mi,Ou;function yp(){if(Ou)return Mi;Ou=1;var e=vo();function t(){}function n(){}return n.resetWarningCache=t,Mi=function(){function r(s,o,l,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Mi}if(process.env.NODE_ENV!=="production"){var xp=Md(),Cp=!0;js.exports=bp()(xp.isElement,Cp)}else js.exports=yp()();var wp=js.exports;/*!
55
+ */var Ai,ku;function pp(){if(ku)return Ai;ku=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var h=0;h<u.length;h++)n.call(o,u[h])&&(l[u[h]]=o[u[h]])}}return l},Ai}var Bi,Fu;function po(){if(Fu)return Bi;Fu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Bi=e,Bi}var Ti,Au;function Md(){return Au||(Au=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Bu;function gp(){if(Bu)return Si;Bu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=po(),n={},r=Md();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var m;try{if(typeof i[d]!="function"){var h=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}m=i[d](s,d,l,o,null,t)}catch(v){m=v}if(m&&!(m instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Tu;function vp(){if(Tu)return ji;Tu=1;var e=Pd(),t=pp(),n=po(),r=Md(),a=gp(),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,d="@@iterator";function m(w){var Q=w&&(u&&w[u]||w[d]);if(typeof Q=="function")return Q}var h="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:C(),arrayOf:D,element:F(),elementType:E(),instanceOf:_,node:z(),objectOf:I,oneOf:T,oneOfType:P,shape:B,exact:A};function v(w,Q){return w===Q?w!==0||1/w===1/Q:w!==w&&Q!==Q}function f(w,Q){this.message=w,this.data=Q&&typeof Q=="object"?Q:{},this.stack=""}f.prototype=Error.prototype;function b(w){if(process.env.NODE_ENV!=="production")var Q={},se=0;function k(q,S,L,G,K,te,ce){if(G=G||h,te=te||L,ce!==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 he=G+":"+L;!Q[he]&&se<3&&(i("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+G+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),Q[he]=!0,se++)}}return S[L]==null?q?S[L]===null?new f("The "+K+" `"+te+"` is marked as required "+("in `"+G+"`, but its value is `null`.")):new f("The "+K+" `"+te+"` is marked as required in "+("`"+G+"`, but its value is `undefined`.")):null:w(S,L,G,K,te)}var M=k.bind(null,!1);return M.isRequired=k.bind(null,!0),M}function g(w){function Q(se,k,M,q,S,L){var G=se[k],K=U(G);if(K!==w){var te=W(G);return new f("Invalid "+q+" `"+S+"` of type "+("`"+te+"` supplied to `"+M+"`, expected ")+("`"+w+"`."),{expectedType:w})}return null}return b(Q)}function C(){return b(s)}function D(w){function Q(se,k,M,q,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside arrayOf.");var L=se[k];if(!Array.isArray(L)){var G=U(L);return new f("Invalid "+q+" `"+S+"` of type "+("`"+G+"` supplied to `"+M+"`, expected an array."))}for(var K=0;K<L.length;K++){var te=w(L,K,M,q,S+"["+K+"]",n);if(te instanceof Error)return te}return null}return b(Q)}function F(){function w(Q,se,k,M,q){var S=Q[se];if(!o(S)){var L=U(S);return new f("Invalid "+M+" `"+q+"` of type "+("`"+L+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return b(w)}function E(){function w(Q,se,k,M,q){var S=Q[se];if(!e.isValidElementType(S)){var L=U(S);return new f("Invalid "+M+" `"+q+"` of type "+("`"+L+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return b(w)}function _(w){function Q(se,k,M,q,S){if(!(se[k]instanceof w)){var L=w.name||h,G=ne(se[k]);return new f("Invalid "+q+" `"+S+"` of type "+("`"+G+"` supplied to `"+M+"`, expected ")+("instance of `"+L+"`."))}return null}return b(Q)}function T(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function Q(se,k,M,q,S){for(var L=se[k],G=0;G<w.length;G++)if(v(L,w[G]))return null;var K=JSON.stringify(w,function(ce,J){var he=W(J);return he==="symbol"?String(J):J});return new f("Invalid "+q+" `"+S+"` of value `"+String(L)+"` "+("supplied to `"+M+"`, expected one of "+K+"."))}return b(Q)}function I(w){function Q(se,k,M,q,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside objectOf.");var L=se[k],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+S+"` of type "+("`"+G+"` supplied to `"+M+"`, expected an object."));for(var K in L)if(r(L,K)){var te=w(L,K,M,q,S+"."+K,n);if(te instanceof Error)return te}return null}return b(Q)}function P(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Q=0;Q<w.length;Q++){var se=w[Q];if(typeof se!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+re(se)+" at index "+Q+"."),s}function k(M,q,S,L,G){for(var K=[],te=0;te<w.length;te++){var ce=w[te],J=ce(M,q,S,L,G,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&K.push(J.data.expectedType)}var he=K.length>0?", expected one of type ["+K.join(", ")+"]":"";return new f("Invalid "+L+" `"+G+"` supplied to "+("`"+S+"`"+he+"."))}return b(k)}function z(){function w(Q,se,k,M,q){return O(Q[se])?null:new f("Invalid "+M+" `"+q+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return b(w)}function $(w,Q,se,k,M){return new f((w||"React class")+": "+Q+" type `"+se+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+M+"`.")}function B(w){function Q(se,k,M,q,S){var L=se[k],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+G+"` "+("supplied to `"+M+"`, expected `object`."));for(var K in w){var te=w[K];if(typeof te!="function")return $(M,q,S,K,W(te));var ce=te(L,K,M,q,S+"."+K,n);if(ce)return ce}return null}return b(Q)}function A(w){function Q(se,k,M,q,S){var L=se[k],G=U(L);if(G!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+G+"` "+("supplied to `"+M+"`, expected `object`."));var K=t({},se[k],w);for(var te in K){var ce=w[te];if(r(w,te)&&typeof ce!="function")return $(M,q,S,te,W(ce));if(!ce)return new f("Invalid "+q+" `"+S+"` key `"+te+"` supplied to `"+M+"`.\nBad object: "+JSON.stringify(se[k],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(w),null," "));var J=ce(L,te,M,q,S+"."+te,n);if(J)return J}return null}return b(Q)}function O(w){switch(typeof w){case"number":case"string":case"undefined":return!0;case"boolean":return!w;case"object":if(Array.isArray(w))return w.every(O);if(w===null||o(w))return!0;var Q=m(w);if(Q){var se=Q.call(w),k;if(Q!==w.entries){for(;!(k=se.next()).done;)if(!O(k.value))return!1}else for(;!(k=se.next()).done;){var M=k.value;if(M&&!O(M[1]))return!1}}else return!1;return!0;default:return!1}}function j(w,Q){return w==="symbol"?!0:Q?Q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Q instanceof Symbol:!1}function U(w){var Q=typeof w;return Array.isArray(w)?"array":w instanceof RegExp?"object":j(Q,w)?"symbol":Q}function W(w){if(typeof w>"u"||w===null)return""+w;var Q=U(w);if(Q==="object"){if(w instanceof Date)return"date";if(w instanceof RegExp)return"regexp"}return Q}function re(w){var Q=W(w);switch(Q){case"array":case"object":return"an "+Q;case"boolean":case"date":case"regexp":return"a "+Q;default:return Q}}function ne(w){return!w.constructor||!w.constructor.name?h:w.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},ji}var Oi,Su;function bp(){if(Su)return Oi;Su=1;var e=po();function t(){}function n(){}return n.resetWarningCache=t,Oi=function(){function r(s,o,l,u,d,m){if(m!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Oi}if(process.env.NODE_ENV!=="production"){var yp=Pd(),xp=!0;Ts.exports=vp()(yp.isElement,xp)}else Ts.exports=bp()();var Cp=Ts.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var Id=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],La=Id.join(","),Rd=typeof Element>"u",Sn=Rd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,za=!Rd&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},qa=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},Dp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},$d=function(t,n,r){if(qa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(La));return n&&Sn.call(t,La)&&a.unshift(t),a=a.filter(r),a},Ld=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!qa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=Sn.call(s,La);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!qa(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},zd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},mn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Dp(t))&&!zd(t)?0:t.tabIndex},Ep=function(t,n){var r=mn(t);return r<0&&n&&!zd(t)?0:r},_p=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},qd=function(t){return t.tagName==="INPUT"},kp=function(t){return qd(t)&&t.type==="hidden"},Fp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Ap=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Bp=function(t){if(!t.name)return!0;var n=t.form||za(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=Ap(a,t.form);return!i||i===t},Tp=function(t){return qd(t)&&t.type==="radio"},Sp=function(t){return Tp(t)&&!Bp(t)},jp=function(t){var n,r=t&&za(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,h;r=za(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},Pu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Op=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Sn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Sn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=za(t);if(l&&!l.shadowRoot&&a(l)===!0)return Pu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(jp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Pu(t);return!1},Pp=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return Sn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ua=function(t,n){return!(n.disabled||qa(n)||kp(n)||Op(n,t)||Fp(n)||Pp(n))},Os=function(t,n){return!(Sp(n)||mn(n)<0||!Ua(t,n))},Mp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Np=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Ep(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(_p).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Ud=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ld([t],n.includeContainer,{filter:Os.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Mp}):r=$d(t,n.includeContainer,Os.bind(null,n)),Np(r)},Wd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ld([t],n.includeContainer,{filter:Ua.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=$d(t,n.includeContainer,Ua.bind(null,n)),r},Dn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Sn.call(t,La)===!1?!1:Os(n,t)},Ip=Id.concat("iframe").join(","),Ba=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Sn.call(t,Ip)===!1?!1:Ua(n,t)};const Rp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Wd,getTabIndex:mn,isFocusable:Ba,isTabbable:Dn,tabbable:Ud},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var Nd=["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])"],za=Nd.join(","),Rd=typeof Element>"u",Pn=Rd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qa=!Rd&&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},Ua=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},Dp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Id=function(t,n,r){if(Ua(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(za));return n&&Pn.call(t,za)&&a.unshift(t),a=a.filter(r),a},$d=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Ua(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=Pn.call(s,za);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Ua(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},Ld=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},gn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Dp(t))&&!Ld(t)?0:t.tabIndex},wp=function(t,n){var r=gn(t);return r<0&&n&&!Ld(t)?0:r},Ep=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},zd=function(t){return t.tagName==="INPUT"},_p=function(t){return zd(t)&&t.type==="hidden"},kp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Fp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ap=function(t){if(!t.name)return!0;var n=t.form||qa(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=Fp(a,t.form);return!i||i===t},Bp=function(t){return zd(t)&&t.type==="radio"},Tp=function(t){return Bp(t)&&!Ap(t)},Sp=function(t){var n,r=t&&qa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,m;r=qa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},ju=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},jp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Pn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Pn.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=qa(t);if(l&&!l.shadowRoot&&a(l)===!0)return ju(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Sp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ju(t);return!1},Op=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 Pn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Wa=function(t,n){return!(n.disabled||Ua(n)||_p(n)||jp(n,t)||kp(n)||Op(n))},Ss=function(t,n){return!(Tp(n)||gn(n)<0||!Wa(t,n))},Pp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Mp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=wp(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(Ep).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},qd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=$d([t],n.includeContainer,{filter:Ss.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Pp}):r=Id(t,n.includeContainer,Ss.bind(null,n)),Mp(r)},Ud=function(t,n){n=n||{};var r;return n.getShadowRoot?r=$d([t],n.includeContainer,{filter:Wa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Id(t,n.includeContainer,Wa.bind(null,n)),r},kn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,za)===!1?!1:Ss(n,t)},Np=Nd.concat("iframe").join(","),Ta=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,Np)===!1?!1:Wa(n,t)};const Rp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Ud,getTabIndex:gn,isFocusable:Ta,isTabbable:kn,tabbable:qd},Symbol.toStringTag,{value:"Module"}));/*!
60
60
  * focus-trap 7.5.4
61
61
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
62
- */function Mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Nu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mu(Object(n),!0).forEach(function(r){$p(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $p(e,t,n){return t=zp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lp(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 zp(e){var t=Lp(e,"string");return typeof t=="symbol"?t:String(t)}var Iu={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()}},qp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Up=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Tr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Wp=function(t){return Tr(t)&&!t.shiftKey},Vp=function(t){return Tr(t)&&t.shiftKey},Ru=function(t){return setTimeout(t,0)},$u=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},yr=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},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Hp=[],Kp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Hp,i=Nu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Wp,isKeyBackward:Vp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(A,F,O){return A&&A[F]!==void 0?A[F]:i[O||F]},u=function(A,F){var O=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var U=M.container,W=M.tabbableNodes;return U.contains(A)||(O==null?void 0:O.includes(U))||W.find(function(ie){return ie===A})})},d=function(A){var F=i[A];if(typeof F=="function"){for(var O=arguments.length,M=new Array(O>1?O-1:0),U=1;U<O;U++)M[U-1]=arguments[U];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(A,"` was specified but was not a node, or did not return a node"))}var W=F;if(typeof F=="string"&&(W=r.querySelector(F),!W))throw new Error("`".concat(A,"` as selector refers to no known node"));return W},h=function(){var A=d("initialFocus");if(A===!1)return!1;if(A===void 0||!Ba(A,i.tabbableOptions))if(u(r.activeElement)>=0)A=r.activeElement;else{var F=s.tabbableGroups[0],O=F&&F.firstTabbableNode;A=O||d("fallbackFocus")}if(!A)throw new Error("Your focus-trap needs to have at least one focusable element");return A},p=function(){if(s.containerGroups=s.containers.map(function(A){var F=Ud(A,i.tabbableOptions),O=Wd(A,i.tabbableOptions),M=F.length>0?F[0]:void 0,U=F.length>0?F[F.length-1]:void 0,W=O.find(function(C){return Dn(C)}),ie=O.slice().reverse().find(function(C){return Dn(C)}),se=!!F.find(function(C){return mn(C)>0});return{container:A,tabbableNodes:F,focusableNodes:O,posTabIndexesFound:se,firstTabbableNode:M,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:ie,nextTabbableNode:function(G){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(G);return _<0?ne?O.slice(O.indexOf(G)+1).find(function(S){return Dn(S)}):O.slice(0,O.indexOf(G)).reverse().find(function(S){return Dn(S)}):F[_+(ne?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(A){return A.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(A){return A.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function R(A){var F=A.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?R(F.shadowRoot):F},v=function R(A){if(A!==!1&&A!==m(document)){if(!A||!A.focus){R(h());return}A.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=A,qp(A)&&A.select()}},f=function(A){var F=d("setReturnFocus",A);return F||(F===!1?!1:A)},b=function(A){var F=A.target,O=A.event,M=A.isBackward,U=M===void 0?!1:M;F=F||oa(O),p();var W=null;if(s.tabbableGroups.length>0){var ie=u(F,O),se=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var C=$u(s.tabbableGroups,function(j){var L=j.firstTabbableNode;return F===L});if(C<0&&(se.container===F||Ba(F,i.tabbableOptions)&&!Dn(F,i.tabbableOptions)&&!se.nextTabbableNode(F,!1))&&(C=ie),C>=0){var G=C===0?s.tabbableGroups.length-1:C-1,ne=s.tabbableGroups[G];W=mn(F)>=0?ne.lastTabbableNode:ne.lastDomTabbableNode}else Tr(O)||(W=se.nextTabbableNode(F,!1))}else{var _=$u(s.tabbableGroups,function(j){var L=j.lastTabbableNode;return F===L});if(_<0&&(se.container===F||Ba(F,i.tabbableOptions)&&!Dn(F,i.tabbableOptions)&&!se.nextTabbableNode(F))&&(_=ie),_>=0){var S=_===s.tabbableGroups.length-1?0:_+1,q=s.tabbableGroups[S];W=mn(F)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else Tr(O)||(W=se.nextTabbableNode(F))}}else W=d("fallbackFocus");return W},g=function(A){var F=oa(A);if(!(u(F,A)>=0)){if(yr(i.clickOutsideDeactivates,A)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}yr(i.allowOutsideClick,A)||A.preventDefault()}},w=function(A){var F=oa(A),O=u(F,A)>=0;if(O||F instanceof Document)O&&(s.mostRecentlyFocusedNode=F);else{A.stopImmediatePropagation();var M,U=!0;if(s.mostRecentlyFocusedNode)if(mn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[W].tabbableNodes;if(ie.length>0){var se=ie.findIndex(function(C){return C===s.mostRecentlyFocusedNode});se>=0&&(i.isKeyForward(s.recentNavEvent)?se+1<ie.length&&(M=ie[se+1],U=!1):se-1>=0&&(M=ie[se-1],U=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(G){return mn(G)>0})})||(U=!1);else U=!1;U&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),v(M||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},E=function(A){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=A;var O=b({event:A,isBackward:F});O&&(Tr(A)&&A.preventDefault(),v(O))},B=function(A){if(Up(A)&&yr(i.escapeDeactivates,A)!==!1){A.preventDefault(),o.deactivate();return}(i.isKeyForward(A)||i.isKeyBackward(A))&&E(A,i.isKeyBackward(A))},D=function(A){var F=oa(A);u(F,A)>=0||yr(i.clickOutsideDeactivates,A)||yr(i.allowOutsideClick,A)||(A.preventDefault(),A.stopImmediatePropagation())},k=function(){if(s.active)return Iu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Ru(function(){v(h())}):v(h()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",B,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",B,!0),o},$=function(A){var F=A.some(function(O){var M=Array.from(O.removedNodes);return M.some(function(U){return U===s.mostRecentlyFocusedNode})});F&&v(h())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,z=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(A){P.observe(A,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(A){if(s.active)return this;var F=l(A,"onActivate"),O=l(A,"onPostActivate"),M=l(A,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var U=function(){M&&p(),k(),z(),O==null||O()};return M?(M(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(A){if(!s.active)return this;var F=Nu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},A);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),Iu.deactivateTrap(a,o);var O=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),U=l(F,"checkCanReturnFocus"),W=l(F,"returnFocus","returnFocusOnDeactivate");O==null||O();var ie=function(){Ru(function(){W&&v(f(s.nodeFocusedBeforeActivation)),M==null||M()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(A){if(s.paused||!s.active)return this;var F=l(A,"onPause"),O=l(A,"onPostPause");return s.paused=!0,F==null||F(),T(),z(),O==null||O(),this},unpause:function(A){if(!s.paused||!s.active)return this;var F=l(A,"onUnpause"),O=l(A,"onPostUnpause");return s.paused=!1,F==null||F(),p(),k(),z(),O==null||O(),this},updateContainerElements:function(A){var F=[].concat(A).filter(Boolean);return s.containers=F.map(function(O){return typeof O=="string"?r.querySelector(O):O}),s.active&&p(),z(),this}},o.updateContainerElements(t),o};const Zp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Kp},Symbol.toStringTag,{value:"Module"})),Yp=Jc(Zp),Gp=Jc(Rp);function sr(e){"@babel/helpers - typeof";return sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sr(e)}function Qp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lu(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,Vd(r.key),r)}}function Jp(e,t,n){return t&&Lu(e.prototype,t),n&&Lu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xp(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&&Ps(e,t)}function Ps(e,t){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ps(e,t)}function eg(e){var t=ng();return function(){var r=Wa(e),a;if(t){var i=Wa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return tg(this,a)}}function tg(e,t){if(t&&(sr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fr(e)}function Fr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ng(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Wa(e){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wa(e)}function rg(e,t,n){return t=Vd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vd(e){var t=ag(e,"string");return sr(t)==="symbol"?t:String(t)}function ag(e,t){if(sr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(sr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ua=y,be=wp,ig=Yp,sg=ig.createFocusTrap,og=Gp,ug=og.isFocusable,bo=function(e){Xp(n,e);var t=eg(n);function n(r){var a;Qp(this,n),a=t.call(this,r),rg(Fr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var v;if(m=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(Fr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Fr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Fr(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 Jp(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&&!ug(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),xr=typeof Element>"u"?Function:Element;bo.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(xr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(xr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(xr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(xr)),children:be.oneOfType([be.element,be.instanceOf(xr)])};bo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:sg};var lg=bo;const cg=Mn(lg);const on=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:h="Modal"})=>{const p=ae.useIntl(),{registerOverlay:m,unregisterOverlay:v}=Ad(),[f,b]=y.useState(t),[g,w]=y.useState(null),E=y.useRef(null),B=P=>{f&&P.key==="Escape"&&T(!1)},D=P=>{w(P.target)},k=P=>{g===E.current&&P.target===E.current&&T(!1),w(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",B),()=>{window.removeEventListener("keyup",B)}},[f]),y.useEffect(()=>{const P=E.current;return P&&(P.addEventListener("mousedown",D),P.addEventListener("mouseup",k)),()=>{P&&(P.removeEventListener("mousedown",D),P.removeEventListener("mouseup",k))}},[g]);const T=P=>{if(b(P),P)a(),m(e);else{if(f===P)return;i(),v(e)}};y.useEffect(()=>(T(t),()=>{f&&v(e)}),[t]);const $=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:E,className:H("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(go,{id:e,className:H("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:$,children:t&&c.jsx(cg,{containerElements:[E.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Fe,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>T(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(zt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(fr,{buttons:u})]}),s&&c.jsx(ir,{className:"error",children:s})]})})})})},Hd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Cr="joinCommunityButton",yo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ae.useIntl(),o=y.useContext(at),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const v={},f={};return d&&p!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${Cr}_leave`}),v["aria-label"]=s.formatMessage({id:`${Cr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Fe,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Cr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Cr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const w=d?i:a;typeof w=="function"&&setTimeout(async()=>{await w()},500),h(!d)},className:H("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Cr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const Ni="communityDetails_",dg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ae.useIntl(),{id:u}=y.useContext(at),d=u,h=5,p=a||i.length,m=i.length?i:Array(h).fill({}),v=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:H("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${Ni}members`}),c.jsx("span",{className:"count",children:p})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Ni}viewAll`})})})]}),d&&c.jsx(po,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(yo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Fe,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Ni}invite`})})]}):c.jsx(c.Fragment,{})]})};const Lr=({icon:e,className:t="",...n})=>c.jsx(Fe,{className:H("action-button",t),variant:"tertiary",icon:e,...n}),fg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),hg=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function mg(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const pg=y.lazy(()=>Promise.resolve().then(()=>fv));let Sr=!1;const Ii=()=>{Sr!==!1&&(clearTimeout(Sr),Sr=!1)},gg=5;let Ri=null;const Kd=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:p=async()=>({next:"",results:[]})}})=>{const m=ae.useIntl(),v={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Qr,v),{numberOfLikes:g,userLikedContent:w,ignoreInteractions:E,showLikers:B,tabbableLink:D,showLikesModal:k}=f,T=mg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const $=y.useMemo(()=>hg(n,gg),[n]),P=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Sr)return Ii(),!1;if(Ii(),E||!s)return!1;Sr=setTimeout(z,350)},z=async()=>{if(Ii(),E||!s)return!1;let F=w?g-1:g+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!w}]);try{if(i&&i.slugs){const O=fg(i.slugs);w?await h(O):await d({...O,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},R=()=>{Ri=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},A=()=>{Ri&&clearTimeout(Ri)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{R()}},c.jsxs(c.Fragment,{children:[c.jsx(Lr,{className:H("discussion-button text-medium action-button likes-button",{"show-spinner":E,"is-liked":w,disabled:!s}),icon:{icon:w?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:P,screenreaderText:s?m.formatMessage({id:`discussion_likes_${w?"unlike":"like"}`},{action:m.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":w,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:m.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Pe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>R,onClick:F=>{var M;F.preventDefault(),F.stopPropagation(),A(),b([{type:"showLikers",value:!0}]);const O=(M=F.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(O){const U=O.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),R())},"aria-expanded":B,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Pe,{showOnFocus:!1,children:m.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(In,{id:`likes-tooltip-${i.slug}`,isOpen:B,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[$.map((F,O)=>{if(typeof F=="string")return null;const M={};return D!==O&&(M.tabIndex=-1),c.jsx("li",{"data-index":O,children:c.jsx(bn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>A(),onKeyDown:T,...M,children:F.name?F.name:c.jsx("span",{className:"deleted-user",children:m.formatMessage({id:"member_deleted"})})})},F.id||window.btoa(F.name||""))}),c.jsx("li",{"data-index":$.length,className:"show-all",children:c.jsx(Fe,{variant:"tertiary",onClick:()=>{A(),R(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:m.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(hr,{children:c.jsx(y.Suspense,{children:c.jsx(pg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:p}}})})})]})]}))},Ms=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},mr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},vg="post",bg="reply",zr="00000000-0000-0000-0000-000000000000",yg="en";function xo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Co({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 xg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Cg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Zd(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 wg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:zr,time:new Date().toISOString(),verb:vg}}function zu({activity:e,user:t}){return{...e,actor:Zd(t),...xg()}}function Va({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Yd({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Ha({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Gd({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function Dg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Eg(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 _g(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function Ka(e,t,n){return t?n!=null&&n.append?Eg(e,t,n):_g(e,t,n):Dg(e)}function kt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Qd(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 wo(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],[]))||[]}var fi=(e=>(e.Post="post",e.Poll="poll",e))(fi||{});const vt="poll-vote",kg=(e,t="en")=>{var r;return e.verb!==fi.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(a=>{var o,l,u,d,h;const i=((o=a==null?void 0:a.own_children)==null?void 0:o["poll-vote"])||[],s=(l=a.data)==null?void 0:l.description;return{id:a.id,label:s[t],numVotes:((u=a==null?void 0:a.children_counts)==null?void 0:u["poll-vote"])||0,hasUserVoted:i.length>0,userVote:{id:(d=i[0])==null?void 0:d.id},position:((h=a.data)==null?void 0:h.position)||0}}).sort((a,i)=>a.position-i.position)};function Fg({activity:e,reactionId:t,user:n}){var i;const r=n==null?void 0:n.id;if(!r)return;const a=(i=e.latest_reactions)==null?void 0:i["poll-option"];if(a){for(const s of a)if(s.id===t){const o={id:zr,activity_id:e.id,kind:vt,data:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),user_id:r,parent:s.id,latest_children:{},own_children:{},children_counts:{}};s.latest_children=s.latest_children||{},s.latest_children[vt]=s.latest_children[vt]||[],s.latest_children[vt].push(o),s.own_children=s.own_children||{},s.own_children[vt]=s.own_children[vt]||[],s.own_children[vt].push(o),s.children_counts=s.children_counts||{},s.children_counts[vt]=(s.children_counts[vt]||0)+1;break}}}function Ag({activity:e,reactionId:t,correctReactionId:n,user:r}){var a;(a=e.latest_reactions)==null||a["poll-option"].forEach(i=>{var s;i.id===t&&(i.latest_children[vt].forEach(o=>{o.id===zr&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=i.own_children)==null||s[vt].forEach(o=>{o.id===zr&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function Bg({cache:e,activityId:t,reactionId:n}){var r,a,i;for(const{results:s}of e.pages)for(const o of s)if(o.id===t){const l=(r=o.latest_reactions)==null?void 0:r["poll-option"];if(l)for(const u of l){const d=(a=u.own_children)==null?void 0:a[vt],h=(i=u.latest_children)==null?void 0:i[vt];if(h){const p=h.findIndex(m=>m.id===n);p!==-1&&(h.splice(p,1),u.children_counts[vt]--)}if(d){const p=d.findIndex(m=>m.id===n);p!==-1&&d.splice(p,1)}}return e}return e}function Tg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:zr,kind:bg,parent:t||""}}function qu({reply:e,user:t}){const n=Zd(t);return{...e,user_id:n.id,user:n,...Cg()}}function Uu({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 Sg({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 Jd=(e,t)=>{const n=new CustomEvent(tt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Wu,$i=0;const Xd=()=>{y.useEffect(()=>(document.addEventListener(tt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(tt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Wu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),$i=0;return}$i++,!($i>10)&&(Wu=setTimeout(()=>{e(t)},50))}},or=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Gt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Do=Object.freeze({actor:`SU:${or.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"}),jg=Object.freeze({actor:`SU:${Gt.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Og=Object.freeze({actor:`SU:${or.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"}),Pg=Object.freeze({actor:`SU:${Gt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Do.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Gt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Gt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Do.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Gt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Gt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Gt.id,user:{id:Gt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Do.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:or.id,user:{id:or.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:jg.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Gt.id,user:{id:Gt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Og.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:or.id,user:{id:or.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Pg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Mg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=zu({activity:wg(o),user:i});return Ka(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=zu({activity:o,user:i});r.setQueryData(a,Ka(d,u,{replace:!0})),setTimeout(()=>{Jd(d.id,"activity")},0)}});return s}function Ng({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:l})=>t(u=>{const d=kt(o,u);return d&&Fg({activity:d,reactionId:l,user:i}),u}),onError:n,onSuccess:(o,{activityId:l,reactionId:u},d)=>{const h=kt(l,d);h&&Ag({activity:h,reactionId:u,correctReactionId:o.body.id,user:i}),r.setQueryData(a,d)}});return s}function Ig({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=kt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Rg({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o,createVote:l,removeVote:u,removePoll:d},queryKey:h,filterOption:p}){const m=Ue.useQueryClient(),v=li(),f={queryClient:m,queryKey:h},b={mutationHandlers:{error:xo(f),mutate:Co(f)},user:v,...f},g=Mg({...b,mutationFn:e}),w=Ig({...b,mutationFn:t}),E=$g({...b,mutationFn:n}),B=qg({...b,mutationFn:a}),D=Wg({...b,mutationFn:i}),k=zg({...b,mutationFn:s}),T=Vg({...b,mutationFn:o}),$=Ng({...b,mutationFn:l}),P=Ug({...b,mutationFn:u}),{activities:z,...R}=Lg({queryKey:h,queryFn:r,filterOption:p});return{activities:z,mutations:{create:g,edit:w,remove:B,like:E,unlike:D,pin:k,unpin:T,createVote:$,removeVote:P},user:v,...R}}function $g({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=kt(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=kt(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Lg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ue.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:wo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function zg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=kt(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=kt(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function qg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Qd(a,i)),onError:n});return r}function Ug({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({activityId:i,reactionId:s})=>t(o=>Bg({cache:o,activityId:i,reactionId:s})),onError:n});return a}function Wg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=kt(i,s);return o&&Yd({activity:o,user:r}),s}),onError:n});return a}function Vg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=kt(i,s);return o&&Gd({activity:o,user:r}),s}),onError:n});return a}const Hg=280,Eo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?rr(e,typeof t=="number"?t:Hg):e;a=a.trim();const i=`<br>
62
+ */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 Pu(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){Ip(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}function Ip(e,t,n){return t=Lp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $p(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 Lp(e){var t=$p(e,"string");return typeof t=="symbol"?t:String(t)}var Mu={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()}},zp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},qp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},jr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Up=function(t){return jr(t)&&!t.shiftKey},Wp=function(t){return jr(t)&&t.shiftKey},Nu=function(t){return setTimeout(t,0)},Ru=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},Cr=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},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Vp=[],Hp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Vp,i=Pu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Up,isKeyBackward:Wp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,A,O){return B&&B[A]!==void 0?B[A]:i[O||A]},u=function(B,A){var O=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(j){var U=j.container,W=j.tabbableNodes;return U.contains(B)||(O==null?void 0:O.includes(U))||W.find(function(re){return re===B})})},d=function(B){var A=i[B];if(typeof A=="function"){for(var O=arguments.length,j=new Array(O>1?O-1:0),U=1;U<O;U++)j[U-1]=arguments[U];A=A.apply(void 0,j)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=A;if(typeof A=="string"&&(W=r.querySelector(A),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},m=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Ta(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var A=s.tabbableGroups[0],O=A&&A.firstTabbableNode;B=O||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},h=function(){if(s.containerGroups=s.containers.map(function(B){var A=qd(B,i.tabbableOptions),O=Ud(B,i.tabbableOptions),j=A.length>0?A[0]:void 0,U=A.length>0?A[A.length-1]:void 0,W=O.find(function(w){return kn(w)}),re=O.slice().reverse().find(function(w){return kn(w)}),ne=!!A.find(function(w){return gn(w)>0});return{container:B,tabbableNodes:A,focusableNodes:O,posTabIndexesFound:ne,firstTabbableNode:j,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:re,nextTabbableNode:function(Q){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=A.indexOf(Q);return k<0?se?O.slice(O.indexOf(Q)+1).find(function(M){return kn(M)}):O.slice(0,O.indexOf(Q)).reverse().find(function(M){return kn(M)}):A[k+(se?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(B){return B.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function $(B){var A=B.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?$(A.shadowRoot):A},v=function $(B){if(B!==!1&&B!==p(document)){if(!B||!B.focus){$(m());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,zp(B)&&B.select()}},f=function(B){var A=d("setReturnFocus",B);return A||(A===!1?!1:B)},b=function(B){var A=B.target,O=B.event,j=B.isBackward,U=j===void 0?!1:j;A=A||oa(O),h();var W=null;if(s.tabbableGroups.length>0){var re=u(A,O),ne=re>=0?s.containerGroups[re]:void 0;if(re<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var w=Ru(s.tabbableGroups,function(S){var L=S.firstTabbableNode;return A===L});if(w<0&&(ne.container===A||Ta(A,i.tabbableOptions)&&!kn(A,i.tabbableOptions)&&!ne.nextTabbableNode(A,!1))&&(w=re),w>=0){var Q=w===0?s.tabbableGroups.length-1:w-1,se=s.tabbableGroups[Q];W=gn(A)>=0?se.lastTabbableNode:se.lastDomTabbableNode}else jr(O)||(W=ne.nextTabbableNode(A,!1))}else{var k=Ru(s.tabbableGroups,function(S){var L=S.lastTabbableNode;return A===L});if(k<0&&(ne.container===A||Ta(A,i.tabbableOptions)&&!kn(A,i.tabbableOptions)&&!ne.nextTabbableNode(A))&&(k=re),k>=0){var M=k===s.tabbableGroups.length-1?0:k+1,q=s.tabbableGroups[M];W=gn(A)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else jr(O)||(W=ne.nextTabbableNode(A))}}else W=d("fallbackFocus");return W},g=function(B){var A=oa(B);if(!(u(A,B)>=0)){if(Cr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}Cr(i.allowOutsideClick,B)||B.preventDefault()}},C=function(B){var A=oa(B),O=u(A,B)>=0;if(O||A instanceof Document)O&&(s.mostRecentlyFocusedNode=A);else{B.stopImmediatePropagation();var j,U=!0;if(s.mostRecentlyFocusedNode)if(gn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),re=s.containerGroups[W].tabbableNodes;if(re.length>0){var ne=re.findIndex(function(w){return w===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<re.length&&(j=re[ne+1],U=!1):ne-1>=0&&(j=re[ne-1],U=!1))}}else s.containerGroups.some(function(w){return w.tabbableNodes.some(function(Q){return gn(Q)>0})})||(U=!1);else U=!1;U&&(j=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),v(j||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},D=function(B){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var O=b({event:B,isBackward:A});O&&(jr(B)&&B.preventDefault(),v(O))},F=function(B){if(qp(B)&&Cr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&D(B,i.isKeyBackward(B))},E=function(B){var A=oa(B);u(A,B)>=0||Cr(i.clickOutsideDeactivates,B)||Cr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},_=function(){if(s.active)return Mu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Nu(function(){v(m())}):v(m()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",F,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",F,!0),o},I=function(B){var A=B.some(function(O){var j=Array.from(O.removedNodes);return j.some(function(U){return U===s.mostRecentlyFocusedNode})});A&&v(m())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(I):void 0,z=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){P.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var A=l(B,"onActivate"),O=l(B,"onPostActivate"),j=l(B,"checkCanFocusTrap");j||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var U=function(){j&&h(),_(),z(),O==null||O()};return j?(j(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(B){if(!s.active)return this;var A=Pu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),Mu.deactivateTrap(a,o);var O=l(A,"onDeactivate"),j=l(A,"onPostDeactivate"),U=l(A,"checkCanReturnFocus"),W=l(A,"returnFocus","returnFocusOnDeactivate");O==null||O();var re=function(){Nu(function(){W&&v(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(re,re),this):(re(),this)},pause:function(B){if(s.paused||!s.active)return this;var A=l(B,"onPause"),O=l(B,"onPostPause");return s.paused=!0,A==null||A(),T(),z(),O==null||O(),this},unpause:function(B){if(!s.paused||!s.active)return this;var A=l(B,"onUnpause"),O=l(B,"onPostUnpause");return s.paused=!1,A==null||A(),h(),_(),z(),O==null||O(),this},updateContainerElements:function(B){var A=[].concat(B).filter(Boolean);return s.containers=A.map(function(O){return typeof O=="string"?r.querySelector(O):O}),s.active&&h(),z(),this}},o.updateContainerElements(t),o};const Kp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Hp},Symbol.toStringTag,{value:"Module"})),Zp=Qc(Kp),Yp=Qc(Rp);function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(e)}function Gp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Iu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wd(r.key),r)}}function Qp(e,t,n){return t&&Iu(e.prototype,t),n&&Iu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&js(e,t)}function js(e,t){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},js(e,t)}function Xp(e){var t=tg();return function(){var r=Va(e),a;if(t){var i=Va(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return eg(this,a)}}function eg(e,t){if(t&&(lr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Br(e)}function Br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tg(){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 Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Va(e)}function ng(e,t,n){return t=Wd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wd(e){var t=rg(e,"string");return lr(t)==="symbol"?t:String(t)}function rg(e,t){if(lr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(lr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ua=y,be=Cp,ag=Zp,ig=ag.createFocusTrap,sg=Yp,og=sg.isFocusable,go=function(e){Jp(n,e);var t=Xp(n);function n(r){var a;Gp(this,n),a=t.call(this,r),ng(Br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),h=1;h<d;h++)m[h-1]=arguments[h];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var v;if(p=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(Br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Br(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 Qp(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&&!og(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),Dr=typeof Element>"u"?Function:Element;go.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(Dr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(Dr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(Dr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(Dr)),children:be.oneOfType([be.element,be.instanceOf(Dr)])};go.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:ig};var ug=go;const lg=In(ug);const ln=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const h=ae.useIntl(),{registerOverlay:p,unregisterOverlay:v}=Fd(),[f,b]=y.useState(t),[g,C]=y.useState(null),D=y.useRef(null),F=P=>{f&&P.key==="Escape"&&T(!1)},E=P=>{C(P.target)},_=P=>{g===D.current&&P.target===D.current&&T(!1),C(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",F),()=>{window.removeEventListener("keyup",F)}},[f]),y.useEffect(()=>{const P=D.current;return P&&(P.addEventListener("mousedown",E),P.addEventListener("mouseup",_)),()=>{P&&(P.removeEventListener("mousedown",E),P.removeEventListener("mouseup",_))}},[g]);const T=P=>{if(b(P),P)a(),p(e);else{if(f===P)return;i(),v(e)}};y.useEffect(()=>(T(t),()=>{f&&v(e)}),[t]);const I=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:D,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ho,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:I,children:t&&c.jsx(lg,{containerElements:[D.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>T(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(zt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(pr,{buttons:u})]}),s&&c.jsx(ur,{className:"error",children:s})]})})})})},Vd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const wr="joinCommunityButton",vo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ae.useIntl(),o=y.useContext(it),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[h,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[d]);const v={},f={};return d&&h!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${wr}_leave`}),v["aria-label"]=s.formatMessage({id:`${wr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${wr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),p(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${wr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const C=d?i:a;typeof C=="function"&&setTimeout(async()=>{await C()},500),m(!d)},className:V("join-community-button",h,{active:h==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${wr}${["joining","leaving"].includes(h)?`_${h}`:d?"_member":n?"_short":""}`})})})};const Pi="communityDetails_",cg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ae.useIntl(),{id:u}=y.useContext(it),d=u,m=5,h=a||i.length,p=i.length?i:Array(m).fill({}),v=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:V("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${Pi}members`}),c.jsx("span",{className:"count",children:h})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Pi}viewAll`})})})]}),d&&c.jsx(mo,{contributors:{total:a,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:h===0},cutoff:m})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(vo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Pi}invite`})})]}):c.jsx(c.Fragment,{})]})};const qr=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:V("action-button",t),variant:"tertiary",icon:e,...n}),dg="post",fg="reply",Hd="00000000-0000-0000-0000-000000000000";function bo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function yo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function mg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function hg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Kd(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 pg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Hd,time:new Date().toISOString(),verb:dg}}function $u({activity:e,user:t}){return{...e,actor:Kd(t),...mg()}}function Ha({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Zd({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 Ka({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Yd({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function gg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Hd,kind:fg,parent:t||""}}function Lu({reply:e,user:t}){const n=Kd(t);return{...e,user_id:n.id,user:n,...hg()}}function zu({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 vg({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function bg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function yg(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 xg(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 Za(e,t,n){return t?n!=null&&n.append?yg(e,t,n):xg(e,t,n):bg(e)}function qt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Gd(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 xo(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 Qd=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let qu,Mi=0;const Jd=()=>{y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(qu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),Mi=0;return}Mi++,!(Mi>10)&&(qu=setTimeout(()=>{e(t)},50))}};var Ae=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Ae||{});const cr=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Qt=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}),Co=Object.freeze({actor:`SU:${cr.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Cg=Object.freeze({actor:`SU:${Qt.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"}),Dg=Object.freeze({actor:`SU:${cr.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),wg=Object.freeze({actor:`SU:${Qt.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:Co.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Co.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.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:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Co.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Cg.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Dg.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const Eg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),_g=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function kg(e){return y.useCallback(t=>{var s,o,l,u;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const Fg=y.lazy(()=>Promise.resolve().then(()=>nv));let Or=!1;const Ni=()=>{Or!==!1&&(clearTimeout(Or),Or=!1)},Ag=5;let Ri=null;const Xd=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:Ae.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:m=()=>{},listLikes:h=async()=>({next:"",results:[]})}})=>{const p=ae.useIntl(),v={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Jr,v),{numberOfLikes:g,userLikedContent:C,ignoreInteractions:D,showLikers:F,tabbableLink:E,showLikesModal:_}=f,T=kg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const I=y.useMemo(()=>_g(n,Ag),[n]),P=A=>{if(A.preventDefault(),A.stopPropagation(),b([{type:"showLikers",value:!1}]),Or)return Ni(),!1;if(Ni(),D||!s)return!1;Or=setTimeout(z,350)},z=async()=>{if(Ni(),D||!s)return!1;let A=C?g-1:g+1;A<0&&(A=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:A},{type:"userLikedContent",value:!C}]);try{if(i&&i.slugs){const O=Eg(i.slugs);C?await m(O):await d({...O,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},$=()=>{Ri=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{Ri&&clearTimeout(Ri)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:A=>{A.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{$()}},c.jsxs(c.Fragment,{children:[c.jsx(qr,{className:V("discussion-button text-medium action-button likes-button",{"show-spinner":D,"is-liked":C,disabled:!s}),icon:{icon:C?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:P,screenreaderText:s?p.formatMessage({id:`discussion_likes_${C?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":C,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Pe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>$,onClick:A=>{var j;A.preventDefault(),A.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const O=(j=A.currentTarget.nextSibling)==null?void 0:j.childNodes[0];if(O){const U=O.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),$())},"aria-expanded":F,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Pe,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Ln,{id:`likes-tooltip-${i.slug}`,isOpen:F,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[I.map((A,O)=>{if(typeof A=="string")return null;const j={};return E!==O&&(j.tabIndex=-1),c.jsx("li",{"data-index":O,children:c.jsx(xn,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:T,...j,children:A.name?A.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},A.id||window.btoa(A.name||""))}),c.jsx("li",{"data-index":I.length,className:"show-all",children:c.jsx(Ee,{variant:"tertiary",onClick:()=>{B(),$(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),_&&c.jsx(gr,{children:c.jsx(y.Suspense,{children:c.jsx(Fg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:_,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:h}}})})})]})]}))},Os=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},vr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function Bg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=$u({activity:pg(o),user:i});return Za(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=$u({activity:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0})),setTimeout(()=>{Qd(d.id,"activity")},0)}});return s}function Tg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Sg({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=Ke.useQueryClient(),m=ci(),h={queryClient:d,queryKey:l},p={mutationHandlers:{error:bo(h),mutate:yo(h)},user:m,...h},v=Bg({...p,mutationFn:e}),f=Tg({...p,mutationFn:t}),b=jg({...p,mutationFn:n}),g=Mg({...p,mutationFn:a}),C=Ng({...p,mutationFn:i}),D=Pg({...p,mutationFn:s}),F=Rg({...p,mutationFn:o}),{activities:E,..._}=Og({queryKey:l,queryFn:r,filterOption:u});return{activities:E,mutations:{create:v,edit:f,remove:g,like:b,unlike:C,pin:D,unpin:F},user:m,..._}}function jg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Og({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:xo(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Pg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Mg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Gd(a,i)),onError:n});return r}function Ng({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Zd({activity:o,user:r}),s}),onError:n});return a}function Rg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Yd({activity:o,user:r}),s}),onError:n});return a}const Ig=280,Do=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?sr(e,typeof t=="number"?t:Ig):e;a=a.trim();const i=`<br>
63
63
 
64
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await hd({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},_o=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),Kg=(e,t,n)=>{let r=!1;function a(i){let s=30;for(;i||s<=0;){if(t.some(o=>Array.from(i==null?void 0:i.classList).includes(o))){r=!0;break}if(Array.from(i==null?void 0:i.classList).includes(n))break;i=i.parentElement,s--}}return a(e.target),r},Zg=(e,t)=>e?typeof e=="string"?e:e[t]:"",Yg=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u,polls:d},profile:h,locale:p=yg})=>{const m=ae.useIntl(),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,g]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),w={...i,...d},{activities:E,error:B,fetchNextPage:D,hasNextPage:k,isLoading:T,mutations:{create:$,edit:P,remove:z,like:R,unlike:A,pin:F,unpin:O,createVote:M,removeVote:U}}=Rg({queryKey:[e,t,"activities",v],queryFns:w,filterOption:v[0]});y.useEffect(()=>{a&&g(b.concat(a==null?void 0:a.map(({slug:C,name:G})=>({id:C,text:G,type:"category"}))))},[a]);const[W,ie]=y.useState(null),se=()=>{ie(E.length),D()};return Xd(),B?c.jsx(yn,{variant:"error",text:B.message}):c.jsxs("section",{children:[c.jsx(iu,{isCard:!0,parentId:t,categories:a,form:{content:{type:fi.Post,slugs:{}},functions:{create:$,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:m.formatMessage({id:"community_joinToPost"})}}),c.jsx(of,{className:"activities-feed-filtering",options:b.map(({id:C,text:G})=>({id:C,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${G}`,defaultMessage:G})})),defaultOptions:v.map(({id:C,text:G})=>({id:C,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${G}`,defaultMessage:G})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:C,previous:G})=>{if(C[0]===G[0])return;f([b.find(S=>S.id===C[0])]);const ne=b.find(S=>S.id===C[0]);if(!ne)return;const _=new CustomEvent("ariaLive",{detail:{message:m.formatMessage({id:"community_sortSuccess"},{order:m.formatMessage({id:`activitiesFeed_rankingMethod_${ne.text}`,defaultMessage:ne.text})})}});document.dispatchEvent(_)}}),E==null?void 0:E.map((C,G)=>{var pe,fe,Ae;const{id:ne,own_reactions:_,latest_reactions:S,reaction_counts:q,mentioned_users:j,total_replies:L,additional_data:Q}=C,Z=(((pe=S==null?void 0:S.like)==null?void 0:pe.length)||0)>0,X=(((fe=_==null?void 0:_.like)==null?void 0:fe.length)||0)>0,le=X?_==null?void 0:_.like[0].id:"",te=Z?(Ae=S==null?void 0:S.like)==null?void 0:Ae.map(ye=>{var Ee,Le,Oe;return{id:(Ee=ye==null?void 0:ye.user)==null?void 0:Ee.id,name:(Oe=(Le=ye==null?void 0:ye.user)==null?void 0:Le.data)==null?void 0:Oe.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(ta,{content:{type:C.verb,title:C==null?void 0:C.title,body:C==null?void 0:C.content,canLike:n,createdAt:(C==null?void 0:C.time)||"",slugs:{question:`${e}/${t}`,answer:ne},slug:ne,author:mr(C==null?void 0:C.actor),userLiked:X,likes:(q==null?void 0:q.like)||0,comments:L||0,peopleWhoLiked:te,data:{mentions:j,...Q||{}},pinned:(q==null?void 0:q.pin)&&(q==null?void 0:q.pin)>0||!1,categories:_o((C==null?void 0:C.categories)||[],a||[]),pollOptions:kg(C,p),pollSettings:C==null?void 0:C.settings},links:{post:`${e}/${t}/${ne}`,comments:`${e}/${t}/${ne}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:ne}),updateContent:(ye,{body:Ee})=>P({activityId:ne,content:Ee})},likes:{createLike:()=>R({activityId:ne}),deleteLike:()=>A({activityId:ne,reactionId:le}),listLikes:ye=>u.list({activityId:ne,...ye})},comments:{openComments:()=>null},pins:{createPin:()=>F({activityId:ne}),deletePin:()=>O({activityId:ne,reactionId:S==null?void 0:S.pin[0].id})},polls:{createVote:({reactionId:ye})=>M({activityId:ne,reactionId:ye}),removeVote:({reactionId:ye})=>U({activityId:ne,reactionId:ye}),removePoll:()=>null},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:G===W,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t})},ne)}),!T&&c.jsx(Jr,{hasNextPage:k,loadNextPage:se,icon:{icon:"arrow-down",position:"right"},messages:{button:m.formatMessage({id:"loadMore_button"}),error:m.formatMessage({id:"loadMore_error"})}}),E.length===0&&!T&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:v[0].type==="category"?c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Fe,{variant:"secondary",size:"small",href:"/communities",children:m.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(su,{form:h})]})},Gg={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Qg({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ae.useIntl();return c.jsx(iu,{form:{content:{type:"reply",slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function Jg({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ae.useIntl(),i=()=>{n(r),t()};return c.jsx(Jr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function Xg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=qu({reply:Tg(o),user:i});return Ka(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=qu({reply:o,user:i});r.setQueryData(a,Ka(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Jd(d.id,"reply")},0)}});return s}function ev({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=kt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function tv({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,g,w;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,h=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,p=d?(g=r==null?void 0:r.like)==null?void 0:g.find(E=>{var B;return((B=E==null?void 0:E.user)==null?void 0:B.id)===(t==null?void 0:t.id)}):!1,m=typeof p=="object"?(p==null?void 0:p.id)??"":"",v=h?(w=a==null?void 0:a.like)==null?void 0:w.map(E=>{var B,D,k;return{id:(B=E==null?void 0:E.user)==null?void 0:B.id,name:(k=(D=E==null?void 0:E.user)==null?void 0:D.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:rv(s),createdAt:o,data:nv(s),likeId:m,liked:h,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!p}})}function nv(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function rv(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function ef({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ue.useQueryClient(),l=li(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:xo(u),mutate:Co(u)},user:l,...u},h=Xg({...d,mutationFn:e}),p=ev({...d,mutationFn:t}),m=av({...d,mutationFn:n}),v=sv({...d,mutationFn:a}),f=ov({...d,mutationFn:i}),{replies:b,...g}=iv({queryKey:s,queryFn:r});return{replies:tv({replies:b,user:l}),mutations:{create:h,edit:p,remove:v,like:m,unlike:f},user:l,...g}}function av({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=kt(s,o);return l&&Uu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=kt(o,l);u&&Uu({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function iv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ue.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:wo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function sv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Qd(a,i)),onError:n});return r}function ov({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=kt(i,s);return o&&Sg({reply:o,user:r}),s}),onError:n});return a}const uv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:v,edit:f,like:b,remove:g,unlike:w}}=ef({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:D=>i.list({...D,reactionId:a})}});so([m]);const[E,B]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Fe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${E?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!E),children:l.formatMessage({id:`discussion_thread_${E?"hide":"show"}`},{count:d==null?void 0:d.length})}),E&&c.jsx(nm,{loadMore:{isLoading:m,hasNextPage:p,loadNextPage:()=>h()},form:{parentId:r,content:{type:"reply",slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(D,{body:k})=>v({activityId:e,replyId:a,content:k}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:D,likes:k,data:T,body:$,createdAt:P,userLiked:z,peopleWhoLiked:R,parent:A,user:F,likeId:O})=>c.jsx(ta,{isCommunity:!0,content:{id:D,type:"reply",body:$,canLike:n,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:A},slug:"",author:mr(F),userLiked:z,likes:k,peopleWhoLiked:R,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:D}),updateContent:(M,{body:U})=>f({replyId:D,content:U})},likes:{createLike:()=>b({replyId:D}),deleteLike:()=>w({replyId:D,reactionId:O}),listLikes:M=>o.list({replyId:D,...M})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:r||""},{scope:ut.Platform,area:"all"}]},basePath:t,parentId:r},D)):null})]})};function lv({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:h,peopleWhoLiked:p,replyId:m,createdAt:v,user:f}=s,{edit:b,like:g,remove:w,unlike:E}=e.mutations;return c.jsx(Jh,{children:c.jsx(ta,{isCommunity:!0,content:{id:m,type:"reply",body:o,canLike:a,createdAt:v,slugs:{question:`${n}/${i}`,answer:t,reply:m},slug:m,author:mr(f),userLiked:d,likes:h,peopleWhoLiked:p,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>w({replyId:m}),updateContent:(B,{body:D})=>b({replyId:m,content:D})},likes:{createLike:()=>g({replyId:m}),deleteLike:()=>E({replyId:m,reactionId:u}),listLikes:B=>e.likes.list({replyId:m,...B})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:i||""},{scope:ut.Platform,area:"all"}]},children:c.jsx(uv,{basePath:n,parentId:i,activityId:t,replyId:m,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},m)},m)}const tf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:h})=>{const{fetchNextPage:p,hasNextPage:m,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:w,like:E,unlike:B}}=ef({queryKey:[t,n,e,"replies"],queryFns:u}),[D,k]=y.useState(null);so([v]),Xd();const T={create:($,P)=>{const{body:z}=P;b({activityId:e,content:z})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(tm,{type:"comment",responses:r,isLoading:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Qg,{parentId:n,isMember:a,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map(($,P)=>c.jsx(lv,{activityId:e,basePath:t,focus:D===P,formFns:{form:i,likes:l,reactions:u,mutations:{remove:g,edit:w,like:E,unlike:B}},isMember:a,parentId:n,reply:$},$.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(Jg,{hasNextPage:m,fetchNextPage:p,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(su,{form:d})]})};function cv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ue.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=wo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function dv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=cv({queryKey:t,queryFn:e});return{likes:n,...r}}function nf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=dv({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?mr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Qh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const rf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ae.useIntl();return c.jsx(on,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:H("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(nf,{...i,likeCount:r??0,functions:{likes:n}})})},fv=Object.freeze(Object.defineProperty({__proto__:null,default:rf},Symbol.toStringTag,{value:"Module"})),hv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const mv=3e3,af=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Lr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},mv)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(In,{className:H({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const qn="discussion_",sf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${qn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${qn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${qn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:H("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Kd,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Lr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${qn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${qn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Lr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${qn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(af,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(uf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const pv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:H("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Pe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(bn,{href:s?void 0:i,...l,children:rr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const ko=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:H("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),i){i(h);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const of=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(p=>p.id):[]),h=(p,m)=>{let v=[];u.includes(p)&&!i?v=u.filter(f=>f!==p):p==="all"?v=["all"]:r?v=[...u.filter(f=>f!=="all"),p]:v=[p],d(f=>(a&&typeof a=="function"&&a({current:v,previous:f}),v)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:H("filters",s),children:l.map(({id:p,text:m,disabled:v=!1,callback:f=()=>{}})=>{let b={};return v&&(b={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:H(p,{selected:u.includes(p)}),onClick:g=>{g.preventDefault(),g.stopPropagation(),h(p,f)},"aria-selected":u.includes(p),...b,children:m})},p)})})},gv=(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 la="languageSwitcher_",vv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(fo),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=h!==e;return c.jsxs("div",{className:H("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${la}label`})}),c.jsx("ul",{children:v.map(b=>{var E;if(!Aa[b])return null;const g=(E=r[b])==null?void 0:E.post_name;let w={className:b};if(h===b)w["aria-label"]=u.formatMessage({id:`${la}selected`},{language:Aa[b]});else{const B=gv(b,g,i);w={...w,href:typeof B=="string"?B:B.url,onClick:D=>{p(b),d(b),typeof a<"u"&&(D.preventDefault(),D.stopPropagation(),a(b,typeof B=="string"?B:B.urlForRouter))}}}return c.jsx("li",{children:c.jsx(bn,{...w,fallbackElement:"span",children:Aa[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${la}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${la}disclaimer`},{email:Zn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const Li=ae.createIntl({locale:"en",messages:dr}),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:Li.formatMessage({id:"loadMore_button"}),endOfFeed:Li.formatMessage({id:"loadMore_endOfFeed"}),error:Li.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(v){v instanceof Error?h(v.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:H("load-more",l),children:!d&&e?c.jsx(Fe,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Fo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:H("logo",e,t,n),...r,children:c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let ca=!1;const uf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ae.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:H("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},v)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ca&&(clearTimeout(ca),ca=!1)},onBlur:()=>{ca=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Fe,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${v}`)})})]})})},bv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const yv=y.lazy(()=>Promise.resolve().then(()=>hp)),xv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],lf=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(at),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[xv.map(({key:i,href:s})=>{const o=bv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:H(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(yv,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},wr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Cv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${wr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${wr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${wr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
64
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await fd({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},wo=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),$g=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const m=ae.useIntl(),[h,p]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:b,error:g,fetchNextPage:C,hasNextPage:D,isLoading:F,mutations:{create:E,edit:_,remove:T,like:I,unlike:P,pin:z,unpin:$}}=Sg({queryKey:[e,t,"activities",h],queryFns:i,filterOption:h[0]});y.useEffect(()=>{a&&f(v.concat(a==null?void 0:a.map(({slug:j,name:U})=>({id:j,text:U,type:"category"}))))},[a]);const[B,A]=y.useState(null),O=()=>{A(b.length),C()};return Jd(),g?c.jsx(Cn,{variant:"error",text:g.message}):c.jsxs("section",{children:[c.jsx(ru,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:E,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:m.formatMessage({id:"community_joinToPost"})}}),c.jsx(of,{className:"activities-feed-filtering",options:v.map(({id:j,text:U})=>({id:j,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),defaultOptions:h.map(({id:j,text:U})=>({id:j,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${U}`,defaultMessage:U})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:j,previous:U})=>{if(j[0]===U[0])return;p([v.find(ne=>ne.id===j[0])]);const W=v.find(ne=>ne.id===j[0]);if(!W)return;const re=new CustomEvent("ariaLive",{detail:{message:m.formatMessage({id:"community_sortSuccess"},{order:m.formatMessage({id:`activitiesFeed_rankingMethod_${W.text}`,defaultMessage:W.text})})}});document.dispatchEvent(re)}}),b==null?void 0:b.map((j,U)=>{var G,K,te;const{id:W,own_reactions:re,latest_reactions:ne,reaction_counts:w,mentioned_users:Q,total_replies:se,additional_data:k}=j,M=(((G=ne==null?void 0:ne.like)==null?void 0:G.length)||0)>0,q=(((K=re==null?void 0:re.like)==null?void 0:K.length)||0)>0,S=q?re==null?void 0:re.like[0].id:"",L=M?(te=ne==null?void 0:ne.like)==null?void 0:te.map(ce=>{var J,he,pe;return{id:(J=ce==null?void 0:ce.user)==null?void 0:J.id,name:(pe=(he=ce==null?void 0:ce.user)==null?void 0:he.data)==null?void 0:pe.name}}):!1;return(j==null?void 0:j.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(na,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:vr(j==null?void 0:j.actor),userLiked:q,likes:(w==null?void 0:w.like)||0,comments:se||0,peopleWhoLiked:L,data:{mentions:Q,...k||{}},pinned:(w==null?void 0:w.pin)&&(w==null?void 0:w.pin)>0||!1,categories:wo((j==null?void 0:j.categories)||[],a||[])},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>T({activityId:W}),updateContent:(ce,{body:J})=>_({activityId:W,content:J})},likes:{createLike:()=>I({activityId:W}),deleteLike:()=>P({activityId:W,reactionId:S}),listLikes:ce=>u.list({activityId:W,...ce})},comments:{openComments:()=>null},pins:{createPin:()=>z({activityId:W}),deletePin:()=>$({activityId:W,reactionId:ne==null?void 0:ne.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:U===B,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t})},W)}),!F&&c.jsx(Xr,{hasNextPage:D,loadNextPage:O,icon:{icon:"arrow-down",position:"right"},messages:{button:m.formatMessage({id:"loadMore_button"}),error:m.formatMessage({id:"loadMore_error"})}}),b.length===0&&!F&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:h[0].type==="category"?c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ee,{variant:"secondary",size:"small",href:"/communities",children:m.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(au,{form:d})]})},Lg={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function zg({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ae.useIntl();return c.jsx(ru,{form:{content:{type:Ae.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function qg({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ae.useIntl(),i=()=>{n(r),t()};return c.jsx(Xr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function Ug({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Lu({reply:gg(o),user:i});return Za(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Lu({reply:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Qd(d.id,"reply")},0)}});return s}function Wg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Vg({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,g,C;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,h=d?(g=r==null?void 0:r.like)==null?void 0:g.find(D=>{var F;return((F=D==null?void 0:D.user)==null?void 0:F.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",v=m?(C=a==null?void 0:a.like)==null?void 0:C.map(D=>{var F,E,_;return{id:(F=D==null?void 0:D.user)==null?void 0:F.id,name:(_=(E=D==null?void 0:D.user)==null?void 0:E.data)==null?void 0:_.name}}):!1;return{user:u==null?void 0:u.user,body:Kg(s),createdAt:o,data:Hg(s),likeId:p,liked:m,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!h}})}function Hg(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function Kg(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function ef({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:bo(u),mutate:yo(u)},user:l,...u},m=Ug({...d,mutationFn:e}),h=Wg({...d,mutationFn:t}),p=Zg({...d,mutationFn:n}),v=Gg({...d,mutationFn:a}),f=Qg({...d,mutationFn:i}),{replies:b,...g}=Yg({queryKey:s,queryFn:r});return{replies:Vg({replies:b,user:l}),mutations:{create:m,edit:h,remove:v,like:p,unlike:f},user:l,...g}}function Zg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=qt(s,o);return l&&zu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=qt(o,l);u&&zu({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Yg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:xo(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Gg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Gd(a,i)),onError:n});return r}function Qg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=qt(i,s);return o&&vg({reply:o,user:r}),s}),onError:n});return a}const Jg=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:v,edit:f,like:b,remove:g,unlike:C}}=ef({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:a})}});ao([p]);const[D,F]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${D?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!D),children:l.formatMessage({id:`discussion_thread_${D?"hide":"show"}`},{count:d==null?void 0:d.length})}),D&&c.jsx(th,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},form:{parentId:r,content:{type:Ae.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(E,{body:_})=>v({activityId:e,replyId:a,content:_}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:E,likes:_,data:T,body:I,createdAt:P,userLiked:z,peopleWhoLiked:$,parent:B,user:A,likeId:O})=>c.jsx(na,{isCommunity:!0,content:{id:E,type:Ae.Reply,body:I,canLike:n,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:vr(A),userLiked:z,likes:_,peopleWhoLiked:$,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:E}),updateContent:(j,{body:U})=>f({replyId:E,content:U})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>C({replyId:E,reactionId:O}),listLikes:j=>o.list({replyId:E,...j})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:r||""},{scope:ct.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function Xg({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:m,peopleWhoLiked:h,replyId:p,createdAt:v,user:f}=s,{edit:b,like:g,remove:C,unlike:D}=e.mutations;return c.jsx(Jm,{children:c.jsx(na,{isCommunity:!0,content:{id:p,type:Ae.Reply,body:o,canLike:a,createdAt:v,slugs:{question:`${n}/${i}`,answer:t,reply:p},slug:p,author:vr(f),userLiked:d,likes:m,peopleWhoLiked:h,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>C({replyId:p}),updateContent:(F,{body:E})=>b({replyId:p,content:E})},likes:{createLike:()=>g({replyId:p}),deleteLike:()=>D({replyId:p,reactionId:u}),listLikes:F=>e.likes.list({replyId:p,...F})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:i||""},{scope:ct.Platform,area:"all"}]},children:c.jsx(Jg,{basePath:n,parentId:i,activityId:t,replyId:p,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},p)},p)}const tf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:C,like:D,unlike:F}}=ef({queryKey:[t,n,e,"replies"],queryFns:u}),[E,_]=y.useState(null);ao([v]),Jd();const T={create:(I,P)=>{const{body:z}=P;b({activityId:e,content:z})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(eh,{type:"comment",responses:r,isLoading:v}),m?c.jsxs(c.Fragment,{children:[c.jsx(zg,{parentId:n,isMember:a,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map((I,P)=>c.jsx(Xg,{activityId:e,basePath:t,focus:E===P,formFns:{form:i,likes:l,reactions:u,mutations:{remove:g,edit:C,like:D,unlike:F}},isMember:a,parentId:n,reply:I},I.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(qg,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:_,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(au,{form:d})]})};function ev({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=xo(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function tv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=ev({queryKey:t,queryFn:e});return{likes:n,...r}}function nf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=tv({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?vr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Qm,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const rf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ae.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:V("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(nf,{...i,likeCount:r??0,functions:{likes:n}})})},nv=Object.freeze(Object.defineProperty({__proto__:null,default:rf},Symbol.toStringTag,{value:"Module"})),rv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const av=3e3,af=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(qr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},av)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(Ln,{className:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const Vn="discussion_",sf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Vn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Vn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Vn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:V("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Xd,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(qr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Vn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${Vn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(qr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Vn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(af,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(uf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const iv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Pe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(xn,{href:s?void 0:i,...l,children:sr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Eo=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:V("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:m=>{if(m.preventDefault(),m.stopPropagation(),i){i(m);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const of=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(v=>v.id):[]),[m,h]=y.useState(0),p=(v,f)=>{let b=[];u.includes(v)&&!i?b=u.filter(g=>g!==v):v==="all"?b=["all"]:r?b=[...u.filter(g=>g!=="all"),v]:b=[v],d(g=>(a&&typeof a=="function"&&a({current:b,previous:g}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:V("filters",s),children:l.map(({id:v,text:f,disabled:b=!1,callback:g=()=>{}},C)=>{let D={tabIndex:m===C?0:-1};return b&&(D={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:V(v,{selected:u.includes(v)}),onClick:F=>{F.preventDefault(),F.stopPropagation(),p(v,g)},onKeyDown:F=>{var I,P;let E=C+1,_,T;switch(F.code){case"Enter":case"Space":F.preventDefault(),F.stopPropagation(),p(v,g);break;case"ArrowLeft":case"ArrowRight":F.preventDefault(),F.stopPropagation(),F.code==="ArrowLeft"?(E=C-1,E<0&&(E=l.length-1)):E>=l.length&&(E=0),h(E),_=F.currentTarget.closest("li"),T=(I=_==null?void 0:_.parentElement)==null?void 0:I.children[E],(P=T==null?void 0:T.querySelector("button"))==null||P.focus();break}},"aria-selected":u.includes(v),...D,children:f})},v)})})},sv=(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 la="languageSwitcher_",ov=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(lo),[m,h]=y.useState(e);if(y.useEffect(()=>{e!==m&&h(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=m!==e;return c.jsxs("div",{className:V("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${la}label`})}),c.jsx("ul",{children:v.map(b=>{var D;if(!Ba[b])return null;const g=(D=r[b])==null?void 0:D.post_name;let C={className:b};if(m===b)C["aria-label"]=u.formatMessage({id:`${la}selected`},{language:Ba[b]});else{const F=sv(b,g,i);C={...C,href:typeof F=="string"?F:F.url,onClick:E=>{h(b),d(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof F=="string"?F:F.urlForRouter))}}}return c.jsx("li",{children:c.jsx(xn,{...C,fallbackElement:"span",children:Ba[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${la}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${la}disclaimer`},{email:Qn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const Ii=ae.createIntl({locale:"en",messages:hr}),Xr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ii.formatMessage({id:"loadMore_button"}),endOfFeed:Ii.formatMessage({id:"loadMore_endOfFeed"}),error:Ii.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),h=async p=>{if(!n)try{await t(p)}catch(v){v instanceof Error?m(v.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:V("load-more",l),children:!d&&e?c.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:h,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const _o=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let ca=!1;const uf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ae.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:m,icon:h,...p},v)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ca&&(clearTimeout(ca),ca=!1)},onBlur:()=>{ca=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${v}`)})})]})})},uv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const lv=y.lazy(()=>Promise.resolve().then(()=>fp)),cv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],lf=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(it),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[cv.map(({key:i,href:s})=>{const o=uv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(lv,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},Er=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,dv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Er(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(`${Er(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(`${Er(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${wr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:wr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const wv="shareLinks_",Dv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ae.useIntl(),l=Cv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:H("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const v={};return m&&(v.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(Fe,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${wv}link_${u}`}),...v})},u)})})]})};const Ev=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),a=Nn(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){i=g;break}}}const[s,o]=y.useState((v=e[i])!=null&&v.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const w=r(e[g].id,e[g].text,g),E=document.getElementById(`tab-${w}`);E==null||E.focus(),u(w);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:g,href:w,hasCarousel:E,breakpoint:B},D)=>{if(B&&!h(B))return;f=r(f,b,D);const k=s===f,T={};w||(T["aria-controls"]=f,T.onClick=$=>{$.preventDefault(),$.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:w||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:H({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:$=>d($,D),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:H("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const _v={"2-1":901,"1-3":769,"1-1":769},cf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Nn(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:H("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<_v[e]?null:o)})};const Ao=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ae.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:H("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Pe,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},hi=e=>(e==null?void 0:e.toString().length)||0,df=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{hi(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const da="emailHelperTextBox_",ff=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ae.useIntl(),[s,o]=y.useState({path:`${da}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${da}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${da}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let v=da,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>d(w),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:f,link:b,mail:g})},[t]);const h={};return["link","mail"].forEach(v=>{h[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(bd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Mt,{element:"span"}),c.jsx(Mt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Yn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,...h})=>{const p=y.useRef(),m=r||p;return y.useEffect(()=>{var v;u&&((v=m.current)==null||v.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:m,...h,type:o,id:n,name:i,className:H(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:v=>{const f=v.target;a.onChange(f.value)}})};const Un={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},kv=500,Fv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const B=setTimeout(()=>{v||h(D=>({...D,debouncedInput:l}))},kv);return()=>{clearTimeout(B)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const D=await o(d)||[];f(k=>({...k,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(k=>({...k,predictions:[]}))}})():f(B=>({...B,predictions:[]}))},[d,v]),y.useEffect(()=>{m>=0&&p[m]&&h(B=>({...B,displayInput:p[m].description}))},[m,p]);const g=B=>{[Un.DOWN,Un.UP,Un.ENTER].includes(B.key)&&(B.preventDefault(),B.key===Un.DOWN&&m<p.length-1?f(D=>({...D,activePredictionIndex:m+1})):B.key===Un.UP&&m>0?f(D=>({...D,activePredictionIndex:m-1})):B.key===Un.ENTER&&m>-1&&(s(p[m].description),h(D=>({...D,input:p[m].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},w=B=>{s(B.target.value),h(D=>({...D,input:B.target.value,displayInput:B.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},E=B=>{s(B.description),h(D=>({...D,input:B.description,displayInput:B.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:g,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((B,D)=>c.jsx("li",{onClick:()=>E(B),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:D})),className:H("predictions-list-item",{active:D===m}),children:B.description},D))})]})};const hf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...p})=>{const m=ae.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:w=>{(w.key==="Enter"||w.code==="Space")&&(w.preventDefault(),w.stopPropagation(),b())},tabIndex:d||!h?0:-1,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:w=>{const E=w.target;E.nodeName.toLowerCase()==="a"||E.parentNode&&E.parentNode.nodeName.toLowerCase()==="a"||(w.preventDefault(),w.stopPropagation(),b())},onKeyDown:h?w=>{var E,B,D;if(w.key!=="Tab")switch(w.code){case"Enter":case"Space":w.stopPropagation(),w.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":w.stopPropagation(),w.preventDefault();const k=w.currentTarget;let T=k==null?void 0:k.nextElementSibling;if(w.key==="ArrowLeft"){const $=k==null?void 0:k.previousElementSibling;$?T=$:T=(E=k==null?void 0:k.parentElement)==null?void 0:E.lastElementChild}else T||(T=(B=k==null?void 0:k.parentElement)==null?void 0:B.firstElementChild);T&&((D=T==null?void 0:T.querySelector("label"))==null||D.focus());break}}:void 0,className:H(a,"checkbox-wrapper",e,{"is-checked":d}),...p,...f},g)};const Av=y.memo(function({direction:t="down"}){return c.jsx(si,{className:H("rotating-chevron",`direction-${t}`)})});const Bv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ae.useIntl(),[h,p]=y.useState(!1),m=r||n,v=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:w,onMultiSelectSubmit:E,...B}=a,D=T=>{if(o){let $=[];f!=null&&f.includes(T.id)?$=f.filter(P=>P!==T.id):$=[...f,T.id],b([...$]),w&&w([...$])}else b([T]),w&&w(T.id),p(!1)},k=T=>{if(T==="all"){const $=(t==null?void 0:t.map(P=>P.id))||[];b($),w&&w($)}else b([]),w&&w([])};return c.jsxs("div",{className:H("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...B,children:[o?`${s} · ${f.length}`:g.label,c.jsx(Av,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const $=t&&t.find(P=>P.id===T.target.value);D($)},hidden:!h,...B,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Fe,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Fe,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const $=T.id===g.id||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:H("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,onClick:P=>{P.preventDefault(),P.stopPropagation(),D(T)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:H({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Fe,{variant:"secondary",onClick:()=>{E&&E(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Ar=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};const Tv=({id:e,label:t,limit:n,value:r,placeholder:a,functions:i,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...h})=>{const p=ae.useIntl(),[m,v]=y.useState(r?Array.isArray(r)?r:[r]:[""]),f=m.filter(k=>k!=="");y.useEffect(()=>{if(!u)return;const k=Rt(u.fields).filter(({id:$,name:P})=>($||($=P||""),$!==e&&!$.includes(`${e}-`))),T=[];m.map(($,P)=>{if(w&&P>=w)return;const z=Rt(l);z&&e&&(z.forEach(R=>{const{condition:A,error:F}=R;if(typeof A=="function")R.condition=O=>{var W;let M=(W=O==null?void 0:O[e])==null?void 0:W[P];M||(O[e]&&!Array.isArray(O[e])?M=O[e]:M="");const U=Rt(O);return U[e]=M,typeof A=="function"&&A(U)?F:!1};else{const O=A;R.condition=M=>{var W;let U=(W=M==null?void 0:M[e])==null?void 0:W[P];switch(U||(M[e]&&!Array.isArray(M[e])?U=M[e]:U=""),O){case"required":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_required"}));break;case"no-numbers":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_numbers"}));break;case"valid-email":F||(R.error=F||(p==null?void 0:p.formatMessage({id:"form_error_email"})));break;case"valid-url":F||(R.error=p==null?void 0:p.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Ar(O,U)?R.error:!1}}}),T.push({id:`${e}-${P}`,validation:z,value:$}))}),u.setFields(k.concat(T))},[m.length]);const{showCount:b=!1,label:g,maxInputs:w=100,hasButton:E=!1}=o||{},B=()=>{(!w||m.length<w)&&v([...m,""])},D=(k,T)=>k.replace("{number}",T+1);return c.jsxs("fieldset",{className:H("multiple-inputs field-wrapper",{"has-button":E,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",children:[t,b?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":p.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:f.length,total:w}),children:p.formatMessage({id:"form_multipleInputs_filledInCount"},{number:f.length,total:w})})]}):""]}):c.jsx(c.Fragment,{}),m.map((k,T)=>{if(w&&T>=w)return c.jsx(c.Fragment,{});let $=!1;t?$=c.jsx(Pe,{showOnFocus:!1,children:p.formatMessage({id:"form_multipleInputs_label"},{number:T+1})}):g&&($=D(g,T));const P=`${e}-${T}`;return c.jsx(mf,{id:P,type:"text",label:$,value:k,placeholder:a?D(a,T):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[P]:void 0,functions:{onFocus:()=>{E||T!==m.length-1||B()},onChange:z=>{const R=Rt(m);R[T]=z,v(R),u==null||u.dispatch({type:"removeError",payload:{key:P}}),i==null||i.onChange(R)}},...h},P)}),E?c.jsx(Fe,{...E,onClick:B,disabled:!!(w&&w<=m.length)}):c.jsx(c.Fragment,{})]})};const Vu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:h,styling:{displayOptionsAsPills:p=!1}={},...m})=>{const v=ae.useIntl(),f=i?d:[],b=d;return c.jsx("ul",{...m,className:H("options-wrapper",e,{"with-pills filters":p}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:w=!1,value:E=g,disabled:B=!1})=>{const D=`${r}_${g}`,k=()=>{if(B)return;let T;if(i){const $=f==null?void 0:f.indexOf(E);Array.isArray(f)&&$>=0?(T=f,T.splice($,1)):(!f||f.length===0?T=[]:T=f,T.push(E))}else T=b===E?void 0:E;t.onChange(T)};return c.jsx(hf,{element:"li",id:D,type:u==="checkboxes"?"checkbox":"radio",shownValue:E,value:i?f==null?void 0:f.includes(E):b===E,functions:{...t,onChange:k},intlPath:n,label:w||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:B,accessibilityOptions:h},D)})})};const Sv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:H("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Yn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Wn={text:{component:Yn},email:{component:Yn},url:{component:Yn},textarea:{component:Yn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:hf},checkboxes:{component:Vu,props:{multiSelect:!0}},radio:{component:Vu,props:{multiSelect:!1}},select:{component:Bv},password:{component:Sv},autocomplete:{component:Fv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},mf=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:a="",error:i,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:h,submitOnEnter:p,fieldData:m,...v}=e;if(u&&u==="multiple-inputs")return c.jsx(Tv,{...e});const f=d&&d.some(({condition:F})=>F==="required"),b=hi(h),g=u&&Wn[u]&&Wn[u].component?Wn[u].component:Yn,w=u&&["checkboxes","radio"].includes(u),E=u&&["autocomplete"].includes(u),B=i&&`error-${n}`,D=`character-limit-${n}`,k={};w?k.element="legend":k.htmlFor=n;let T={...v,id:n,name:n,className:i?"error":"",type:u,required:f,"aria-required":f,functions:Rt(s),value:h};const $=F=>{T["aria-describedby"]?T["aria-describedby"]+=` ${F}`:T["aria-describedby"]=F};if(o>0){const F=df(o,s);$(`${D}-info`),T={...T,...F},F.functions&&typeof F.functions=="object"&&(T.functions={...T.functions,...F.functions})}u&&Wn[u]&&Wn[u].props&&(T={...T,...Wn[u].props}),w&&(T.intlPath=`${r}_${n}`),i&&(T["aria-invalid"]=!0,T["aria-errormessage"]=B,$(B));const P=v.label||t.formatMessage({id:r?`${r}_${n}`:n}),z=({...F})=>i?y.createElement(F.as||"p",{id:B,className:"error text-small",...F},i):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(g,{...T,label:P,className:H("field-wrapper",a)}),c.jsx(z,{as:"p"})]});const R={};w?k.className="legend-as-label text-small":R.className="field-label";const A=({element:F,...O})=>y.createElement(F||"label",{...O,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(w?"fieldset":"div",{className:H("field-wrapper text-medium",a)},c.jsxs(c.Fragment,{children:[v.label===!1?c.jsx(c.Fragment,{}):y.createElement(w?y.Fragment:"p",R,c.jsxs(A,{...k,children:[P,f&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(w||E?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(g,{...T}),c.jsx(Ao,{id:D,limit:o,valueLength:b})]})),c.jsx(z,{})]}))})},jv=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?Rt(e.errors):{},i=e.values?Rt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,h=Rt(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:v="required",error:f=!1}=p.validation[m];let b=!1;if(typeof v=="function"){const g=v(i);g&&(b=f||g)}else{const g=i[p.id],w=v;switch(w){case"required":Ar(w,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Ar(w,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Ar(w,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Ar(w,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let zi=null;const Qt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const[m,v]=y.useState(t);y.useEffect(()=>{v(t)},[t]);const{customOnSubmit:f,hideButton:b,...g}=s,w=40,{shouldShowCancelButton:E=!1,shouldReset:B=!0,shouldHide:D=!0,showRequiredLabels:k=!0,showSuccessMessage:T=!1}=l||{},{onSuccess:$=async()=>{},onCancel:P=()=>{},onCatch:z=()=>{},onFailure:R=()=>{}}=h||{},A=ae.useIntl(),F={};t.length&&t.forEach(j=>{const L=j.id||j.name;L&&(F[L]=j.value||"")});const[O,M]=y.useReducer(jv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:F}),{errors:U,isSubmitting:W,formSubmitted:ie,values:se}=O;y.useEffect(()=>{B&&ie&&(zi=setTimeout(()=>{M({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[ie]),y.useEffect(()=>()=>{zi&&clearTimeout(zi)},[]),y.useEffect(()=>{const j=L=>{M({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",j),()=>{document.removeEventListener("dropdownMultiSelectSubmit",j)}},[]);const C=y.useRef(null),G=a||C;if(!t.length)return null;const ne={};s.children&&(ne.default=s.children),g.text&&typeof g.text=="string"&&(ne.default=g.text),["default","submitting","submitted"].forEach(j=>{g.text&&typeof g.text!="string"&&j in g.text?ne[j]=g.text[j]:ne[j]||(ne[j]=A.formatMessage({id:`form_${j==="default"?"submit":j}`}))}),delete g.text;const _=()=>{if(!W){if(M({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&M({type:"submitForm",payload:{fields:m,dispatch:M,intl:A}});return}M({type:"submitForm",payload:{fields:m,dispatch:M,onSuccess:async j=>{try{await $(j),M({type:B?"formSubmittedAndReset":"formSubmitted"})}catch(L){z(L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(j,L)=>{R(j,L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:A}})}},S=j=>{var Z;if(j.preventDefault(),j.stopPropagation(),W)return;let L=0;if((Z=G==null?void 0:G.current)!=null&&Z.id){const X=document.getElementById(G.current.id);X&&(L=X.getBoundingClientRect().top+window.scrollY)}const Q=document.getElementById("header");Q&&(L=L-Q.offsetHeight-w),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),_()},q=[{...g,icon:ie?{icon:"tick",position:"left"}:!1,className:H("gtm-trackable",g.className),onClick:S,disabled:W||ie||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:ne[W?"submitting":ie?"submitted":"default"]}];return E&&q.unshift({...o,className:H("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:W||ie,onClick:P,children:o.text||A.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:H("form",n),ref:G},c.jsxs(c.Fragment,{children:[U!=null&&U.general?c.jsx(yn,{variant:"error",text:A.formatMessage({id:"form_error_generalError"})}):null,u,(!D||!W&&!ie||f)&&t.map((j,L)=>{const{id:Q=j.name||L,component:Z,functions:X={onChange:()=>{}},submitOnEnter:le=!1}=j;if(Z)return c.jsx(Z,{...j.props||{}},`component-${Q}-${L}`);const te=(se==null?void 0:se[Q])||"",pe={...X,onChange:fe=>{M({type:"updateValue",payload:{key:Q,value:fe}}),X.onChange(fe&&fe.toString(),M)}};return le&&(pe.onKeyDown=fe=>{fe.key==="Enter"&&(fe.stopPropagation(),fe.preventDefault(),_()),X.onKeyDown&&X.onKeyDown(fe)}),c.jsx(mf,{intlPath:i,...j,showRequiredLabels:k,value:te,error:j.type==="multiple-inputs"?U:U==null?void 0:U[Q],functions:pe,fieldData:{fields:m,setFields:v,dispatch:M}},Q)}),b?null:(W||ie)&&f?f:c.jsx(fr,{className:H("cta",{center:W||ie,submitted:ie}),buttons:q})]})),T&&ie&&c.jsx(ir,{className:"success",children:typeof T=="string"?T:A.formatMessage({id:"form_success"})})]})};const fa="passwordRules_",pf="isMoreThanEightCharacters",gf="includesNumberAndSymbol",vf="includesLowerAndUppercase",Ov={[pf]:"8Characters",[gf]:"numberSymbol",[vf]:"lowercaseUppercase"},Pv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:H("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${fa}intro`})}),c.jsx("ul",{children:[pf,gf,vf].map(r=>c.jsxs("li",{className:H({matches:e[r]}),children:[c.jsxs(Pe,{children:[n.formatMessage({id:`${fa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${fa}rule_${Ov[r]}`})}),!e[r]&&c.jsxs(Pe,{element:"strong",children:[" ",n.formatMessage({id:`${fa}notMet`})]})]},`rule-${r}`))})]})},bf=y.memo(Pv);const Mv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(w=>({...w,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(w=>({...w,setUp:!0,disabled:!0})),a(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Mt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!h||m))try{u(w=>({...w,rating:g,disabled:!0})),await r({id:h,value:g})}catch(w){u(E=>({...E,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return c.jsxs("div",{className:H("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const w=g+1;return c.jsx("li",{className:H({selected:p&&w<=p}),children:c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:E=>{E.preventDefault(),E.stopPropagation(),b(w)},disabled:m})},`rating-${w}`)})})]})},Nv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},un=y.createContext(Nv);var K=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(K||{}),Ht=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ht||{});const Iv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case K.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case K.link:return c.jsx("a",{...e,children:t});case K.li:return c.jsx("li",{...e,children:t});case K.mention:const a=r;return a!=null&&a.name&&a.name===Rr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case K.ol:return c.jsx("ol",{...e,children:t});case K.ul:return c.jsx("ul",{...e,children:t});case K.span:return c.jsx("span",{...e,children:t});case K.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Rv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[K.bold]&&(t=c.jsx("strong",{children:t})),r[K.italic]&&(t=c.jsx("em",{children:t})),r[K.strikethrough]&&(t=c.jsx("s",{children:t})),r[K.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var $v=qv,yf="֑-߿יִ-﷽ﹰ-ﻼ",xf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Lv=new RegExp("^[^"+xf+"]*["+yf+"]"),zv=new RegExp("^[^"+yf+"]*["+xf+"]");function qv(e){return e=String(e||""),Lv.test(e)?"rtl":zv.test(e)?"ltr":"neutral"}const Cf=Mn($v);function Uv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Bo=Uv,Wv=typeof ra=="object"&&ra&&ra.Object===Object&&ra,Vv=Wv,Hv=Vv,Kv=typeof self=="object"&&self&&self.Object===Object&&self,Zv=Hv||Kv||Function("return this")(),wf=Zv,Yv=wf,Gv=function(){return Yv.Date.now()},Qv=Gv,Jv=/\s/;function Xv(e){for(var t=e.length;t--&&Jv.test(e.charAt(t)););return t}var eb=Xv,tb=eb,nb=/^\s+/;function rb(e){return e&&e.slice(0,tb(e)+1).replace(nb,"")}var ab=rb,ib=wf,sb=ib.Symbol,Df=sb,Hu=Df,Ef=Object.prototype,ob=Ef.hasOwnProperty,ub=Ef.toString,Dr=Hu?Hu.toStringTag:void 0;function lb(e){var t=ob.call(e,Dr),n=e[Dr];try{e[Dr]=void 0;var r=!0}catch{}var a=ub.call(e);return r&&(t?e[Dr]=n:delete e[Dr]),a}var cb=lb,db=Object.prototype,fb=db.toString;function hb(e){return fb.call(e)}var mb=hb,Ku=Df,pb=cb,gb=mb,vb="[object Null]",bb="[object Undefined]",Zu=Ku?Ku.toStringTag:void 0;function yb(e){return e==null?e===void 0?bb:vb:Zu&&Zu in Object(e)?pb(e):gb(e)}var xb=yb;function Cb(e){return e!=null&&typeof e=="object"}var wb=Cb,Db=xb,Eb=wb,_b="[object Symbol]";function kb(e){return typeof e=="symbol"||Eb(e)&&Db(e)==_b}var Fb=kb,Ab=ab,Yu=Bo,Bb=Fb,Gu=0/0,Tb=/^[-+]0x[0-9a-f]+$/i,Sb=/^0b[01]+$/i,jb=/^0o[0-7]+$/i,Ob=parseInt;function Pb(e){if(typeof e=="number")return e;if(Bb(e))return Gu;if(Yu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Yu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ab(e);var n=Sb.test(e);return n||jb.test(e)?Ob(e.slice(2),n?2:8):Tb.test(e)?Gu:+e}var Mb=Pb,Nb=Bo,qi=Qv,Qu=Mb,Ib="Expected a function",Rb=Math.max,$b=Math.min;function Lb(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Ib);t=Qu(t)||0,Nb(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Rb(Qu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(k){var T=r,$=a;return r=a=void 0,u=k,s=e.apply($,T),s}function v(k){return u=k,o=setTimeout(g,t),d?m(k):s}function f(k){var T=k-l,$=k-u,P=t-T;return h?$b(P,i-$):P}function b(k){var T=k-l,$=k-u;return l===void 0||T>=t||T<0||h&&$>=i}function g(){var k=qi();if(b(k))return w(k);o=setTimeout(g,f(k))}function w(k){return o=void 0,p&&r?m(k):(r=a=void 0,s)}function E(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function B(){return o===void 0?s:w(qi())}function D(){var k=qi(),T=b(k);if(r=arguments,a=this,l=k,T){if(o===void 0)return v(l);if(h)return clearTimeout(o),o=setTimeout(g,t),m(l)}return o===void 0&&(o=setTimeout(g,t)),s}return D.cancel=E,D.flush=B,D}var _f=Lb;const zb=Mn(_f);var qb=_f,Ub=Bo,Wb="Expected a function";function Vb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Wb);return Ub(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),qb(e,t,{leading:r,maxWait:t,trailing:a})}var Hb=Vb;const Kb=Mn(Hb),Ju=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Xu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ui=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Xu(n.overflowY,t)||Xu(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},ha=(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,Zb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},el=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:U=>U!==u;if(!Ju(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let v=e;for(;Ju(v)&&h(v);){if(v=Zb(v),v===p){m.push(v);break}v!=null&&v===document.body&&Ui(v)&&!Ui(document.documentElement)||v!=null&&Ui(v,d)&&m.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:g,scrollY:w}=window,{height:E,width:B,top:D,right:k,bottom:T,left:$}=e.getBoundingClientRect(),{top:P,right:z,bottom:R,left:A}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?D-P:o==="end"?T+R:D+E/2-P+R,O=l==="center"?$+B/2-A+z:l==="end"?k+z:$-A;const M=[];for(let U=0;U<m.length;U++){const W=m[U],{height:ie,width:se,top:C,right:G,bottom:ne,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&D>=0&&$>=0&&T<=b&&k<=f&&D>=C&&T<=ne&&$>=_&&k<=G)return M;const S=getComputedStyle(W),q=parseInt(S.borderLeftWidth,10),j=parseInt(S.borderTopWidth,10),L=parseInt(S.borderRightWidth,10),Q=parseInt(S.borderBottomWidth,10);let Z=0,X=0;const le="offsetWidth"in W?W.offsetWidth-W.clientWidth-q-L:0,te="offsetHeight"in W?W.offsetHeight-W.clientHeight-j-Q:0,pe="offsetWidth"in W?W.offsetWidth===0?0:se/W.offsetWidth:0,fe="offsetHeight"in W?W.offsetHeight===0?0:ie/W.offsetHeight:0;if(p===W)Z=o==="start"?F:o==="end"?F-b:o==="nearest"?ha(w,w+b,b,j,Q,w+F,w+F+E,E):F-b/2,X=l==="start"?O:l==="center"?O-f/2:l==="end"?O-f:ha(g,g+f,f,q,L,g+O,g+O+B,B),Z=Math.max(0,Z+w),X=Math.max(0,X+g);else{Z=o==="start"?F-C-j:o==="end"?F-ne+Q+te:o==="nearest"?ha(C,ne,ie,j,Q+te,F,F+E,E):F-(C+ie/2)+te/2,X=l==="start"?O-_-q:l==="center"?O-(_+se/2)+le/2:l==="end"?O-G+L+le:ha(_,G,se,q,L+le,O,O+B,B);const{scrollLeft:Ae,scrollTop:ye}=W;Z=fe===0?0:Math.max(0,Math.min(ye+Z/fe,W.scrollHeight-ie/fe+te)),X=pe===0?0:Math.max(0,Math.min(Ae+X/pe,W.scrollWidth-se/pe+le)),F+=ye-Z,O+=Ae-X}M.push({el:W,top:Z,left:X})}return M},Yb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Gb(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(el(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of el(e,Yb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${Er(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Er(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const fv="shareLinks_",mv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ae.useIntl(),l=dv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const v={};return p&&(v.onClick=f=>p(f,m)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${fv}link_${u}`}),...v})},u)})})]})};const hv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),a=$n(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){i=g;break}}}const[s,o]=y.useState((v=e[i])!=null&&v.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const C=r(e[g].id,e[g].text,g),D=document.getElementById(`tab-${C}`);D==null||D.focus(),u(C);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:g,href:C,hasCarousel:D,breakpoint:F},E)=>{if(F&&!m(F))return;f=r(f,b,E);const _=s===f,T={};C||(T["aria-controls"]=f,T.onClick=I=>{I.preventDefault(),I.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:C||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:I=>d(I,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:V("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const pv={"2-1":901,"1-3":769,"1-1":769},cf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=$n(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<pv[e]?null:o)})};const ko=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ae.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:V("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Pe,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},mi=e=>(e==null?void 0:e.toString().length)||0,df=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{mi(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const da="emailHelperTextBox_",ff=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ae.useIntl(),[s,o]=y.useState({path:`${da}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${da}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${da}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let v=da,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:C=>d(C),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:f,link:b,mail:g})},[t]);const m={};return["link","mail"].forEach(v=>{m[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(vd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,...m})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var v;u&&((v=p.current)==null||v.focus())},[]),!(m!=null&&m.autoComplete)&&["email"].includes(o)&&(m.autoComplete="email"),y.createElement(t,{ref:p,...m,type:o,id:n,name:i,className:V(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:v=>{const f=v.target;a.onChange(f.value)}})};const Hn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},gv=500,vv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const F=setTimeout(()=>{v||m(E=>({...E,debouncedInput:l}))},gv);return()=>{clearTimeout(F)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];f(_=>({..._,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(_=>({..._,predictions:[]}))}})():f(F=>({...F,predictions:[]}))},[d,v]),y.useEffect(()=>{p>=0&&h[p]&&m(F=>({...F,displayInput:h[p].description}))},[p,h]);const g=F=>{[Hn.DOWN,Hn.UP,Hn.ENTER].includes(F.key)&&(F.preventDefault(),F.key===Hn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):F.key===Hn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):F.key===Hn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},C=F=>{s(F.target.value),m(E=>({...E,input:F.target.value,displayInput:F.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},D=F=>{s(F.description),m(E=>({...E,input:F.description,displayInput:F.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:C,onKeyDown:g,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:h.map((F,E)=>c.jsx("li",{onClick:()=>D(F),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:E})),className:V("predictions-list-item",{active:E===p}),children:F.description},E))})]})};const mf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:m=!1}={}}={},...h})=>{const p=ae.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:C=>{(C.key==="Enter"||C.code==="Space")&&(C.preventDefault(),C.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:C=>{const D=C.target;D.nodeName.toLowerCase()==="a"||D.parentNode&&D.parentNode.nodeName.toLowerCase()==="a"||(C.preventDefault(),C.stopPropagation(),b())},onKeyDown:m?C=>{var D,F,E;if(C.key!=="Tab")switch(C.code){case"Enter":case"Space":C.stopPropagation(),C.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":C.stopPropagation(),C.preventDefault();const _=C.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(C.key==="ArrowLeft"){const I=_==null?void 0:_.previousElementSibling;I?T=I:T=(D=_==null?void 0:_.parentElement)==null?void 0:D.lastElementChild}else T||(T=(F=_==null?void 0:_.parentElement)==null?void 0:F.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:V(a,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},g)};const bv=y.memo(function({direction:t="down"}){return c.jsx(oi,{className:V("rotating-chevron",`direction-${t}`)})});const yv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ae.useIntl(),[m,h]=y.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:C,onMultiSelectSubmit:D,...F}=a,E=T=>{if(o){let I=[];f!=null&&f.includes(T.id)?I=f.filter(P=>P!==T.id):I=[...f,T.id],b([...I]),C&&C([...I])}else b([T]),C&&C(T.id),h(!1)},_=T=>{if(T==="all"){const I=(t==null?void 0:t.map(P=>P.id))||[];b(I),C&&C(I)}else b([]),C&&C([])};return c.jsxs("div",{className:V("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...F,children:[o?`${s} · ${f.length}`:g.label,c.jsx(bv,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const I=t&&t.find(P=>P.id===T.target.value);E(I)},hidden:!m,...F,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const I=T.id===g.id||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:V("gtm-trackable",{selected:I,"selected-single":I&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":I,"data-testid":I?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:V({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{D&&D(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Tr=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};const xv=({id:e,label:t,limit:n,value:r,placeholder:a,functions:i,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=ae.useIntl(),[p,v]=y.useState(r?Array.isArray(r)?r:[r]:[""]),f=p.filter(_=>_!=="");y.useEffect(()=>{if(!u)return;const _=Ot(u.fields).filter(({id:I,name:P})=>(I||(I=P||""),I!==e&&!I.includes(`${e}-`))),T=[];p.map((I,P)=>{if(C&&P>=C)return;const z=Ot(l);z&&e&&(z.forEach($=>{const{condition:B,error:A}=$;if(typeof B=="function")$.condition=O=>{var W;let j=(W=O==null?void 0:O[e])==null?void 0:W[P];j||(O[e]&&!Array.isArray(O[e])?j=O[e]:j="");const U=Ot(O);return U[e]=j,typeof B=="function"&&B(U)?A:!1};else{const O=B;$.condition=j=>{var W;let U=(W=j==null?void 0:j[e])==null?void 0:W[P];switch(U||(j[e]&&!Array.isArray(j[e])?U=j[e]:U=""),O){case"required":A||($.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":A||($.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":A||($.error=A||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":A||($.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Tr(O,U)?$.error:!1}}}),T.push({id:`${e}-${P}`,validation:z,value:I}))}),u.setFields(_.concat(T))},[p.length]);const{showCount:b=!1,label:g,maxInputs:C=100,hasButton:D=!1}=o||{},F=()=>{(!C||p.length<C)&&v([...p,""])},E=(_,T)=>_.replace("{number}",T+1);return c.jsxs("fieldset",{className:V("multiple-inputs field-wrapper",{"has-button":D,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",children:[t,b?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":h.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:f.length,total:C}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:f.length,total:C})})]}):""]}):c.jsx(c.Fragment,{}),p.map((_,T)=>{if(C&&T>=C)return c.jsx(c.Fragment,{});let I=!1;t?I=c.jsx(Pe,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:T+1})}):g&&(I=E(g,T));const P=`${e}-${T}`;return c.jsx(hf,{id:P,type:"text",label:I,value:_,placeholder:a?E(a,T):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[P]:void 0,functions:{...i,onFocus:()=>{D||T!==p.length-1||F()},onChange:z=>{const $=Ot(p);$[T]=z,v($),u==null||u.dispatch({type:"removeError",payload:{key:P}}),i==null||i.onChange($)}},siblings:T===0?void 0:c.jsx(Ee,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const z=Ot(p);z.splice(T,1),v(z),u==null||u.dispatch({type:"removeError",payload:{key:P}}),i==null||i.onChange(z)}}),...m},P)}),D?c.jsx(Ee,{...D,onClick:F,disabled:!!(C&&C<=p.length)}):c.jsx(c.Fragment,{})]})};const Uu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const v=ae.useIntl(),f=i?d:[],b=d;return c.jsx("ul",{...p,className:V("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:C=!1,value:D=g,disabled:F=!1})=>{const E=`${r}_${g}`,_=()=>{if(F)return;let T;if(i){const I=f==null?void 0:f.indexOf(D);Array.isArray(f)&&I>=0?(T=f,T.splice(I,1)):(!f||f.length===0?T=[]:T=f,T.push(D))}else T=b===D?void 0:D;t.onChange(T)};return c.jsx(mf,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:D,value:i?f==null?void 0:f.includes(D):b===D,functions:{...t,onChange:_},intlPath:n,label:C||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:F,accessibilityOptions:m},E)})})};const Cv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),h=()=>{var p;u(!l),m(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:h,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Kn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:mf},checkboxes:{component:Uu,props:{multiSelect:!0}},radio:{component:Uu,props:{multiSelect:!1}},select:{component:yv},password:{component:Cv},autocomplete:{component:vv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},hf=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:a="",error:i,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:v,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(xv,{...e});const b=d&&d.some(({condition:O})=>O==="required"),g=mi(m),C=u&&Kn[u]&&Kn[u].component?Kn[u].component:Jn,D=u&&["checkboxes","radio"].includes(u),F=u&&["autocomplete"].includes(u),E=i&&`error-${n}`,_=`character-limit-${n}`,T={};D?T.element="legend":T.htmlFor=n;let I={...f,id:n,name:n,className:i?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const P=O=>{I["aria-describedby"]?I["aria-describedby"]+=` ${O}`:I["aria-describedby"]=O};if(o>0){const O=df(o,s);P(`${_}-info`),I={...I,...O},O.functions&&typeof O.functions=="object"&&(I.functions={...I.functions,...O.functions})}u&&Kn[u]&&Kn[u].props&&(I={...I,...Kn[u].props}),D&&(I.intlPath=`${r}_${n}`),i&&(I["aria-invalid"]=!0,I["aria-errormessage"]=E,P(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),$=({...O})=>i?y.createElement(O.as||"p",{id:E,className:"error text-small",...O},i):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(C,{...I,label:z,className:V("field-wrapper",a)}),c.jsx($,{as:"p"})]});const B={};D?T.className="legend-as-label text-small":B.className="field-label";const A=({element:O,...j})=>y.createElement(O||"label",{...j,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(D?"fieldset":"div",{className:V("field-wrapper text-medium",a,`${u}-wrapper`,{"multiple-options-wrapper":D})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(D?y.Fragment:"p",B,c.jsxs(A,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(D||F?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(C,{...I}),c.jsx(ko,{id:_,limit:o,valueLength:g}),v]})),c.jsx($,{})]}))})},Dv=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?Ot(e.errors):{},i=e.values?Ot(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=Ot(Object.keys(a));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:v="required",error:f=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(i);g&&(b=f||g)}else{const g=i[h.id],C=v;switch(C){case"required":Tr(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Tr(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Tr(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Tr(C,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:h.id,value:b}}),m.push(h.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let $i=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...h})=>{const[p,v]=y.useState(t);y.useEffect(()=>{v(t)},[t.length]);const{customOnSubmit:f,hideButton:b,...g}=s,C=40,{shouldShowCancelButton:D=!1,shouldReset:F=!0,shouldHide:E=!0,showRequiredLabels:_=!0,showSuccessMessage:T=!1}=l||{},{onSuccess:I=async()=>{},onCancel:P=()=>{},onCatch:z=()=>{},onFailure:$=()=>{}}=m||{},B=ae.useIntl(),A={};t.length&&t.forEach(S=>{const L=S.id||S.name;L&&(A[L]=S.value||"")});const[O,j]=y.useReducer(Dv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:A}),{errors:U,isSubmitting:W,formSubmitted:re,values:ne}=O;y.useEffect(()=>{F&&re&&($i=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[re]),y.useEffect(()=>()=>{$i&&clearTimeout($i)},[]),y.useEffect(()=>{const S=L=>{j({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",S),()=>{document.removeEventListener("dropdownMultiSelectSubmit",S)}},[]);const w=y.useRef(null),Q=a||w;if(!t.length)return null;const se={};s.children&&(se.default=s.children),g.text&&typeof g.text=="string"&&(se.default=g.text),["default","submitting","submitted"].forEach(S=>{g.text&&typeof g.text!="string"&&S in g.text?se[S]=g.text[S]:se[S]||(se[S]=B.formatMessage({id:`form_${S==="default"?"submit":S}`}))}),delete g.text;const k=()=>{if(!W){if(j({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&j({type:"submitForm",payload:{fields:p,dispatch:j,intl:B}});return}j({type:"submitForm",payload:{fields:p,dispatch:j,onSuccess:async S=>{try{await I(S),j({type:F?"formSubmittedAndReset":"formSubmitted"})}catch(L){z(L),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(S,L)=>{$(S,L),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},M=S=>{var K;if(S.preventDefault(),S.stopPropagation(),W)return;let L=0;if((K=Q==null?void 0:Q.current)!=null&&K.id){const te=document.getElementById(Q.current.id);te&&(L=te.getBoundingClientRect().top+window.scrollY)}const G=document.getElementById("header");G&&(L=L-G.offsetHeight-C),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),k()},q=[{...g,icon:re?{icon:"tick",position:"left"}:!1,className:V("gtm-trackable",g.className),onClick:M,disabled:W||re||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:se[W?"submitting":re?"submitted":"default"]}];return D&&q.unshift({...o,className:V("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:W||re,onClick:P,children:o.text||B.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:V("form",n),ref:Q},c.jsxs(c.Fragment,{children:[U!=null&&U.general?c.jsx(Cn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,u,(!E||!W&&!re||f)&&t.map((S,L)=>{const{id:G=S.name||L,component:K,functions:te={onChange:()=>{}},submitOnEnter:ce=!1}=S;if(K)return c.jsx(K,{...S.props||{}},`component-${G}-${L}`);const J=(ne==null?void 0:ne[G])||"",he={...te,onChange:pe=>{j({type:"updateValue",payload:{key:G,value:pe}}),te.onChange(pe,j)}};return ce&&(he.onKeyDown=pe=>{pe.key==="Enter"&&(pe.stopPropagation(),pe.preventDefault(),k()),te.onKeyDown&&te.onKeyDown(pe)}),c.jsx(hf,{intlPath:i,...S,showRequiredLabels:_,value:J,error:S.type==="multiple-inputs"?U:U==null?void 0:U[G],functions:he,fieldData:{fields:p,setFields:v,dispatch:j}},G)}),b?null:(W||re)&&f?f:c.jsx(pr,{className:V("cta",{center:W||re,submitted:re}),buttons:q})]})),T&&re&&c.jsx(ur,{className:"success",children:typeof T=="string"?T:B.formatMessage({id:"form_success"})})]})};const fa="passwordRules_",pf="isMoreThanEightCharacters",gf="includesNumberAndSymbol",vf="includesLowerAndUppercase",wv={[pf]:"8Characters",[gf]:"numberSymbol",[vf]:"lowercaseUppercase"},Ev=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${fa}intro`})}),c.jsx("ul",{children:[pf,gf,vf].map(r=>c.jsxs("li",{className:V({matches:e[r]}),children:[c.jsxs(Pe,{children:[n.formatMessage({id:`${fa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${fa}rule_${wv[r]}`})}),!e[r]&&c.jsxs(Pe,{element:"strong",children:[" ",n.formatMessage({id:`${fa}notMet`})]})]},`rule-${r}`))})]})},bf=y.memo(Ev);const _v=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(C=>({...C,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(C=>({...C,setUp:!0,disabled:!0})),a(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!m||p))try{u(C=>({...C,rating:g,disabled:!0})),await r({id:m,value:g})}catch(C){u(D=>({...D,rating:null})),a(C)}finally{u(C=>({...C,disabled:!1}))}};return c.jsxs("div",{className:V("rating",i),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const C=g+1;return c.jsx("li",{className:V({selected:h&&C<=h}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!h||C>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:C,total:t})}${C===1||C===t?` - ${f[C===1?"low":"high"]}`:""}`,onClick:D=>{D.preventDefault(),D.stopPropagation(),b(C)},disabled:p})},`rating-${C}`)})})]})},kv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},cn=y.createContext(kv);var H=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(H||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Fv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const a=r;return a!=null&&a.name&&a.name===Lr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Av=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var Bv=jv,yf="֑-߿יִ-﷽ﹰ-ﻼ",xf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Tv=new RegExp("^[^"+xf+"]*["+yf+"]"),Sv=new RegExp("^[^"+yf+"]*["+xf+"]");function jv(e){return e=String(e||""),Tv.test(e)?"rtl":Sv.test(e)?"ltr":"neutral"}const Cf=In(Bv);function Ov(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Fo=Ov,Pv=typeof ra=="object"&&ra&&ra.Object===Object&&ra,Mv=Pv,Nv=Mv,Rv=typeof self=="object"&&self&&self.Object===Object&&self,Iv=Nv||Rv||Function("return this")(),Df=Iv,$v=Df,Lv=function(){return $v.Date.now()},zv=Lv,qv=/\s/;function Uv(e){for(var t=e.length;t--&&qv.test(e.charAt(t)););return t}var Wv=Uv,Vv=Wv,Hv=/^\s+/;function Kv(e){return e&&e.slice(0,Vv(e)+1).replace(Hv,"")}var Zv=Kv,Yv=Df,Gv=Yv.Symbol,wf=Gv,Wu=wf,Ef=Object.prototype,Qv=Ef.hasOwnProperty,Jv=Ef.toString,_r=Wu?Wu.toStringTag:void 0;function Xv(e){var t=Qv.call(e,_r),n=e[_r];try{e[_r]=void 0;var r=!0}catch{}var a=Jv.call(e);return r&&(t?e[_r]=n:delete e[_r]),a}var eb=Xv,tb=Object.prototype,nb=tb.toString;function rb(e){return nb.call(e)}var ab=rb,Vu=wf,ib=eb,sb=ab,ob="[object Null]",ub="[object Undefined]",Hu=Vu?Vu.toStringTag:void 0;function lb(e){return e==null?e===void 0?ub:ob:Hu&&Hu in Object(e)?ib(e):sb(e)}var cb=lb;function db(e){return e!=null&&typeof e=="object"}var fb=db,mb=cb,hb=fb,pb="[object Symbol]";function gb(e){return typeof e=="symbol"||hb(e)&&mb(e)==pb}var vb=gb,bb=Zv,Ku=Fo,yb=vb,Zu=0/0,xb=/^[-+]0x[0-9a-f]+$/i,Cb=/^0b[01]+$/i,Db=/^0o[0-7]+$/i,wb=parseInt;function Eb(e){if(typeof e=="number")return e;if(yb(e))return Zu;if(Ku(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ku(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=bb(e);var n=Cb.test(e);return n||Db.test(e)?wb(e.slice(2),n?2:8):xb.test(e)?Zu:+e}var _b=Eb,kb=Fo,Li=zv,Yu=_b,Fb="Expected a function",Ab=Math.max,Bb=Math.min;function Tb(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Fb);t=Yu(t)||0,kb(n)&&(d=!!n.leading,m="maxWait"in n,i=m?Ab(Yu(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(_){var T=r,I=a;return r=a=void 0,u=_,s=e.apply(I,T),s}function v(_){return u=_,o=setTimeout(g,t),d?p(_):s}function f(_){var T=_-l,I=_-u,P=t-T;return m?Bb(P,i-I):P}function b(_){var T=_-l,I=_-u;return l===void 0||T>=t||T<0||m&&I>=i}function g(){var _=Li();if(b(_))return C(_);o=setTimeout(g,f(_))}function C(_){return o=void 0,h&&r?p(_):(r=a=void 0,s)}function D(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function F(){return o===void 0?s:C(Li())}function E(){var _=Li(),T=b(_);if(r=arguments,a=this,l=_,T){if(o===void 0)return v(l);if(m)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=D,E.flush=F,E}var _f=Tb;const Sb=In(_f);var jb=_f,Ob=Fo,Pb="Expected a function";function Mb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Pb);return Ob(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),jb(e,t,{leading:r,maxWait:t,trailing:a})}var Nb=Mb;const Rb=In(Nb),Gu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Qu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",zi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Qu(n.overflowY,t)||Qu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},ma=(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,Ib=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Ju=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:U=>U!==u;if(!Gu(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;Gu(v)&&m(v);){if(v=Ib(v),v===h){p.push(v);break}v!=null&&v===document.body&&zi(v)&&!zi(document.documentElement)||v!=null&&zi(v,d)&&p.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:g,scrollY:C}=window,{height:D,width:F,top:E,right:_,bottom:T,left:I}=e.getBoundingClientRect(),{top:P,right:z,bottom:$,left:B}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?E-P:o==="end"?T+$:E+D/2-P+$,O=l==="center"?I+F/2-B+z:l==="end"?_+z:I-B;const j=[];for(let U=0;U<p.length;U++){const W=p[U],{height:re,width:ne,top:w,right:Q,bottom:se,left:k}=W.getBoundingClientRect();if(s==="if-needed"&&E>=0&&I>=0&&T<=b&&_<=f&&E>=w&&T<=se&&I>=k&&_<=Q)return j;const M=getComputedStyle(W),q=parseInt(M.borderLeftWidth,10),S=parseInt(M.borderTopWidth,10),L=parseInt(M.borderRightWidth,10),G=parseInt(M.borderBottomWidth,10);let K=0,te=0;const ce="offsetWidth"in W?W.offsetWidth-W.clientWidth-q-L:0,J="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-G:0,he="offsetWidth"in W?W.offsetWidth===0?0:ne/W.offsetWidth:0,pe="offsetHeight"in W?W.offsetHeight===0?0:re/W.offsetHeight:0;if(h===W)K=o==="start"?A:o==="end"?A-b:o==="nearest"?ma(C,C+b,b,S,G,C+A,C+A+D,D):A-b/2,te=l==="start"?O:l==="center"?O-f/2:l==="end"?O-f:ma(g,g+f,f,q,L,g+O,g+O+F,F),K=Math.max(0,K+C),te=Math.max(0,te+g);else{K=o==="start"?A-w-S:o==="end"?A-se+G+J:o==="nearest"?ma(w,se,re,S,G+J,A,A+D,D):A-(w+re/2)+J/2,te=l==="start"?O-k-q:l==="center"?O-(k+ne/2)+ce/2:l==="end"?O-Q+L+ce:ma(k,Q,ne,q,L+ce,O,O+F,F);const{scrollLeft:we,scrollTop:Me}=W;K=pe===0?0:Math.max(0,Math.min(Me+K/pe,W.scrollHeight-re/pe+J)),te=he===0?0:Math.max(0,Math.min(we+te/he,W.scrollWidth-ne/he+ce)),A+=Me-K,O+=we-te}j.push({el:W,top:K,left:te})}return j},$b=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Lb(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(Ju(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Ju(e,$b(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
67
67
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
68
68
  *
69
69
  * Copyright (c) 2014-2017, Jon Schlinkert.
70
70
  * Released under the MIT License.
71
- */function tl(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return tl(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(tl(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var kf=Symbol.for("immer-nothing"),nl=Symbol.for("immer-draftable"),Ft=Symbol.for("immer-state"),Qb=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 yt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Qb[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 ur=Object.getPrototypeOf;function jn(e){return!!e&&!!e[Ft]}function On(e){var t;return e?Ff(e)||Array.isArray(e)||!!e[nl]||!!((t=e.constructor)!=null&&t[nl])||pi(e)||gi(e):!1}var Jb=Object.prototype.constructor.toString();function Ff(e){if(!e||typeof e!="object")return!1;const t=ur(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)===Jb}function Za(e,t){mi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function mi(e){const t=e[Ft];return t?t.type_:Array.isArray(e)?1:pi(e)?2:gi(e)?3:0}function Ns(e,t){return mi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Af(e,t,n){const r=mi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Xb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function pi(e){return e instanceof Map}function gi(e){return e instanceof Set}function En(e){return e.copy_||e.base_}function Is(e,t){if(pi(e))return new Map(e);if(gi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ff(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Ft];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(ur(e),r)}else{const r=ur(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function To(e,t=!1){return vi(e)||jn(e)||!On(e)||(mi(e)>1&&(e.set=e.add=e.clear=e.delete=e0),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>To(r,!0))),e}function e0(){yt(2)}function vi(e){return Object.isFrozen(e)}var t0={};function Pn(e){const t=t0[e];return t||yt(0,e),t}var qr;function Bf(){return qr}function n0(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function rl(e,t){t&&(Pn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rs(e){$s(e),e.drafts_.forEach(r0),e.drafts_=null}function $s(e){e===qr&&(qr=e.parent_)}function al(e){return qr=n0(qr,e)}function r0(e){const t=e[Ft];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function il(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ft].modified_&&(Rs(t),yt(4)),On(e)&&(e=Ya(t,e),t.parent_||Ga(t,e)),t.patches_&&Pn("Patches").generateReplacementPatches_(n[Ft].base_,e,t.patches_,t.inversePatches_)):e=Ya(t,n,[]),Rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kf?e:void 0}function Ya(e,t,n){if(vi(t))return t;const r=t[Ft];if(!r)return Za(t,(a,i)=>sl(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ga(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Za(i,(o,l)=>sl(e,r,a,o,l,n,s)),Ga(e,a,!1),n&&e.patches_&&Pn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function sl(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&yt(5),jn(a)){const o=i&&t&&t.type_!==3&&!Ns(t.assigned_,r)?i.concat(r):void 0,l=Ya(e,a,o);if(Af(n,r,l),jn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(On(a)&&!vi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ya(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ga(e,a)}}function Ga(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&To(t,n)}function a0(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Bf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=So;n&&(a=[r],i=Ur);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var So={get(e,t){if(t===Ft)return e;const n=En(e);if(!Ns(n,t))return i0(e,n,t);const r=n[t];return e.finalized_||!On(r)?r:r===Wi(e.base_,t)?(Vi(e),e.copy_[t]=zs(r,e)):r},has(e,t){return t in En(e)},ownKeys(e){return Reflect.ownKeys(En(e))},set(e,t,n){const r=Tf(En(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Wi(En(e),t),i=a==null?void 0:a[Ft];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Xb(n,a)&&(n!==void 0||Ns(e.base_,t)))return!0;Vi(e),Ls(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 Wi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vi(e),Ls(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=En(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return ur(e.base_)},setPrototypeOf(){yt(12)}},Ur={};Za(So,(e,t)=>{Ur[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ur.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&yt(13),Ur.set.call(this,e,t,void 0)};Ur.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&yt(14),So.set.call(this,e[0],t,n,e[0])};function Wi(e,t){const n=e[Ft];return(n?En(n):e)[t]}function i0(e,t,n){var a;const r=Tf(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Tf(e,t){if(!(t in e))return;let n=ur(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ur(n)}}function Ls(e){e.modified_||(e.modified_=!0,e.parent_&&Ls(e.parent_))}function Vi(e){e.copy_||(e.copy_=Is(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var s0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let a;if(On(t)){const i=al(this),s=zs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Rs(i):$s(i)}return rl(i,r),il(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===kf&&(a=void 0),this.autoFreeze_&&To(a,!0),r){const i=[],s=[];Pn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else yt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){On(e)||yt(8),jn(e)&&(e=o0(e));const t=al(this),n=zs(e,void 0);return n[Ft].isManual_=!0,$s(t),n}finishDraft(e,t){const n=e&&e[Ft];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return rl(r,t),il(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=Pn("Patches").applyPatches_;return jn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function zs(e,t){const n=pi(e)?Pn("MapSet").proxyMap_(e,t):gi(e)?Pn("MapSet").proxySet_(e,t):a0(e,t);return(t?t.scope_:Bf()).drafts_.push(n),n}function o0(e){return jn(e)||yt(10,e),Sf(e)}function Sf(e){if(!On(e)||vi(e))return e;const t=e[Ft];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Is(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Is(e,!0);return Za(n,(r,a)=>{Af(n,r,Sf(a))}),t&&(t.finalized_=!1),n}var At=new s0,jo=At.produce;At.produceWithPatches.bind(At);At.setAutoFreeze.bind(At);At.setUseStrictShallowCopy.bind(At);At.applyPatches.bind(At);var ol=At.createDraft.bind(At),ul=At.finishDraft.bind(At),u0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},l0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Be.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},c0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Y.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Qa=new WeakMap,Ja=new WeakMap,jr=new WeakMap,jf=new WeakMap,ll=new WeakMap,cl=new WeakMap,dl=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!I.isAncestor(t,e)&&!I.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(I.equals(h,p))return r;if(I.isAncestor(h,r)||I.equals(h,r)){var m=p.slice();return I.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else I.isSibling(h,p)&&(I.isAncestor(p,r)||I.equals(p,r))?I.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:I.endsBefore(p,r)||I.equals(p,r)||I.isAncestor(p,r)?(I.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):I.endsBefore(h,r)&&(I.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function d0(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 f0(e){var t=d0(e,"string");return Wr(t)==="symbol"?t:String(t)}function mt(e,t,n){return t=f0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Er(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var h0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of Y.points(t))t[l]=Be.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=ue.leaf(e,u),m=p.text.slice(0,d),v=p.text.slice(d);if(p.text=m+h+v,t)for(var[f,b]of Y.points(t))t[b]=Be.transform(f,n);break}case"merge_node":{var{path:g}=n,w=ue.get(e,g),E=I.previous(g),B=ue.get(e,E),D=ue.parent(e,g),k=g[g.length-1];if(he.isText(w)&&he.isText(B))B.text+=w.text;else if(!he.isText(w)&&!he.isText(B))B.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(rt.stringify(w)," ").concat(rt.stringify(B)));if(D.children.splice(k,1),t)for(var[T,$]of Y.points(t))t[$]=Be.transform(T,n);break}case"move_node":{var{path:P,newPath:z}=n;if(I.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var R=ue.get(e,P),A=ue.parent(e,P),F=P[P.length-1];A.children.splice(F,1);var O=I.transform(P,n),M=ue.get(e,I.parent(O)),U=O[O.length-1];if(M.children.splice(U,0,R),t)for(var[W,ie]of Y.points(t))t[ie]=Be.transform(W,n);break}case"remove_node":{var{path:se}=n,C=se[se.length-1],G=ue.parent(e,se);if(G.children.splice(C,1),t)for(var[ne,_]of Y.points(t)){var S=Be.transform(ne,n);if(t!=null&&S!=null)t[_]=S;else{var q=void 0,j=void 0;for(var[L,Q]of ue.texts(e))if(I.compare(Q,se)===-1)q=[L,Q];else{j=[L,Q];break}var Z=!1;q&&j&&(I.equals(j[1],se)?Z=!I.hasPrevious(j[1]):Z=I.common(q[1],se).length<I.common(j[1],se).length),q&&!Z?(ne.path=q[1],ne.offset=q[0].text.length):j?(ne.path=j[1],ne.offset=0):t=null}}break}case"remove_text":{var{path:X,offset:le,text:te}=n;if(te.length===0)break;var pe=ue.leaf(e,X),fe=pe.text.slice(0,le),Ae=pe.text.slice(le+te.length);if(pe.text=fe+Ae,t)for(var[ye,Ee]of Y.points(t))t[Ee]=Be.transform(ye,n);break}case"set_node":{var{path:Le,properties:Oe,newProperties:ze}=n;if(Le.length===0)throw new Error("Cannot set properties on the root node!");var Je=ue.get(e,Le);for(var Se in ze){if(Se==="children"||Se==="text")throw new Error('Cannot set the "'.concat(Se,'" property of nodes!'));var qe=ze[Se];qe==null?delete Je[Se]:Je[Se]=qe}for(var xe in Oe)ze.hasOwnProperty(xe)||delete Je[xe];break}case"set_selection":{var{newProperties:V}=n;if(V==null)t=V;else{if(t==null){if(!Y.isRange(V))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(rt.stringify(V)," when there is no current selection."));t=Er({},V)}for(var re in V){var me=V[re];if(me==null){if(re==="anchor"||re==="focus")throw new Error('Cannot remove the "'.concat(re,'" selection property'));delete t[re]}else t[re]=me}}break}case"split_node":{var{path:ve,position:ke,properties:ge}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var _e=ue.get(e,ve),Ye=ue.parent(e,ve),nt=ve[ve.length-1],pt;if(he.isText(_e)){var Xe=_e.text.slice(0,ke),wt=_e.text.slice(ke);_e.text=Xe,pt=Er(Er({},ge),{},{text:wt})}else{var Dt=_e.children.slice(0,ke),Ei=_e.children.slice(ke);_e.children=Dt,pt=Er(Er({},ge),{},{children:Ei})}if(Ye.children.splice(nt+1,0,pt),t)for(var[gr,na]of Y.points(t))t[na]=Be.transform(gr,n);break}}return t},m0={transform(e,t){e.children=ol(e.children);var n=e.selection&&ol(e.selection);try{n=h0(e,n,t)}finally{e.children=ul(e.children),n?e.selection=jn(n)?ul(n):n:e.selection=null}}},p0={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)}},g0={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)}},Of=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Of(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 v0(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function rn(e,t){if(e==null)return{};var n=v0(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 b0=["anchor","focus"];function hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function y0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Y={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Y.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Y.edges(e);return t},equals(e,t){return Be.equals(e.anchor,t.anchor)&&Be.equals(e.focus,t.focus)},includes(e,t){if(Y.isRange(t)){if(Y.includes(e,t.anchor)||Y.includes(e,t.focus))return!0;var[n,r]=Y.edges(e),[a,i]=Y.edges(t);return Be.isBefore(n,a)&&Be.isAfter(r,i)}var[s,o]=Y.edges(e),l=!1,u=!1;return Be.isPoint(t)?(l=Be.compare(t,s)>=0,u=Be.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=rn(e,b0),[r,a]=Y.edges(e),[i,s]=Y.edges(t),o=Be.isBefore(r,i)?i:r,l=Be.isBefore(a,s)?a:s;return Be.isBefore(l,o)?null:y0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Be.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Be.equals(t,n)},isExpanded(e){return!Y.isCollapsed(e)},isForward(e){return!Y.isBackward(e)},isRange(e){return st(e)&&Be.isPoint(e.anchor)&&Be.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Y.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return jo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Y.isCollapsed(r);Y.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Y.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Be.transform(r.anchor,t,{affinity:i}),u=Be.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ml=e=>st(e)&&ue.isNodeList(e.children)&&!x.isEditor(e),de={isAncestor(e){return st(e)&&ue.isNodeList(e.children)},isElement:ml,isElementList(e){return Array.isArray(e)&&e.every(t=>de.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return ml(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},x0=["children"],C0=["text"],pl=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(he.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(rt.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.isText(e))throw new Error("Cannot get the child of a text node: ".concat(rt.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(rt.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(rt.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=rn(e,x0);return t}else{var t=rn(e,C0);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(rt.stringify(e)));var n=jo({children:e.children},r=>{var[a,i]=Y.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!Y.includes(t,m)}});for(var[,o]of s){if(!Y.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(rt.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||de.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=pl.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return pl.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ue.get(e,t);if(!he.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(rt.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of I.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=I.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=I.previous(o);o=h,l=ue.get(e,o);continue}o=I.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=ue.get(e,n);if(he.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return he.isText(e)?e.text:e.children.map(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))he.isText(n)&&(yield[n,r])}()}};function gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pn={isNodeOperation(e){return pn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!st(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&st(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&Y.isRange(e.newProperties)||e.newProperties===null&&Y.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&st(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>pn.isOperation(t))},isSelectionOperation(e){return pn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return pn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return He(He({},e),{},{type:"remove_node"});case"insert_text":return He(He({},e),{},{type:"remove_text"});case"merge_node":return He(He({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return He(He({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return He(He({},e),{},{path:r,newPath:a})}case"remove_node":return He(He({},e),{},{type:"insert_node"});case"remove_text":return He(He({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return He(He({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?He(He({},e),{},{properties:l,newProperties:null}):l==null?He(He({},e),{},{properties:null,newProperties:o}):He(He({},e),{},{properties:l,newProperties:o})}case"split_node":return He(He({},e),{},{type:"merge_node",path:I.next(e.path)})}}},vl=new WeakMap,w0=e=>{var t=vl.get(e);if(t!==void 0)return t;if(!st(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||st(e.marks))&&(e.selection===null||Y.isRange(e.selection))&&ue.isNodeList(e.children)&&pn.isOperationList(e.operations);return vl.set(e,n),n},x={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return w0(e)},isElementReadOnly(e,t){return e.isElementReadOnly(t)},isEmpty(e,t){return e.isEmpty(t)},isEnd(e,t,n){return e.isEnd(t,n)},isInline(e,t){return e.isInline(t)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,t){return e.isSelectable(t)},isStart(e,t,n){return e.isStart(t,n)},isVoid(e,t){return e.isVoid(t)},last(e,t){return e.last(t)},leaf(e,t,n){return e.leaf(t,n)},levels(e,t){return e.levels(t)},marks(e){return e.getMarks()},next(e,t){return e.next(t)},node(e,t,n){return e.node(t,n)},nodes(e,t){return e.nodes(t)},normalize(e,t){e.normalize(t)},parent(e,t,n){return e.parent(t,n)},path(e,t,n){return e.path(t,n)},pathRef(e,t,n){return e.pathRef(t,n)},pathRefs(e){return e.pathRefs()},point(e,t,n){return e.point(t,n)},pointRef(e,t,n){return e.pointRef(t,n)},pointRefs(e){return e.pointRefs()},positions(e,t){return e.positions(t)},previous(e,t){return e.previous(t)},range(e,t,n){return e.range(t,n)},rangeRef(e,t,n){return e.rangeRef(t,n)},rangeRefs(e){return e.rangeRefs()},removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start(e,t){return e.start(t)},string(e,t,n){return e.string(t,n)},unhangRange(e,t,n){return e.unhangRange(t,n)},void(e,t){return e.void(t)},withoutNormalizing(e,t){e.withoutNormalizing(t)}},D0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Be={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Be.compare(e,t)===1},isBefore(e,t){return Be.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return jo(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=I.transform(i,t,yl(yl({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},xl=void 0,rt={setScrubber(e){xl=e},stringify(e){return JSON.stringify(e,xl)}},E0=["text"],_0=["anchor","focus"];function Cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=rn(i,E0);return s}return Of(r?a(e):e,r?a(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Xt({},e)];for(var r of t){var a=rn(r,_0),[i,s]=Y.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var v=h,f=void 0,b=void 0;if(d<l){var g=d-m;b=Xt(Xt({},v),{},{text:v.text.slice(g)}),v=Xt(Xt({},v),{},{text:v.text.slice(0,g)})}if(u>m){var w=u-m;f=Xt(Xt({},v),{},{text:v.text.slice(0,w)}),v=Xt(Xt({},v),{},{text:v.text.slice(w)})}Object.assign(v,a),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},Oo=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],pr=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},Po=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?S0(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=U0(d,h);if([i,s]=r?[s,p]:[p,i],Gn(i,De.ZWJ)&&Gn(s,De.ExtPict)&&(r?l=wl(t.substring(0,o)):l=wl(t.substring(0,t.length-o)),!l)||Gn(i,De.RI)&&Gn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=Z0(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&V0(i,s))break;o+=d.length}return o||1},k0=/\s/,F0=/[\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]/,A0=/['\u2018\u2019]/,B0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Po(t,n),[s,o]=Mo(t,i,n);if(T0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Mo=(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)]},T0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(k0.test(t))return!1;if(A0.test(t)){var a=Po(n,r),[i,s]=Mo(n,a,r);if(e(i,s,r))return!0}return!F0.test(t)},S0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(O0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(j0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},j0=e=>e>=55296&&e<=56319,O0=e=>e>=56320&&e<=57343,De;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(De||(De={}));var P0=/^(?:[\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])$/,M0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,N0=/^(?:[\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])$/,I0=/^[\u1100-\u115F\uA960-\uA97C]$/,R0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,$0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,L0=/^[\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]$/,z0=/^[\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]$/,q0=/^(?:[\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])$/,U0=(e,t)=>{var n=De.Any;return e.search(P0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(M0)!==-1&&(n|=De.Prepend),e.search(N0)!==-1&&(n|=De.SpacingMark),e.search(I0)!==-1&&(n|=De.L),e.search(R0)!==-1&&(n|=De.V),e.search($0)!==-1&&(n|=De.T),e.search(L0)!==-1&&(n|=De.LV),e.search(z0)!==-1&&(n|=De.LVT),e.search(q0)!==-1&&(n|=De.ExtPict),n};function Gn(e,t){return(e&t)!==0}var W0=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function V0(e,t){return W0.findIndex(n=>Gn(e,n[0])&&Gn(t,n[1]))===-1}var H0=/(?:[\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$/,wl=e=>e.search(H0)!==-1,K0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Z0=e=>{var t=e.match(K0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Y0={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Oo(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),Y.isRange(a))if(Y.isCollapsed(a))a=a.anchor;else{var i=Y.end(a);if(!r&&x.void(e,{at:i}))return;var s=Y.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ma(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J=ma(ma(ma(ma({},m0),p0),g0),Y0),Ta=new WeakMap,G0=e=>Ta.get(e)||!1,Q0=(e,t,n)=>{var r=Ta.get(e)||!1;Ta.set(e,!0);try{t(),n()}finally{Ta.set(e,r)}};function Pf(e,t,n){var r=Qa.get(e)||[],a=Ja.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Qa.set(e,i),Ja.set(e,s)}var J0=(e,t)=>{for(var n of x.pathRefs(e))u0.transform(n,t);for(var r of x.pointRefs(e))l0.transform(r,t);for(var a of x.rangeRefs(e))c0.transform(a,t);if(!G0(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;Pf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),jr.get(e)||(jr.set(e,!0),Promise.resolve().then(()=>{jr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},X0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=he.isText(r)?[]:Array.from(ue.nodes(r),z=>{var[,R]=z;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(I.equals(d,h))return[];var p=[],m=[];for(var v of I.ancestors(d)){var f=I.transform(v,t);p.push(f)}for(var b of I.ancestors(h)){var g=I.transform(b,t);m.push(g)}var w=m[m.length-1],E=h[h.length-1],B=w.concat(E);return[...p,...m,B]}case"remove_node":{var{path:D}=t,k=I.ancestors(D);return[...k]}case"split_node":{var{path:T}=t,$=I.levels(T),P=I.next(T);return[...$,P]}default:return[]}},ey=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},ty=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ue.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=he.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!he.isText(d)){var m={text:""};J.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var v={text:""};J.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&he.isText(d)&&(he.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},ny=(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},ry=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(Y.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function El(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?El(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):El(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ay=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!he.isText(h))return!1;var[m,v]=x.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=Y.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=_l(_l({},x.marks(e)||{}),{},{[t]:n});e.marks=d,jr.get(e)||e.onChange()}}};function kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var iy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Fl(Fl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Bl(Bl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},oy=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},uy=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&J.delete(e,{unit:t})},ly=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Y.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},cy=(e,t)=>[x.start(e,t),x.end(e,t)];function Tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var dy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Sl(Sl({},n),{},{match:r=>de.isElement(r)&&x.isElementReadOnly(t,r)}))},fy=(e,t)=>x.point(e,t,{edge:"end"}),hy=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},my=(e,t)=>{var n=x.range(e,t);return ue.fragment(e,n)};function jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var py=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Ol(Ol({},n),{},{match:r=>de.isElement(r)&&x.isVoid(t,r)}))},gy=(e,t)=>t.children.some(n=>de.isElement(n)&&x.isBlock(e,n)),vy=(e,t)=>t.children.some(n=>he.isText(n)||x.isInline(e,n)),by=(e,t)=>ue.has(e,t),yy=(e,t)=>t.children.every(n=>he.isText(n)),xy=e=>{J.splitNodes(e,{always:!0})},Cy=(e,t,n)=>{J.insertNodes(e,t,n)},wy=e=>{J.splitNodes(e,{always:!0})};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Dy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ey=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=Dy({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},_y=(e,t)=>!e.isInline(t),ky=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),Fy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},Ay=(e,t,n)=>{var r=x.end(e,n);return Be.equals(t,r)},By=e=>{var t=jf.get(e);return t===void 0?!0:t},Ty=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return Be.equals(t,r)},Sy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},jy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function Oy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Py=["text"],My=["text"],Ny=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Y.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=rn(u,Py);return d}else return{}}var{path:h}=a,[p]=x.leaf(t,h);if(a.offset===0){var m=x.previous(t,{at:h,match:he.isText}),v=x.above(t,{match:B=>de.isElement(B)&&x.isVoid(t,B)&&t.markableVoid(B)});if(!v){var f=x.above(t,{match:B=>de.isElement(B)&&x.isBlock(t,B)});if(m&&f){var[b,g]=m,[,w]=f;I.isAncestor(w,g)&&(p=b)}}}var E=rn(p,My);return E},Iy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},Ry=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=ue.get(t,a);return[i,a]};function $y(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(D0.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),p=x.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=ue.nodes(e,{reverse:i,from:u,to:d,pass:B=>{var[D]=B;return de.isElement(D)?!!(!s&&(x.isVoid(e,D)||x.isElementReadOnly(e,D))||o&&!x.isSelectable(e,D)):!1}}),v=[],f;for(var[b,g]of m)if(!(o&&de.isElement(b)&&!x.isSelectable(e,b))){var w=f&&I.compare(g,f[1])===0;if(!(r==="highest"&&w)){if(!l(b,g)){if(a&&!w&&he.isText(b))return;continue}if(r==="lowest"&&w){f=[b,g];continue}var E=r==="lowest"?f:[b,g];E&&(a?v.push(E):yield E),f=[b,g]}}r==="lowest"&&f&&(a?v.push(f):yield f),a&&(yield*v)}}()}var Ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Qa.get(d)||[],s=d=>Ja.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(x.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));Qa.set(t,l),Ja.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=x.node(t,d),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var v=i(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var g=o(t);if(ue.has(t,g)){var w=x.node(t,g);t.normalizeNode(w,{operation:a})}b++,v=i(t)}})}},zy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},qy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},Uy=e=>{var t=ll.get(e);return t||(t=new Set,ll.set(e,t)),t},Wy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return Y.isRange(n)&&(i==="start"?n=Y.start(n):i==="end"?n=Y.end(n):n=I.common(n.anchor.path,n.focus.path)),Be.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Vy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},Hy=e=>{var t=cl.get(e);return t||(t=new Set,cl.set(e,t)),t},Ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!he.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(Y.isRange(n)){var[u,d]=Y.edges(n);return a==="start"?u:d}return n};function Zy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=Y.edges(o),d=a?u:l,h=!1,p="",m=0,v=0,f=0;for(var[b,g]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,g);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var w=I.isAncestor(g,u.path)?u:x.end(e,g),E=I.isAncestor(g,l.path)?l:x.start(e,g);p=x.string(e,{anchor:E,focus:w},{voids:i}),h=!0}}if(he.isText(b)){var B=I.equals(g,d.path);for(B?(v=a?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=a?v:0),(B||h||r==="offset")&&(yield{path:g,offset:f},h=!1);;){if(m===0){if(p==="")break;m=D(p,r,a),p=Mo(p,m,a)[1]}if(f=a?f-m:f+m,v=v-m,v<0){m=-v;break}m=0,yield{path:g,offset:f}}}}function D(k,T,$){return T==="character"?Po(k,$):T==="word"?B0(k,$):T==="line"||T==="block"?k.length:1}}()}var Yy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Gy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},Qy=e=>{var t=dl.get(e);return t||(t=new Set,dl.set(e,t)),t},Jy=(e,t,n)=>{if(Y.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};function Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ml(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ex=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!he.isText(d))return!1;var[p,m]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=Y.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Xy({},x.marks(e)||{});delete u[t],e.marks=u,jr.get(e)||e.onChange()}}},tx=(e,t)=>{jf.set(e,t)},nx=(e,t)=>x.point(e,t,{edge:"start"}),rx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Y.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:he.isText,voids:a})){var h=u.text;I.equals(d,o.path)&&(h=h.slice(0,o.offset)),I.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Y.edges(n);if(i.offset!==0||s.offset!==0||Y.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:v=>de.isElement(v)&&x.isBlock(t,v),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of x.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||I.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},ix=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(Y.isRange(u)&&Y.isCollapsed(u)&&(h=!0,u=u.anchor),Be.isPoint(u)){var p=x.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var v={unit:s,distance:o},f=i?x.before(t,u,v)||x.start(t,[]):x.after(t,u,v)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!Y.isCollapsed(u)){if(!d){var[,b]=Y.edges(u),g=x.end(t,[]);Be.equals(b,g)||(u=x.unhangRange(t,u,{voids:l}))}var[w,E]=Y.edges(u),B=x.above(t,{match:fe=>de.isElement(fe)&&x.isBlock(t,fe),at:w,voids:l}),D=x.above(t,{match:fe=>de.isElement(fe)&&x.isBlock(t,fe),at:E,voids:l}),k=B&&D&&!I.equals(B[1],D[1]),T=I.equals(w.path,E.path),$=l?null:(r=x.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:w,mode:"highest"}),P=l?null:(a=x.void(t,{at:E,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:E,mode:"highest"});if($){var z=x.before(t,w);z&&B&&I.isAncestor(B[1],z.path)&&(w=z)}if(P){var R=x.after(t,E);R&&D&&I.isAncestor(D[1],R.path)&&(E=R)}var A=[],F;for(var O of x.nodes(t,{at:u,voids:l})){var[M,U]=O;F&&I.compare(U,F)===0||(!l&&de.isElement(M)&&(x.isVoid(t,M)||x.isElementReadOnly(t,M))||!I.isCommon(U,w.path)&&!I.isCommon(U,E.path))&&(A.push(O),F=U)}var W=Array.from(A,fe=>{var[,Ae]=fe;return x.pathRef(t,Ae)}),ie=x.pointRef(t,w),se=x.pointRef(t,E),C="";if(!T&&!$){var G=ie.current,[ne]=x.leaf(t,G),{path:_}=G,{offset:S}=w,q=ne.text.slice(S);q.length>0&&(t.apply({type:"remove_text",path:_,offset:S,text:q}),C=q)}if(W.reverse().map(fe=>fe.unref()).filter(fe=>fe!==null).forEach(fe=>J.removeNodes(t,{at:fe,voids:l})),!P){var j=se.current,[L]=x.leaf(t,j),{path:Q}=j,Z=T?w.offset:0,X=L.text.slice(Z,E.offset);X.length>0&&(t.apply({type:"remove_text",path:Q,offset:Z,text:X}),C=X)}!T&&k&&se.current&&ie.current&&J.mergeNodes(t,{at:se.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,C.slice(0,C.length-o));var le=ie.unref(),te=se.unref(),pe=i?le||te:te||le;n.at==null&&pe&&J.select(t,pe)}}})},ox=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Oo(t),batchDirty:o=!0}=r;if(n.length){if(Y.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Y.isCollapsed(s))s=s.anchor;else{var[,l]=Y.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:q=>de.isElement(q)&&x.isInline(t,q),mode:"highest",voids:i});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var p=x.after(t,h);s=p}else if(x.isStart(t,s,h)){var m=x.before(t,h);s=m}}var v=x.above(t,{match:q=>de.isElement(q)&&x.isBlock(t,q),at:s,voids:i}),[,f]=v,b=x.isStart(t,s,f),g=x.isEnd(t,s,f),w=b&&g,E=!b||b&&g,B=!g,[,D]=ue.first({children:n},[]),[,k]=ue.last({children:n},[]),T=[],$=q=>{var[j,L]=q,Q=L.length===0;return Q?!1:w?!0:!(E&&I.isAncestor(L,D)&&de.isElement(j)&&!t.isVoid(j)&&!t.isInline(j)||B&&I.isAncestor(L,k)&&de.isElement(j)&&!t.isVoid(j)&&!t.isInline(j))};for(var P of ue.nodes({children:n},{pass:$}))$(P)&&T.push(P);var z=[],R=[],A=[],F=!0,O=!1;for(var[M]of T)de.isElement(M)&&!t.isInline(M)?(F=!1,O=!0,R.push(M)):F?z.push(M):A.push(M);var[U]=x.nodes(t,{at:s,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i}),[,W]=U,ie=x.isStart(t,s,W),se=x.isEnd(t,s,W),C=x.pathRef(t,g&&!A.length?I.next(f):f),G=x.pathRef(t,se?I.next(W):W);J.splitNodes(t,{at:s,match:q=>O?de.isElement(q)&&x.isBlock(t,q):he.isText(q)||x.isInline(t,q),mode:O?"lowest":"highest",always:O&&(!b||z.length>0)&&(!g||A.length>0),voids:i});var ne=x.pathRef(t,!ie||ie&&se?I.next(W):W);if(J.insertNodes(t,z,{at:ne.current,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),w&&!z.length&&R.length&&!A.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,R,{at:C.current,match:q=>de.isElement(q)&&x.isBlock(t,q),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,A,{at:G.current,match:q=>he.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(A.length>0&&G.current?_=I.previous(G.current):R.length>0&&C.current?_=I.previous(C.current):ne.current&&(_=I.previous(ne.current)),_){var S=x.end(t,_);J.select(t,S)}}ne.unref(),C.unref(),G.unref()}}})},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=Y.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=Y.edges(a);J.select(t,s)}}else return},lx=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},cx=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=Y.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Y.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?x.before(t,l,d):x.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?x.before(t,u,d):x.after(t,u,d);m&&(h.focus=m)}J.setSelection(t,h)}},dx=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){J.setSelection(e,t);return}if(!Y.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(rt.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fx=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=Y.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Y.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Il(Il({},l),n)})}},hx=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Be.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Be.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})}},mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=Oo(t),d!==!1&&(d=!0)),d==null&&(d=!1),Y.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Y.isCollapsed(l))l=l.anchor;else{var[,p]=Y.edges(l),m=x.pointRef(t,p);J.delete(t,{at:l}),l=m.unref()}if(Be.isPoint(l)){u==null&&(he.isText(h)?u=z=>he.isText(z):t.isInline(h)?u=z=>he.isText(z)||x.isInline(t,z):u=z=>de.isElement(z)&&x.isBlock(t,z));var[v]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(v){var[,f]=v,b=x.pathRef(t,f),g=x.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=b.unref();l=g?I.next(w):w}else return}var E=I.parent(l),B=l[l.length-1];if(!(!i&&x.void(t,{at:E}))){if(o){var D=[],k=I.levels(E);Q0(t,()=>{var z=function(){var F=E.concat(B);B++;var O={type:"insert_node",path:F,node:R};t.apply(O),l=I.next(l),D.push(O),he.isText?k.push(...Array.from(ue.nodes(R),M=>{var[,U]=M;return F.concat(U)})):k.push(F)};for(var R of n)z()},()=>{Pf(t,k,z=>{var R=z;for(var A of D)if(I.operationCanTransformPath(A)&&(R=I.transform(R,A),!R))return null;return R})})}else for(var T of n){var $=E.concat(B);B++,t.apply({type:"insert_node",path:$,node:T}),l=I.next(l)}if(l=I.previous(l),d){var P=x.end(t,l);P&&J.select(t,P)}}}})},px=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?pr(t,r):B=>de.isElement(B)&&x.isBlock(t,B)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,B=>{var[,D]=B;return x.pathRef(t,D)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=x.node(t,I.parent(d)),[p,m]=h,v=d[d.length-1],{length:f}=p.children;if(f===1){var b=I.next(m);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:m,voids:i})}else if(v===0)J.moveNodes(t,{at:d,to:m,voids:i});else if(v===f-1){var g=I.next(m);J.moveNodes(t,{at:d,to:g,voids:i})}else{var w=I.next(d),E=I.next(m);J.splitNodes(t,{at:w,voids:i}),J.moveNodes(t,{at:d,to:E,voids:i})}}}})},gx=["text"],vx=["children"],Mf=(e,t)=>{if(de.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?Mf(e,n.children[0]):!1}else return!x.isEditor(t)},bx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(I.isPath(a)){var[l]=x.parent(t,a);r=z=>l.children.includes(z)}else r=z=>de.isElement(z)&&x.isBlock(t,z);if(!i&&Y.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Y.isRange(a))if(Y.isCollapsed(a))a=a.anchor;else{var[,u]=Y.edges(a),d=x.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[h]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),p=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,v]=h,[f,b]=p;if(!(v.length===0||b.length===0)){var g=I.next(b),w=I.common(v,b),E=I.isSibling(v,b),B=Array.from(x.levels(t,{at:v}),z=>{var[R]=z;return R}).slice(w.length).slice(0,-1),D=x.above(t,{at:v,mode:"highest",match:z=>B.includes(z)&&Mf(t,z)}),k=D&&x.pathRef(t,D[1]),T,$;if(he.isText(m)&&he.isText(f)){var P=rn(m,gx);$=f.text.length,T=P}else if(de.isElement(m)&&de.isElement(f)){var P=rn(m,vx);$=f.children.length,T=P}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(rt.stringify(m)," ").concat(rt.stringify(f)));E||J.moveNodes(t,{at:v,to:g,voids:s}),k&&J.removeNodes(t,{at:k.current,voids:s}),de.isElement(f)&&x.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:$,properties:T}),k&&k.unref()}}}})},yx=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?pr(e,r):m=>de.isElement(m)&&x.isBlock(e,m));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(e,v)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&I.isSibling(p,h)&&I.isAfter(p,h)&&(o.current=I.next(o.current))}o.unref()}})},xx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?pr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),!r&&Y.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(t,v)});for(var d of u){var h=d.unref();if(h){var[p]=x.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},Cx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=I.isPath(i)?pr(t,i):$=>de.isElement($)&&x.isBlock(t,$)),!l&&Y.isRange(i)&&(i=x.unhangRange(t,i,{voids:h})),d&&Y.isRange(i)){if(Y.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var p=x.rangeRef(t,i,{affinity:"inward"}),[m,v]=Y.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,v,v.path);J.splitNodes(t,{at:v,match:a,mode:f,voids:h,always:!b});var g=x.isStart(t,m,m.path);J.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!g}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=($,P)=>$!==P);for(var[w,E]of x.nodes(t,{at:i,match:a,mode:u,voids:h})){var B={},D={};if(E.length!==0){var k=!1;for(var T in n)T==="children"||T==="text"||s(n[T],w[T])&&(k=!0,w.hasOwnProperty(T)&&(B[T]=w[T]),o?n[T]!=null&&(D[T]=o(w[T],n[T])):n[T]!=null&&(D[T]=n[T]));k&&t.apply({type:"set_node",path:E,properties:B,newProperties:D})}}}})},wx=(e,t)=>{if(Y.isCollapsed(t))return t.anchor;var[,n]=Y.edges(t),r=x.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},Dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=se=>de.isElement(se)&&x.isBlock(t,se)),Y.isRange(s)&&(s=wx(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);i=se=>se===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=x.pointRef(t,s,{affinity:"backward"}),m;try{var[v]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!v)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[g,w]=f;if(de.isElement(g)&&t.isInline(g)){var E=x.after(t,w);if(!E){var B={text:""},D=I.next(w);J.insertNodes(t,B,{at:D,voids:a}),E=x.point(t,D)}s=E,l=!0}var k=s.path.length-w.length;o=k+1,l=!0}m=x.pointRef(t,s);var T=s.path.length-o,[,$]=v,P=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[R,A]of x.levels(t,{at:P,reverse:!0,voids:a})){var F=!1;if(A.length<$.length||A.length===0||!a&&de.isElement(R)&&x.isVoid(t,R))break;var O=p.current,M=x.isEnd(t,O,A);if(l||!p||!x.isEdge(t,O,A)){F=!0;var U=ue.extractProps(R);t.apply({type:"split_node",path:A,position:z,properties:U})}z=A[A.length-1]+(F||M?1:0)}if(n.at==null){var W=m.current||x.end(t,[]);J.select(t,W)}}finally{var ie;p.unref(),(ie=m)===null||ie===void 0||ie.unref()}}})},Ex=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;J.setNodes(t,a,r)},_x=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?pr(t,s):m=>de.isElement(m)&&x.isBlock(t,m)),I.isPath(s)&&(s=x.range(t,s));var l=Y.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,v]=m;return x.pathRef(t,v)}).reverse(),h=function(){var v=p.unref(),[f]=x.node(t,v),b=x.range(t,v);a&&l&&(b=Y.intersection(l.current,b)),J.liftNodes(t,{at:b,match:g=>de.isAncestor(f)&&f.children.includes(g),voids:i})};for(var p of d)h();l&&l.unref()}})};function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(r){mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=pr(t,l):t.isInline(n)?o=b=>de.isElement(b)&&x.isInline(t,b)||he.isText(b):o=b=>de.isElement(b)&&x.isBlock(t,b)),i&&Y.isRange(l)){var[u,d]=Y.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&J.select(t,l)}var p=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),m=function(){var g=Y.isRange(l)?Y.intersection(l,x.range(t,f)):l;if(!g)return 0;var w=Array.from(x.nodes(t,{at:g,match:o,mode:a,voids:s}));if(w.length>0){var[E]=w,B=w[w.length-1],[,D]=E,[,k]=B;if(D.length===0&&k.length===0)return 0;var T=I.equals(D,k)?I.parent(D):I.common(D,k),$=x.range(t,D,k),P=x.node(t,T),[z]=P,R=T.length+1,A=I.next(k.slice(0,R)),F=$l($l({},n),{},{children:[]});J.insertNodes(t,F,{at:A,voids:s}),J.moveNodes(t,{at:$,match:O=>de.isAncestor(z)&&z.children.includes(O),to:A.concat(0),voids:s})}},v;for(var[,f]of p)v=m()}})},Fx=()=>{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 J0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wy(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ox(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ey(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ux(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sx(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lx(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return my(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mx(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _y(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ky(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ay(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return px(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bx(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $y(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zy(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uy(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vy(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hy(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fx(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nx(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rx(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ax(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ex(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _x(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return py(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ix(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kx(e,...r)}};return e},Fn=[],Ax=function(){return Fn.some(function(e){return e.activeTargets.length>0})},Bx=function(){return Fn.some(function(e){return e.skippedTargets.length>0})},Ll="ResizeObserver loop completed with undelivered notifications.",Tx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Ll}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Ll),window.dispatchEvent(e)},Vr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Vr||(Vr={}));var An=function(e){return Object.freeze(e)},Sx=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,An(this)}return e}(),Nf=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,An(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),No=function(e){return e instanceof SVGElement&&"getBBox"in e},If=function(e){if(No(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)},zl=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)},jx=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Or=typeof window<"u"?window:{},pa=new WeakMap,ql=/auto|scroll/,Ox=/^tb|vertical/,Px=/msie|trident/i.test(Or.navigator&&Or.navigator.userAgent),qt=function(e){return parseFloat(e||"0")},tr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Sx((n?t:e)||0,(n?e:t)||0)},Ul=An({devicePixelContentBoxSize:tr(),borderBoxSize:tr(),contentBoxSize:tr(),contentRect:new Nf(0,0,0,0)}),Rf=function(e,t){if(t===void 0&&(t=!1),pa.has(e)&&!t)return pa.get(e);if(If(e))return pa.set(e,Ul),Ul;var n=getComputedStyle(e),r=No(e)&&e.ownerSVGElement&&e.getBBox(),a=!Px&&n.boxSizing==="border-box",i=Ox.test(n.writingMode||""),s=!r&&ql.test(n.overflowY||""),o=!r&&ql.test(n.overflowX||""),l=r?0:qt(n.paddingTop),u=r?0:qt(n.paddingRight),d=r?0:qt(n.paddingBottom),h=r?0:qt(n.paddingLeft),p=r?0:qt(n.borderTopWidth),m=r?0:qt(n.borderRightWidth),v=r?0:qt(n.borderBottomWidth),f=r?0:qt(n.borderLeftWidth),b=h+u,g=l+d,w=f+m,E=p+v,B=o?e.offsetHeight-E-e.clientHeight:0,D=s?e.offsetWidth-w-e.clientWidth:0,k=a?b+w:0,T=a?g+E:0,$=r?r.width:qt(n.width)-k-D,P=r?r.height:qt(n.height)-T-B,z=$+b+D+w,R=P+g+B+E,A=An({devicePixelContentBoxSize:tr(Math.round($*devicePixelRatio),Math.round(P*devicePixelRatio),i),borderBoxSize:tr(z,R,i),contentBoxSize:tr($,P,i),contentRect:new Nf(h,l,$,P)});return pa.set(e,A),A},$f=function(e,t,n){var r=Rf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Vr.DEVICE_PIXEL_CONTENT_BOX:return s;case Vr.BORDER_BOX:return a;default:return i}},Mx=function(){function e(t){var n=Rf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=An([n.borderBoxSize]),this.contentBoxSize=An([n.contentBoxSize]),this.devicePixelContentBoxSize=An([n.devicePixelContentBoxSize])}return e}(),Lf=function(e){if(If(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Nx=function(){var e=1/0,t=[];Fn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Mx(u.target),h=Lf(u.target);o.push(d),u.lastReportedSize=$f(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Wl=function(e){Fn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Lf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Ix=function(){var e=0;for(Wl(e);Ax();)e=Nx(),Wl(e);return Bx()&&Tx(),e>0},Hi,zf=[],Rx=function(){return zf.splice(0).forEach(function(e){return e()})},$x=function(e){if(!Hi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Rx()}).observe(n,r),Hi=function(){n.textContent="".concat(t?t--:t++)}}zf.push(e),Hi()},Lx=function(e){$x(function(){requestAnimationFrame(e)})},Sa=0,zx=function(){return!!Sa},qx=250,Ux={attributes:!0,characterData:!0,childList:!0,subtree:!0},Vl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Hl=function(e){return e===void 0&&(e=0),Date.now()+e},Ki=!1,Wx=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=qx),!Ki){Ki=!0;var r=Hl(t);Lx(function(){var a=!1;try{a=Ix()}finally{if(Ki=!1,t=r-Hl(),!zx())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,Ux)};document.body?n():Or.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Vl.forEach(function(n){return Or.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Vl.forEach(function(n){return Or.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),qs=new Wx,Kl=function(e){!Sa&&e>0&&qs.start(),Sa+=e,!Sa&&qs.stop()},Vx=function(e){return!No(e)&&!jx(e)&&getComputedStyle(e).display==="inline"},Hx=function(){function e(t,n){this.target=t,this.observedBox=n||Vr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=$f(this.target,this.observedBox,!0);return Vx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Kx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ga=new WeakMap,Zl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},va=function(){function e(){}return e.connect=function(t,n){var r=new Kx(t,n);ga.set(t,r)},e.observe=function(t,n,r){var a=ga.get(t),i=a.observationTargets.length===0;Zl(a.observationTargets,n)<0&&(i&&Fn.push(a),a.observationTargets.push(new Hx(n,r&&r.box)),Kl(1),qs.schedule())},e.unobserve=function(t,n){var r=ga.get(t),a=Zl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Fn.splice(Fn.indexOf(r),1),r.observationTargets.splice(a,1),Kl(-1))},e.disconnect=function(t){var n=this,r=ga.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Zx=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.");va.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(!zl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");va.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(!zl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");va.unobserve(this,t)},e.prototype.disconnect=function(){va.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),ln={};Object.defineProperty(ln,"__esModule",{value:!0});var Yx=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Zi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},qf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Yx?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Io={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 ba=1;ba<20;ba++)Io["f"+ba]=111+ba;function bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Uf(s,t)}),a=function(o){return r.some(function(l){return Wf(l,o)})},i=n==null?a:a(n);return i}function Gx(e,t){return bi(e,t)}function Qx(e,t){return bi(e,{byKey:!0},t)}function Uf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Zi)r[Zi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var v=Ro(p),f=Zi[v];if(p.length>1&&!f&&!qf[p]&&!Io[v])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=v:r.which=Vf(p)),f&&(r[f]=m?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Wf(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 Vf(e){e=Ro(e);var t=Io[e]||e.toUpperCase().charCodeAt(0);return t}function Ro(e){return e=e.toLowerCase(),e=qf[e]||e,e}var Jx=ln.default=bi,Yi=ln.isHotkey=bi;ln.isCodeHotkey=Gx;ln.isKeyHotkey=Qx;ln.parseHotkey=Uf;ln.compareHotkey=Wf;ln.toKeyCode=Vf;ln.toKeyName=Ro;function Xx(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 lr(e,t){if(e==null)return{};var n=Xx(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Hr(e){"@babel/helpers - typeof";return Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(e)}function e1(e,t){if(Hr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Hr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function t1(e){var t=e1(e,"string");return Hr(t)==="symbol"?t:String(t)}function Pt(e,t,n){return t=t1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $o=y.createContext(null),xn=()=>{var e=y.useContext($o);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Hf=parseInt(y.version.split(".")[0],10),n1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Yl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ht=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Qn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Br=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),r1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Kf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),a1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),i1=ht&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),s1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),o1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),u1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ja=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cn=(!a1||!i1)&&!r1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Lo=new WeakMap,zo=new WeakMap,Zf=new WeakMap,Oa=new WeakMap,Us=new WeakMap,Kr=new WeakMap,Bn=new WeakMap,Xa=new WeakMap,yi=new WeakMap,Ws=new WeakMap,gn=new WeakMap,kn=new WeakMap,Pr=new WeakMap,Vs=new WeakMap,qo=new WeakMap,$t=new WeakMap,tn=new WeakMap,bt=new WeakMap,fn=new WeakMap,hn=new WeakMap,Yf=new WeakMap,cr=Symbol("placeholder"),Gf=Symbol("mark-placeholder"),l1=globalThis.Text,Uo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,c1=e=>vn(e)&&e.nodeType===8,Ot=e=>vn(e)&&e.nodeType===1,vn=e=>{var t=Uo(e);return!!t&&e instanceof t.Node},Hs=e=>{var t=e&&e.anchorNode&&Uo(e.anchorNode);return!!t&&e instanceof t.Selection},Qf=e=>vn(e)&&e.nodeType===3,d1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,f1=e=>{var[t,n]=e;if(Ot(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Jf(t,a,r?"backward":"forward"),r=a<n;Ot(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=m1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},h1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Jf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(c1(a)||Ot(a)&&a.childNodes.length===0||Ot(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]},m1=(e,t,n)=>{var[r]=Jf(e,t,n);return r},Xf=e=>{var t="";if(Qf(e)&&e.nodeValue)return e.nodeValue;if(Ot(e)){for(var n of Array.from(e.childNodes))t+=Xf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
- `)}return t},p1=/data-slate-fragment="(.+?)"/m,g1=e=>{var t=e.getData("text/html"),[,n]=t.match(p1)||[];return n},Wo=(e,t,n)=>{var{target:r}=t;if(Ot(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:Wo(e,i,n)},v1=0;class b1{constructor(){Pt(this,"id",void 0),this.id="".concat(v1++)}}var ee={androidPendingDiffs:e=>bt.get(e),androidScheduleFlush:e=>{var t;(t=qo.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);gn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&J.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var h=x.range(e,d);return h}}var p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var v=m.caretPositionFromPoint(n,r);v&&(p=m.createRange(),p.setStart(v.offsetNode,v.offset),p.setEnd(v.offsetNode,v.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Xa.get(t);return n||(n=new b1,Xa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=zo.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=Lo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(rt.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!gn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(J.select(t,x.start(t,[])),t.onChange()),gn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Zf.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=ee.toDOMNode(t,t),s;try{s=Ot(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>vn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>vn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!kn.get(e),isFocused:e=>!!gn.get(e),isReadOnly:e=>!!Ws.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ws.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=yi.get(e),r=x.isEditor(t)?Oa.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(rt.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=ee.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),v=o+m,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];a=[g instanceof l1?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var w=Math.min(h,Math.max(0,t.offset-o));a=[d,w];break}o=v}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(rt.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Y.isBackward(t),i=ee.toDOMPoint(e,n),s=Y.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,p]=a?i:s,m=Ot(u)?u:u.parentElement,v=!!m.getAttribute("data-slate-zero-width"),f=Ot(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(h,b?1:p),l},toSlateNode:(e,t)=>{var n=Ot(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Kr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:f1(t),o=i.parentNode,l=null,u=0;if(o){var d,h,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),v=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var g=ee.getWindow(e),w=g.document.createRange();w.setStart(l,0),w.setEnd(i,s);var E=w.cloneContents(),B=[...Array.prototype.slice.call(E.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(E.querySelectorAll("[contenteditable=false]"))];B.forEach(O=>{if(ht&&!r&&O.hasAttribute("data-slate-zero-width")&&O.textContent.length>0&&O.textContext!=="\uFEFF"){O.textContent.startsWith("\uFEFF")&&(O.textContent=O.textContent.slice(1));return}O.parentNode.removeChild(O)}),u=E.textContent.length,b=l}}else if(v){for(var D=v.querySelectorAll("[data-slate-leaf]"),k=0;k<D.length;k++){var T=D[k];if(ee.hasDOMNode(e,T)){f=T;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(O=>{u-=O.textContent.length})):u=1}b&&u===b.textContent.length&&ht&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Qn&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
71
+ */function Xu(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return Xu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Xu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var kf=Symbol.for("immer-nothing"),el=Symbol.for("immer-draftable"),kt=Symbol.for("immer-state"),zb=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 Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=zb[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 dr=Object.getPrototypeOf;function Mn(e){return!!e&&!!e[kt]}function Nn(e){var t;return e?Ff(e)||Array.isArray(e)||!!e[el]||!!((t=e.constructor)!=null&&t[el])||pi(e)||gi(e):!1}var qb=Object.prototype.constructor.toString();function Ff(e){if(!e||typeof e!="object")return!1;const t=dr(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)===qb}function Ya(e,t){hi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function hi(e){const t=e[kt];return t?t.type_:Array.isArray(e)?1:pi(e)?2:gi(e)?3:0}function Ps(e,t){return hi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Af(e,t,n){const r=hi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Ub(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function pi(e){return e instanceof Map}function gi(e){return e instanceof Set}function Fn(e){return e.copy_||e.base_}function Ms(e,t){if(pi(e))return new Map(e);if(gi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ff(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[kt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(dr(e),r)}else{const r=dr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function Ao(e,t=!1){return vi(e)||Mn(e)||!Nn(e)||(hi(e)>1&&(e.set=e.add=e.clear=e.delete=Wb),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ao(r,!0))),e}function Wb(){Ct(2)}function vi(e){return Object.isFrozen(e)}var Vb={};function Rn(e){const t=Vb[e];return t||Ct(0,e),t}var Ur;function Bf(){return Ur}function Hb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tl(e,t){t&&(Rn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ns(e){Rs(e),e.drafts_.forEach(Kb),e.drafts_=null}function Rs(e){e===Ur&&(Ur=e.parent_)}function nl(e){return Ur=Hb(Ur,e)}function Kb(e){const t=e[kt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function rl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[kt].modified_&&(Ns(t),Ct(4)),Nn(e)&&(e=Ga(t,e),t.parent_||Qa(t,e)),t.patches_&&Rn("Patches").generateReplacementPatches_(n[kt].base_,e,t.patches_,t.inversePatches_)):e=Ga(t,n,[]),Ns(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kf?e:void 0}function Ga(e,t,n){if(vi(t))return t;const r=t[kt];if(!r)return Ya(t,(a,i)=>al(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Qa(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),Ya(i,(o,l)=>al(e,r,a,o,l,n,s)),Qa(e,a,!1),n&&e.patches_&&Rn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function al(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&Ct(5),Mn(a)){const o=i&&t&&t.type_!==3&&!Ps(t.assigned_,r)?i.concat(r):void 0,l=Ga(e,a,o);if(Af(n,r,l),Mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Nn(a)&&!vi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ga(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Qa(e,a)}}function Qa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ao(t,n)}function Zb(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Bf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Bo;n&&(a=[r],i=Wr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Bo={get(e,t){if(t===kt)return e;const n=Fn(e);if(!Ps(n,t))return Yb(e,n,t);const r=n[t];return e.finalized_||!Nn(r)?r:r===qi(e.base_,t)?(Ui(e),e.copy_[t]=$s(r,e)):r},has(e,t){return t in Fn(e)},ownKeys(e){return Reflect.ownKeys(Fn(e))},set(e,t,n){const r=Tf(Fn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=qi(Fn(e),t),i=a==null?void 0:a[kt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Ub(n,a)&&(n!==void 0||Ps(e.base_,t)))return!0;Ui(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 qi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ui(e),Is(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Fn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return dr(e.base_)},setPrototypeOf(){Ct(12)}},Wr={};Ya(Bo,(e,t)=>{Wr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),Wr.set.call(this,e,t,void 0)};Wr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),Bo.set.call(this,e[0],t,n,e[0])};function qi(e,t){const n=e[kt];return(n?Fn(n):e)[t]}function Yb(e,t,n){var a;const r=Tf(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Tf(e,t){if(!(t in e))return;let n=dr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=dr(n)}}function Is(e){e.modified_||(e.modified_=!0,e.parent_&&Is(e.parent_))}function Ui(e){e.copy_||(e.copy_=Ms(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Gb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let a;if(Nn(t)){const i=nl(this),s=$s(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Ns(i):Rs(i)}return tl(i,r),rl(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===kf&&(a=void 0),this.autoFreeze_&&Ao(a,!0),r){const i=[],s=[];Rn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else Ct(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){Nn(e)||Ct(8),Mn(e)&&(e=Qb(e));const t=nl(this),n=$s(e,void 0);return n[kt].isManual_=!0,Rs(t),n}finishDraft(e,t){const n=e&&e[kt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return tl(r,t),rl(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=Rn("Patches").applyPatches_;return Mn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function $s(e,t){const n=pi(e)?Rn("MapSet").proxyMap_(e,t):gi(e)?Rn("MapSet").proxySet_(e,t):Zb(e,t);return(t?t.scope_:Bf()).drafts_.push(n),n}function Qb(e){return Mn(e)||Ct(10,e),Sf(e)}function Sf(e){if(!Nn(e)||vi(e))return e;const t=e[kt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ms(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ms(e,!0);return Ya(n,(r,a)=>{Af(n,r,Sf(a))}),t&&(t.finalized_=!1),n}var Ft=new Gb,To=Ft.produce;Ft.produceWithPatches.bind(Ft);Ft.setAutoFreeze.bind(Ft);Ft.setUseStrictShallowCopy.bind(Ft);Ft.applyPatches.bind(Ft);var il=Ft.createDraft.bind(Ft),sl=Ft.finishDraft.bind(Ft),Jb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=R.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Xb={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Fe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},e0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Y.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ja=new WeakMap,Xa=new WeakMap,Pr=new WeakMap,jf=new WeakMap,ol=new WeakMap,ul=new WeakMap,ll=new WeakMap,R={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=R.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return R.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return R.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return R.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return R.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&R.compare(e,t)===0},isBefore(e,t){return R.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&R.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&R.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&R.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&R.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&R.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!R.isAncestor(t,e)&&!R.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(R.equals(i,r)||R.endsBefore(i,r)||R.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(R.equals(s,r)||R.isAncestor(s,r))return null;R.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;R.equals(o,r)||R.endsBefore(o,r)?r[o.length-1]-=1:R.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(R.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else R.endsBefore(u,r)?r[u.length-1]+=1:R.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:m,newPath:h}=t;if(R.equals(m,h))return r;if(R.isAncestor(m,r)||R.equals(m,r)){var p=h.slice();return R.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else R.isSibling(m,h)&&(R.isAncestor(h,r)||R.equals(h,r))?R.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:R.endsBefore(h,r)||R.equals(h,r)||R.isAncestor(h,r)?(R.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):R.endsBefore(m,r)&&(R.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Vr(e){"@babel/helpers - typeof";return Vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vr(e)}function t0(e,t){if(Vr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function n0(e){var t=t0(e,"string");return Vr(t)==="symbol"?t:String(t)}function gt(e,t,n){return t=n0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var r0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=le.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 Y.points(t))t[l]=Fe.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var h=le.leaf(e,u),p=h.text.slice(0,d),v=h.text.slice(d);if(h.text=p+m+v,t)for(var[f,b]of Y.points(t))t[b]=Fe.transform(f,n);break}case"merge_node":{var{path:g}=n,C=le.get(e,g),D=R.previous(g),F=le.get(e,D),E=le.parent(e,g),_=g[g.length-1];if(ge.isText(C)&&ge.isText(F))F.text+=C.text;else if(!ge.isText(C)&&!ge.isText(F))F.children.push(...C.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(at.stringify(C)," ").concat(at.stringify(F)));if(E.children.splice(_,1),t)for(var[T,I]of Y.points(t))t[I]=Fe.transform(T,n);break}case"move_node":{var{path:P,newPath:z}=n;if(R.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var $=le.get(e,P),B=le.parent(e,P),A=P[P.length-1];B.children.splice(A,1);var O=R.transform(P,n),j=le.get(e,R.parent(O)),U=O[O.length-1];if(j.children.splice(U,0,$),t)for(var[W,re]of Y.points(t))t[re]=Fe.transform(W,n);break}case"remove_node":{var{path:ne}=n,w=ne[ne.length-1],Q=le.parent(e,ne);if(Q.children.splice(w,1),t)for(var[se,k]of Y.points(t)){var M=Fe.transform(se,n);if(t!=null&&M!=null)t[k]=M;else{var q=void 0,S=void 0;for(var[L,G]of le.texts(e))if(R.compare(G,ne)===-1)q=[L,G];else{S=[L,G];break}var K=!1;q&&S&&(R.equals(S[1],ne)?K=!R.hasPrevious(S[1]):K=R.common(q[1],ne).length<R.common(S[1],ne).length),q&&!K?(se.path=q[1],se.offset=q[0].text.length):S?(se.path=S[1],se.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:ce,text:J}=n;if(J.length===0)break;var he=le.leaf(e,te),pe=he.text.slice(0,ce),we=he.text.slice(ce+J.length);if(he.text=pe+we,t)for(var[Me,je]of Y.points(t))t[je]=Fe.transform(Me,n);break}case"set_node":{var{path:Je,properties:Ue,newProperties:Le}=n;if(Je.length===0)throw new Error("Cannot set properties on the root node!");var Xe=le.get(e,Je);for(var _e in Le){if(_e==="children"||_e==="text")throw new Error('Cannot set the "'.concat(_e,'" property of nodes!'));var Oe=Le[_e];Oe==null?delete Xe[_e]:Xe[_e]=Oe}for(var We in Ue)Le.hasOwnProperty(We)||delete Xe[We];break}case"set_selection":{var{newProperties:Z}=n;if(Z==null)t=Z;else{if(t==null){if(!Y.isRange(Z))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(Z)," when there is no current selection."));t=kr({},Z)}for(var oe in Z){var ie=Z[oe];if(ie==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=ie}}break}case"split_node":{var{path:me,position:ve,properties:ke}=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 ze=le.get(e,me),ot=le.parent(e,me),At=me[me.length-1],vt;if(ge.isText(ze)){var tt=ze.text.slice(0,ve),xe=ze.text.slice(ve);ze.text=tt,vt=kr(kr({},ke),{},{text:xe})}else{var Be=ze.children.slice(0,ve),Rt=ze.children.slice(ve);ze.children=Be,vt=kr(kr({},ke),{},{children:Rt})}if(ot.children.splice(At+1,0,vt),t)for(var[bt,_n]of Y.points(t))t[_n]=Fe.transform(bt,n);break}}return t},a0={transform(e,t){e.children=il(e.children);var n=e.selection&&il(e.selection);try{n=r0(e,n,t)}finally{e.children=sl(e.children),n?e.selection=Mn(n)?sl(n):n:e.selection=null}}},i0={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)}},s0={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)}},Of=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Of(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 o0(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 sn(e,t){if(e==null)return{};var n=o0(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 u0=["anchor","focus"];function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function l0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Y={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Y.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Y.edges(e);return t},equals(e,t){return Fe.equals(e.anchor,t.anchor)&&Fe.equals(e.focus,t.focus)},includes(e,t){if(Y.isRange(t)){if(Y.includes(e,t.anchor)||Y.includes(e,t.focus))return!0;var[n,r]=Y.edges(e),[a,i]=Y.edges(t);return Fe.isBefore(n,a)&&Fe.isAfter(r,i)}var[s,o]=Y.edges(e),l=!1,u=!1;return Fe.isPoint(t)?(l=Fe.compare(t,s)>=0,u=Fe.compare(t,o)<=0):(l=R.compare(t,s.path)>=0,u=R.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=sn(e,u0),[r,a]=Y.edges(e),[i,s]=Y.edges(t),o=Fe.isBefore(r,i)?i:r,l=Fe.isBefore(a,s)?a:s;return Fe.isBefore(l,o)?null:l0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Fe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Fe.equals(t,n)},isExpanded(e){return!Y.isCollapsed(e)},isForward(e){return!Y.isBackward(e)},isRange(e){return st(e)&&Fe.isPoint(e.anchor)&&Fe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Y.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return To(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Y.isCollapsed(r);Y.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Y.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Fe.transform(r.anchor,t,{affinity:i}),u=Fe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},fl=e=>st(e)&&le.isNodeList(e.children)&&!x.isEditor(e),fe={isAncestor(e){return st(e)&&le.isNodeList(e.children)},isElement:fl,isElementList(e){return Array.isArray(e)&&e.every(t=>fe.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 fl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},c0=["children"],d0=["text"],ml=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(ge.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(at.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of R.ancestors(t,n)){var a=le.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(ge.isText(e))throw new Error("Cannot get the child of a text node: ".concat(at.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(at.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=le.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=le.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=R.common(t,n),a=le.get(e,r);return[a,r]},descendant(e,t){var n=le.get(e,t);if(x.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(at.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.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 le.nodes(e,t))fe.isElement(n)&&(yield[n,r])}()},extractProps(e){if(fe.isAncestor(e)){var t=sn(e,c0);return t}else{var t=sn(e,d0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(ge.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=To({children:e.children},r=>{var[a,i]=Y.edges(t),s=le.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!Y.includes(t,p)}});for(var[,o]of s){if(!Y.includes(t,o)){var l=le.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(R.equals(o,i.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(R.equals(o,a.path)){var m=le.leaf(r,o);m.text=m.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(ge.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(ge.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return ge.isText(e)||fe.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=ml.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return ml.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.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=le.get(e,t);if(!ge.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(at.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of R.levels(t,n)){var a=le.get(e,r);yield[a,r]}}()},matches(e,t){return fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||ge.isText(e)&&ge.isTextProps(t)&&ge.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?R.isBefore(o,i):R.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!ge.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;R.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=le.get(e,o);continue}if(o.length===0)break;if(!r){var d=R.next(o);if(le.has(e,d)){o=d,l=le.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=R.previous(o);o=m,l=le.get(e,o);continue}o=R.parent(o),l=le.get(e,o),s.add(l)}}()},parent(e,t){var n=R.parent(t),r=le.get(e,n);if(ge.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 ge.isText(e)?e.text:e.children.map(le.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))ge.isText(n)&&(yield[n,r])}()}};function hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var vn={isNodeOperation(e){return vn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!st(e))return!1;switch(e.type){case"insert_node":return R.isPath(e.path)&&le.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&R.isPath(e.path);case"merge_node":return typeof e.position=="number"&&R.isPath(e.path)&&st(e.properties);case"move_node":return R.isPath(e.path)&&R.isPath(e.newPath);case"remove_node":return R.isPath(e.path)&&le.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&R.isPath(e.path);case"set_node":return R.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&Y.isRange(e.newProperties)||e.newProperties===null&&Y.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return R.isPath(e.path)&&typeof e.position=="number"&&st(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>vn.isOperation(t))},isSelectionOperation(e){return vn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return vn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ze(Ze({},e),{},{type:"remove_node"});case"insert_text":return Ze(Ze({},e),{},{type:"remove_text"});case"merge_node":return Ze(Ze({},e),{},{type:"split_node",path:R.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(R.equals(t,n))return e;if(R.isSibling(n,t))return Ze(Ze({},e),{},{path:t,newPath:n});var r=R.transform(n,e),a=R.transform(R.next(n),e);return Ze(Ze({},e),{},{path:r,newPath:a})}case"remove_node":return Ze(Ze({},e),{},{type:"insert_node"});case"remove_text":return Ze(Ze({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ze(Ze({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ze(Ze({},e),{},{properties:l,newProperties:null}):l==null?Ze(Ze({},e),{},{properties:null,newProperties:o}):Ze(Ze({},e),{},{properties:l,newProperties:o})}case"split_node":return Ze(Ze({},e),{},{type:"merge_node",path:R.next(e.path)})}}},pl=new WeakMap,f0=e=>{var t=pl.get(e);if(t!==void 0)return t;if(!st(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||st(e.marks))&&(e.selection===null||Y.isRange(e.selection))&&le.isNodeList(e.children)&&vn.isOperationList(e.operations);return pl.set(e,n),n},x={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return f0(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)}},m0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(R.isPath)}};function gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function vl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Fe={compare(e,t){var n=R.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Fe.compare(e,t)===1},isBefore(e,t){return Fe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&R.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&R.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return To(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=R.transform(i,t,n);break}case"insert_text":{R.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{R.equals(t.path,i)&&(r.offset+=t.position),r.path=R.transform(i,t,n);break}case"remove_text":{R.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(R.equals(t.path,i)||R.isAncestor(t.path,i))return null;r.path=R.transform(i,t,n);break}case"split_node":{if(R.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=R.transform(i,t,vl(vl({},n),{},{affinity:"forward"})))}else r.path=R.transform(i,t,n);break}}})}},bl=void 0,at={setScrubber(e){bl=e},stringify(e){return JSON.stringify(e,bl)}},h0=["text"],p0=["anchor","focus"];function yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ge={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=sn(i,h0);return s}return Of(r?a(e):e,r?a(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>ge.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=[tn({},e)];for(var r of t){var a=sn(r,p0),[i,s]=Y.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:h}=m.text,p=l;if(l+=h,u<=p&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(m);continue}var v=m,f=void 0,b=void 0;if(d<l){var g=d-p;b=tn(tn({},v),{},{text:v.text.slice(g)}),v=tn(tn({},v),{},{text:v.text.slice(0,g)})}if(u>p){var C=u-p;f=tn(tn({},v),{},{text:v.text.slice(0,C)}),v=tn(tn({},v),{},{text:v.text.slice(C)})}Object.assign(v,a),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},So=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],br=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},jo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?C0(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var h=O0(d,m);if([i,s]=r?[s,h]:[h,i],Xn(i,De.ZWJ)&&Xn(s,De.ExtPict)&&(r?l=xl(t.substring(0,o)):l=xl(t.substring(0,t.length-o)),!l)||Xn(i,De.RI)&&Xn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=I0(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&M0(i,s))break;o+=d.length}return o||1},g0=/\s/,v0=/[\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]/,b0=/['\u2018\u2019]/,y0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=jo(t,n),[s,o]=Oo(t,i,n);if(x0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Oo=(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)]},x0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(g0.test(t))return!1;if(b0.test(t)){var a=jo(n,r),[i,s]=Oo(n,a,r);if(e(i,s,r))return!0}return!v0.test(t)},C0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(w0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(D0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},D0=e=>e>=55296&&e<=56319,w0=e=>e>=56320&&e<=57343,De;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(De||(De={}));var E0=/^(?:[\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])$/,_0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,k0=/^(?:[\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])$/,F0=/^[\u1100-\u115F\uA960-\uA97C]$/,A0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,B0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,T0=/^[\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]$/,S0=/^[\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]$/,j0=/^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/,O0=(e,t)=>{var n=De.Any;return e.search(E0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(_0)!==-1&&(n|=De.Prepend),e.search(k0)!==-1&&(n|=De.SpacingMark),e.search(F0)!==-1&&(n|=De.L),e.search(A0)!==-1&&(n|=De.V),e.search(B0)!==-1&&(n|=De.T),e.search(T0)!==-1&&(n|=De.LV),e.search(S0)!==-1&&(n|=De.LVT),e.search(j0)!==-1&&(n|=De.ExtPict),n};function Xn(e,t){return(e&t)!==0}var P0=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function M0(e,t){return P0.findIndex(n=>Xn(e,n[0])&&Xn(t,n[1]))===-1}var N0=/(?:[\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$/,xl=e=>e.search(N0)!==-1,R0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,I0=e=>{var t=e.match(R0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},$0={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=So(e)}=n;if(R.isPath(a)&&(a=x.range(e,a)),Y.isRange(a))if(Y.isCollapsed(a))a=a.anchor;else{var i=Y.end(a);if(!r&&x.void(e,{at:i}))return;var s=Y.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:m,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function Cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=ha(ha(ha(ha({},a0),i0),s0),$0),Sa=new WeakMap,L0=e=>Sa.get(e)||!1,z0=(e,t,n)=>{var r=Sa.get(e)||!1;Sa.set(e,!0);try{t(),n()}finally{Sa.set(e,r)}};function Pf(e,t,n){var r=Ja.get(e)||[],a=Xa.get(e)||new Set,i,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Ja.set(e,i),Xa.set(e,s)}var q0=(e,t)=>{for(var n of x.pathRefs(e))Jb.transform(n,t);for(var r of x.pointRefs(e))Xb.transform(r,t);for(var a of x.rangeRefs(e))e0.transform(a,t);if(!L0(e)){var i=R.operationCanTransformPath(t)?s=>R.transform(s,t):void 0;Pf(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Pr.get(e)||(Pr.set(e,!0),Promise.resolve().then(()=>{Pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},U0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return R.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=R.levels(a),s=ge.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,$]=z;return a.concat($)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=R.ancestors(o),u=R.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:m}=t;if(R.equals(d,m))return[];var h=[],p=[];for(var v of R.ancestors(d)){var f=R.transform(v,t);h.push(f)}for(var b of R.ancestors(m)){var g=R.transform(b,t);p.push(g)}var C=p[p.length-1],D=m[m.length-1],F=C.concat(D);return[...h,...p,F]}case"remove_node":{var{path:E}=t,_=R.ancestors(E);return[..._]}case"split_node":{var{path:T}=t,I=R.levels(T),P=R.next(T);return[...I,P]}default:return[]}},W0=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},V0=(e,t)=>{var[n,r]=t;if(!ge.isText(n)){if(fe.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:fe.isElement(n)&&(e.isInline(n)||n.children.length===0||ge.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=le.get(e,r);if(!ge.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,h=ge.isText(u)||fe.isElement(u)&&e.isInline(u);if(h!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(fe.isElement(u)){if(e.isInline(u)){if(d==null||!ge.isText(d)){var p={text:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var v={text:""};X.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&ge.isText(d)&&(ge.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},H0=(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},K0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!ge.isText(u)){if(Y.isRange(i)){if(R.isAncestor(d,i.anchor.path)&&R.isAncestor(d,i.focus.path))return[u,d]}else if(!R.equals(o,d))return[u,d]}}};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z0=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,h)=>{if(!ge.isText(m))return!1;var[p,v]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=Y.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=wl(wl({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Pr.get(e)||e.onChange()}}};function El(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?El(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):El(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Y0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,_l(_l({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Fl(Fl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Q0=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},J0=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&X.delete(e,{unit:t})},X0=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Y.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},ey=(e,t)=>[x.start(e,t),x.end(e,t)];function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Bl(Bl({},n),{},{match:r=>fe.isElement(r)&&x.isElementReadOnly(t,r)}))},ny=(e,t)=>x.point(e,t,{edge:"end"}),ry=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},ay=(e,t)=>{var n=x.range(e,t);return le.fragment(e,n)};function Tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var iy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Sl(Sl({},n),{},{match:r=>fe.isElement(r)&&x.isVoid(t,r)}))},sy=(e,t)=>t.children.some(n=>fe.isElement(n)&&x.isBlock(e,n)),oy=(e,t)=>t.children.some(n=>ge.isText(n)||x.isInline(e,n)),uy=(e,t)=>le.has(e,t),ly=(e,t)=>t.children.every(n=>ge.isText(n)),cy=e=>{X.splitNodes(e,{always:!0})},dy=(e,t,n)=>{X.insertNodes(e,t,n)},fy=e=>{X.splitNodes(e,{always:!0})};function jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function my(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var hy=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=my({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},py=(e,t)=>!e.isInline(t),gy=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),vy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&ge.isText(r)&&r.text===""&&!e.isVoid(t)},by=(e,t,n)=>{var r=x.end(e,n);return Fe.equals(t,r)},yy=e=>{var t=jf.get(e);return t===void 0?!0:t},xy=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return Fe.equals(t,r)},Cy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},Dy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.leaf(t,a);return[i,a]};function wy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of le.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&fe.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Ey=["text"],_y=["text"],ky=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Y.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:ge.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=sn(u,Ey);return d}else return{}}var{path:m}=a,[h]=x.leaf(t,m);if(a.offset===0){var p=x.previous(t,{at:m,match:ge.isText}),v=x.above(t,{match:F=>fe.isElement(F)&&x.isVoid(t,F)&&t.markableVoid(F)});if(!v){var f=x.above(t,{match:F=>fe.isElement(F)&&x.isBlock(t,F)});if(p&&f){var[b,g]=p,[,C]=f;R.isAncestor(C,g)&&(h=b)}}}var D=sn(h,_y);return D},Fy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(R.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(R.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},Ay=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.get(t,a);return[i,a]};function By(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(m0.isSpan(n))u=n[0],d=n[1];else{var m=x.path(e,n,{edge:"start"}),h=x.path(e,n,{edge:"end"});u=i?h:m,d=i?m:h}var p=le.nodes(e,{reverse:i,from:u,to:d,pass:F=>{var[E]=F;return fe.isElement(E)?!!(!s&&(x.isVoid(e,E)||x.isElementReadOnly(e,E))||o&&!x.isSelectable(e,E)):!1}}),v=[],f;for(var[b,g]of p)if(!(o&&fe.isElement(b)&&!x.isSelectable(e,b))){var C=f&&R.compare(g,f[1])===0;if(!(r==="highest"&&C)){if(!l(b,g)){if(a&&!C&&ge.isText(b))return;continue}if(r==="lowest"&&C){f=[b,g];continue}var D=r==="lowest"?f:[b,g];D&&(a?v.push(D):yield D),f=[b,g]}}r==="lowest"&&f&&(a?v.push(f):yield f),a&&(yield*v)}}()}var Ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Ja.get(d)||[],s=d=>Xa.get(d)||new Set,o=d=>{var m=i(d).pop(),h=m.join(",");return s(d).delete(h),m};if(x.isNormalizing(t)){if(r){var l=Array.from(le.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));Ja.set(t,l),Xa.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(le.has(t,d)){var m=x.node(t,d),[h,p]=m;fe.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:a})}for(var v=i(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var g=o(t);if(le.has(t,g)){var C=x.node(t,g);t.normalizeNode(C,{operation:a})}b++,v=i(t)}})}},Sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=R.parent(a),s=x.node(t,i);return s},jy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},Oy=e=>{var t=ol.get(e);return t||(t=new Set,ol.set(e,t)),t},Py=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(R.isPath(n)){if(i==="start"){var[,s]=le.first(t,n);n=s}else if(i==="end"){var[,o]=le.last(t,n);n=o}}return Y.isRange(n)&&(i==="start"?n=Y.start(n):i==="end"?n=Y.end(n):n=R.common(n.anchor.path,n.focus.path)),Fe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},My=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},Ny=e=>{var t=ul.get(e);return t||(t=new Set,ul.set(e,t)),t},Ry=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(R.isPath(n)){var i;if(a==="end"){var[,s]=le.last(t,n);i=s}else{var[,o]=le.first(t,n);i=o}var l=le.get(t,i);if(!ge.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(Y.isRange(n)){var[u,d]=Y.edges(n);return a==="start"?u:d}return n};function Iy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=Y.edges(o),d=a?u:l,m=!1,h="",p=0,v=0,f=0;for(var[b,g]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(fe.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,g);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var C=R.isAncestor(g,u.path)?u:x.end(e,g),D=R.isAncestor(g,l.path)?l:x.start(e,g);h=x.string(e,{anchor:D,focus:C},{voids:i}),m=!0}}if(ge.isText(b)){var F=R.equals(g,d.path);for(F?(v=a?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=a?v:0),(F||m||r==="offset")&&(yield{path:g,offset:f},m=!1);;){if(p===0){if(h==="")break;p=E(h,r,a),h=Oo(h,p,a)[1]}if(f=a?f-p:f+p,v=v-p,v<0){p=-v;break}p=0,yield{path:g,offset:f}}}}function E(_,T,I){return T==="character"?jo(_,I):T==="word"?y0(_,I):T==="line"||T==="block"?_.length:1}}()}var $y=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(R.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(R.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},Ly=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},zy=e=>{var t=ll.get(e);return t||(t=new Set,ll.set(e,t)),t},qy=(e,t,n)=>{if(Y.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Uy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ol(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Wy=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!ge.isText(d))return!1;var[h,p]=x.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},a=Y.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Uy({},x.marks(e)||{});delete u[t],e.marks=u,Pr.get(e)||e.onChange()}}},Vy=(e,t)=>{jf.set(e,t)},Hy=(e,t)=>x.point(e,t,{edge:"start"}),Ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=Y.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:ge.isText,voids:a})){var m=u.text;R.equals(d,o.path)&&(m=m.slice(0,o.offset)),R.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},Zy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Y.edges(n);if(i.offset!==0||s.offset!==0||Y.isCollapsed(n)||R.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:v=>fe.isElement(v)&&x.isBlock(t,v),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},m=!0;for(var[h,p]of x.nodes(t,{at:d,match:ge.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(h.text!==""||R.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:i,focus:s}},Yy=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},Gy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(Y.isRange(u)&&Y.isCollapsed(u)&&(m=!0,u=u.anchor),Fe.isPoint(u)){var h=x.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var v={unit:s,distance:o},f=i?x.before(t,u,v)||x.start(t,[]):x.after(t,u,v)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(R.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!Y.isCollapsed(u)){if(!d){var[,b]=Y.edges(u),g=x.end(t,[]);Fe.equals(b,g)||(u=x.unhangRange(t,u,{voids:l}))}var[C,D]=Y.edges(u),F=x.above(t,{match:pe=>fe.isElement(pe)&&x.isBlock(t,pe),at:C,voids:l}),E=x.above(t,{match:pe=>fe.isElement(pe)&&x.isBlock(t,pe),at:D,voids:l}),_=F&&E&&!R.equals(F[1],E[1]),T=R.equals(C.path,D.path),I=l?null:(r=x.void(t,{at:C,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:C,mode:"highest"}),P=l?null:(a=x.void(t,{at:D,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:D,mode:"highest"});if(I){var z=x.before(t,C);z&&F&&R.isAncestor(F[1],z.path)&&(C=z)}if(P){var $=x.after(t,D);$&&E&&R.isAncestor(E[1],$.path)&&(D=$)}var B=[],A;for(var O of x.nodes(t,{at:u,voids:l})){var[j,U]=O;A&&R.compare(U,A)===0||(!l&&fe.isElement(j)&&(x.isVoid(t,j)||x.isElementReadOnly(t,j))||!R.isCommon(U,C.path)&&!R.isCommon(U,D.path))&&(B.push(O),A=U)}var W=Array.from(B,pe=>{var[,we]=pe;return x.pathRef(t,we)}),re=x.pointRef(t,C),ne=x.pointRef(t,D),w="";if(!T&&!I){var Q=re.current,[se]=x.leaf(t,Q),{path:k}=Q,{offset:M}=C,q=se.text.slice(M);q.length>0&&(t.apply({type:"remove_text",path:k,offset:M,text:q}),w=q)}if(W.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>X.removeNodes(t,{at:pe,voids:l})),!P){var S=ne.current,[L]=x.leaf(t,S),{path:G}=S,K=T?C.offset:0,te=L.text.slice(K,D.offset);te.length>0&&(t.apply({type:"remove_text",path:G,offset:K,text:te}),w=te)}!T&&_&&ne.current&&re.current&&X.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),m&&i&&s==="character"&&w.length>1&&w.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,w.slice(0,w.length-o));var ce=re.unref(),J=ne.unref(),he=i?ce||J:J||ce;n.at==null&&he&&X.select(t,he)}}})},Qy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=So(t),batchDirty:o=!0}=r;if(n.length){if(Y.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),Y.isCollapsed(s))s=s.anchor;else{var[,l]=Y.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else R.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:q=>fe.isElement(q)&&x.isInline(t,q),mode:"highest",voids:i});if(d){var[,m]=d;if(x.isEnd(t,s,m)){var h=x.after(t,m);s=h}else if(x.isStart(t,s,m)){var p=x.before(t,m);s=p}}var v=x.above(t,{match:q=>fe.isElement(q)&&x.isBlock(t,q),at:s,voids:i}),[,f]=v,b=x.isStart(t,s,f),g=x.isEnd(t,s,f),C=b&&g,D=!b||b&&g,F=!g,[,E]=le.first({children:n},[]),[,_]=le.last({children:n},[]),T=[],I=q=>{var[S,L]=q,G=L.length===0;return G?!1:C?!0:!(D&&R.isAncestor(L,E)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||F&&R.isAncestor(L,_)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var P of le.nodes({children:n},{pass:I}))I(P)&&T.push(P);var z=[],$=[],B=[],A=!0,O=!1;for(var[j]of T)fe.isElement(j)&&!t.isInline(j)?(A=!1,O=!0,$.push(j)):A?z.push(j):B.push(j);var[U]=x.nodes(t,{at:s,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:i}),[,W]=U,re=x.isStart(t,s,W),ne=x.isEnd(t,s,W),w=x.pathRef(t,g&&!B.length?R.next(f):f),Q=x.pathRef(t,ne?R.next(W):W);X.splitNodes(t,{at:s,match:q=>O?fe.isElement(q)&&x.isBlock(t,q):ge.isText(q)||x.isInline(t,q),mode:O?"lowest":"highest",always:O&&(!b||z.length>0)&&(!g||B.length>0),voids:i});var se=x.pathRef(t,!re||re&&ne?R.next(W):W);if(X.insertNodes(t,z,{at:se.current,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),C&&!z.length&&$.length&&!B.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,$,{at:w.current,match:q=>fe.isElement(q)&&x.isBlock(t,q),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,B,{at:Q.current,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:i,batchDirty:o}),!r.at){var k;if(B.length>0&&Q.current?k=R.previous(Q.current):$.length>0&&w.current?k=R.previous(w.current):se.current&&(k=R.previous(se.current)),k){var M=x.end(t,k);X.select(t,M)}}se.unref(),w.unref(),Q.unref()}}})},Jy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=Y.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=Y.edges(a);X.select(t,s)}}else return},Xy=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},ex=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=Y.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Y.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?x.before(t,l,d):x.after(t,l,d);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?x.before(t,u,d):x.after(t,u,d);p&&(m.focus=p)}X.setSelection(t,m)}},tx=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){X.setSelection(e,t);return}if(!Y.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(at.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nx=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=Y.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Y.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Ml(Ml({},l),n)})}},rx=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Fe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Fe.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})}},ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=So(t),d!==!1&&(d=!0)),d==null&&(d=!1),Y.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),Y.isCollapsed(l))l=l.anchor;else{var[,h]=Y.edges(l),p=x.pointRef(t,h);X.delete(t,{at:l}),l=p.unref()}if(Fe.isPoint(l)){u==null&&(ge.isText(m)?u=z=>ge.isText(z):t.isInline(m)?u=z=>ge.isText(z)||x.isInline(t,z):u=z=>fe.isElement(z)&&x.isBlock(t,z));var[v]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(v){var[,f]=v,b=x.pathRef(t,f),g=x.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var C=b.unref();l=g?R.next(C):C}else return}var D=R.parent(l),F=l[l.length-1];if(!(!i&&x.void(t,{at:D}))){if(o){var E=[],_=R.levels(D);z0(t,()=>{var z=function(){var A=D.concat(F);F++;var O={type:"insert_node",path:A,node:$};t.apply(O),l=R.next(l),E.push(O),ge.isText?_.push(...Array.from(le.nodes($),j=>{var[,U]=j;return A.concat(U)})):_.push(A)};for(var $ of n)z()},()=>{Pf(t,_,z=>{var $=z;for(var B of E)if(R.operationCanTransformPath(B)&&($=R.transform($,B),!$))return null;return $})})}else for(var T of n){var I=D.concat(F);F++,t.apply({type:"insert_node",path:I,node:T}),l=R.next(l)}if(l=R.previous(l),d){var P=x.end(t,l);P&&X.select(t,P)}}}})},ix=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=R.isPath(r)?br(t,r):F=>fe.isElement(F)&&x.isBlock(t,F)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,F=>{var[,E]=F;return x.pathRef(t,E)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var m=x.node(t,R.parent(d)),[h,p]=m,v=d[d.length-1],{length:f}=h.children;if(f===1){var b=R.next(p);X.moveNodes(t,{at:d,to:b,voids:i}),X.removeNodes(t,{at:p,voids:i})}else if(v===0)X.moveNodes(t,{at:d,to:p,voids:i});else if(v===f-1){var g=R.next(p);X.moveNodes(t,{at:d,to:g,voids:i})}else{var C=R.next(d),D=R.next(p);X.splitNodes(t,{at:C,voids:i}),X.moveNodes(t,{at:d,to:D,voids:i})}}}})},sx=["text"],ox=["children"],Mf=(e,t)=>{if(fe.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?Mf(e,n.children[0]):!1}else return!x.isEditor(t)},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(R.isPath(a)){var[l]=x.parent(t,a);r=z=>l.children.includes(z)}else r=z=>fe.isElement(z)&&x.isBlock(t,z);if(!i&&Y.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),Y.isRange(a))if(Y.isCollapsed(a))a=a.anchor;else{var[,u]=Y.edges(a),d=x.pointRef(t,u);X.delete(t,{at:a}),a=d.unref(),n.at==null&&X.select(t,a)}var[m]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),h=x.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!h)){var[p,v]=m,[f,b]=h;if(!(v.length===0||b.length===0)){var g=R.next(b),C=R.common(v,b),D=R.isSibling(v,b),F=Array.from(x.levels(t,{at:v}),z=>{var[$]=z;return $}).slice(C.length).slice(0,-1),E=x.above(t,{at:v,mode:"highest",match:z=>F.includes(z)&&Mf(t,z)}),_=E&&x.pathRef(t,E[1]),T,I;if(ge.isText(p)&&ge.isText(f)){var P=sn(p,sx);I=f.text.length,T=P}else if(fe.isElement(p)&&fe.isElement(f)){var P=sn(p,ox);I=f.children.length,T=P}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(at.stringify(p)," ").concat(at.stringify(f)));D||X.moveNodes(t,{at:v,to:g,voids:s}),_&&X.removeNodes(t,{at:_.current,voids:s}),fe.isElement(f)&&x.isEmpty(t,f)||ge.isText(f)&&f.text===""&&b[b.length-1]!==0?X.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:I,properties:T}),_&&_.unref()}}}})},lx=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=R.isPath(r)?br(e,r):p=>fe.isElement(p)&&x.isBlock(e,p));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,v]=p;return x.pathRef(e,v)});for(var d of u){var m=d.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&R.isSibling(h,m)&&R.isAfter(h,m)&&(o.current=R.next(o.current))}o.unref()}})},cx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=R.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),!r&&Y.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,v]=p;return x.pathRef(t,v)});for(var d of u){var m=d.unref();if(m){var[h]=x.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},dx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=R.isPath(i)?br(t,i):I=>fe.isElement(I)&&x.isBlock(t,I)),!l&&Y.isRange(i)&&(i=x.unhangRange(t,i,{voids:m})),d&&Y.isRange(i)){if(Y.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var h=x.rangeRef(t,i,{affinity:"inward"}),[p,v]=Y.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,v,v.path);X.splitNodes(t,{at:v,match:a,mode:f,voids:m,always:!b});var g=x.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:f,voids:m,always:!g}),i=h.unref(),r.at==null&&X.select(t,i)}s||(s=(I,P)=>I!==P);for(var[C,D]of x.nodes(t,{at:i,match:a,mode:u,voids:m})){var F={},E={};if(D.length!==0){var _=!1;for(var T in n)T==="children"||T==="text"||s(n[T],C[T])&&(_=!0,C.hasOwnProperty(T)&&(F[T]=C[T]),o?n[T]!=null&&(E[T]=o(C[T],n[T])):n[T]!=null&&(E[T]=n[T]));_&&t.apply({type:"set_node",path:D,properties:F,newProperties:E})}}}})},fx=(e,t)=>{if(Y.isCollapsed(t))return t.anchor;var[,n]=Y.edges(t),r=x.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},mx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>fe.isElement(ne)&&x.isBlock(t,ne)),Y.isRange(s)&&(s=fx(t,s)),R.isPath(s)){var u=s,d=x.point(t,u),[m]=x.parent(t,u);i=ne=>ne===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var h=x.pointRef(t,s,{affinity:"backward"}),p;try{var[v]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!v)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[g,C]=f;if(fe.isElement(g)&&t.isInline(g)){var D=x.after(t,C);if(!D){var F={text:""},E=R.next(C);X.insertNodes(t,F,{at:E,voids:a}),D=x.point(t,E)}s=D,l=!0}var _=s.path.length-C.length;o=_+1,l=!0}p=x.pointRef(t,s);var T=s.path.length-o,[,I]=v,P=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[$,B]of x.levels(t,{at:P,reverse:!0,voids:a})){var A=!1;if(B.length<I.length||B.length===0||!a&&fe.isElement($)&&x.isVoid(t,$))break;var O=h.current,j=x.isEnd(t,O,B);if(l||!h||!x.isEdge(t,O,B)){A=!0;var U=le.extractProps($);t.apply({type:"split_node",path:B,position:z,properties:U})}z=B[B.length-1]+(A||j?1:0)}if(n.at==null){var W=p.current||x.end(t,[]);X.select(t,W)}}finally{var re;h.unref(),(re=p)===null||re===void 0||re.unref()}}})},hx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;X.setNodes(t,a,r)},px=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=R.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),R.isPath(s)&&(s=x.range(t,s));var l=Y.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,p=>{var[,v]=p;return x.pathRef(t,v)}).reverse(),m=function(){var v=h.unref(),[f]=x.node(t,v),b=x.range(t,v);a&&l&&(b=Y.intersection(l.current,b)),X.liftNodes(t,{at:b,match:g=>fe.isAncestor(f)&&f.children.includes(g),voids:i})};for(var h of d)m();l&&l.unref()}})};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(R.isPath(l)?o=br(t,l):t.isInline(n)?o=b=>fe.isElement(b)&&x.isInline(t,b)||ge.isText(b):o=b=>fe.isElement(b)&&x.isBlock(t,b)),i&&Y.isRange(l)){var[u,d]=Y.edges(l),m=x.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&X.select(t,l)}var h=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>fe.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),p=function(){var g=Y.isRange(l)?Y.intersection(l,x.range(t,f)):l;if(!g)return 0;var C=Array.from(x.nodes(t,{at:g,match:o,mode:a,voids:s}));if(C.length>0){var[D]=C,F=C[C.length-1],[,E]=D,[,_]=F;if(E.length===0&&_.length===0)return 0;var T=R.equals(E,_)?R.parent(E):R.common(E,_),I=x.range(t,E,_),P=x.node(t,T),[z]=P,$=T.length+1,B=R.next(_.slice(0,$)),A=Rl(Rl({},n),{},{children:[]});X.insertNodes(t,A,{at:B,voids:s}),X.moveNodes(t,{at:I,match:O=>fe.isAncestor(z)&&z.children.includes(O),to:B.concat(0),voids:s})}},v;for(var[,f]of h)v=p()}})},vx=()=>{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 q0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xy(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ky(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ax(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return py(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xy(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dy(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wy(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ix(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ux(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fy(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ay(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Py(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return My(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $y(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zy(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vy(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nx(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hy(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return px(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gx(e,...r)}};return e},Tn=[],bx=function(){return Tn.some(function(e){return e.activeTargets.length>0})},yx=function(){return Tn.some(function(e){return e.skippedTargets.length>0})},Il="ResizeObserver loop completed with undelivered notifications.",xx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Il}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Il),window.dispatchEvent(e)},Hr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Hr||(Hr={}));var Sn=function(e){return Object.freeze(e)},Cx=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Sn(this)}return e}(),Nf=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,Sn(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}(),Po=function(e){return e instanceof SVGElement&&"getBBox"in e},Rf=function(e){if(Po(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)},$l=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)},Dx=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},Mr=typeof window<"u"?window:{},pa=new WeakMap,Ll=/auto|scroll/,wx=/^tb|vertical/,Ex=/msie|trident/i.test(Mr.navigator&&Mr.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},ar=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Cx((n?t:e)||0,(n?e:t)||0)},zl=Sn({devicePixelContentBoxSize:ar(),borderBoxSize:ar(),contentBoxSize:ar(),contentRect:new Nf(0,0,0,0)}),If=function(e,t){if(t===void 0&&(t=!1),pa.has(e)&&!t)return pa.get(e);if(Rf(e))return pa.set(e,zl),zl;var n=getComputedStyle(e),r=Po(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ex&&n.boxSizing==="border-box",i=wx.test(n.writingMode||""),s=!r&&Ll.test(n.overflowY||""),o=!r&&Ll.test(n.overflowX||""),l=r?0:Ut(n.paddingTop),u=r?0:Ut(n.paddingRight),d=r?0:Ut(n.paddingBottom),m=r?0:Ut(n.paddingLeft),h=r?0:Ut(n.borderTopWidth),p=r?0:Ut(n.borderRightWidth),v=r?0:Ut(n.borderBottomWidth),f=r?0:Ut(n.borderLeftWidth),b=m+u,g=l+d,C=f+p,D=h+v,F=o?e.offsetHeight-D-e.clientHeight:0,E=s?e.offsetWidth-C-e.clientWidth:0,_=a?b+C:0,T=a?g+D:0,I=r?r.width:Ut(n.width)-_-E,P=r?r.height:Ut(n.height)-T-F,z=I+b+E+C,$=P+g+F+D,B=Sn({devicePixelContentBoxSize:ar(Math.round(I*devicePixelRatio),Math.round(P*devicePixelRatio),i),borderBoxSize:ar(z,$,i),contentBoxSize:ar(I,P,i),contentRect:new Nf(m,l,I,P)});return pa.set(e,B),B},$f=function(e,t,n){var r=If(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Hr.DEVICE_PIXEL_CONTENT_BOX:return s;case Hr.BORDER_BOX:return a;default:return i}},_x=function(){function e(t){var n=If(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Sn([n.borderBoxSize]),this.contentBoxSize=Sn([n.contentBoxSize]),this.devicePixelContentBoxSize=Sn([n.devicePixelContentBoxSize])}return e}(),Lf=function(e){if(Rf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},kx=function(){var e=1/0,t=[];Tn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new _x(u.target),m=Lf(u.target);o.push(d),u.lastReportedSize=$f(u.target,u.observedBox),m<e&&(e=m)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},ql=function(e){Tn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Lf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Fx=function(){var e=0;for(ql(e);bx();)e=kx(),ql(e);return yx()&&xx(),e>0},Wi,zf=[],Ax=function(){return zf.splice(0).forEach(function(e){return e()})},Bx=function(e){if(!Wi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Ax()}).observe(n,r),Wi=function(){n.textContent="".concat(t?t--:t++)}}zf.push(e),Wi()},Tx=function(e){Bx(function(){requestAnimationFrame(e)})},ja=0,Sx=function(){return!!ja},jx=250,Ox={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ul=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Wl=function(e){return e===void 0&&(e=0),Date.now()+e},Vi=!1,Px=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=jx),!Vi){Vi=!0;var r=Wl(t);Tx(function(){var a=!1;try{a=Fx()}finally{if(Vi=!1,t=r-Wl(),!Sx())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,Ox)};document.body?n():Mr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ul.forEach(function(n){return Mr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ul.forEach(function(n){return Mr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ls=new Px,Vl=function(e){!ja&&e>0&&Ls.start(),ja+=e,!ja&&Ls.stop()},Mx=function(e){return!Po(e)&&!Dx(e)&&getComputedStyle(e).display==="inline"},Nx=function(){function e(t,n){this.target=t,this.observedBox=n||Hr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=$f(this.target,this.observedBox,!0);return Mx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Rx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ga=new WeakMap,Hl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},va=function(){function e(){}return e.connect=function(t,n){var r=new Rx(t,n);ga.set(t,r)},e.observe=function(t,n,r){var a=ga.get(t),i=a.observationTargets.length===0;Hl(a.observationTargets,n)<0&&(i&&Tn.push(a),a.observationTargets.push(new Nx(n,r&&r.box)),Vl(1),Ls.schedule())},e.unobserve=function(t,n){var r=ga.get(t),a=Hl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Tn.splice(Tn.indexOf(r),1),r.observationTargets.splice(a,1),Vl(-1))},e.disconnect=function(t){var n=this,r=ga.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Ix=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.");va.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(!$l(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");va.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(!$l(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");va.unobserve(this,t)},e.prototype.disconnect=function(){va.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),dn={};Object.defineProperty(dn,"__esModule",{value:!0});var $x=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Hi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},qf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:$x?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Mo={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 ba=1;ba<20;ba++)Mo["f"+ba]=111+ba;function bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Uf(s,t)}),a=function(o){return r.some(function(l){return Wf(l,o)})},i=n==null?a:a(n);return i}function Lx(e,t){return bi(e,t)}function zx(e,t){return bi(e,{byKey:!0},t)}function Uf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Hi)r[Hi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var h=m.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var v=No(h),f=Hi[v];if(h.length>1&&!f&&!qf[h]&&!Mo[v])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!f)&&(n?r.key=v:r.which=Vf(h)),f&&(r[f]=p?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Wf(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 Vf(e){e=No(e);var t=Mo[e]||e.toUpperCase().charCodeAt(0);return t}function No(e){return e=e.toLowerCase(),e=qf[e]||e,e}var qx=dn.default=bi,Ki=dn.isHotkey=bi;dn.isCodeHotkey=Lx;dn.isKeyHotkey=zx;dn.parseHotkey=Uf;dn.compareHotkey=Wf;dn.toKeyCode=Vf;dn.toKeyName=No;function Ux(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 fr(e,t){if(e==null)return{};var n=Ux(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 Kr(e){"@babel/helpers - typeof";return Kr=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},Kr(e)}function Wx(e,t){if(Kr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Kr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vx(e){var t=Wx(e,"string");return Kr(t)==="symbol"?t:String(t)}function Mt(e,t,n){return t=Vx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ro=y.createContext(null),Dn=()=>{var e=y.useContext(Ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Hf=parseInt(y.version.split(".")[0],10),Hx=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Kl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),pt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),er=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Kx=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Kf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Zx=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Yx=pt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Gx=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Qx=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Jx=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Oa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fn=(!Zx||!Yx)&&!Kx&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Io=new WeakMap,$o=new WeakMap,Zf=new WeakMap,Pa=new WeakMap,zs=new WeakMap,Zr=new WeakMap,jn=new WeakMap,ei=new WeakMap,yi=new WeakMap,qs=new WeakMap,bn=new WeakMap,Bn=new WeakMap,Nr=new WeakMap,Us=new WeakMap,Lo=new WeakMap,$t=new WeakMap,rn=new WeakMap,xt=new WeakMap,hn=new WeakMap,pn=new WeakMap,Yf=new WeakMap,mr=Symbol("placeholder"),Gf=Symbol("mark-placeholder"),Xx=globalThis.Text,zo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,e1=e=>yn(e)&&e.nodeType===8,Pt=e=>yn(e)&&e.nodeType===1,yn=e=>{var t=zo(e);return!!t&&e instanceof t.Node},Ws=e=>{var t=e&&e.anchorNode&&zo(e.anchorNode);return!!t&&e instanceof t.Selection},Qf=e=>yn(e)&&e.nodeType===3,t1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,n1=e=>{var[t,n]=e;if(Pt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Jf(t,a,r?"backward":"forward"),r=a<n;Pt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=a1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},r1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Jf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(e1(a)||Pt(a)&&a.childNodes.length===0||Pt(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]},a1=(e,t,n)=>{var[r]=Jf(e,t,n);return r},Xf=e=>{var t="";if(Qf(e)&&e.nodeValue)return e.nodeValue;if(Pt(e)){for(var n of Array.from(e.childNodes))t+=Xf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
+ `)}return t},i1=/data-slate-fragment="(.+?)"/m,s1=e=>{var t=e.getData("text/html"),[,n]=t.match(i1)||[];return n},qo=(e,t,n)=>{var{target:r}=t;if(Pt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:qo(e,i,n)},o1=0;class u1{constructor(){Mt(this,"id",void 0),this.id="".concat(o1++)}}var ee={androidPendingDiffs:e=>xt.get(e),androidScheduleFlush:e=>{var t;(t=Lo.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);bn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(fe.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var m=x.range(e,d);return m}}var h,{document:p}=ee.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var v=p.caretPositionFromPoint(n,r);v&&(h=p.createRange(),h.setStart(v.offsetNode,v.offset),h.setEnd(v.offsetNode,v.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ei.get(t);return n||(n=new u1,ei.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=$o.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=Io.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(at.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!bn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,x.start(t,[])),t.onChange()),bn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Zf.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=ee.toDOMNode(t,t),s;try{s=Pt(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)=>yn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>yn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Bn.get(e),isFocused:e=>!!bn.get(e),isReadOnly:e=>!!qs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(qs.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return fe.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=yi.get(e),r=x.isEditor(t)?Pa.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(at.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=ee.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,h=u.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),v=o+p,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];a=[g instanceof Xx?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var C=Math.min(m,Math.max(0,t.offset-o));a=[d,C];break}o=v}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=Y.isBackward(t),i=ee.toDOMPoint(e,n),s=Y.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,h]=a?i:s,p=Pt(u)?u:u.parentElement,v=!!p.getAttribute("data-slate-zero-width"),f=Pt(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(m,b?1:h),l},toSlateNode:(e,t)=>{var n=Pt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Zr.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:n1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,h=ee.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),v=p&&h.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var g=ee.getWindow(e),C=g.document.createRange();C.setStart(l,0),C.setEnd(i,s);var D=C.cloneContents(),F=[...Array.prototype.slice.call(D.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(D.querySelectorAll("[contenteditable=false]"))];F.forEach(O=>{if(pt&&!r&&O.hasAttribute("data-slate-zero-width")&&O.textContent.length>0&&O.textContext!=="\uFEFF"){O.textContent.startsWith("\uFEFF")&&(O.textContent=O.textContent.slice(1));return}O.parentNode.removeChild(O)}),u=D.textContent.length,b=l}}else if(v){for(var E=v.querySelectorAll("[data-slate-leaf]"),_=0;_<E.length;_++){var T=E[_];if(ee.hasDOMNode(e,T)){f=T;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(O=>{u-=O.textContent.length})):u=1}b&&u===b.textContent.length&&pt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||er&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
73
73
 
74
- `))&&u--}if(ht&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&ee.hasDOMNode(e,$,{editable:!0})){var P=ee.toSlateNode(e,$),{path:z,offset:R}=x.start(e,ee.findPath(e,P));return $.querySelector("[data-slate-leaf]")||(R=s),{path:z,offset:R}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var A=ee.toSlateNode(e,l),F=ee.findPath(e,A);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Hs(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if(Hs(t)){if(Qn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let k=function(T){return T.childElementCount>0?k(T.children[0]):T};var v=p.startContainer,f=m.startContainer,b=k(v.children[p.startOffset]),g=k(f.children[m.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Kf&&h1(o)||Qn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Qn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
74
+ `))&&u--}if(pt&&!l&&!r){var I=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(I&&ee.hasDOMNode(e,I,{editable:!0})){var P=ee.toSlateNode(e,I),{path:z,offset:$}=x.start(e,ee.findPath(e,P));return I.querySelector("[data-slate-leaf]")||($=s),{path:z,offset:$}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=ee.toSlateNode(e,l),A=ee.findPath(e,B);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ws(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Ws(t)){if(er&&t.rangeCount>1){u=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let _=function(T){return T.childElementCount>0?_(T.children[0]):T};var v=h.startContainer,f=p.startContainer,b=_(v.children[h.startOffset]),g=_(f.children[p.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.innerHTML.length:l=0}else h.startContainer===u?(o=p.endContainer,l=p.endOffset,d=h.startOffset):(o=h.startContainer,l=h.endOffset,d=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Kf&&r1(o)||er?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(er&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
75
75
 
76
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,d=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var E=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!E)return null;var B=h?E:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!B)return null;var D={anchor:E,focus:B};return Y.isExpanded(D)&&Y.isForward(D)&&Ot(u)&&x.void(e,{at:D.focus,mode:"highest"})&&(D=x.unhangRange(e,D,{voids:!0})),D}};function y1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=ue.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=I.next(n);if(!x.hasPath(e,i))return!1;var s=ue.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function eh(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 x1(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 C1(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 th(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=x1(i,a),o=Math.min(i.length-s,a.length-s),l=C1(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 w1(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=eh(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 th(e,{start:r,end:l,text:o})}function D1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ks(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=ue.get(e,n);if(!he.isText(a))return null;var i=x.above(e,{match:o=>de.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:he.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Gl(e,t){var n=Ks(e,t.anchor);if(!n)return null;if(Y.isCollapsed(t))return{anchor:n,focus:n};var r=Ks(e,t.focus);return r?{anchor:n,focus:r}:null}function Zs(e,t,n){var r=bt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return I.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return Be.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=Be.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=Be.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Ql(e,t,n){var r=Zs(e,t.anchor,n);if(!r)return null;if(Y.isCollapsed(t))return{anchor:r,focus:r};var a=Zs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function E1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!I.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ya(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _1=25,k1=200,F1=function(){},A1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function B1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var A=hn.get(t);if(hn.delete(t),A){var{selection:F}=t,O=Gl(t,A);O&&(!F||!Y.equals(O,F))&&J.select(t,O)}},h=()=>{var A=fn.get(t);if(fn.delete(t),!!A){if(A.at){var F=Be.isPoint(A.at)?Ks(t,A.at):Gl(t,A.at);if(!F)return;var O=x.range(t,F);(!t.selection||!Y.equals(t.selection,O))&&J.select(t,F)}A.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!B()&&!E()){d();return}a||(a=!0,setTimeout(()=>a=!1)),E()&&(a="action");var A=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});tn.set(t,t.marks),F1("flush",fn.get(t),bt.get(t));for(var F=B(),O;O=(M=bt.get(t))===null||M===void 0?void 0:M[0];){var M,U,W=$t.get(t);W!==void 0&&($t.delete(t),t.marks=W),W&&u===!1&&(u=null);var ie=D1(O);(!t.selection||!Y.equals(t.selection,ie))&&J.select(t,ie),O.diff.text?x.insertText(t,O.diff.text):x.deleteFragment(t),bt.set(t,(U=bt.get(t))===null||U===void 0?void 0:U.filter(G=>{var{id:ne}=G;return ne!==O.id})),y1(t,O)||(F=!1,fn.delete(t),tn.delete(t),a="action",hn.delete(t),n.cancel(),r.cancel(),A==null||A.unref())}var se=A==null?void 0:A.unref();if(se&&!hn.get(t)&&(!t.selection||!Y.equals(se,t.selection))&&J.select(t,se),E()){h();return}F&&n(),n.flush(),r.flush(),d();var C=tn.get(t);tn.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=A=>{i&&clearTimeout(i),i=setTimeout(()=>{kn.set(t,!1),p()},_1)},v=A=>{kn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=Us.get(t);if(O){if(B()||F){O.style.display="none";return}O.style.removeProperty("display")}},b=(A,F)=>{var O,M=(O=bt.get(t))!==null&&O!==void 0?O:[];bt.set(t,M);var U=ue.leaf(t,A),W=M.findIndex(C=>I.equals(C.path,A));if(W<0){var ie=th(U.text,F);ie&&M.push({path:A,diff:F,id:l++}),f();return}var se=w1(U.text,M[W].diff,F);if(!se){M.splice(W,1),f();return}M[W]=ya(ya({},M[W]),{},{diff:se})},g=function(F){var{at:O}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,hn.delete(t),n.cancel(),r.cancel(),E()&&p(),fn.set(t,{at:O,run:F}),o=setTimeout(p)},w=A=>{var F;s&&(clearTimeout(s),s=null);var{inputType:O}=A,M=null,U=A.dataTransfer||A.data||void 0;u!==!1&&O!=="insertText"&&O!=="insertCompositionText"&&(u=!1);var[W]=A.getTargetRanges();W&&(M=ee.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ie=ee.getWindow(t),se=ie.getSelection();if(!M&&se&&(W=se,M=ee.toSlateRange(t,se,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var C=!0;if(O.startsWith("delete")){if(Y.isExpanded(M)){var[G,ne]=Y.edges(M),_=ue.leaf(t,G.path);if(_.text.length===G.offset&&ne.offset===0){var S=x.next(t,{at:G.path,match:he.isText});S&&I.equals(S[1],ne.path)&&(M={anchor:ne,focus:ne})}}var q=O.endsWith("Backward")?"backward":"forward",[j,L]=Y.edges(M),[Q,Z]=x.leaf(t,j.path),X={text:"",start:j.offset,end:L.offset},le=bt.get(t),te=le==null?void 0:le.find(ve=>I.equals(ve.path,Z)),pe=te?[te.diff,X]:[X],fe=eh(Q.text,...pe);if(fe.length===0&&(C=!1),Y.isExpanded(M)){if(C&&I.equals(M.anchor.path,M.focus.path)){var Ae={path:M.anchor.path,offset:j.offset},ye=x.range(t,Ae,Ae);return T(ye),b(M.anchor.path,{text:"",end:L.offset,start:j.offset})}return g(()=>x.deleteFragment(t,{direction:q}),{at:M})}}switch(O){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>x.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Ee}=M;if(C&&Y.isCollapsed(M)){var Le=ue.leaf(t,Ee.path);if(Ee.offset<Le.text.length)return b(Ee.path,{text:"",start:Ee.offset,end:Ee.offset+1})}return g(()=>x.deleteForward(t),{at:M})}case"deleteContentBackward":{var Oe,{anchor:ze}=M,Je=Hs(W)?W.isCollapsed:!!((Oe=W)!==null&&Oe!==void 0&&Oe.collapsed);return C&&Je&&Y.isCollapsed(M)&&ze.offset>0?b(ze.path,{text:"",start:ze.offset-1,end:ze.offset}):g(()=>x.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return g(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return g(()=>x.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return g(()=>x.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return g(()=>x.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return g(()=>x.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return g(()=>x.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return g(()=>x.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return g(()=>x.insertSoftBreak(t),{at:M});case"insertParagraph":return g(()=>x.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(A1(U))return g(()=>ee.insertData(t,U),{at:M});var Se=U??"";if($t.get(t)&&(Se=Se.replace("\uFEFF","")),O==="insertText"&&/.*\n.*\n$/.test(Se)&&(Se=Se.slice(0,-1)),Se.includes(`
77
- `))return g(()=>{var ve=Se.split(`
78
- `);ve.forEach((ke,ge)=>{ke&&x.insertText(t,ke),ge!==ve.length-1&&x.insertSoftBreak(t)})},{at:M});if(I.equals(M.anchor.path,M.focus.path)){var[qe,xe]=Y.edges(M),V={start:qe.offset,end:xe.offset,text:Se};if(Se&&u&&O==="insertCompositionText"){var re=u.start+u.text.search(/\S|$/),me=V.start+V.text.search(/\S|$/);me===re+1&&V.end===u.start+u.text.length?(V.start-=1,u=null,z()):u=!1}else O==="insertText"?u===null?u=V:u&&Y.isCollapsed(M)&&u.end+u.text.length===qe.offset?u=ya(ya({},u),{},{text:u.text+Se}):u=!1:u=!1;if(C){b(qe.path,V);return}}return g(()=>x.insertText(t,Se),{at:M})}}}},E=()=>!!fn.get(t),B=()=>{var A;return!!((A=bt.get(t))!==null&&A!==void 0&&A.length)},D=()=>E()||B(),k=()=>a,T=A=>{hn.set(t,A),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(A){var O=!F||!I.equals(F.anchor.path,A.anchor.path),M=!F||!I.equals(F.anchor.path.slice(0,-1),A.anchor.path.slice(0,-1));(O&&u||M)&&(u=!1),(O||B())&&(s=setTimeout(p,k1))}},$=()=>{(E()||!B())&&p()},P=A=>{B()||(f(!0),setTimeout(f))},z=()=>{E()||(o=setTimeout(p))},R=A=>{if(!(B()||E())&&A.some(O=>Wo(t,O,A))){var F;(F=Yf.get(t))===null||F===void 0||F()}};return{flush:p,scheduleFlush:z,hasPendingDiffs:B,hasPendingAction:E,hasPendingChanges:D,isFlushing:k,handleUserSelect:T,handleCompositionEnd:m,handleCompositionStart:v,handleDOMBeforeInput:w,handleKeyDown:P,handleDomMutations:R,handleInput:$}}function T1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Zr=ja?y.useLayoutEffect:y.useEffect;function S1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Zr(()=>{r.takeRecords()}),y.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var j1=["node"];function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function O1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xl(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var P1={subtree:!0,childList:!0,characterData:!0},M1=ht?e=>{var{node:t}=e,n=lr(e,j1);if(!ht)return null;var r=xn(),a=T1(),[i]=y.useState(()=>B1(O1({editor:r},n)));return S1(t,i.handleDomMutations,P1),qo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,N1=["anchor","focus"],I1=["anchor","focus"],R1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),nh=(e,t)=>{var n=lr(e,N1),r=lr(t,I1);return e[cr]===t[cr]&&R1(n,r)},$1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!Y.equals(r,a)||!nh(r,a))return!1}return!0},L1=(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||!nh(r,a))return!1}return!0};function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function z1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var q1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=xn(),s=ee.findPath(i,a),o=I.parent(s),l=!!n[Gf];return i.isVoid(r)?y.createElement(Gi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Gi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Gi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
- `?y.createElement(tc,{isTrailing:!0,text:n.text}):y.createElement(tc,{text:n.text})},tc=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
80
- `:""),[i]=y.useState(a);return Zr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(U1,{ref:r},i)},U1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Gi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",z1({},a),!ht||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function nc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W1=ht?300:0;function V1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function rc(e){e.current&&(clearTimeout(e.current),e.current=null)}var H1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>y.createElement(Z1,rh({},w))}=e,o=xn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(w=>{if(V1(l,w==null),w==null){var E;Us.delete(o),(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,null)}else{if(Us.set(o,w),!l.current){var B=window.ResizeObserver||Zx;l.current=new B(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),v=y.createElement(q1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[cr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},W1)):(rc(p),h(!1)),()=>rc(p)),[f,h]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Br?"inherit":void 0},contentEditable:!1,ref:m}};v=y.createElement(y.Fragment,null,i(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},K1=y.memo(H1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[cr]===e.leaf[cr]),Z1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",rh({},t),n)},Y1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=xn(),l=y.useRef(null),u=he.decorations(s,t),d=ee.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(K1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var v=y.useCallback(f=>{var b=yi.get(o);f?(b==null||b.set(d,f),Bn.set(s,f),Kr.set(f,s)):(b==null||b.delete(d),Bn.delete(s),l.current&&Kr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},h)},ah=y.memo(Y1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&L1(t.decorations,e.decorations));function ac(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 Ys(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ac(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ac(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G1=e=>{var{decorations:t,element:n,renderElement:r=w=>y.createElement(J1,Ys({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=xn(),l=tC(),u=o.isInline(n),d=ee.findKey(o,n),h=y.useCallback(w=>{var E=yi.get(o);w?(E==null||E.set(d,w),Bn.set(n,w),Kr.set(w,n)):(E==null||E.delete(d),Bn.delete(n))},[o,d,n]),p=sh({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var v=ue.string(n),f=Cf(v);f==="rtl"&&(m.dir=f)}if(x.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[g]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(ah,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:g})),Lo.set(g,0),zo.set(g,n)}return r({attributes:m,children:p,element:n})},Q1=y.memo(G1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&$1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Y.equals(e.selection,t.selection))),J1=e=>{var{attributes:t,children:n,element:r}=e,a=xn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ys(Ys({},t),{},{style:{position:"relative"}}),n)},ih=y.createContext(()=>[]),X1=()=>y.useContext(ih),eC=y.createContext(!1),sh=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=X1(),l=xn(),u=ee.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),v=n.children[p],f=ee.findKey(l,v),b=x.range(l,m),g=s&&Y.intersection(b,s),w=o([v,m]);for(var E of t){var B=Y.intersection(E,b);B&&w.push(B)}de.isElement(v)?d.push(y.createElement(eC.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement(Q1,{decorations:w,element:v,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:g}))):d.push(y.createElement(ah,{decorations:w,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:v})),Lo.set(v,p),zo.set(v,n)}return d},oh=y.createContext(!1),tC=()=>y.useContext(oh),uh=y.createContext(null),$n=()=>{var e=y.useContext(uh);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function nC(){var e=xn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var rC=3,aC={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"},iC={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"},sC={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ke=e=>{var t=aC[e],n=iC[e],r=sC[e],a=t&&Yi(t),i=n&&Yi(n),s=r&&Yi(r);return o=>!!(a&&a(o)||Yl&&i&&i(o)||!Yl&&s&&s(o))},Ze={isBold:Ke("bold"),isCompose:Ke("compose"),isMoveBackward:Ke("moveBackward"),isMoveForward:Ke("moveForward"),isDeleteBackward:Ke("deleteBackward"),isDeleteForward:Ke("deleteForward"),isDeleteLineBackward:Ke("deleteLineBackward"),isDeleteLineForward:Ke("deleteLineForward"),isDeleteWordBackward:Ke("deleteWordBackward"),isDeleteWordForward:Ke("deleteWordForward"),isExtendBackward:Ke("extendBackward"),isExtendForward:Ke("extendForward"),isExtendLineBackward:Ke("extendLineBackward"),isExtendLineForward:Ke("extendLineForward"),isItalic:Ke("italic"),isMoveLineBackward:Ke("moveLineBackward"),isMoveLineForward:Ke("moveLineForward"),isMoveWordBackward:Ke("moveWordBackward"),isMoveWordForward:Ke("moveWordForward"),isRedo:Ke("redo"),isSoftBreak:Ke("insertSoftBreak"),isSplitBlock:Ke("splitBlock"),isTransposeCharacter:Ke("transposeCharacter"),isUndo:Ke("undo")},oC=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Wo(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}},uC={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class lh extends y.Component{constructor(){super(...arguments),Pt(this,"context",null),Pt(this,"manager",null),Pt(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,uC)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=oC(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}}Pt(lh,"contextType",$o);var lC=ht?lh:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},cC=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],dC=["text"];function ic(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ic(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ic(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fC=e=>y.createElement(y.Fragment,null,sh(e)),hC=e=>{var t=y.useCallback(S=>y.createElement(mC,Ut({},S)),[]),{autoFocus:n,decorate:r=pC,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=gC,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,v=lr(e,cC),f=$n(),[b,g]=y.useState(!1),w=y.useRef(null),E=y.useRef([]),[B,D]=y.useState(),{onUserInput:k,receivedUserInput:T}=nC(),[,$]=y.useReducer(S=>S+1,0);Yf.set(f,$),Ws.set(f,s);var P=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var z=y.useRef(),R=y.useMemo(()=>Kb(()=>{var S=z.current;if((ht||!ee.isComposing(f))&&(!P.isUpdatingSelection||S!=null&&S.isFlushing())&&!P.isDraggingInternally){var q=ee.findDocumentOrShadowRoot(f),{activeElement:j}=q,L=ee.toDOMNode(f,f),Q=q.getSelection();if(j===L?(P.latestElement=j,gn.set(f,!0)):gn.delete(f),!Q)return J.deselect(f);var{anchorNode:Z,focusNode:X}=Q,le=ee.hasEditableTarget(f,Z)||ee.isTargetInsideNonReadonlyVoid(f,Z),te=ee.hasEditableTarget(f,X)||ee.isTargetInsideNonReadonlyVoid(f,X);if(le&&te){var pe=ee.toSlateRange(f,Q,{exactMatch:!1,suppressThrow:!0});pe&&(!ee.isComposing(f)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?J.select(f,pe):S==null||S.handleUserSelect(pe))}s&&(!le||!te)&&J.deselect(f)}},100),[f,s,P]),A=y.useMemo(()=>zb(R,0),[R]);z.current=M1({node:w,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:A}),Zr(()=>{var S,q,j;w.current&&(j=Uo(w.current))?(Zf.set(f,j),Oa.set(f,w.current),Bn.set(f,w.current),Kr.set(w.current,f)):Bn.delete(f);var{selection:L}=f,Q=ee.findDocumentOrShadowRoot(f),Z=Q.getSelection();if(!(!Z||!ee.isFocused(f)||(S=z.current)!==null&&S!==void 0&&S.hasPendingAction())){var X=fe=>{var Ae=Z.type!=="None";if(!(!L&&!Ae)){var ye=Z.focusNode,Ee;if(Qn&&Z.rangeCount>1){var Le=Z.getRangeAt(0),Oe=Z.getRangeAt(Z.rangeCount-1);Le.startContainer===ye?Ee=Oe.endContainer:Ee=Le.startContainer}else Ee=Z.anchorNode;var ze=Oa.get(f),Je=!1;if(ze.contains(Ee)&&ze.contains(ye)&&(Je=!0),Ae&&Je&&L&&!fe){var Se=ee.toSlateRange(f,Z,{exactMatch:!0,suppressThrow:!0});if(Se&&Y.equals(Se,L)){var qe;if(!P.hasMarkPlaceholder||(qe=Ee)!==null&&qe!==void 0&&(qe=qe.parentElement)!==null&&qe!==void 0&&qe.hasAttribute("data-slate-mark-placeholder"))return}}if(L&&!ee.hasRange(f,L)){f.selection=ee.toSlateRange(f,Z,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var xe=L&&ee.toDOMRange(f,L);return xe?(ee.isComposing(f)&&!ht?Z.collapseToEnd():Y.isBackward(L)?Z.setBaseAndExtent(xe.endContainer,xe.endOffset,xe.startContainer,xe.startOffset):Z.setBaseAndExtent(xe.startContainer,xe.startOffset,xe.endContainer,xe.endOffset),d(f,xe)):Z.removeAllRanges(),xe}};Z.rangeCount<=1&&X();var le=((q=z.current)===null||q===void 0?void 0:q.isFlushing())==="action";if(!ht||!le){setTimeout(()=>{P.isUpdatingSelection=!1});return}var te=null,pe=requestAnimationFrame(()=>{if(le){var fe=Ae=>{try{var ye=ee.toDOMNode(f,f);ye.focus(),X(Ae)}catch{}};fe(),te=setTimeout(()=>{fe(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),te&&clearTimeout(te)}}});var F=y.useCallback(S=>{if(k(),!s&&ee.hasEditableTarget(f,S.target)&&!vC(S,a)){var q;if(z.current)return z.current.handleDOMBeforeInput(S);A.flush(),R.flush();var{selection:j}=f,{inputType:L}=S,Q=S.dataTransfer||S.data||void 0,Z=L==="insertCompositionText"||L==="deleteCompositionText";if(Z&&ee.isComposing(f))return;var X=!1;if(L==="insertText"&&j&&Y.isCollapsed(j)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&j.anchor.offset!==0){var le,te;X=!0,f.marks&&(X=!1);var{anchor:pe}=j,[fe,Ae]=ee.toDOMPoint(f,pe),ye=(le=fe.parentElement)===null||le===void 0?void 0:le.closest("a"),Ee=ee.getWindow(f);if(X&&ye&&ee.hasDOMNode(f,ye)){var Le,Oe=Ee==null?void 0:Ee.document.createTreeWalker(ye,NodeFilter.SHOW_TEXT).lastChild();Oe===fe&&((Le=Oe.textContent)===null||Le===void 0?void 0:Le.length)===Ae&&(X=!1)}if(X&&fe.parentElement&&(Ee==null||(te=Ee.getComputedStyle(fe.parentElement))===null||te===void 0?void 0:te.whiteSpace)==="pre"){var ze=x.above(f,{at:pe.path,match:re=>de.isElement(re)&&x.isBlock(f,re)});ze&&ue.string(ze[0]).includes(" ")&&(X=!1)}}if(!L.startsWith("delete")||L.startsWith("deleteBy")){var[Je]=S.getTargetRanges();if(Je){var Se=ee.toSlateRange(f,Je,{exactMatch:!1,suppressThrow:!1});if(!j||!Y.equals(j,Se)){X=!1;var qe=!Z&&f.selection&&x.rangeRef(f,f.selection);J.select(f,Se),qe&&Pr.set(f,qe)}}}if(Z)return;if(X||S.preventDefault(),j&&Y.isExpanded(j)&&L.startsWith("delete")){var xe=L.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:xe});return}switch(L){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{L==="insertFromComposition"&&ee.isComposing(f)&&(g(!1),kn.set(f,!1)),(Q==null?void 0:Q.constructor.name)==="DataTransfer"?ee.insertData(f,Q):typeof Q=="string"&&(X?E.current.push(()=>x.insertText(f,Q)):x.insertText(f,Q));break}}var V=(q=Pr.get(f))===null||q===void 0?void 0:q.unref();Pr.delete(f),V&&(!f.selection||!Y.equals(f.selection,V))&&J.select(f,V)}},[f,R,k,a,s,A]),O=y.useCallback(S=>{S==null?(R.cancel(),A.cancel(),Oa.delete(f),Bn.delete(f),w.current&&cn&&w.current.removeEventListener("beforeinput",F)):cn&&S.addEventListener("beforeinput",F),w.current=S},[R,A,f,F]);Zr(()=>{var S=ee.getWindow(f);return S.document.addEventListener("selectionchange",A),()=>{S.document.removeEventListener("selectionchange",A)}},[A]);var M=r([f,[]]),U=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,W=y.useCallback(S=>{if(S&&U){var q;D((q=S.getBoundingClientRect())===null||q===void 0?void 0:q.height)}else D(void 0)},[U]);if(U){var ie=x.start(f,[]);M.push({[cr]:!0,placeholder:i,onPlaceholderResize:W,anchor:ie,focus:ie})}var{marks:se}=f;if(P.hasMarkPlaceholder=!1,f.selection&&Y.isCollapsed(f.selection)&&se){var{anchor:C}=f.selection,G=ue.leaf(f,C.path),ne=lr(G,dC);if(!he.equals(G,se,{loose:!0})){P.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(ne).map(S=>[S,null]));M.push(Ut(Ut(Ut({[Gf]:!0},_),se),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:S}=f;if(S){var{anchor:q}=S,j=ue.leaf(f,q.path);if(se&&!he.equals(j,se,{loose:!0})){$t.set(f,se);return}}$t.delete(f)})}),y.createElement(oh.Provider,{value:s},y.createElement(ih.Provider,{value:r},y.createElement(lC,{node:w,receivedUserInput:T},y.createElement(p,Ut(Ut({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:cn||!ja?v.spellCheck:!1,autoCorrect:cn||!ja?v.autoCorrect:"false",autoCapitalize:cn||!ja?v.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:O,style:Ut(Ut({},m?{}:Ut({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},B?{minHeight:B}:{})),h),onBeforeInput:y.useCallback(S=>{if(!cn&&!s&&!dt(S,v.onBeforeInput)&&ee.hasSelectableTarget(f,S.target)&&(S.preventDefault(),!ee.isComposing(f))){var q=S.data;x.insertText(f,q)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(S=>{if(!dt(S,v.onInput)){if(z.current){z.current.handleInput();return}for(var q of E.current)q();E.current=[]}},[v.onInput]),onBlur:y.useCallback(S=>{if(!(s||P.isUpdatingSelection||!ee.hasSelectableTarget(f,S.target)||dt(S,v.onBlur))){var q=ee.findDocumentOrShadowRoot(f);if(P.latestElement!==q.activeElement){var{relatedTarget:j}=S,L=ee.toDOMNode(f,f);if(j!==L&&!(Ot(j)&&j.hasAttribute("data-slate-spacer"))){if(j!=null&&vn(j)&&ee.hasDOMNode(f,j)){var Q=ee.toSlateNode(f,j);if(de.isElement(Q)&&!f.isVoid(Q))return}if(Br){var Z=q.getSelection();Z==null||Z.removeAllRanges()}gn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,v.onBlur]),onClick:y.useCallback(S=>{if(ee.hasTarget(f,S.target)&&!dt(S,v.onClick)&&vn(S.target)){var q=ee.toSlateNode(f,S.target),j=ee.findPath(f,q);if(!x.hasPath(f,j)||ue.get(f,j)!==q)return;if(S.detail===rC&&j.length>=1){var L=j;if(!(de.isElement(q)&&x.isBlock(f,q))){var Q,Z=x.above(f,{match:ye=>de.isElement(ye)&&x.isBlock(f,ye),at:j});L=(Q=Z==null?void 0:Z[1])!==null&&Q!==void 0?Q:j.slice(0,1)}var X=x.range(f,L);J.select(f,X);return}if(s)return;var le=x.start(f,j),te=x.end(f,j),pe=x.void(f,{at:le}),fe=x.void(f,{at:te});if(pe&&fe&&I.equals(pe[1],fe[1])){var Ae=x.range(f,le);J.select(f,Ae)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(S=>{if(ee.hasSelectableTarget(f,S.target)){var q;if(ee.isComposing(f)&&Promise.resolve().then(()=>{g(!1),kn.set(f,!1)}),(q=z.current)===null||q===void 0||q.handleCompositionEnd(S),dt(S,v.onCompositionEnd)||ht)return;if(!Br&&!s1&&!n1&&!u1&&!o1&&S.data){var j=$t.get(f);$t.delete(f),j!==void 0&&(tn.set(f,f.marks),f.marks=j),x.insertText(f,S.data);var L=tn.get(f);tn.delete(f),L!==void 0&&(f.marks=L)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(S=>{ee.hasSelectableTarget(f,S.target)&&!dt(S,v.onCompositionUpdate)&&(ee.isComposing(f)||(g(!0),kn.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(S=>{if(ee.hasSelectableTarget(f,S.target)){var q;if((q=z.current)===null||q===void 0||q.handleCompositionStart(S),dt(S,v.onCompositionStart)||ht)return;g(!0);var{selection:j}=f;if(j&&Y.isExpanded(j)){x.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(S=>{ee.hasSelectableTarget(f,S.target)&&!dt(S,v.onCopy)&&!sc(S)&&(S.preventDefault(),ee.setFragmentData(f,S.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(S=>{if(!s&&ee.hasSelectableTarget(f,S.target)&&!dt(S,v.onCut)&&!sc(S)){S.preventDefault(),ee.setFragmentData(f,S.clipboardData,"cut");var{selection:q}=f;if(q)if(Y.isExpanded(q))x.deleteFragment(f);else{var j=ue.parent(f,q.anchor.path);x.isVoid(f,j)&&J.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(S=>{if(ee.hasTarget(f,S.target)&&!dt(S,v.onDragOver)){var q=ee.toSlateNode(f,S.target);de.isElement(q)&&x.isVoid(f,q)&&S.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(S=>{if(!s&&ee.hasTarget(f,S.target)&&!dt(S,v.onDragStart)){var q=ee.toSlateNode(f,S.target),j=ee.findPath(f,q),L=de.isElement(q)&&x.isVoid(f,q)||x.void(f,{at:j,voids:!0});if(L){var Q=x.range(f,j);J.select(f,Q)}P.isDraggingInternally=!0,ee.setFragmentData(f,S.dataTransfer,"drag")}},[s,f,v.onDragStart,P]),onDrop:y.useCallback(S=>{if(!s&&ee.hasTarget(f,S.target)&&!dt(S,v.onDrop)){S.preventDefault();var q=f.selection,j=ee.findEventRange(f,S),L=S.dataTransfer;J.select(f,j),P.isDraggingInternally&&q&&!Y.equals(q,j)&&!x.void(f,{at:j,voids:!0})&&J.delete(f,{at:q}),ee.insertData(f,L),ee.isFocused(f)||ee.focus(f)}P.isDraggingInternally=!1},[s,f,v.onDrop,P]),onDragEnd:y.useCallback(S=>{!s&&P.isDraggingInternally&&v.onDragEnd&&ee.hasTarget(f,S.target)&&v.onDragEnd(S),P.isDraggingInternally=!1},[s,P,v,f]),onFocus:y.useCallback(S=>{if(!s&&!P.isUpdatingSelection&&ee.hasEditableTarget(f,S.target)&&!dt(S,v.onFocus)){var q=ee.toDOMNode(f,f),j=ee.findDocumentOrShadowRoot(f);if(P.latestElement=j.activeElement,Qn&&S.target!==q){q.focus();return}gn.set(f,!0)}},[s,P,f,v.onFocus]),onKeyDown:y.useCallback(S=>{if(!s&&ee.hasEditableTarget(f,S.target)){var q;(q=z.current)===null||q===void 0||q.handleKeyDown(S);var{nativeEvent:j}=S;if(ee.isComposing(f)&&j.isComposing===!1&&(kn.set(f,!1),g(!1)),dt(S,v.onKeyDown)||ee.isComposing(f))return;var{selection:L}=f,Q=f.children[L!==null?L.focus.path[0]:0],Z=Cf(ue.string(Q))==="rtl";if(Ze.isRedo(j)){S.preventDefault();var X=f;typeof X.redo=="function"&&X.redo();return}if(Ze.isUndo(j)){S.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ze.isMoveLineBackward(j)){S.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ze.isMoveLineForward(j)){S.preventDefault(),J.move(f,{unit:"line"});return}if(Ze.isExtendLineBackward(j)){S.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ze.isExtendLineForward(j)){S.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ze.isMoveBackward(j)){S.preventDefault(),L&&Y.isCollapsed(L)?J.move(f,{reverse:!Z}):J.collapse(f,{edge:Z?"end":"start"});return}if(Ze.isMoveForward(j)){S.preventDefault(),L&&Y.isCollapsed(L)?J.move(f,{reverse:Z}):J.collapse(f,{edge:Z?"start":"end"});return}if(Ze.isMoveWordBackward(j)){S.preventDefault(),L&&Y.isExpanded(L)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!Z});return}if(Ze.isMoveWordForward(j)){S.preventDefault(),L&&Y.isExpanded(L)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:Z});return}if(cn){if((Kf||Br)&&L&&(Ze.isDeleteBackward(j)||Ze.isDeleteForward(j))&&Y.isCollapsed(L)){var te=ue.parent(f,L.anchor.path);if(de.isElement(te)&&x.isVoid(f,te)&&(x.isInline(f,te)||x.isBlock(f,te))){S.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ze.isBold(j)||Ze.isItalic(j)||Ze.isTransposeCharacter(j)){S.preventDefault();return}if(Ze.isSoftBreak(j)){S.preventDefault(),x.insertSoftBreak(f);return}if(Ze.isSplitBlock(j)){S.preventDefault(),x.insertBreak(f);return}if(Ze.isDeleteBackward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ze.isDeleteForward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ze.isDeleteLineBackward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ze.isDeleteLineForward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ze.isDeleteWordBackward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ze.isDeleteWordForward(j)){S.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(S=>{!s&&ee.hasEditableTarget(f,S.target)&&!dt(S,v.onPaste)&&(!cn||d1(S.nativeEvent)||Br)&&(S.preventDefault(),ee.insertData(f,S.clipboardData))},[s,f,v.onPaste])}),y.createElement(fC,{decorations:M,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},mC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Ut({},t),n,ht&&y.createElement("br",null))},pC=()=>[],gC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Y.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Gb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},dt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},sc=e=>vn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),vC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},bC=y.createContext(!1),yC=y.createContext({});function xC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var CC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],wC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=lr(e,CC),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(rt.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(rt.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=xC(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(g=>({v:g.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(Vs.set(t,p),()=>{Vs.set(t,()=>{})}),[t,p]);var[m,v]=y.useState(ee.isFocused(t));return y.useEffect(()=>{v(ee.isFocused(t))},[t]),Zr(()=>{var f=()=>v(ee.isFocused(t));return Hf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(yC.Provider,{value:d},y.createElement(uh.Provider,{value:l},y.createElement($o.Provider,{value:l.editor},y.createElement(bC.Provider,{value:m},n))))},oc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},uc=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return oc(r,a)&&oc(a,r)},DC=(e,t)=>{var n=x.range(e,Y.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(uc(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)uc(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function lc(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 cc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lc(Object(n),!0).forEach(function(r){Pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var EC=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 yi.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=qo.get(r))===null||h===void 0||h(),!$t.get(r)&&(p=bt.get(r))!==null&&p!==void 0&&p.length&&$t.set(r,null),tn.delete(r),o(u,d)},r.removeMark=u=>{var d;!$t.get(r)&&(d=bt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),tn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Y.isCollapsed(r.selection)){var d=x.above(r,{match:v=>de.isElement(v)&&x.isBlock(r,v),at:r.selection});if(d){var[,h]=d,p=x.range(r,h,r.selection.anchor),m=DC(r,p);Y.isCollapsed(m)||J.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=bt.get(r);if(p!=null&&p.length){var m=p.map(O=>E1(O,u)).filter(Boolean);bt.set(r,m)}var v=hn.get(r);v&&hn.set(r,Ql(r,v,u));var f=fn.get(r);if(f!=null&&f.at){var b=Be.isPoint(f==null?void 0:f.at)?Zs(r,f.at,u):Ql(r,f.at,u);fn.set(r,b?cc(cc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Vn(r,u.path));break}case"set_selection":{var g;(g=Pr.get(r))===null||g===void 0||g.unref(),Pr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Vn(r,I.parent(u.path)));break}case"merge_node":{var w=I.previous(u.path);d.push(...Vn(r,w));break}case"move_node":{var E=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Vn(r,E));var B;I.isBefore(u.path,u.newPath)?(d.push(...Vn(r,I.parent(u.path))),B=u.newPath):(d.push(...Vn(r,I.parent(u.newPath))),B=u.path);var D=ue.get(t,I.parent(B)),k=ee.findKey(r,D),T=x.pathRef(r,I.parent(B));h.push([T,k]);break}}a(u);for(var[$,P]of d){var[z]=x.node(r,$);Xa.set(z,P)}for(var[R,A]of h)if(R.current){var[F]=x.node(r,R.current);Xa.set(F,A)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=Y.edges(d),m=x.void(r,{at:h.path}),v=x.void(r,{at:p.path});if(!(Y.isCollapsed(d)&&!m)){var f=ee.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(g=z)}),v){var[w]=v,E=f.cloneRange(),B=ee.toDOMNode(r,w);E.setEndAfter(B),b=E.cloneContents()}if(m&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var R=z.getAttribute("data-slate-zero-width")==="n";z.textContent=R?`
81
- `:""}),Qf(g)){var D=g.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(g),b.appendChild(D),g=D}var k=r.getFragment(),T=JSON.stringify(k),$=window.btoa(encodeURIComponent(T));g.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var P=b.ownerDocument.createElement("div");return P.appendChild(b),P.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(P),u.setData("text/html",P.innerHTML),u.setData("text/plain",Xf(P)),b.ownerDocument.body.removeChild(P),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||g1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&J.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=Hf<18?Gc.unstable_batchedUpdates:h=>h();d(()=>{var h=Vs.get(r);h&&h(u),i(u)})},r},Vn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const Gs="MENTION: ",ch={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},dc={"mention-popover":35,default:-52},Qi=16,dh=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(un),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,v;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=E=>{if(!x.hasPath(e,E.path))return!1;const B=ue.get(e,E.path);return x.isEditor(B)||de.isElement(B)?E.offset<=B.children.length:he.isText(B)?E.offset<=B.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||ch).getBoundingClientRect();const w=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/Qi}rem`),d=(w==null?void 0:w.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const h=dc[t]||dc.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Qi}rem`,l.style.left=`${d/Qi}rem`},o),r},_C=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===K.link});if(a){const i=a[0],s=lo(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var ft=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e.h3="heading_three",e))(ft||{});const Jn={[K.paragraph]:K.paragraph,[K.blockquote]:K.blockquote,[K.codeblock]:K.codeblock,[K.link]:K.link,[K.ul]:K.ul,[K.ol]:K.ol,[K.li]:K.li,[K.mention]:K.mention,[K.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ht.emphasis]:K.italic,[Ht.strong]:K.bold,[Ht.delete]:K.strikethrough,[Ht.code]:K.code,[K.hr]:K.hr,[K.image]:K.image,[K.h3]:K.h3};function fc(e){if(e)throw e}var Pa=Object.prototype.hasOwnProperty,fh=Object.prototype.toString,hc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,pc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):fh.call(t)==="[object Array]"},gc=function(t){if(!t||fh.call(t)!=="[object Object]")return!1;var n=Pa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Pa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Pa.call(t,a)},vc=function(t,n){hc&&n.name==="__proto__"?hc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},bc=function(t,n){if(n==="__proto__")if(Pa.call(t,n)){if(mc)return mc(t,n).value}else return;return t[n]},kC=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=bc(o,n),a=bc(t,n),o!==a&&(d&&a&&(gc(a)||(i=pc(a)))?(i?(i=!1,s=r&&pc(r)?r:[]):s=r&&gc(r)?r:{},vc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&vc(o,{name:n,newValue:a}));return o};const Ji=Mn(kC);function Qs(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 FC(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?AC(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function AC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Mr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yc(e.position):"start"in e||"end"in e?yc(e):"line"in e||"column"in e?Js(e):""}function Js(e){return xc(e&&e.line)+":"+xc(e&&e.column)}function yc(e){return Js(e&&e.start)+"-"+Js(e&&e.end)}function xc(e){return e&&typeof e=="number"?e:1}class Ct extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Mr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Wt={basename:BC,dirname:TC,extname:SC,join:jC,sep:"/"};function BC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xr(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function TC(e){if(Xr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function SC(e){Xr(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function jC(...e){let t=-1,n;for(;++t<e.length;)Xr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":OC(n)}function OC(e){Xr(e);const t=e.codePointAt(0)===47;let n=PC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function PC(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Xr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const MC={cwd:NC};function NC(){return"/"}function Xs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function IC(e){if(typeof e=="string")e=new URL(e);else if(!Xs(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 RC(e)}function RC(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 Xi=["history","path","basename","stem","extname","dirname"];class $C{constructor(t){let n;t?Xs(t)?n={path:t}:typeof t=="string"||LC(t)?n={value:t}:n=t:n={},this.cwd=MC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Xi.length;){const i=Xi[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)Xi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Wt.basename(this.path):void 0}set basename(t){ts(t,"basename"),es(t,"basename"),this.path=Wt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wt.dirname(this.path):void 0}set dirname(t){Cc(this.basename,"dirname"),this.path=Wt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wt.extname(this.path):void 0}set extname(t){if(es(t,"extname"),Cc(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Wt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Xs(t)&&(t=IC(t)),ts(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wt.basename(this.path,this.extname):void 0}set stem(t){ts(t,"stem"),es(t,"stem"),this.path=Wt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Ct(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function es(e,t){if(e&&e.includes(Wt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wt.sep+"`")}function ts(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Cc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function LC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zC=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},qC={}.hasOwnProperty;class Vo extends zC{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=FC()}copy(){const t=new Vo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ji(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(as("data",this.frozen),this.namespace[t]=n,this):qC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(as("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=xa(t),r=this.parser||this.Parser;return ns("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ns("process",this.parser||this.Parser),rs("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=xa(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,v=r.stringify(m,p);VC(v)?p.value=v:p.result=v,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),ns("processSync",this.parser||this.Parser),rs("processSync",this.compiler||this.Compiler),this.process(t,a),Dc("processSync","process",n),r;function a(i,s){n=!0,fc(i),r=s}}run(t,n,r){wc(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=xa(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Dc("runSync","run",r),a;function i(s,o){fc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=xa(n),a=this.compiler||this.Compiler;return rs("stringify",a),wc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(as("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ji(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...v]=d;const f=r[p][1];Qs(f)&&Qs(m)&&(m=Ji(!0,f,m)),r[p]=[u,m,...v]}}}}const UC=new Vo().freeze();function ns(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function rs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function as(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 wc(e){if(!Qs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xa(e){return WC(e)?e:new $C(e)}function WC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function VC(e){return typeof e=="string"||HC(e)}function HC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const KC={};function ZC(e,t){const n=t||KC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return hh(e,r,a)}function hh(e,t,n){if(YC(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 Ec(e.children,t,n)}return Array.isArray(e)?Ec(e,t,n):""}function Ec(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=hh(e[a],t,n);return r.join("")}function YC(e){return!!(e&&typeof e=="object")}const _c=document.createElement("i");function Ho(e){const t="&"+e+";";_c.innerHTML=t;const n=_c.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function an(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function jt(e,t){return e.length>0?(an(e,e.length,0,t),e):t}const kc={}.hasOwnProperty;function GC(e){const t={};let n=-1;for(;++n<e.length;)QC(t,e[n]);return t}function QC(e,t){let n;for(n in t){const a=(kc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){kc.call(a,s)||(a[s]=[]);const o=i[s];JC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function JC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);an(e,0,0,r)}function mh(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function nr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vt=Cn(/[A-Za-z]/),Lt=Cn(/[\dA-Za-z]/),XC=Cn(/[#-'*+\--9=?A-Z^-~]/);function eo(e){return e!==null&&(e<32||e===127)}const to=Cn(/\d/),ew=Cn(/[\dA-Fa-f]/),tw=Cn(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const nw=Cn(/\p{P}|\p{S}/u),rw=Cn(/\s/);function Cn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ve(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ne(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ne(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const aw={tokenize:iw};function iw(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"),Ve(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 Ce(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const sw={tokenize:ow},Fc={tokenize:uw};function ow(e){const t=this,n=[];let r=0,a,i,s;return o;function o(E){if(r<n.length){const B=n[r];return t.containerState=B[1],e.attempt(B[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const B=t.events.length;let D=B,k;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){k=t.events[D][1].end;break}g(r);let T=B;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},k),T++;return an(t.events,D+1,0,t.events.slice(B)),t.events.length=T,u(E)}return o(E)}function u(E){if(r===n.length){if(!a)return p(E);if(a.currentConstruct&&a.currentConstruct.concrete)return v(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fc,d,h)(E)}function d(E){return a&&w(),g(r),p(E)}function h(E){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(E)}function p(E){return t.containerState={},e.attempt(Fc,m,v)(E)}function m(E){return r++,n.push([t.currentConstruct,t.containerState]),p(E)}function v(E){if(E===null){a&&w(),g(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(E)}function f(E){if(E===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(E);return}return Ce(E)?(e.consume(E),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(E),f)}function b(E,B){const D=t.sliceStream(E);if(B&&D.push(null),E.previous=i,i&&(i.next=E),i=E,a.defineSkip(E.start),a.write(D),t.parser.lazy[E.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const T=t.events.length;let $=T,P,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(P){z=t.events[$][1].end;break}P=!0}for(g(r),k=T;k<t.events.length;)t.events[k][1].end=Object.assign({},z),k++;an(t.events,$+1,0,t.events.slice(T)),t.events.length=k}}function g(E){let B=n.length;for(;B-- >E;){const D=n[B];t.containerState=D[1],D[0].exit.call(t,e)}n.length=E}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function uw(e,t,n){return Ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ac(e){if(e===null||xt(e)||rw(e))return 1;if(nw(e))return 2}function Ko(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 no={name:"attention",tokenize:cw,resolveAll:lw};function lw(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);Bc(h,-l),Bc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=jt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=jt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=jt(u,Ko(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=jt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=jt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,an(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function cw(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ac(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Ac(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function Bc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dw={name:"autolink",tokenize:fw};function fw(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Vt(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||Lt(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||Lt(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||eo(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):XC(m)?(e.consume(m),u):n(m)}function d(m){return Lt(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||Lt(m))&&r++<63){const v=m===45?p:h;return e.consume(m),v}return n(m)}}const xi={tokenize:hw,partial:!0};function hw(e,t,n){return r;function r(i){return Ne(i)?Ve(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Ce(i)?t(i):n(i)}}const ph={name:"blockQuote",tokenize:mw,continuation:{tokenize:pw},exit:gw};function mw(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 Ne(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function pw(e,t,n){const r=this;return a;function a(s){return Ne(s)?Ve(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(ph,t,n)(s)}}function gw(e){e.exit("blockQuote")}const gh={name:"characterEscape",tokenize:vw};function vw(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 tw(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const vh={name:"characterReference",tokenize:bw};function bw(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Lt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=ew,d):(e.enter("characterReferenceValue"),i=7,s=to,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===Lt&&!Ho(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const Tc={tokenize:xw,partial:!0},Sc={name:"codeFenced",tokenize:yw,concrete:!0};function yw(e,t,n){const r=this,a={tokenize:D,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===o?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Ne(k)?Ve(e,h,"whitespace")(k):h(k))}function h(k){return k===null||Ce(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Tc,f,B)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):Ne(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),p)}function m(k){return k===null||Ce(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===o?n(k):(e.consume(k),v)}function f(k){return e.attempt(a,B,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),g}function g(k){return i>0&&Ne(k)?Ve(e,w,"linePrefix",i+1)(k):w(k)}function w(k){return k===null||Ce(k)?e.check(Tc,f,B)(k):(e.enter("codeFlowValue"),E(k))}function E(k){return k===null||Ce(k)?(e.exit("codeFlowValue"),w(k)):(e.consume(k),E)}function B(k){return e.exit("codeFenced"),t(k)}function D(k,T,$){let P=0;return z;function z(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),R}function R(M){return k.enter("codeFencedFence"),Ne(M)?Ve(k,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):A(M)}function A(M){return M===o?(k.enter("codeFencedFenceSequence"),F(M)):$(M)}function F(M){return M===o?(P++,k.consume(M),F):P>=s?(k.exit("codeFencedFenceSequence"),Ne(M)?Ve(k,O,"whitespace")(M):O(M)):$(M)}function O(M){return M===null||Ce(M)?(k.exit("codeFencedFence"),T(M)):$(M)}}}function xw(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 is={name:"codeIndented",tokenize:ww},Cw={tokenize:Dw,partial:!0};function ww(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ve(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):Ce(u)?e.attempt(Cw,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Ce(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function Dw(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):Ce(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ve(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):Ce(s)?a(s):n(s)}}const Ew={name:"codeText",tokenize:Fw,resolve:_w,previous:kw};function _w(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 kw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Fw(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||Ce(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class Aw{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&_r(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_r(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_r(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);_r(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_r(this.left,n.reverse())}}}function _r(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function bh(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new Aw(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Bw(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return an(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Bw(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,v=0,f=0;const b=[f];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const g=o.slice(b[p],b[p+1]),w=i.pop();l.push([w,w+g.length-1]),e.splice(w,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[v+l[p][0]]=v+l[p][1],v+=l[p][1]-l[p][0]-1;return u}const Tw={tokenize:Ow,resolve:jw},Sw={tokenize:Pw,partial:!0};function jw(e){return bh(e),e}function Ow(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):Ce(o)?e.check(Sw,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 Pw(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ve(e,i,"linePrefix")}function i(s){if(s===null||Ce(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 yh(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(g){return g===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||eo(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||Ce(g)?n(g):(e.consume(g),g===92?v:m)}function v(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function f(g){return!d&&(g===null||g===41||xt(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||eo(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function xh(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):Ce(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||Ce(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Ne(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function Ch(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):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ve(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||Ce(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Nr(e,t){let n;return r;function r(a){return Ce(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ne(a)?Ve(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Mw={name:"definition",tokenize:Iw},Nw={tokenize:Rw,partial:!0};function Iw(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return xh.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return xt(m)?Nr(e,u)(m):u(m)}function u(m){return yh(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(Nw,h,h)(m)}function h(m){return Ne(m)?Ve(e,p,"whitespace")(m):p(m)}function p(m){return m===null||Ce(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function Rw(e,t,n){return r;function r(o){return xt(o)?Nr(e,a)(o):n(o)}function a(o){return Ch(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ne(o)?Ve(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Ce(o)?t(o):n(o)}}const $w={name:"hardBreakEscape",tokenize:Lw};function Lw(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Ce(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const zw={name:"headingAtx",tokenize:Uw,resolve:qw};function qw(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},an(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Uw(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||xt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):Ne(d)?Ve(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||xt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const Ww=["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"],jc=["pre","script","style","textarea"],Vw={name:"htmlFlow",tokenize:Yw,resolveTo:Zw,concrete:!0},Hw={tokenize:Qw,partial:!0},Kw={tokenize:Gw,partial:!0};function Zw(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 Yw(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:C):Vt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,m):_===91?(e.consume(_),a=5,o=0,v):Vt(_)?(e.consume(_),a=4,r.interrupt?t:C):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:C):n(_)}function v(_){const S="CDATA[";return _===S.charCodeAt(o++)?(e.consume(_),o===S.length?r.interrupt?t:A:v):n(_)}function f(_){return Vt(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||xt(_)){const S=_===47,q=s.toLowerCase();return!S&&!i&&jc.includes(q)?(a=1,r.interrupt?t(_):A(_)):Ww.includes(s.toLowerCase())?(a=6,S?(e.consume(_),g):r.interrupt?t(_):A(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?w(_):E(_))}return _===45||Lt(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:A):n(_)}function w(_){return Ne(_)?(e.consume(_),w):z(_)}function E(_){return _===47?(e.consume(_),z):_===58||_===95||Vt(_)?(e.consume(_),B):Ne(_)?(e.consume(_),E):z(_)}function B(_){return _===45||_===46||_===58||_===95||Lt(_)?(e.consume(_),B):D(_)}function D(_){return _===61?(e.consume(_),k):Ne(_)?(e.consume(_),D):E(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,T):Ne(_)?(e.consume(_),k):$(_)}function T(_){return _===l?(e.consume(_),l=null,P):_===null||Ce(_)?n(_):(e.consume(_),T)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||xt(_)?D(_):(e.consume(_),$)}function P(_){return _===47||_===62||Ne(_)?E(_):n(_)}function z(_){return _===62?(e.consume(_),R):n(_)}function R(_){return _===null||Ce(_)?A(_):Ne(_)?(e.consume(_),R):n(_)}function A(_){return _===45&&a===2?(e.consume(_),U):_===60&&a===1?(e.consume(_),W):_===62&&a===4?(e.consume(_),G):_===63&&a===3?(e.consume(_),C):_===93&&a===5?(e.consume(_),se):Ce(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Hw,ne,F)(_)):_===null||Ce(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),A)}function F(_){return e.check(Kw,O,ne)(_)}function O(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||Ce(_)?F(_):(e.enter("htmlFlowData"),A(_))}function U(_){return _===45?(e.consume(_),C):A(_)}function W(_){return _===47?(e.consume(_),s="",ie):A(_)}function ie(_){if(_===62){const S=s.toLowerCase();return jc.includes(S)?(e.consume(_),G):A(_)}return Vt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):A(_)}function se(_){return _===93?(e.consume(_),C):A(_)}function C(_){return _===62?(e.consume(_),G):_===45&&a===2?(e.consume(_),C):A(_)}function G(_){return _===null||Ce(_)?(e.exit("htmlFlowData"),ne(_)):(e.consume(_),G)}function ne(_){return e.exit("htmlFlow"),t(_)}}function Gw(e,t,n){const r=this;return a;function a(s){return Ce(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 Qw(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xi,t,n)}}const Jw={name:"htmlText",tokenize:Xw};function Xw(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),D):C===63?(e.consume(C),E):Vt(C)?(e.consume(C),$):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,v):Vt(C)?(e.consume(C),w):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):Ce(C)?(s=h,W(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?U(C):C===45?p(C):h(C)}function v(C){const G="CDATA[";return C===G.charCodeAt(i++)?(e.consume(C),i===G.length?f:v):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):Ce(C)?(s=f,W(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),g):f(C)}function g(C){return C===62?U(C):C===93?(e.consume(C),g):f(C)}function w(C){return C===null||C===62?U(C):Ce(C)?(s=w,W(C)):(e.consume(C),w)}function E(C){return C===null?n(C):C===63?(e.consume(C),B):Ce(C)?(s=E,W(C)):(e.consume(C),E)}function B(C){return C===62?U(C):E(C)}function D(C){return Vt(C)?(e.consume(C),k):n(C)}function k(C){return C===45||Lt(C)?(e.consume(C),k):T(C)}function T(C){return Ce(C)?(s=T,W(C)):Ne(C)?(e.consume(C),T):U(C)}function $(C){return C===45||Lt(C)?(e.consume(C),$):C===47||C===62||xt(C)?P(C):n(C)}function P(C){return C===47?(e.consume(C),U):C===58||C===95||Vt(C)?(e.consume(C),z):Ce(C)?(s=P,W(C)):Ne(C)?(e.consume(C),P):U(C)}function z(C){return C===45||C===46||C===58||C===95||Lt(C)?(e.consume(C),z):R(C)}function R(C){return C===61?(e.consume(C),A):Ce(C)?(s=R,W(C)):Ne(C)?(e.consume(C),R):P(C)}function A(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,F):Ce(C)?(s=A,W(C)):Ne(C)?(e.consume(C),A):(e.consume(C),O)}function F(C){return C===a?(e.consume(C),a=void 0,M):C===null?n(C):Ce(C)?(s=F,W(C)):(e.consume(C),F)}function O(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||xt(C)?P(C):(e.consume(C),O)}function M(C){return C===47||C===62||xt(C)?P(C):n(C)}function U(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function W(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),ie}function ie(C){return Ne(C)?Ve(e,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):se(C)}function se(C){return e.enter("htmlTextData"),s(C)}}const Zo={name:"labelEnd",tokenize:iD,resolveTo:aD,resolveAll:rD},eD={tokenize:sD},tD={tokenize:oD},nD={tokenize:uD};function rD(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 aD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=jt(o,e.slice(i+1,i+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,Ko(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",l,t]]),an(e,i,e.length,o),e}function iD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(nr(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(eD,d,s?d:h)(p):p===91?e.attempt(tD,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(nD,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function sD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return xt(h)?Nr(e,i)(h):i(h)}function i(h){return h===41?d(h):yh(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return xt(h)?Nr(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Ch(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return xt(h)?Nr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function oD(e,t,n){const r=this;return a;function a(o){return xh.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(nr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function uD(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 lD={name:"labelStartImage",tokenize:cD,resolveAll:Zo.resolveAll};function cD(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:fD,resolveAll:Zo.resolveAll};function fD(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 ss={name:"lineEnding",tokenize:hD};function hD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ve(e,t,"linePrefix")}}const Ma={name:"thematicBreak",tokenize:mD};function mD(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||Ce(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ne(u)?Ve(e,o,"whitespace")(u):o(u))}}const gt={name:"list",tokenize:vD,continuation:{tokenize:bD},exit:xD},pD={tokenize:CD,partial:!0},gD={tokenize:yD,partial:!0};function vD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(m){const v=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:to(m)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ma,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return to(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(xi,r.interrupt?n:d,e.attempt(pD,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Ne(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function bD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ve(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ne(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(gD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ve(e,e.attempt(gt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function yD(e,t,n){const r=this;return Ve(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 xD(e){e.exit(this.containerState.type)}function CD(e,t,n){const r=this;return Ve(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!Ne(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Oc={name:"setextUnderline",tokenize:DD,resolveTo:wD};function wD(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 DD(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ne(u)?Ve(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Ce(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ED={tokenize:_D};function _D(e){const t=this,n=e.attempt(xi,r,e.attempt(this.parser.constructs.flowInitial,a,Ve(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Tw,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 kD={resolveAll:Dh()},FD=wh("string"),AD=wh("text");function wh(e){return{tokenize:t,resolveAll:Dh(e==="text"?BD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Dh(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 BD(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 TD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:E,exit:B,attempt:T(D),check:T(k),interrupt:T(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:v,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(R){return s=jt(s,R),b(),s[s.length-1]!==null?[]:($(t,0),u.events=Ko(i,u.events,u),u.events)}function p(R,A){return jD(m(R),A)}function m(R){return SD(s,R)}function v(){const{line:R,column:A,offset:F,_index:O,_bufferIndex:M}=r;return{line:R,column:A,offset:F,_index:O,_bufferIndex:M}}function f(R){a[R.line]=R.column,z()}function b(){let R;for(;r._index<s.length;){const A=s[r._index];if(typeof A=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<A.length;)g(A.charCodeAt(r._bufferIndex));else g(A)}}function g(R){d=d(R)}function w(R){Ce(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,z()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=R}function E(R,A){const F=A||{};return F.type=R,F.start=v(),u.events.push(["enter",F,u]),o.push(F),F}function B(R){const A=o.pop();return A.end=v(),u.events.push(["exit",A,u]),A}function D(R,A){$(R,A.from)}function k(R,A){A.restore()}function T(R,A){return F;function F(O,M,U){let W,ie,se,C;return Array.isArray(O)?ne(O):"tokenize"in O?ne([O]):G(O);function G(j){return L;function L(Q){const Z=Q!==null&&j[Q],X=Q!==null&&j.null,le=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(X)?X:X?[X]:[]];return ne(le)(Q)}}function ne(j){return W=j,ie=0,j.length===0?U:_(j[ie])}function _(j){return L;function L(Q){return C=P(),se=j,j.partial||(u.currentConstruct=j),j.name&&u.parser.constructs.disable.null.includes(j.name)?q():j.tokenize.call(A?Object.assign(Object.create(u),A):u,l,S,q)(Q)}}function S(j){return R(se,C),M}function q(j){return C.restore(),++ie<W.length?_(W[ie]):U}}}function $(R,A){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&an(u.events,A,u.events.length-A,R.resolve(u.events.slice(A),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function P(){const R=v(),A=u.previous,F=u.currentConstruct,O=u.events.length,M=Array.from(o);return{restore:U,from:O};function U(){r=R,u.previous=A,u.currentConstruct=F,u.events.length=O,o=M,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function SD(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 jD(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=`
76
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var C;u=o,d=((C=o.textContent)===null||C===void 0?void 0:C.length)||0}var D=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!D)return null;var F=m?D:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!F)return null;var E={anchor:D,focus:F};return Y.isExpanded(E)&&Y.isForward(E)&&Pt(u)&&x.void(e,{at:E.focus,mode:"highest"})&&(E=x.unhangRange(e,E,{voids:!0})),E}};function l1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=le.get(e,n);if(!ge.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=R.next(n);if(!x.hasPath(e,i))return!1;var s=le.get(e,i);return ge.isText(s)&&s.text.startsWith(r.text)}function em(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 c1(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 d1(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 tm(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=c1(i,a),o=Math.min(i.length-s,a.length-s),l=d1(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 f1(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=em(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 tm(e,{start:r,end:l,text:o})}function m1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Vs(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=le.get(e,n);if(!ge.isText(a))return null;var i=x.above(e,{match:o=>fe.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:ge.isText});if(!s||!R.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Zl(e,t){var n=Vs(e,t.anchor);if(!n)return null;if(Y.isCollapsed(t))return{anchor:n,focus:n};var r=Vs(e,t.focus);return r?{anchor:n,focus:r}:null}function Hs(e,t,n){var r=xt.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return R.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return Fe.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=Fe.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=Fe.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&R.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Yl(e,t,n){var r=Hs(e,t.anchor,n);if(!r)return null;if(Y.isCollapsed(t))return{anchor:r,focus:r};var a=Hs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function h1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!R.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!R.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!R.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:R.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:R.transform(n,t,{affinity:"forward"})};case"merge_node":return R.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:R.transform(n,t)}:{diff:r,id:a,path:R.transform(n,t)}}var i=R.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ya(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gl(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var p1=25,g1=200,v1=function(){},b1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function y1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=pn.get(t);if(pn.delete(t),B){var{selection:A}=t,O=Zl(t,B);O&&(!A||!Y.equals(O,A))&&X.select(t,O)}},m=()=>{var B=hn.get(t);if(hn.delete(t),!!B){if(B.at){var A=Fe.isPoint(B.at)?Vs(t,B.at):Zl(t,B.at);if(!A)return;var O=x.range(t,A);(!t.selection||!Y.equals(t.selection,O))&&X.select(t,A)}B.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!F()&&!D()){d();return}a||(a=!0,setTimeout(()=>a=!1)),D()&&(a="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});rn.set(t,t.marks),v1("flush",hn.get(t),xt.get(t));for(var A=F(),O;O=(j=xt.get(t))===null||j===void 0?void 0:j[0];){var j,U,W=$t.get(t);W!==void 0&&($t.delete(t),t.marks=W),W&&u===!1&&(u=null);var re=m1(O);(!t.selection||!Y.equals(t.selection,re))&&X.select(t,re),O.diff.text?x.insertText(t,O.diff.text):x.deleteFragment(t),xt.set(t,(U=xt.get(t))===null||U===void 0?void 0:U.filter(Q=>{var{id:se}=Q;return se!==O.id})),l1(t,O)||(A=!1,hn.delete(t),rn.delete(t),a="action",pn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var ne=B==null?void 0:B.unref();if(ne&&!pn.get(t)&&(!t.selection||!Y.equals(ne,t.selection))&&X.select(t,ne),D()){m();return}A&&n(),n.flush(),r.flush(),d();var w=rn.get(t);rn.delete(t),w!==void 0&&(t.marks=w,t.onChange())},p=B=>{i&&clearTimeout(i),i=setTimeout(()=>{Bn.set(t,!1),h()},p1)},v=B=>{Bn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=zs.get(t);if(O){if(F()||A){O.style.display="none";return}O.style.removeProperty("display")}},b=(B,A)=>{var O,j=(O=xt.get(t))!==null&&O!==void 0?O:[];xt.set(t,j);var U=le.leaf(t,B),W=j.findIndex(w=>R.equals(w.path,B));if(W<0){var re=tm(U.text,A);re&&j.push({path:B,diff:A,id:l++}),f();return}var ne=f1(U.text,j[W].diff,A);if(!ne){j.splice(W,1),f();return}j[W]=ya(ya({},j[W]),{},{diff:ne})},g=function(A){var{at:O}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,pn.delete(t),n.cancel(),r.cancel(),D()&&h(),hn.set(t,{at:O,run:A}),o=setTimeout(h)},C=B=>{var A;s&&(clearTimeout(s),s=null);var{inputType:O}=B,j=null,U=B.dataTransfer||B.data||void 0;u!==!1&&O!=="insertText"&&O!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(j=ee.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var re=ee.getWindow(t),ne=re.getSelection();if(!j&&ne&&(W=ne,j=ee.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),j=(A=j)!==null&&A!==void 0?A:t.selection,!!j){var w=!0;if(O.startsWith("delete")){if(Y.isExpanded(j)){var[Q,se]=Y.edges(j),k=le.leaf(t,Q.path);if(k.text.length===Q.offset&&se.offset===0){var M=x.next(t,{at:Q.path,match:ge.isText});M&&R.equals(M[1],se.path)&&(j={anchor:se,focus:se})}}var q=O.endsWith("Backward")?"backward":"forward",[S,L]=Y.edges(j),[G,K]=x.leaf(t,S.path),te={text:"",start:S.offset,end:L.offset},ce=xt.get(t),J=ce==null?void 0:ce.find(me=>R.equals(me.path,K)),he=J?[J.diff,te]:[te],pe=em(G.text,...he);if(pe.length===0&&(w=!1),Y.isExpanded(j)){if(w&&R.equals(j.anchor.path,j.focus.path)){var we={path:j.anchor.path,offset:S.offset},Me=x.range(t,we,we);return T(Me),b(j.anchor.path,{text:"",end:L.offset,start:S.offset})}return g(()=>x.deleteFragment(t,{direction:q}),{at:j})}}switch(O){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>x.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:je}=j;if(w&&Y.isCollapsed(j)){var Je=le.leaf(t,je.path);if(je.offset<Je.text.length)return b(je.path,{text:"",start:je.offset,end:je.offset+1})}return g(()=>x.deleteForward(t),{at:j})}case"deleteContentBackward":{var Ue,{anchor:Le}=j,Xe=Ws(W)?W.isCollapsed:!!((Ue=W)!==null&&Ue!==void 0&&Ue.collapsed);return w&&Xe&&Y.isCollapsed(j)&&Le.offset>0?b(Le.path,{text:"",start:Le.offset-1,end:Le.offset}):g(()=>x.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return g(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return g(()=>x.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return g(()=>x.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return g(()=>x.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return g(()=>x.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return g(()=>x.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return g(()=>x.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return g(()=>x.insertSoftBreak(t),{at:j});case"insertParagraph":return g(()=>x.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(b1(U))return g(()=>ee.insertData(t,U),{at:j});var _e=U??"";if($t.get(t)&&(_e=_e.replace("\uFEFF","")),O==="insertText"&&/.*\n.*\n$/.test(_e)&&(_e=_e.slice(0,-1)),_e.includes(`
77
+ `))return g(()=>{var me=_e.split(`
78
+ `);me.forEach((ve,ke)=>{ve&&x.insertText(t,ve),ke!==me.length-1&&x.insertSoftBreak(t)})},{at:j});if(R.equals(j.anchor.path,j.focus.path)){var[Oe,We]=Y.edges(j),Z={start:Oe.offset,end:We.offset,text:_e};if(_e&&u&&O==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),ie=Z.start+Z.text.search(/\S|$/);ie===oe+1&&Z.end===u.start+u.text.length?(Z.start-=1,u=null,z()):u=!1}else O==="insertText"?u===null?u=Z:u&&Y.isCollapsed(j)&&u.end+u.text.length===Oe.offset?u=ya(ya({},u),{},{text:u.text+_e}):u=!1:u=!1;if(w){b(Oe.path,Z);return}}return g(()=>x.insertText(t,_e),{at:j})}}}},D=()=>!!hn.get(t),F=()=>{var B;return!!((B=xt.get(t))!==null&&B!==void 0&&B.length)},E=()=>D()||F(),_=()=>a,T=B=>{pn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(B){var O=!A||!R.equals(A.anchor.path,B.anchor.path),j=!A||!R.equals(A.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(O&&u||j)&&(u=!1),(O||F())&&(s=setTimeout(h,g1))}},I=()=>{(D()||!F())&&h()},P=B=>{F()||(f(!0),setTimeout(f))},z=()=>{D()||(o=setTimeout(h))},$=B=>{if(!(F()||D())&&B.some(O=>qo(t,O,B))){var A;(A=Yf.get(t))===null||A===void 0||A()}};return{flush:h,scheduleFlush:z,hasPendingDiffs:F,hasPendingAction:D,hasPendingChanges:E,isFlushing:_,handleUserSelect:T,handleCompositionEnd:p,handleCompositionStart:v,handleDOMBeforeInput:C,handleKeyDown:P,handleDomMutations:$,handleInput:I}}function x1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Yr=Oa?y.useLayoutEffect:y.useEffect;function C1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Yr(()=>{r.takeRecords()}),y.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var D1=["node"];function Ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function w1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ql(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var E1={subtree:!0,childList:!0,characterData:!0},_1=pt?e=>{var{node:t}=e,n=fr(e,D1);if(!pt)return null;var r=Dn(),a=x1(),[i]=y.useState(()=>y1(w1({editor:r},n)));return C1(t,i.handleDomMutations,E1),Lo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,k1=["anchor","focus"],F1=["anchor","focus"],A1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),nm=(e,t)=>{var n=fr(e,k1),r=fr(t,F1);return e[mr]===t[mr]&&A1(n,r)},B1=(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(!Y.equals(r,a)||!nm(r,a))return!1}return!0},T1=(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||!nm(r,a))return!1}return!0};function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function S1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var j1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=Dn(),s=ee.findPath(i,a),o=R.parent(s),l=!!n[Gf];return i.isVoid(r)?y.createElement(Zi,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Zi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Zi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
+ `?y.createElement(Xl,{isTrailing:!0,text:n.text}):y.createElement(Xl,{text:n.text})},Xl=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
80
+ `:""),[i]=y.useState(a);return Yr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(O1,{ref:r},i)},O1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Zi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",S1({},a),!pt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var P1=pt?300:0;function M1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function tc(e){e.current&&(clearTimeout(e.current),e.current=null)}var N1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=C=>y.createElement(I1,rm({},C))}=e,o=Dn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),h=y.useRef(null),p=y.useCallback(C=>{if(M1(l,C==null),C==null){var D;zs.delete(o),(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,null)}else{if(zs.set(o,C),!l.current){var F=window.ResizeObserver||Ix;l.current=new F(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,C)})}l.current.observe(C),u.current=C}},[u,t,o]),v=y.createElement(j1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[mr];if(y.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},P1)):(tc(h),m(!1)),()=>tc(h)),[f,m]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Sr?"inherit":void 0},contentEditable:!1,ref:p}};v=y.createElement(y.Fragment,null,i(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},R1=y.memo(N1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&ge.equals(t.leaf,e.leaf)&&t.leaf[mr]===e.leaf[mr]),I1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",rm({},t),n)},$1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=Dn(),l=y.useRef(null),u=ge.decorations(s,t),d=ee.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(y.createElement(R1,{isLast:n&&h===u.length-1,key:"".concat(d.id,"-").concat(h),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var v=y.useCallback(f=>{var b=yi.get(o);f?(b==null||b.set(d,f),jn.set(s,f),Zr.set(f,s)):(b==null||b.delete(d),jn.delete(s),l.current&&Zr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},m)},am=y.memo($1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&T1(t.decorations,e.decorations));function nc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ks(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var L1=e=>{var{decorations:t,element:n,renderElement:r=C=>y.createElement(q1,Ks({},C)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Dn(),l=V1(),u=o.isInline(n),d=ee.findKey(o,n),m=y.useCallback(C=>{var D=yi.get(o);C?(D==null||D.set(d,C),jn.set(n,C),Zr.set(C,n)):(D==null||D.delete(d),jn.delete(n))},[o,d,n]),h=sm({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var v=le.string(n),f=Cf(v);f==="rtl"&&(p.dir=f)}if(x.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var b=u?"span":"div",[[g]]=le.texts(n);h=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(am,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:g})),Io.set(g,0),$o.set(g,n)}return r({attributes:p,children:h,element:n})},z1=y.memo(L1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&B1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Y.equals(e.selection,t.selection))),q1=e=>{var{attributes:t,children:n,element:r}=e,a=Dn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ks(Ks({},t),{},{style:{position:"relative"}}),n)},im=y.createContext(()=>[]),U1=()=>y.useContext(im),W1=y.createContext(!1),sm=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=U1(),l=Dn(),u=ee.findPath(l,n),d=[],m=fe.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),v=n.children[h],f=ee.findKey(l,v),b=x.range(l,p),g=s&&Y.intersection(b,s),C=o([v,p]);for(var D of t){var F=Y.intersection(D,b);F&&C.push(F)}fe.isElement(v)?d.push(y.createElement(W1.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement(z1,{decorations:C,element:v,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:g}))):d.push(y.createElement(am,{decorations:C,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:v})),Io.set(v,h),$o.set(v,n)}return d},om=y.createContext(!1),V1=()=>y.useContext(om),um=y.createContext(null),qn=()=>{var e=y.useContext(um);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function H1(){var e=Dn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var K1=3,Z1={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"},Y1={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"},G1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ye=e=>{var t=Z1[e],n=Y1[e],r=G1[e],a=t&&Ki(t),i=n&&Ki(n),s=r&&Ki(r);return o=>!!(a&&a(o)||Kl&&i&&i(o)||!Kl&&s&&s(o))},Qe={isBold:Ye("bold"),isCompose:Ye("compose"),isMoveBackward:Ye("moveBackward"),isMoveForward:Ye("moveForward"),isDeleteBackward:Ye("deleteBackward"),isDeleteForward:Ye("deleteForward"),isDeleteLineBackward:Ye("deleteLineBackward"),isDeleteLineForward:Ye("deleteLineForward"),isDeleteWordBackward:Ye("deleteWordBackward"),isDeleteWordForward:Ye("deleteWordForward"),isExtendBackward:Ye("extendBackward"),isExtendForward:Ye("extendForward"),isExtendLineBackward:Ye("extendLineBackward"),isExtendLineForward:Ye("extendLineForward"),isItalic:Ye("italic"),isMoveLineBackward:Ye("moveLineBackward"),isMoveLineForward:Ye("moveLineForward"),isMoveWordBackward:Ye("moveWordBackward"),isMoveWordForward:Ye("moveWordForward"),isRedo:Ye("redo"),isSoftBreak:Ye("insertSoftBreak"),isSplitBlock:Ye("splitBlock"),isTransposeCharacter:Ye("transposeCharacter"),isUndo:Ye("undo")},Q1=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>qo(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}},J1={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class lm extends y.Component{constructor(){super(...arguments),Mt(this,"context",null),Mt(this,"manager",null),Mt(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,J1)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Q1(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}}Mt(lm,"contextType",Ro);var X1=pt?lm:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},eC=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],tC=["text"];function rc(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 Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nC=e=>y.createElement(y.Fragment,null,sm(e)),rC=e=>{var t=y.useCallback(M=>y.createElement(aC,Wt({},M)),[]),{autoFocus:n,decorate:r=iC,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=sC,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,v=fr(e,eC),f=qn(),[b,g]=y.useState(!1),C=y.useRef(null),D=y.useRef([]),[F,E]=y.useState(),{onUserInput:_,receivedUserInput:T}=H1(),[,I]=y.useReducer(M=>M+1,0);Yf.set(f,I),qs.set(f,s);var P=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{C.current&&n&&C.current.focus()},[n]);var z=y.useRef(),$=y.useMemo(()=>Rb(()=>{var M=z.current;if((pt||!ee.isComposing(f))&&(!P.isUpdatingSelection||M!=null&&M.isFlushing())&&!P.isDraggingInternally){var q=ee.findDocumentOrShadowRoot(f),{activeElement:S}=q,L=ee.toDOMNode(f,f),G=q.getSelection();if(S===L?(P.latestElement=S,bn.set(f,!0)):bn.delete(f),!G)return X.deselect(f);var{anchorNode:K,focusNode:te}=G,ce=ee.hasEditableTarget(f,K)||ee.isTargetInsideNonReadonlyVoid(f,K),J=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te);if(ce&&J){var he=ee.toSlateRange(f,G,{exactMatch:!1,suppressThrow:!0});he&&(!ee.isComposing(f)&&!(M!=null&&M.hasPendingChanges())&&!(M!=null&&M.isFlushing())?X.select(f,he):M==null||M.handleUserSelect(he))}s&&(!ce||!J)&&X.deselect(f)}},100),[f,s,P]),B=y.useMemo(()=>Sb($,0),[$]);z.current=_1({node:C,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:B}),Yr(()=>{var M,q,S;C.current&&(S=zo(C.current))?(Zf.set(f,S),Pa.set(f,C.current),jn.set(f,C.current),Zr.set(C.current,f)):jn.delete(f);var{selection:L}=f,G=ee.findDocumentOrShadowRoot(f),K=G.getSelection();if(!(!K||!ee.isFocused(f)||(M=z.current)!==null&&M!==void 0&&M.hasPendingAction())){var te=pe=>{var we=K.type!=="None";if(!(!L&&!we)){var Me=K.focusNode,je;if(er&&K.rangeCount>1){var Je=K.getRangeAt(0),Ue=K.getRangeAt(K.rangeCount-1);Je.startContainer===Me?je=Ue.endContainer:je=Je.startContainer}else je=K.anchorNode;var Le=Pa.get(f),Xe=!1;if(Le.contains(je)&&Le.contains(Me)&&(Xe=!0),we&&Xe&&L&&!pe){var _e=ee.toSlateRange(f,K,{exactMatch:!0,suppressThrow:!0});if(_e&&Y.equals(_e,L)){var Oe;if(!P.hasMarkPlaceholder||(Oe=je)!==null&&Oe!==void 0&&(Oe=Oe.parentElement)!==null&&Oe!==void 0&&Oe.hasAttribute("data-slate-mark-placeholder"))return}}if(L&&!ee.hasRange(f,L)){f.selection=ee.toSlateRange(f,K,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var We=L&&ee.toDOMRange(f,L);return We?(ee.isComposing(f)&&!pt?K.collapseToEnd():Y.isBackward(L)?K.setBaseAndExtent(We.endContainer,We.endOffset,We.startContainer,We.startOffset):K.setBaseAndExtent(We.startContainer,We.startOffset,We.endContainer,We.endOffset),d(f,We)):K.removeAllRanges(),We}};K.rangeCount<=1&&te();var ce=((q=z.current)===null||q===void 0?void 0:q.isFlushing())==="action";if(!pt||!ce){setTimeout(()=>{P.isUpdatingSelection=!1});return}var J=null,he=requestAnimationFrame(()=>{if(ce){var pe=we=>{try{var Me=ee.toDOMNode(f,f);Me.focus(),te(we)}catch{}};pe(),J=setTimeout(()=>{pe(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(he),J&&clearTimeout(J)}}});var A=y.useCallback(M=>{if(_(),!s&&ee.hasEditableTarget(f,M.target)&&!oC(M,a)){var q;if(z.current)return z.current.handleDOMBeforeInput(M);B.flush(),$.flush();var{selection:S}=f,{inputType:L}=M,G=M.dataTransfer||M.data||void 0,K=L==="insertCompositionText"||L==="deleteCompositionText";if(K&&ee.isComposing(f))return;var te=!1;if(L==="insertText"&&S&&Y.isCollapsed(S)&&M.data&&M.data.length===1&&/[a-z ]/i.test(M.data)&&S.anchor.offset!==0){var ce,J;te=!0,f.marks&&(te=!1);var{anchor:he}=S,[pe,we]=ee.toDOMPoint(f,he),Me=(ce=pe.parentElement)===null||ce===void 0?void 0:ce.closest("a"),je=ee.getWindow(f);if(te&&Me&&ee.hasDOMNode(f,Me)){var Je,Ue=je==null?void 0:je.document.createTreeWalker(Me,NodeFilter.SHOW_TEXT).lastChild();Ue===pe&&((Je=Ue.textContent)===null||Je===void 0?void 0:Je.length)===we&&(te=!1)}if(te&&pe.parentElement&&(je==null||(J=je.getComputedStyle(pe.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Le=x.above(f,{at:he.path,match:oe=>fe.isElement(oe)&&x.isBlock(f,oe)});Le&&le.string(Le[0]).includes(" ")&&(te=!1)}}if(!L.startsWith("delete")||L.startsWith("deleteBy")){var[Xe]=M.getTargetRanges();if(Xe){var _e=ee.toSlateRange(f,Xe,{exactMatch:!1,suppressThrow:!1});if(!S||!Y.equals(S,_e)){te=!1;var Oe=!K&&f.selection&&x.rangeRef(f,f.selection);X.select(f,_e),Oe&&Nr.set(f,Oe)}}}if(K)return;if(te||M.preventDefault(),S&&Y.isExpanded(S)&&L.startsWith("delete")){var We=L.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:We});return}switch(L){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{L==="insertFromComposition"&&ee.isComposing(f)&&(g(!1),Bn.set(f,!1)),(G==null?void 0:G.constructor.name)==="DataTransfer"?ee.insertData(f,G):typeof G=="string"&&(te?D.current.push(()=>x.insertText(f,G)):x.insertText(f,G));break}}var Z=(q=Nr.get(f))===null||q===void 0?void 0:q.unref();Nr.delete(f),Z&&(!f.selection||!Y.equals(f.selection,Z))&&X.select(f,Z)}},[f,$,_,a,s,B]),O=y.useCallback(M=>{M==null?($.cancel(),B.cancel(),Pa.delete(f),jn.delete(f),C.current&&fn&&C.current.removeEventListener("beforeinput",A)):fn&&M.addEventListener("beforeinput",A),C.current=M},[$,B,f,A]);Yr(()=>{var M=ee.getWindow(f);return M.document.addEventListener("selectionchange",B),()=>{M.document.removeEventListener("selectionchange",B)}},[B]);var j=r([f,[]]),U=i&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,W=y.useCallback(M=>{if(M&&U){var q;E((q=M.getBoundingClientRect())===null||q===void 0?void 0:q.height)}else E(void 0)},[U]);if(U){var re=x.start(f,[]);j.push({[mr]:!0,placeholder:i,onPlaceholderResize:W,anchor:re,focus:re})}var{marks:ne}=f;if(P.hasMarkPlaceholder=!1,f.selection&&Y.isCollapsed(f.selection)&&ne){var{anchor:w}=f.selection,Q=le.leaf(f,w.path),se=fr(Q,tC);if(!ge.equals(Q,ne,{loose:!0})){P.hasMarkPlaceholder=!0;var k=Object.fromEntries(Object.keys(se).map(M=>[M,null]));j.push(Wt(Wt(Wt({[Gf]:!0},k),ne),{},{anchor:w,focus:w}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:M}=f;if(M){var{anchor:q}=M,S=le.leaf(f,q.path);if(ne&&!ge.equals(S,ne,{loose:!0})){$t.set(f,ne);return}}$t.delete(f)})}),y.createElement(om.Provider,{value:s},y.createElement(im.Provider,{value:r},y.createElement(X1,{node:C,receivedUserInput:T},y.createElement(h,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:fn||!Oa?v.spellCheck:!1,autoCorrect:fn||!Oa?v.autoCorrect:"false",autoCapitalize:fn||!Oa?v.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:O,style:Wt(Wt({},p?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},F?{minHeight:F}:{})),m),onBeforeInput:y.useCallback(M=>{if(!fn&&!s&&!mt(M,v.onBeforeInput)&&ee.hasSelectableTarget(f,M.target)&&(M.preventDefault(),!ee.isComposing(f))){var q=M.data;x.insertText(f,q)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(M=>{if(!mt(M,v.onInput)){if(z.current){z.current.handleInput();return}for(var q of D.current)q();D.current=[]}},[v.onInput]),onBlur:y.useCallback(M=>{if(!(s||P.isUpdatingSelection||!ee.hasSelectableTarget(f,M.target)||mt(M,v.onBlur))){var q=ee.findDocumentOrShadowRoot(f);if(P.latestElement!==q.activeElement){var{relatedTarget:S}=M,L=ee.toDOMNode(f,f);if(S!==L&&!(Pt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&yn(S)&&ee.hasDOMNode(f,S)){var G=ee.toSlateNode(f,S);if(fe.isElement(G)&&!f.isVoid(G))return}if(Sr){var K=q.getSelection();K==null||K.removeAllRanges()}bn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,v.onBlur]),onClick:y.useCallback(M=>{if(ee.hasTarget(f,M.target)&&!mt(M,v.onClick)&&yn(M.target)){var q=ee.toSlateNode(f,M.target),S=ee.findPath(f,q);if(!x.hasPath(f,S)||le.get(f,S)!==q)return;if(M.detail===K1&&S.length>=1){var L=S;if(!(fe.isElement(q)&&x.isBlock(f,q))){var G,K=x.above(f,{match:Me=>fe.isElement(Me)&&x.isBlock(f,Me),at:S});L=(G=K==null?void 0:K[1])!==null&&G!==void 0?G:S.slice(0,1)}var te=x.range(f,L);X.select(f,te);return}if(s)return;var ce=x.start(f,S),J=x.end(f,S),he=x.void(f,{at:ce}),pe=x.void(f,{at:J});if(he&&pe&&R.equals(he[1],pe[1])){var we=x.range(f,ce);X.select(f,we)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(M=>{if(ee.hasSelectableTarget(f,M.target)){var q;if(ee.isComposing(f)&&Promise.resolve().then(()=>{g(!1),Bn.set(f,!1)}),(q=z.current)===null||q===void 0||q.handleCompositionEnd(M),mt(M,v.onCompositionEnd)||pt)return;if(!Sr&&!Gx&&!Hx&&!Jx&&!Qx&&M.data){var S=$t.get(f);$t.delete(f),S!==void 0&&(rn.set(f,f.marks),f.marks=S),x.insertText(f,M.data);var L=rn.get(f);rn.delete(f),L!==void 0&&(f.marks=L)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(M=>{ee.hasSelectableTarget(f,M.target)&&!mt(M,v.onCompositionUpdate)&&(ee.isComposing(f)||(g(!0),Bn.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(M=>{if(ee.hasSelectableTarget(f,M.target)){var q;if((q=z.current)===null||q===void 0||q.handleCompositionStart(M),mt(M,v.onCompositionStart)||pt)return;g(!0);var{selection:S}=f;if(S&&Y.isExpanded(S)){x.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(M=>{ee.hasSelectableTarget(f,M.target)&&!mt(M,v.onCopy)&&!ac(M)&&(M.preventDefault(),ee.setFragmentData(f,M.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(M=>{if(!s&&ee.hasSelectableTarget(f,M.target)&&!mt(M,v.onCut)&&!ac(M)){M.preventDefault(),ee.setFragmentData(f,M.clipboardData,"cut");var{selection:q}=f;if(q)if(Y.isExpanded(q))x.deleteFragment(f);else{var S=le.parent(f,q.anchor.path);x.isVoid(f,S)&&X.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(M=>{if(ee.hasTarget(f,M.target)&&!mt(M,v.onDragOver)){var q=ee.toSlateNode(f,M.target);fe.isElement(q)&&x.isVoid(f,q)&&M.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(M=>{if(!s&&ee.hasTarget(f,M.target)&&!mt(M,v.onDragStart)){var q=ee.toSlateNode(f,M.target),S=ee.findPath(f,q),L=fe.isElement(q)&&x.isVoid(f,q)||x.void(f,{at:S,voids:!0});if(L){var G=x.range(f,S);X.select(f,G)}P.isDraggingInternally=!0,ee.setFragmentData(f,M.dataTransfer,"drag")}},[s,f,v.onDragStart,P]),onDrop:y.useCallback(M=>{if(!s&&ee.hasTarget(f,M.target)&&!mt(M,v.onDrop)){M.preventDefault();var q=f.selection,S=ee.findEventRange(f,M),L=M.dataTransfer;X.select(f,S),P.isDraggingInternally&&q&&!Y.equals(q,S)&&!x.void(f,{at:S,voids:!0})&&X.delete(f,{at:q}),ee.insertData(f,L),ee.isFocused(f)||ee.focus(f)}P.isDraggingInternally=!1},[s,f,v.onDrop,P]),onDragEnd:y.useCallback(M=>{!s&&P.isDraggingInternally&&v.onDragEnd&&ee.hasTarget(f,M.target)&&v.onDragEnd(M),P.isDraggingInternally=!1},[s,P,v,f]),onFocus:y.useCallback(M=>{if(!s&&!P.isUpdatingSelection&&ee.hasEditableTarget(f,M.target)&&!mt(M,v.onFocus)){var q=ee.toDOMNode(f,f),S=ee.findDocumentOrShadowRoot(f);if(P.latestElement=S.activeElement,er&&M.target!==q){q.focus();return}bn.set(f,!0)}},[s,P,f,v.onFocus]),onKeyDown:y.useCallback(M=>{if(!s&&ee.hasEditableTarget(f,M.target)){var q;(q=z.current)===null||q===void 0||q.handleKeyDown(M);var{nativeEvent:S}=M;if(ee.isComposing(f)&&S.isComposing===!1&&(Bn.set(f,!1),g(!1)),mt(M,v.onKeyDown)||ee.isComposing(f))return;var{selection:L}=f,G=f.children[L!==null?L.focus.path[0]:0],K=Cf(le.string(G))==="rtl";if(Qe.isRedo(S)){M.preventDefault();var te=f;typeof te.redo=="function"&&te.redo();return}if(Qe.isUndo(S)){M.preventDefault();var ce=f;typeof ce.undo=="function"&&ce.undo();return}if(Qe.isMoveLineBackward(S)){M.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Qe.isMoveLineForward(S)){M.preventDefault(),X.move(f,{unit:"line"});return}if(Qe.isExtendLineBackward(S)){M.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Qe.isExtendLineForward(S)){M.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Qe.isMoveBackward(S)){M.preventDefault(),L&&Y.isCollapsed(L)?X.move(f,{reverse:!K}):X.collapse(f,{edge:K?"end":"start"});return}if(Qe.isMoveForward(S)){M.preventDefault(),L&&Y.isCollapsed(L)?X.move(f,{reverse:K}):X.collapse(f,{edge:K?"start":"end"});return}if(Qe.isMoveWordBackward(S)){M.preventDefault(),L&&Y.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!K});return}if(Qe.isMoveWordForward(S)){M.preventDefault(),L&&Y.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:K});return}if(fn){if((Kf||Sr)&&L&&(Qe.isDeleteBackward(S)||Qe.isDeleteForward(S))&&Y.isCollapsed(L)){var J=le.parent(f,L.anchor.path);if(fe.isElement(J)&&x.isVoid(f,J)&&(x.isInline(f,J)||x.isBlock(f,J))){M.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Qe.isBold(S)||Qe.isItalic(S)||Qe.isTransposeCharacter(S)){M.preventDefault();return}if(Qe.isSoftBreak(S)){M.preventDefault(),x.insertSoftBreak(f);return}if(Qe.isSplitBlock(S)){M.preventDefault(),x.insertBreak(f);return}if(Qe.isDeleteBackward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Qe.isDeleteForward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Qe.isDeleteLineBackward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Qe.isDeleteLineForward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Qe.isDeleteWordBackward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Qe.isDeleteWordForward(S)){M.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(M=>{!s&&ee.hasEditableTarget(f,M.target)&&!mt(M,v.onPaste)&&(!fn||t1(M.nativeEvent)||Sr)&&(M.preventDefault(),ee.insertData(f,M.clipboardData))},[s,f,v.onPaste])}),y.createElement(nC,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},aC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Wt({},t),n,pt&&y.createElement("br",null))},iC=()=>[],sC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Y.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Lb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},mt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ac=e=>yn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),oC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},uC=y.createContext(!1),lC=y.createContext({});function cC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var dC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],fC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=fr(e,dC),[l,u]=y.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(at.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=cC(t),h=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(g=>({v:g.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(Us.set(t,h),()=>{Us.set(t,()=>{})}),[t,h]);var[p,v]=y.useState(ee.isFocused(t));return y.useEffect(()=>{v(ee.isFocused(t))},[t]),Yr(()=>{var f=()=>v(ee.isFocused(t));return Hf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(lC.Provider,{value:d},y.createElement(um.Provider,{value:l},y.createElement(Ro.Provider,{value:l.editor},y.createElement(uC.Provider,{value:p},n))))},ic=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},sc=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return ic(r,a)&&ic(a,r)},mC=(e,t)=>{var n=x.range(e,Y.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(sc(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)sc(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function oc(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 uc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var hC=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 yi.set(r,new WeakMap),r.addMark=(u,d)=>{var m,h;(m=Lo.get(r))===null||m===void 0||m(),!$t.get(r)&&(h=xt.get(r))!==null&&h!==void 0&&h.length&&$t.set(r,null),rn.delete(r),o(u,d)},r.removeMark=u=>{var d;!$t.get(r)&&(d=xt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),rn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Y.isCollapsed(r.selection)){var d=x.above(r,{match:v=>fe.isElement(v)&&x.isBlock(r,v),at:r.selection});if(d){var[,m]=d,h=x.range(r,m,r.selection.anchor),p=mC(r,h);Y.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var d=[],m=[],h=xt.get(r);if(h!=null&&h.length){var p=h.map(O=>h1(O,u)).filter(Boolean);xt.set(r,p)}var v=pn.get(r);v&&pn.set(r,Yl(r,v,u));var f=hn.get(r);if(f!=null&&f.at){var b=Fe.isPoint(f==null?void 0:f.at)?Hs(r,f.at,u):Yl(r,f.at,u);hn.set(r,b?uc(uc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Zn(r,u.path));break}case"set_selection":{var g;(g=Nr.get(r))===null||g===void 0||g.unref(),Nr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Zn(r,R.parent(u.path)));break}case"merge_node":{var C=R.previous(u.path);d.push(...Zn(r,C));break}case"move_node":{var D=R.common(R.parent(u.path),R.parent(u.newPath));d.push(...Zn(r,D));var F;R.isBefore(u.path,u.newPath)?(d.push(...Zn(r,R.parent(u.path))),F=u.newPath):(d.push(...Zn(r,R.parent(u.newPath))),F=u.path);var E=le.get(t,R.parent(F)),_=ee.findKey(r,E),T=x.pathRef(r,R.parent(F));m.push([T,_]);break}}a(u);for(var[I,P]of d){var[z]=x.node(r,I);ei.set(z,P)}for(var[$,B]of m)if($.current){var[A]=x.node(r,$.current);ei.set(A,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,h]=Y.edges(d),p=x.void(r,{at:m.path}),v=x.void(r,{at:h.path});if(!(Y.isCollapsed(d)&&!p)){var f=ee.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(g=z)}),v){var[C]=v,D=f.cloneRange(),F=ee.toDOMNode(r,C);D.setEndAfter(F),b=D.cloneContents()}if(p&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var $=z.getAttribute("data-slate-zero-width")==="n";z.textContent=$?`
81
+ `:""}),Qf(g)){var E=g.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(g),b.appendChild(E),g=E}var _=r.getFragment(),T=JSON.stringify(_),I=window.btoa(encodeURIComponent(T));g.setAttribute("data-slate-fragment",I),u.setData("application/".concat(n),I);var P=b.ownerDocument.createElement("div");return P.appendChild(b),P.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(P),u.setData("text/html",P.innerHTML),u.setData("text/plain",Xf(P)),b.ownerDocument.body.removeChild(P),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||s1(u);if(d){var m=decodeURIComponent(window.atob(d)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var m=d.split(/\r\n|\r|\n/),h=!1;for(var p of m)h&&X.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=u=>{var d=Hf<18?Yc.unstable_batchedUpdates:m=>m();d(()=>{var m=Us.get(r);m&&m(u),i(u)})},r},Zn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const Zs="MENTION: ",cm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},lc={"mention-popover":35,default:-52},Yi=16,dm=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(cn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,v;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=D=>{if(!x.hasPath(e,D.path))return!1;const F=le.get(e,D.path);return x.isEditor(F)||fe.isElement(F)?D.offset<=F.children.length:ge.isText(F)?D.offset<=F.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||cm).getBoundingClientRect();const C=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((C==null?void 0:C.width)||0)/Yi}rem`),d=(C==null?void 0:C.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const m=lc[t]||lc.default,h=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${h/Yi}rem`,l.style.left=`${d/Yi}rem`},o),r},pC=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===H.link});if(a){const i=a[0],s=oo(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var ht=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e.h3="heading_three",e))(ht||{});const tr={[H.paragraph]:H.paragraph,[H.blockquote]:H.blockquote,[H.codeblock]:H.codeblock,[H.link]:H.link,[H.ul]:H.ul,[H.ol]:H.ol,[H.li]:H.li,[H.mention]:H.mention,[H.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Kt.emphasis]:H.italic,[Kt.strong]:H.bold,[Kt.delete]:H.strikethrough,[Kt.code]:H.code,[H.hr]:H.hr,[H.image]:H.image,[H.h3]:H.h3};function cc(e){if(e)throw e}var Ma=Object.prototype.hasOwnProperty,fm=Object.prototype.toString,dc=Object.defineProperty,fc=Object.getOwnPropertyDescriptor,mc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):fm.call(t)==="[object Array]"},hc=function(t){if(!t||fm.call(t)!=="[object Object]")return!1;var n=Ma.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ma.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ma.call(t,a)},pc=function(t,n){dc&&n.name==="__proto__"?dc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},gc=function(t,n){if(n==="__proto__")if(Ma.call(t,n)){if(fc)return fc(t,n).value}else return;return t[n]},gC=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=gc(o,n),a=gc(t,n),o!==a&&(d&&a&&(hc(a)||(i=mc(a)))?(i?(i=!1,s=r&&mc(r)?r:[]):s=r&&hc(r)?r:{},pc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&pc(o,{name:n,newValue:a}));return o};const Gi=In(gC);function Ys(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 vC(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?bC(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function bC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Rr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vc(e.position):"start"in e||"end"in e?vc(e):"line"in e||"column"in e?Gs(e):""}function Gs(e){return bc(e&&e.line)+":"+bc(e&&e.column)}function vc(e){return Gs(e&&e.start)+"-"+Gs(e&&e.end)}function bc(e){return e&&typeof e=="number"?e:1}class wt 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=Rr(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}}wt.prototype.file="";wt.prototype.name="";wt.prototype.reason="";wt.prototype.message="";wt.prototype.stack="";wt.prototype.column=void 0;wt.prototype.line=void 0;wt.prototype.ancestors=void 0;wt.prototype.cause=void 0;wt.prototype.fatal=void 0;wt.prototype.place=void 0;wt.prototype.ruleId=void 0;wt.prototype.source=void 0;const Vt={basename:yC,dirname:xC,extname:CC,join:DC,sep:"/"};function yC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ea(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 xC(e){if(ea(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 CC(e){ea(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 DC(...e){let t=-1,n;for(;++t<e.length;)ea(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":wC(n)}function wC(e){ea(e);const t=e.codePointAt(0)===47;let n=EC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function EC(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 ea(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _C={cwd:kC};function kC(){return"/"}function Qs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function FC(e){if(typeof e=="string")e=new URL(e);else if(!Qs(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 AC(e)}function AC(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Qi=["history","path","basename","stem","extname","dirname"];class BC{constructor(t){let n;t?Qs(t)?n={path:t}:typeof t=="string"||TC(t)?n={value:t}:n=t:n={},this.cwd=_C.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Qi.length;){const i=Qi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Qi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){Xi(t,"basename"),Ji(t,"basename"),this.path=Vt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Vt.dirname(this.path):void 0}set dirname(t){yc(this.basename,"dirname"),this.path=Vt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Vt.extname(this.path):void 0}set extname(t){if(Ji(t,"extname"),yc(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=Vt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Qs(t)&&(t=FC(t)),Xi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Vt.basename(this.path,this.extname):void 0}set stem(t){Xi(t,"stem"),Ji(t,"stem"),this.path=Vt.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 wt(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 Ji(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function Xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function TC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const SC=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},jC={}.hasOwnProperty;class Uo extends SC{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=vC()}copy(){const t=new Uo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Gi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ns("data",this.frozen),this.namespace[t]=n,this):jC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ns("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=xa(t),r=this.parser||this.Parser;return es("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),es("process",this.parser||this.Parser),ts("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=xa(t),l=r.parse(o);r.run(l,o,function(d,m,h){if(d||!m||!h)return u(d);const p=m,v=r.stringify(p,h);MC(v)?h.value=v:h.result=v,u(d,h)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),es("processSync",this.parser||this.Parser),ts("processSync",this.compiler||this.Compiler),this.process(t,a),Cc("processSync","process",n),r;function a(i,s){n=!0,cc(i),r=s}}run(t,n,r){xc(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=xa(n);a.run(t,l,u);function u(d,m,h){const p=m||t;d?o(d):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Cc("runSync","run",r),a;function i(s,o){cc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=xa(n),a=this.compiler||this.Compiler;return ts("stringify",a),xc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(ns("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;l(d,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Gi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===u){h=m;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...v]=d;const f=r[h][1];Ys(f)&&Ys(p)&&(p=Gi(!0,f,p)),r[h]=[u,p,...v]}}}}const OC=new Uo().freeze();function es(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ns(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 xc(e){if(!Ys(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xa(e){return PC(e)?e:new BC(e)}function PC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function MC(e){return typeof e=="string"||NC(e)}function NC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RC={};function IC(e,t){const n=t||RC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return mm(e,r,a)}function mm(e,t,n){if($C(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 Dc(e.children,t,n)}return Array.isArray(e)?Dc(e,t,n):""}function Dc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=mm(e[a],t,n);return r.join("")}function $C(e){return!!(e&&typeof e=="object")}const wc=document.createElement("i");function Wo(e){const t="&"+e+";";wc.innerHTML=t;const n=wc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function on(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 jt(e,t){return e.length>0?(on(e,e.length,0,t),e):t}const Ec={}.hasOwnProperty;function LC(e){const t={};let n=-1;for(;++n<e.length;)zC(t,e[n]);return t}function zC(e,t){let n;for(n in t){const a=(Ec.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Ec.call(a,s)||(a[s]=[]);const o=i[s];qC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function qC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);on(e,0,0,r)}function hm(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 ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=wn(/[A-Za-z]/),Lt=wn(/[\dA-Za-z]/),UC=wn(/[#-'*+\--9=?A-Z^-~]/);function Js(e){return e!==null&&(e<32||e===127)}const Xs=wn(/\d/),WC=wn(/[\dA-Fa-f]/),VC=wn(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function Re(e){return e===-2||e===-1||e===32}const HC=wn(/\p{P}|\p{S}/u),KC=wn(/\s/);function wn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Re(l)?(e.enter(n),o(l)):t(l)}function o(l){return Re(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const ZC={tokenize:YC};function YC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),He(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const GC={tokenize:QC},_c={tokenize:JC};function QC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(D){if(r<n.length){const F=n[r];return t.containerState=F[1],e.attempt(F[0].continuation,l,u)(D)}return u(D)}function l(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const F=t.events.length;let E=F,_;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){_=t.events[E][1].end;break}g(r);let T=F;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},_),T++;return on(t.events,E+1,0,t.events.slice(F)),t.events.length=T,u(D)}return o(D)}function u(D){if(r===n.length){if(!a)return h(D);if(a.currentConstruct&&a.currentConstruct.concrete)return v(D);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_c,d,m)(D)}function d(D){return a&&C(),g(r),h(D)}function m(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(D)}function h(D){return t.containerState={},e.attempt(_c,p,v)(D)}function p(D){return r++,n.push([t.currentConstruct,t.containerState]),h(D)}function v(D){if(D===null){a&&C(),g(0),e.consume(D);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(D)}function f(D){if(D===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(D);return}return ye(D)?(e.consume(D),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(D),f)}function b(D,F){const E=t.sliceStream(D);if(F&&E.push(null),D.previous=i,i&&(i.next=D),i=D,a.defineSkip(D.start),a.write(E),t.parser.lazy[D.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<s&&(!a.events[_][1].end||a.events[_][1].end.offset>s))return;const T=t.events.length;let I=T,P,z;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(P){z=t.events[I][1].end;break}P=!0}for(g(r),_=T;_<t.events.length;)t.events[_][1].end=Object.assign({},z),_++;on(t.events,I+1,0,t.events.slice(T)),t.events.length=_}}function g(D){let F=n.length;for(;F-- >D;){const E=n[F];t.containerState=E[1],E[0].exit.call(t,e)}n.length=D}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function JC(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kc(e){if(e===null||Dt(e)||KC(e))return 1;if(HC(e))return 2}function Vo(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 eo={name:"attention",tokenize:eD,resolveAll:XC};function XC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);Fc(m,-l),Fc(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=jt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=jt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=jt(u,Vo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=jt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=jt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,on(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function eD(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=kc(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=kc(l),m=!d||d===2&&a||n.includes(l),h=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!h)),u._close=!!(i===42?h:h&&(d||!m)),t(l)}}function Fc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const tD={name:"autolink",tokenize:nD};function nD(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Ht(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Lt(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Lt(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Js(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):UC(p)?(e.consume(p),u):n(p)}function d(p){return Lt(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||Lt(p))&&r++<63){const v=p===45?h:m;return e.consume(p),v}return n(p)}}const xi={tokenize:rD,partial:!0};function rD(e,t,n){return r;function r(i){return Re(i)?He(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const pm={name:"blockQuote",tokenize:aD,continuation:{tokenize:iD},exit:sD};function aD(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 Re(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function iD(e,t,n){const r=this;return a;function a(s){return Re(s)?He(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(pm,t,n)(s)}}function sD(e){e.exit("blockQuote")}const gm={name:"characterEscape",tokenize:oD};function oD(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 VC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const vm={name:"characterReference",tokenize:uD};function uD(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Lt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=WC,d):(e.enter("characterReferenceValue"),i=7,s=Xs,d(m))}function d(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return s===Lt&&!Wo(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const Ac={tokenize:cD,partial:!0},Bc={name:"codeFenced",tokenize:lD,concrete:!0};function lD(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(_){return u(_)}function u(_){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===o?(s++,e.consume(_),d):s<3?n(_):(e.exit("codeFencedFenceSequence"),Re(_)?He(e,m,"whitespace")(_):m(_))}function m(_){return _===null||ye(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(Ac,f,F)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||ye(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(_)):Re(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(_)):_===96&&_===o?n(_):(e.consume(_),h)}function p(_){return _===null||ye(_)?m(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||ye(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(_)):_===96&&_===o?n(_):(e.consume(_),v)}function f(_){return e.attempt(a,F,b)(_)}function b(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g}function g(_){return i>0&&Re(_)?He(e,C,"linePrefix",i+1)(_):C(_)}function C(_){return _===null||ye(_)?e.check(Ac,f,F)(_):(e.enter("codeFlowValue"),D(_))}function D(_){return _===null||ye(_)?(e.exit("codeFlowValue"),C(_)):(e.consume(_),D)}function F(_){return e.exit("codeFenced"),t(_)}function E(_,T,I){let P=0;return z;function z(j){return _.enter("lineEnding"),_.consume(j),_.exit("lineEnding"),$}function $(j){return _.enter("codeFencedFence"),Re(j)?He(_,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):B(j)}function B(j){return j===o?(_.enter("codeFencedFenceSequence"),A(j)):I(j)}function A(j){return j===o?(P++,_.consume(j),A):P>=s?(_.exit("codeFencedFenceSequence"),Re(j)?He(_,O,"whitespace")(j):O(j)):I(j)}function O(j){return j===null||ye(j)?(_.exit("codeFencedFence"),T(j)):I(j)}}}function cD(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 rs={name:"codeIndented",tokenize:fD},dD={tokenize:mD,partial:!0};function fD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),He(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(dD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function mD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):He(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const hD={name:"codeText",tokenize:vD,resolve:pD,previous:gD};function pD(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 gD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vD(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ye(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class bD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Fr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Fr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Fr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fr(this.left,n.reverse())}}}function Fr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function bm(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new bD(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,yD(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return on(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function yD(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,h=-1,p=n,v=0,f=0;const b=[f];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(f=h+1,b.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const g=o.slice(b[h],b[h+1]),C=i.pop();l.push([C,C+g.length-1]),e.splice(C,2,g)}for(l.reverse(),h=-1;++h<l.length;)u[v+l[h][0]]=v+l[h][1],v+=l[h][1]-l[h][0]-1;return u}const xD={tokenize:wD,resolve:DD},CD={tokenize:ED,partial:!0};function DD(e){return bm(e),e}function wD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(CD,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 ED(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,i,"linePrefix")}function i(s){if(s===null||ye(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function ym(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(g){return g===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(g),e.exit(i),h):g===null||g===32||g===41||Js(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function h(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||ye(g)?n(g):(e.consume(g),g===92?v:p)}function v(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function f(g){return!d&&(g===null||g===41||Dt(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||Js(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function xm(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||ye(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Re(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function Cm(e,t,n,r,a,i){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===s?(e.exit(i),l(s)):h===null?n(h):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===s||h===null||ye(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?m:d)}function m(h){return h===s||h===92?(e.consume(h),d):d(h)}}function Ir(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Re(a)?He(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const _D={name:"definition",tokenize:FD},kD={tokenize:AD,partial:!0};function FD(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return xm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Dt(p)?Ir(e,u)(p):u(p)}function u(p){return ym(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(kD,m,m)(p)}function m(p){return Re(p)?He(e,h,"whitespace")(p):h(p)}function h(p){return p===null||ye(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function AD(e,t,n){return r;function r(o){return Dt(o)?Ir(e,a)(o):n(o)}function a(o){return Cm(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Re(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const BD={name:"hardBreakEscape",tokenize:TD};function TD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const SD={name:"headingAtx",tokenize:OD,resolve:jD};function jD(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"},on(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function OD(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ye(d)?(e.exit("atxHeading"),t(d)):Re(d)?He(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const PD=["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"],Tc=["pre","script","style","textarea"],MD={name:"htmlFlow",tokenize:$D,resolveTo:ID,concrete:!0},ND={tokenize:zD,partial:!0},RD={tokenize:LD,partial:!0};function ID(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 $D(e,t,n){const r=this;let a,i,s,o,l;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),m}function m(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),i=!0,f):k===63?(e.consume(k),a=3,r.interrupt?t:w):Ht(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function h(k){return k===45?(e.consume(k),a=2,p):k===91?(e.consume(k),a=5,o=0,v):Ht(k)?(e.consume(k),a=4,r.interrupt?t:w):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:w):n(k)}function v(k){const M="CDATA[";return k===M.charCodeAt(o++)?(e.consume(k),o===M.length?r.interrupt?t:B:v):n(k)}function f(k){return Ht(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function b(k){if(k===null||k===47||k===62||Dt(k)){const M=k===47,q=s.toLowerCase();return!M&&!i&&Tc.includes(q)?(a=1,r.interrupt?t(k):B(k)):PD.includes(s.toLowerCase())?(a=6,M?(e.consume(k),g):r.interrupt?t(k):B(k)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?C(k):D(k))}return k===45||Lt(k)?(e.consume(k),s+=String.fromCharCode(k),b):n(k)}function g(k){return k===62?(e.consume(k),r.interrupt?t:B):n(k)}function C(k){return Re(k)?(e.consume(k),C):z(k)}function D(k){return k===47?(e.consume(k),z):k===58||k===95||Ht(k)?(e.consume(k),F):Re(k)?(e.consume(k),D):z(k)}function F(k){return k===45||k===46||k===58||k===95||Lt(k)?(e.consume(k),F):E(k)}function E(k){return k===61?(e.consume(k),_):Re(k)?(e.consume(k),E):D(k)}function _(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,T):Re(k)?(e.consume(k),_):I(k)}function T(k){return k===l?(e.consume(k),l=null,P):k===null||ye(k)?n(k):(e.consume(k),T)}function I(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Dt(k)?E(k):(e.consume(k),I)}function P(k){return k===47||k===62||Re(k)?D(k):n(k)}function z(k){return k===62?(e.consume(k),$):n(k)}function $(k){return k===null||ye(k)?B(k):Re(k)?(e.consume(k),$):n(k)}function B(k){return k===45&&a===2?(e.consume(k),U):k===60&&a===1?(e.consume(k),W):k===62&&a===4?(e.consume(k),Q):k===63&&a===3?(e.consume(k),w):k===93&&a===5?(e.consume(k),ne):ye(k)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(ND,se,A)(k)):k===null||ye(k)?(e.exit("htmlFlowData"),A(k)):(e.consume(k),B)}function A(k){return e.check(RD,O,se)(k)}function O(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),j}function j(k){return k===null||ye(k)?A(k):(e.enter("htmlFlowData"),B(k))}function U(k){return k===45?(e.consume(k),w):B(k)}function W(k){return k===47?(e.consume(k),s="",re):B(k)}function re(k){if(k===62){const M=s.toLowerCase();return Tc.includes(M)?(e.consume(k),Q):B(k)}return Ht(k)&&s.length<8?(e.consume(k),s+=String.fromCharCode(k),re):B(k)}function ne(k){return k===93?(e.consume(k),w):B(k)}function w(k){return k===62?(e.consume(k),Q):k===45&&a===2?(e.consume(k),w):B(k)}function Q(k){return k===null||ye(k)?(e.exit("htmlFlowData"),se(k)):(e.consume(k),Q)}function se(k){return e.exit("htmlFlow"),t(k)}}function LD(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function zD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xi,t,n)}}const qD={name:"htmlText",tokenize:UD};function UD(e,t,n){const r=this;let a,i,s;return o;function o(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),l}function l(w){return w===33?(e.consume(w),u):w===47?(e.consume(w),E):w===63?(e.consume(w),D):Ht(w)?(e.consume(w),I):n(w)}function u(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),i=0,v):Ht(w)?(e.consume(w),C):n(w)}function d(w){return w===45?(e.consume(w),p):n(w)}function m(w){return w===null?n(w):w===45?(e.consume(w),h):ye(w)?(s=m,W(w)):(e.consume(w),m)}function h(w){return w===45?(e.consume(w),p):m(w)}function p(w){return w===62?U(w):w===45?h(w):m(w)}function v(w){const Q="CDATA[";return w===Q.charCodeAt(i++)?(e.consume(w),i===Q.length?f:v):n(w)}function f(w){return w===null?n(w):w===93?(e.consume(w),b):ye(w)?(s=f,W(w)):(e.consume(w),f)}function b(w){return w===93?(e.consume(w),g):f(w)}function g(w){return w===62?U(w):w===93?(e.consume(w),g):f(w)}function C(w){return w===null||w===62?U(w):ye(w)?(s=C,W(w)):(e.consume(w),C)}function D(w){return w===null?n(w):w===63?(e.consume(w),F):ye(w)?(s=D,W(w)):(e.consume(w),D)}function F(w){return w===62?U(w):D(w)}function E(w){return Ht(w)?(e.consume(w),_):n(w)}function _(w){return w===45||Lt(w)?(e.consume(w),_):T(w)}function T(w){return ye(w)?(s=T,W(w)):Re(w)?(e.consume(w),T):U(w)}function I(w){return w===45||Lt(w)?(e.consume(w),I):w===47||w===62||Dt(w)?P(w):n(w)}function P(w){return w===47?(e.consume(w),U):w===58||w===95||Ht(w)?(e.consume(w),z):ye(w)?(s=P,W(w)):Re(w)?(e.consume(w),P):U(w)}function z(w){return w===45||w===46||w===58||w===95||Lt(w)?(e.consume(w),z):$(w)}function $(w){return w===61?(e.consume(w),B):ye(w)?(s=$,W(w)):Re(w)?(e.consume(w),$):P(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,A):ye(w)?(s=B,W(w)):Re(w)?(e.consume(w),B):(e.consume(w),O)}function A(w){return w===a?(e.consume(w),a=void 0,j):w===null?n(w):ye(w)?(s=A,W(w)):(e.consume(w),A)}function O(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||Dt(w)?P(w):(e.consume(w),O)}function j(w){return w===47||w===62||Dt(w)?P(w):n(w)}function U(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function W(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),re}function re(w){return Re(w)?He(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):ne(w)}function ne(w){return e.enter("htmlTextData"),s(w)}}const Ho={name:"labelEnd",tokenize:YD,resolveTo:ZD,resolveAll:KD},WD={tokenize:GD},VD={tokenize:QD},HD={tokenize:JD};function KD(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 ZD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=jt(o,e.slice(i+1,i+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,Vo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",l,t]]),on(e,i,e.length,o),e}function YD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(h){return i?i._inactive?m(h):(s=r.parser.defined.includes(ir(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(WD,d,s?d:m)(h):h===91?e.attempt(VD,d,s?u:m)(h):s?d(h):m(h)}function u(h){return e.attempt(HD,d,m)(h)}function d(h){return t(h)}function m(h){return i._balanced=!0,n(h)}}function GD(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Dt(m)?Ir(e,i)(m):i(m)}function i(m){return m===41?d(m):ym(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return Dt(m)?Ir(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Cm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return Dt(m)?Ir(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function QD(e,t,n){const r=this;return a;function a(o){return xm.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function JD(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 XD={name:"labelStartImage",tokenize:ew,resolveAll:Ho.resolveAll};function ew(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 tw={name:"labelStartLink",tokenize:nw,resolveAll:Ho.resolveAll};function nw(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 as={name:"lineEnding",tokenize:rw};function rw(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Na={name:"thematicBreak",tokenize:aw};function aw(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Re(u)?He(e,o,"whitespace")(u):o(u))}}const yt={name:"list",tokenize:ow,continuation:{tokenize:uw},exit:cw},iw={tokenize:dw,partial:!0},sw={tokenize:lw,partial:!0};function ow(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const v=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Xs(p)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Na,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Xs(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(xi,r.interrupt?n:d,e.attempt(iw,h,m))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return Re(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function uw(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Re(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(sw,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(yt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function lw(e,t,n){const r=this;return He(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function cw(e){e.exit(this.containerState.type)}function dw(e,t,n){const r=this;return He(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Re(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Sc={name:"setextUnderline",tokenize:mw,resolveTo:fw};function fw(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 mw(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Re(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const hw={tokenize:pw};function pw(e){const t=this,n=e.attempt(xi,r,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(xD,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 gw={resolveAll:wm()},vw=Dm("string"),bw=Dm("text");function Dm(e){return{tokenize:t,resolveAll:wm(e==="text"?yw:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=a[d];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function wm(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 yw(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 xw(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:C,enter:D,exit:F,attempt:T(E),check:T(_),interrupt:T(_,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:v,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m($){return s=jt(s,$),b(),s[s.length-1]!==null?[]:(I(t,0),u.events=Vo(i,u.events,u),u.events)}function h($,B){return Dw(p($),B)}function p($){return Cw(s,$)}function v(){const{line:$,column:B,offset:A,_index:O,_bufferIndex:j}=r;return{line:$,column:B,offset:A,_index:O,_bufferIndex:j}}function f($){a[$.line]=$.column,z()}function b(){let $;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<B.length;)g(B.charCodeAt(r._bufferIndex));else g(B)}}function g($){d=d($)}function C($){ye($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,z()):$!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=$}function D($,B){const A=B||{};return A.type=$,A.start=v(),u.events.push(["enter",A,u]),o.push(A),A}function F($){const B=o.pop();return B.end=v(),u.events.push(["exit",B,u]),B}function E($,B){I($,B.from)}function _($,B){B.restore()}function T($,B){return A;function A(O,j,U){let W,re,ne,w;return Array.isArray(O)?se(O):"tokenize"in O?se([O]):Q(O);function Q(S){return L;function L(G){const K=G!==null&&S[G],te=G!==null&&S.null,ce=[...Array.isArray(K)?K:K?[K]:[],...Array.isArray(te)?te:te?[te]:[]];return se(ce)(G)}}function se(S){return W=S,re=0,S.length===0?U:k(S[re])}function k(S){return L;function L(G){return w=P(),ne=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?q():S.tokenize.call(B?Object.assign(Object.create(u),B):u,l,M,q)(G)}}function M(S){return $(ne,w),j}function q(S){return w.restore(),++re<W.length?k(W[re]):U}}}function I($,B){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&on(u.events,B,u.events.length-B,$.resolve(u.events.slice(B),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function P(){const $=v(),B=u.previous,A=u.currentConstruct,O=u.events.length,j=Array.from(o);return{restore:U,from:O};function U(){r=$,u.previous=B,u.currentConstruct=A,u.events.length=O,o=j,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Cw(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 Dw(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
82
82
  `;break}case-3:{s=`\r
83
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const OD={42:gt,43:gt,45:gt,48:gt,49:gt,50:gt,51:gt,52:gt,53:gt,54:gt,55:gt,56:gt,57:gt,62:ph},PD={91:Mw},MD={[-2]:is,[-1]:is,32:is},ND={35:zw,42:Ma,45:[Oc,Ma],60:Vw,61:Oc,95:Ma,96:Sc,126:Sc},ID={38:vh,92:gh},RD={[-5]:ss,[-4]:ss,[-3]:ss,33:lD,38:vh,42:no,60:[dw,Jw],91:dD,92:[$w,gh],93:Zo,95:no,96:Ew},$D={null:[no,kD]},LD={null:[42,95]},zD={null:[]},qD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:LD,contentInitial:PD,disable:zD,document:OD,flow:ND,flowInitial:MD,insideSpan:$D,string:ID,text:RD},Symbol.toStringTag,{value:"Module"}));function UD(e){const n=GC([qD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(aw),document:a(sw),flow:a(ED),string:a(FD),text:a(AD)};return r;function a(i){return s;function s(o){return TD(r,i,o)}}}function WD(e){for(;!bh(e););return e}const Pc=/[\0\t\n\r]/g;function VD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Pc.lastIndex=h,u=Pc.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const HD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KD(e){return e.replace(HD,ZD)}function ZD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return mh(n.slice(i?2:1),i?16:10)}return Ho(n)||e}const Eh={}.hasOwnProperty;function YD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),GD(n)(WD(UD(n).document().write(VD()(e,t,!0))))}function GD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Le),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(fe),blockQuote:i(Z),characterEscape:P,characterReference:P,codeFenced:i(X),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(X,s),codeText:i(le,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(te),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(Ae),hardBreakTrailing:i(Ae),htmlFlow:i(ye,s),htmlFlowData:P,htmlText:i(ye,s),htmlTextData:P,image:i(Ee),label:s,link:i(Le),listItem:i(ze),listItemValue:p,listOrdered:i(Oe,h),listUnordered:i(Oe),paragraph:i(Je),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(fe),strong:i(Se),thematicBreak:i(xe)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Q,autolinkProtocol:L,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:j,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:l(g),codeText:l(M),codeTextData:z,data:z,definition:l(),definitionDestinationString:B,definitionLabelString:w,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(F),htmlFlowData:z,htmlText:l(O),htmlTextData:z,image:l(W),label:se,labelText:ie,lineEnding:R,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:C,resourceTitleString:G,resource:ne,setextHeading:l($),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};_h(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(V){let re={type:"root",children:[]};const me={stack:[re],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ve=[];let ke=-1;for(;++ke<V.length;)if(V[ke][1].type==="listOrdered"||V[ke][1].type==="listUnordered")if(V[ke][0]==="enter")ve.push(ke);else{const ge=ve.pop();ke=a(V,ge,ke)}for(ke=-1;++ke<V.length;){const ge=t[V[ke][0]];Eh.call(ge,V[ke][1].type)&&ge[V[ke][1].type].call(Object.assign({sliceSerialize:V[ke][2].sliceSerialize},me),V[ke][1])}if(me.tokenStack.length>0){const ge=me.tokenStack[me.tokenStack.length-1];(ge[1]||Mc).call(me,void 0,ge[0])}for(re.position={start:dn(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:dn(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)re=t.transforms[ke](re)||re;return re}function a(V,re,me){let ve=re-1,ke=-1,ge=!1,_e,Ye,nt,pt;for(;++ve<=me;){const Xe=V[ve];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?ke++:ke--,pt=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(_e&&!pt&&!ke&&!nt&&(nt=ve),pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pt=void 0}if(!ke&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||ke===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(_e){let wt=ve;for(Ye=void 0;wt--;){const Dt=V[wt];if(Dt[1].type==="lineEnding"||Dt[1].type==="lineEndingBlank"){if(Dt[0]==="exit")continue;Ye&&(V[Ye][1].type="lineEndingBlank",ge=!0),Dt[1].type="lineEnding",Ye=wt}else if(!(Dt[1].type==="linePrefix"||Dt[1].type==="blockQuotePrefix"||Dt[1].type==="blockQuotePrefixWhitespace"||Dt[1].type==="blockQuoteMarker"||Dt[1].type==="listItemIndent"))break}nt&&(!Ye||nt<Ye)&&(_e._spread=!0),_e.end=Object.assign({},Ye?V[Ye][1].start:Xe[1].end),V.splice(Ye||ve,0,["exit",_e,Xe[2]]),ve++,me++}if(Xe[1].type==="listItemPrefix"){const wt={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};_e=wt,V.splice(ve,0,["enter",wt,Xe[2]]),ve++,me++,nt=void 0,pt=!0}}}return V[re][1]._spread=ge,me}function i(V,re){return me;function me(ve){o.call(this,V(ve),ve),re&&re.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(V,re,me){this.stack[this.stack.length-1].children.push(V),this.stack.push(V),this.tokenStack.push([re,me]),V.position={start:dn(re.start),end:void 0}}function l(V){return re;function re(me){V&&V.call(this,me),u.call(this,me)}}function u(V,re){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==V.type&&(re?re.call(this,V,ve[0]):(ve[1]||Mc).call(this,V,ve[0]));else throw new Error("Cannot close `"+V.type+"` ("+Mr({start:V.start,end:V.end})+"): it’s not open");me.position.end=dn(V.end)}function d(){return ZC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(V){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(V),10),this.data.expectingFirstListItemValue=void 0}}function m(){const V=this.resume(),re=this.stack[this.stack.length-1];re.lang=V}function v(){const V=this.resume(),re=this.stack[this.stack.length-1];re.meta=V}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const V=this.resume(),re=this.stack[this.stack.length-1];re.value=V.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const V=this.resume(),re=this.stack[this.stack.length-1];re.value=V.replace(/(\r?\n|\r)$/g,"")}function w(V){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=nr(this.sliceSerialize(V)).toLowerCase()}function E(){const V=this.resume(),re=this.stack[this.stack.length-1];re.title=V}function B(){const V=this.resume(),re=this.stack[this.stack.length-1];re.url=V}function D(V){const re=this.stack[this.stack.length-1];if(!re.depth){const me=this.sliceSerialize(V).length;re.depth=me}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(V){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(V).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function P(V){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=qe(),ve.position={start:dn(V.start),end:void 0},me.push(ve)),this.stack.push(ve)}function z(V){const re=this.stack.pop();re.value+=this.sliceSerialize(V),re.position.end=dn(V.end)}function R(V){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=re.children[re.children.length-1];me.position.end=dn(V.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(P.call(this,V),z.call(this,V))}function A(){this.data.atHardBreak=!0}function F(){const V=this.resume(),re=this.stack[this.stack.length-1];re.value=V}function O(){const V=this.resume(),re=this.stack[this.stack.length-1];re.value=V}function M(){const V=this.resume(),re=this.stack[this.stack.length-1];re.value=V}function U(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=re,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function W(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=re,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function ie(V){const re=this.sliceSerialize(V),me=this.stack[this.stack.length-2];me.label=KD(re),me.identifier=nr(re).toLowerCase()}function se(){const V=this.stack[this.stack.length-1],re=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=V.children;me.children=ve}else me.alt=re}function C(){const V=this.resume(),re=this.stack[this.stack.length-1];re.url=V}function G(){const V=this.resume(),re=this.stack[this.stack.length-1];re.title=V}function ne(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function S(V){const re=this.resume(),me=this.stack[this.stack.length-1];me.label=re,me.identifier=nr(this.sliceSerialize(V)).toLowerCase(),this.data.referenceType="full"}function q(V){this.data.characterReferenceType=V.type}function j(V){const re=this.sliceSerialize(V),me=this.data.characterReferenceType;let ve;me?(ve=mh(re,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Ho(re);const ke=this.stack.pop();ke.value+=ve,ke.position.end=dn(V.end)}function L(V){z.call(this,V);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(V)}function Q(V){z.call(this,V);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(V)}function Z(){return{type:"blockquote",children:[]}}function X(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function fe(){return{type:"heading",depth:0,children:[]}}function Ae(){return{type:"break"}}function ye(){return{type:"html",value:""}}function Ee(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Oe(V){return{type:"list",ordered:V.type==="listOrdered",start:null,spread:V._spread,children:[]}}function ze(V){return{type:"listItem",spread:V._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function xe(){return{type:"thematicBreak"}}}function dn(e){return{line:e.line,column:e.column,offset:e.offset}}function _h(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?_h(e,r):QD(e,r)}}function QD(e,t){let n;for(n in t)if(Eh.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Mc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is still open")}function JD(e){const t=this;t.parser=n;function n(r){return YD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function kh(e,t){var l,u,d;const n={...Jn,...t==null?void 0:t.nodeTypes,[K.heading]:{...Jn[K.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[K.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>kh({...h,ordered:e.ordered||!1},t))),e.type){case ft.heading:return{type:n[K.heading][e.depth||1],children:s.map(h=>({...h,[n[K.heading][e.depth||1]]:!0}))};case ft.list:return{type:e.ordered?n[K.ol]:n[K.ul],children:s};case ft.listItem:return{type:n[K.li],children:s};case ft.paragraph:return{type:n[K.paragraph],children:s};case ft.link:return{type:n[K.link],[r]:e.url,children:s};case ft.image:return{type:n[K.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ft.blockquote:return{type:n[K.blockquote],children:s};case ft.code:return{type:n[K.codeblock],language:e.lang,children:[{text:e.value}]};case ft.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[K.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:K.paragraph,children:[{text:e.value||""}]};case ft.emphasis:return{[n[Ht.emphasis]]:!0,...os(s),...Ca(s)};case ft.strong:return{[n[Ht.strong]]:!0,...os(s),...Ca(s)};case ft.delete:return{[n[Ht.delete]]:!0,...os(s),...Ca(s)};case ft.inlineCode:return{[n[Ht.code]]:!0,text:e.value,...Ca(s)};case ft.thematicBreak:return{type:n[K.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const os=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ca(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const XD=function(t){const n=r=>r.children.map(a=>kh(a,t));this.Compiler=n},eE=(e,t=n=>{})=>{UC().use(JD).use(XD).process(e).then(n=>{const r=Rt(n.result),a=s=>{const o=s;[K.li,K.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===K.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===K.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Gs)){const h=u,p=d.text.replace(Gs,""),m="link"in h&&h.link?h.link:"";h.type=K.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),v=o.text.substring(p+d.length),f=[{text:m},{text:h,[K.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Yo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},tE=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},nE=e=>{const{selection:t}=e;return t?x.string(e,t):null},Nc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},rE=e=>{for(const[t]of ue.descendants(e)){const n=t;if(n.type===K.link)return n.link}return null},Ic={"mod+b":K.bold,"mod+i":K.italic,"mod+shift+x":K.strikethrough,"mod+k":K.link,"mod+shift+7":K.ol,"mod+shift+8":K.ul,"mod+shift+9":K.blockquote},aE=(e,t,n,r)=>{for(const a in Ic)if(Jx(a,e)){e.stopPropagation(),e.preventDefault();const i=Ic[a];if(i===K.link){n([{type:"showLinkEditor",value:!0}]);return}if(mE(i)){Ph(t,i,r);return}Sh(t,i,r)}},Fh=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:K.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||ch),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),Yo(r)},iE=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Y.isCollapsed(i)){const[s]=Y.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(cd);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},v=x.range(e,p,m),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const E=d[1];let B=[];r&&(B=await r({name:E})),a([{type:"mentionPopover",value:{show:B.length>0?!0:n!==null,selectedUser:0,possibleUsers:B,position:B.length>0?v:null,numberOfUsers:B.length>0?B.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Ah=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Hn=e=>typeof e.text=="string",sE=[K.hr,K.image,K.mention],Rc="<br>";function Bh(e,t={nodeTypes:Jn}){const{nodeTypes:n=Jn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Jn,...n,heading:{...Jn[K.heading],...n[K.heading]}},l=[o[K.ul],o[K.ol]];let u=i;if(!Hn(e)&&s!==K.mention&&(u=e.children.map(d=>{const h=Hn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!Hn(e)&&Array.isArray(e.children)&&(m=e.children.some(v=>!Hn(v)&&v.type===o.link)),Bh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[K.blockquote]||e.parentType===o[K.blockquote]})}).join("")),!r&&(i===""||i===`
84
- `)&&e.parentType===o[K.paragraph]&&s!==o[K.mention]&&(s=o[K.paragraph],u=Rc),!(u===""&&!sE.find(d=>o[d]===s)))switch(u!==Rc&&Hn(e)&&(e[K.strikethrough]&&e[K.bold]&&e[K.italic]?u=Kn(u,"~~***"):e[K.bold]&&e[K.italic]?u=Kn(u,"***"):(e[K.bold]&&(u=Kn(u,"**")),e[K.italic]&&(u=Kn(u,"_")),e[K.strikethrough]&&(u=Kn(u,"~~")),e[K.code]&&(u=Kn(u,"`")))),s){case o[K.heading][1]:return`# ${u}
85
- `;case o[K.heading][2]:return`## ${u}
86
- `;case o[K.heading][3]:return`### ${u}
87
- `;case o[K.heading][4]:return`#### ${u}
88
- `;case o[K.heading][5]:return`##### ${u}
89
- `;case o[K.heading][6]:return`###### ${u}
90
- `;case o[K.blockquote]:return`> ${u}
91
-
92
- `;case o[K.codeblock]:return`\`\`\`${e.language||""}
83
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const ww={42:yt,43:yt,45:yt,48:yt,49:yt,50:yt,51:yt,52:yt,53:yt,54:yt,55:yt,56:yt,57:yt,62:pm},Ew={91:_D},_w={[-2]:rs,[-1]:rs,32:rs},kw={35:SD,42:Na,45:[Sc,Na],60:MD,61:Sc,95:Na,96:Bc,126:Bc},Fw={38:vm,92:gm},Aw={[-5]:as,[-4]:as,[-3]:as,33:XD,38:vm,42:eo,60:[tD,qD],91:tw,92:[BD,gm],93:Ho,95:eo,96:hD},Bw={null:[eo,gw]},Tw={null:[42,95]},Sw={null:[]},jw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Tw,contentInitial:Ew,disable:Sw,document:ww,flow:kw,flowInitial:_w,insideSpan:Bw,string:Fw,text:Aw},Symbol.toStringTag,{value:"Module"}));function Ow(e){const n=LC([jw,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(ZC),document:a(GC),flow:a(hw),string:a(vw),text:a(bw)};return r;function a(i){return s;function s(o){return xw(r,i,o)}}}function Pw(e){for(;!bm(e););return e}const jc=/[\0\t\n\r]/g;function Mw(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(jc.lastIndex=m,u=jc.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(m);break}if(p===10&&m===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<h&&(l.push(i.slice(m,h)),e+=h-m),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Nw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rw(e){return e.replace(Nw,Iw)}function Iw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return hm(n.slice(i?2:1),i?16:10)}return Wo(n)||e}const Em={}.hasOwnProperty;function $w(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Lw(n)(Pw(Ow(n).document().write(Mw()(e,t,!0))))}function Lw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Je),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(pe),blockQuote:i(K),characterEscape:P,characterReference:P,codeFenced:i(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(te,s),codeText:i(ce,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(he),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(Me,s),htmlFlowData:P,htmlText:i(Me,s),htmlTextData:P,image:i(je),label:s,link:i(Je),listItem:i(Le),listItemValue:h,listOrdered:i(Ue,m),listUnordered:i(Ue),paragraph:i(Xe),reference:k,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(_e),thematicBreak:i(We)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:G,autolinkProtocol:L,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:l(g),codeText:l(j),codeTextData:z,data:z,definition:l(),definitionDestinationString:F,definitionLabelString:C,definitionTitleString:D,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(A),htmlFlowData:z,htmlText:l(O),htmlTextData:z,image:l(W),label:ne,labelText:re,lineEnding:$,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:M,resourceDestinationString:w,resourceTitleString:Q,resource:se,setextHeading:l(I),setextHeadingLineSequence:T,setextHeadingText:_,strong:l(),thematicBreak:l()}};_m(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let oe={type:"root",children:[]};const ie={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let ve=-1;for(;++ve<Z.length;)if(Z[ve][1].type==="listOrdered"||Z[ve][1].type==="listUnordered")if(Z[ve][0]==="enter")me.push(ve);else{const ke=me.pop();ve=a(Z,ke,ve)}for(ve=-1;++ve<Z.length;){const ke=t[Z[ve][0]];Em.call(ke,Z[ve][1].type)&&ke[Z[ve][1].type].call(Object.assign({sliceSerialize:Z[ve][2].sliceSerialize},ie),Z[ve][1])}if(ie.tokenStack.length>0){const ke=ie.tokenStack[ie.tokenStack.length-1];(ke[1]||Oc).call(ie,void 0,ke[0])}for(oe.position={start:mn(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:mn(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<t.transforms.length;)oe=t.transforms[ve](oe)||oe;return oe}function a(Z,oe,ie){let me=oe-1,ve=-1,ke=!1,ze,ot,At,vt;for(;++me<=ie;){const tt=Z[me];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ve++:ve--,vt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(ze&&!vt&&!ve&&!At&&(At=me),vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vt=void 0}if(!ve&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ve===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(ze){let xe=me;for(ot=void 0;xe--;){const Be=Z[xe];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;ot&&(Z[ot][1].type="lineEndingBlank",ke=!0),Be[1].type="lineEnding",ot=xe}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}At&&(!ot||At<ot)&&(ze._spread=!0),ze.end=Object.assign({},ot?Z[ot][1].start:tt[1].end),Z.splice(ot||me,0,["exit",ze,tt[2]]),me++,ie++}if(tt[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};ze=xe,Z.splice(me,0,["enter",xe,tt[2]]),me++,ie++,At=void 0,vt=!0}}}return Z[oe][1]._spread=ke,ie}function i(Z,oe){return ie;function ie(me){o.call(this,Z(me),me),oe&&oe.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Z,oe,ie){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,ie]),Z.position={start:mn(oe.start),end:void 0}}function l(Z){return oe;function oe(ie){Z&&Z.call(this,ie),u.call(this,ie)}}function u(Z,oe){const ie=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==Z.type&&(oe?oe.call(this,Z,me[0]):(me[1]||Oc).call(this,Z,me[0]));else throw new Error("Cannot close `"+Z.type+"` ("+Rr({start:Z.start,end:Z.end})+"): it’s not open");ie.position.end=mn(Z.end)}function d(){return IC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function v(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function C(Z){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Z)).toLowerCase()}function D(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function F(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function E(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ie=this.sliceSerialize(Z).length;oe.depth=ie}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function T(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Z){const ie=this.stack[this.stack.length-1].children;let me=ie[ie.length-1];(!me||me.type!=="text")&&(me=Oe(),me.position={start:mn(Z.start),end:void 0},ie.push(me)),this.stack.push(me)}function z(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=mn(Z.end)}function $(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=oe.children[oe.children.length-1];ie.position.end=mn(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(P.call(this,Z),z.call(this,Z))}function B(){this.data.atHardBreak=!0}function A(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function O(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function j(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function U(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function W(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function re(Z){const oe=this.sliceSerialize(Z),ie=this.stack[this.stack.length-2];ie.label=Rw(oe),ie.identifier=ir(oe).toLowerCase()}function ne(){const Z=this.stack[this.stack.length-1],oe=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const me=Z.children;ie.children=me}else ie.alt=oe}function w(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function Q(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function se(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function M(Z){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function q(Z){this.data.characterReferenceType=Z.type}function S(Z){const oe=this.sliceSerialize(Z),ie=this.data.characterReferenceType;let me;ie?(me=hm(oe,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Wo(oe);const ve=this.stack.pop();ve.value+=me,ve.position.end=mn(Z.end)}function L(Z){z.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function G(Z){z.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function K(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function Me(){return{type:"html",value:""}}function je(){return{type:"image",title:null,url:"",alt:null}}function Je(){return{type:"link",title:null,url:"",children:[]}}function Ue(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Le(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function _e(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function We(){return{type:"thematicBreak"}}}function mn(e){return{line:e.line,column:e.column,offset:e.offset}}function _m(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?_m(e,r):zw(e,r)}}function zw(e,t){let n;for(n in t)if(Em.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 Oc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rr({start:t.start,end:t.end})+") is still open")}function qw(e){const t=this;t.parser=n;function n(r){return $w(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function km(e,t){var l,u,d;const n={...tr,...t==null?void 0:t.nodeTypes,[H.heading]:{...tr[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>km({...m,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(m=>({...m,[n[H.heading][e.depth||1]]:!0}))};case ht.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case ht.listItem:return{type:n[H.li],children:s};case ht.paragraph:return{type:n[H.paragraph],children:s};case ht.link:return{type:n[H.link],[r]:e.url,children:s};case ht.image:return{type:n[H.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ht.blockquote:return{type:n[H.blockquote],children:s};case ht.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case ht.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[H.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:H.paragraph,children:[{text:e.value||""}]};case ht.emphasis:return{[n[Kt.emphasis]]:!0,...is(s),...Ca(s)};case ht.strong:return{[n[Kt.strong]]:!0,...is(s),...Ca(s)};case ht.delete:return{[n[Kt.delete]]:!0,...is(s),...Ca(s)};case ht.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ca(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const is=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ca(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Uw=function(t){const n=r=>r.children.map(a=>km(a,t));this.Compiler=n},Ww=(e,t=n=>{})=>{OC().use(qw).use(Uw).process(e).then(n=>{const r=Ot(n.result),a=s=>{const o=s;[H.li,H.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===H.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===H.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Zs)){const m=u,h=d.text.replace(Zs,""),p="link"in m&&m.link?m.link:"";m.type=H.mention,m.id=p,m.name=h,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const m=d.replace(/~~/g,""),h=o.text.indexOf(d),p=o.text.substring(0,h),v=o.text.substring(h+d.length),f=[{text:p},{text:m,[H.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Ko=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Vw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=R.parent(a),r=le.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},Hw=e=>{const{selection:t}=e;return t?x.string(e,t):null},Pc=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Kw=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Mc={"mod+b":H.bold,"mod+i":H.italic,"mod+shift+x":H.strikethrough,"mod+k":H.link,"mod+shift+7":H.ol,"mod+shift+8":H.ul,"mod+shift+9":H.blockquote},Zw=(e,t,n,r)=>{for(const a in Mc)if(qx(a,e)){e.stopPropagation(),e.preventDefault();const i=Mc[a];if(i===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(aE(i)){Pm(t,i,r);return}Sm(t,i,r)}},Fm=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:H.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||cm),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Ko(r)},Yw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Y.isCollapsed(i)){const[s]=Y.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(ld);if(d){const m=d.index||0,h={path:s.path,offset:m},p={path:s.path,offset:m+d[0].length},v=x.range(e,h,p),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const D=d[1];let F=[];r&&(F=await r({name:D})),a([{type:"mentionPopover",value:{show:F.length>0?!0:n!==null,selectedUser:0,possibleUsers:F,position:F.length>0?v:null,numberOfUsers:F.length>0?F.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Am=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Yn=e=>typeof e.text=="string",Gw=[H.hr,H.image,H.mention],Nc="<br>";function Bm(e,t={nodeTypes:tr}){const{nodeTypes:n=tr,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...tr,...n,heading:{...tr[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=i;if(!Yn(e)&&s!==H.mention&&(u=e.children.map(d=>{const m=Yn(d)?!1:l.includes(d.type||""),h=l.includes(e.type||"");let p=!1;return!Yn(e)&&Array.isArray(e.children)&&(p=e.children.some(v=>!Yn(v)&&v.type===o.link)),Bm({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(i===""||i===`
84
+ `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Nc),!(u===""&&!Gw.find(d=>o[d]===s)))switch(u!==Nc&&Yn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Gn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Gn(u,"***"):(e[H.bold]&&(u=Gn(u,"**")),e[H.italic]&&(u=Gn(u,"_")),e[H.strikethrough]&&(u=Gn(u,"~~")),e[H.code]&&(u=Gn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
85
+ `;case o[H.heading][2]:return`## ${u}
86
+ `;case o[H.heading][3]:return`### ${u}
87
+ `;case o[H.heading][4]:return`#### ${u}
88
+ `;case o[H.heading][5]:return`##### ${u}
89
+ `;case o[H.heading][6]:return`###### ${u}
90
+ `;case o[H.blockquote]:return`> ${u}
91
+
92
+ `;case o[H.codeblock]:return`\`\`\`${e.language||""}
93
93
  ${u}
94
94
  \`\`\`
95
- `;case o[K.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[K.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[K.ul]:case o[K.ol]:return`
95
+ `;case o[H.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[H.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[H.ul]:case o[H.ol]:return`
96
96
  ${u}
97
97
 
98
- `;case o[K.li]:const h=e&&e.parentType===o[K.ol],p=e.children.length===1&&Hn(e.children[0]);let m="";for(let v=0;a>v;v++)h?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
99
- ${m}${h?"1.":"-"} ${u}${p?`
100
- `:""}`;case o[K.paragraph]:return`${u}
98
+ `;case o[H.li]:const m=e&&e.parentType===o[H.ol],h=e.children.length===1&&Yn(e.children[0]);let p="";for(let v=0;a>v;v++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`
99
+ ${p}${m?"1.":"-"} ${u}${h?`
100
+ `:""}`;case o[H.paragraph]:return`${u}
101
101
 
102
- `;case o[K.hr]:return`---
103
- `;default:return u}}function Kn(e,t){const n=e.trim(),r=n,a=`${t}${r}${$c(t)}`;if(r.length===e.length)return a;const i=t+r+$c(t);return e.replace(n,i)}const $c=e=>e.split("").reverse().join(""),oE=e=>e.map(t=>Bh(t)).join("").trim();const uE=({onFallbackClick:e=()=>{}})=>{const t=ae.useIntl(),n=$n(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(un),{show:l,selectedUser:u,possibleUsers:d}=i,h=dh(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Ah(a);return c.jsx(hr,{parent:p,children:c.jsx(pd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:v},f)=>c.jsx(nn,{element:"li",className:H({selected:f===u}),member:{id:m,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...i,selectedUser:f};r([{type:"mentionPopover",value:g}]),Fh(n,g,r,s),o&&o({id:m||"",name:v.name||""})}}},m)),c.jsx(nn,{element:"li",className:H("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Yt}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Go=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Pe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Qo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ae.useIntl(),u=$n(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:v}=y.useContext(un),f={};return e!==h&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:H(e,{"has-divider":n}),onMouseEnter:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:H(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,w,E,B;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const D=b.currentTarget.closest("li");let k=D==null?void 0:D.nextElementSibling;if(b.key==="ArrowLeft"){const P=D==null?void 0:D.previousElementSibling;P?k=P:k=(g=D==null?void 0:D.parentElement)==null?void 0:g.lastElementChild}else k||(k=(w=D==null?void 0:D.parentElement)==null?void 0:w.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(p(T),(E=k==null?void 0:k.querySelector("button"))==null||E.focus());break;default:const $=b.currentTarget.closest("fieldset");if($){(B=$==null?void 0:$.previousElementSibling)==null||B.focus();break}}},children:[c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(In,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Lc=[K.ol,K.ul],Th=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},lE=e=>{const[t]=x.nodes(e,{match:n=>n.type===K.blockquote});return!!t},Sh=(e,t,n)=>{try{const r=lE(e),a=Th(e,t),i=Lc.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&de.isElement(u)&&Lc.includes(u.type)},split:!0});const o={type:a?K.paragraph:i?K.li:t};if(J.setNodes(e,o),t===K.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),J.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:p=>{const m=p;return!x.isEditor(p)&&de.isElement(p)&&m.type===K.li}})).forEach(([p,m])=>{ue.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:K.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},zc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(un),a=$n(),i=Th(a,e);return c.jsx(Qo,{id:e,active:i,hasDivider:t,callback:()=>{Sh(a,e,r),n(i?null:e)}})},Ir=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&de.isElement(n)&&r.type===K.link}});return!!t},cE=(e,t,n,r)=>{e.selection&&Jo(e,t,n,r)},dE=(e,t,n,r)=>{const{selection:a}=e;if(a&&Y.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&de.isElement(o)&&l.type===K.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),Yo(n)}}else Jo(e,t,n,r)},Jo=(e,t,n,r=a=>{console.error(a)})=>{try{Ir(e)&&jh(e);const{selection:a}=e,i=a&&Y.isCollapsed(a),s={type:K.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),Yo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},jh=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&de.isElement(t)&&n.type===K.link}})};let us=null;const fE=()=>{const e=ae.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(un),u=$n(),d=_C(u),h=(d==null?void 0:d.text)||nE(u),p=i!==!1,[m,v]=y.useState(Ir(u)),f=dh(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var D;!m&&r&&((D=b.current)==null||D.focus())},[m]),y.useEffect(()=>{us&&clearTimeout(us),us=setTimeout(()=>{v(Ir(u))},500)},[u.selection]);const g=[],w=["open","edit","remove"].map(D=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(g.push({className:D}),D){case"open":k.href=(d==null?void 0:d.full)||"",k.onClick=T=>{T.preventDefault(),T.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Pe,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":k.onClick=()=>{v(!1)};break;case"remove":k.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];Ir(u)&&(jh(u),T.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return k}),E=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!u)return;D.preventDefault(),D.stopPropagation();const k=x.end(u,[]);J.select(u,k),ee.focus(u)}}}}];h&&E.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const B=Ah(a);return c.jsx(hr,{parent:B,children:c.jsx(In,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!m},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=b.current)==null?void 0:D.focus()})}},children:m?c.jsx(fr,{wrappers:g,buttons:w}):c.jsx(Qt,{element:"fieldset",id:`${n}-link-editor`,className:H({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{const k=[{type:"showLinkEditor",value:!1}];let T=D.url;if(D.url){const{full:$}=lo(D.url);T=$,d!=null&&d.full?dE(u,T,n,l):cE(u,T,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),D.url&&o&&(!p||i&&(d==null?void 0:d.full)===i.url)){const $=await o(T);$.url&&s([{type:"enrichedUrl",value:$}])}})}},fields:E,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},hE=()=>{const e=$n(),{setFocus:t,dispatch:n}=y.useContext(un),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Ir(e))},[e.selection]),c.jsx(Qo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},mE=e=>[K.bold,K.italic,K.strikethrough].includes(e),Oh=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Ph=(e,t,n)=>{try{Oh(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},pE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(un),a=$n(),i=Oh(a,e);return c.jsx(Qo,{id:e,active:i,hasDivider:t,callback:()=>{Ph(a,e,r),n(i?null:e)}})},ei=[K.bold,K.italic,K.strikethrough],gE=[K.ol,K.ul,K.blockquote];const vE=({styling:e={showHeadingOption:!1},...t})=>{const n=ae.useIntl(),{id:r}=y.useContext(un);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Pe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(zc,{format:K.h3,hasDivider:!0},K.h3),ei.map((a,i)=>c.jsx(pE,{format:a,hasDivider:i===ei.length-1},a)),c.jsx(hE,{}),gE.map((a,i)=>c.jsx(zc,{format:a,hasDivider:i===1},a))]})]}),c.jsx(fE,{})]})};function bE(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 ro(e,t){return Array(t+1).join(e)}function yE(e){return e.replace(/^\n*/,"")}function xE(e){for(var t=e.length;t>0&&e[t-1]===`
104
- `;)t--;return e.substring(0,t)}var CE=["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 Xo(e){return eu(e,CE)}var Mh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Nh(e){return eu(e,Mh)}function wE(e){return Rh(e,Mh)}var Ih=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function DE(e){return eu(e,Ih)}function EE(e){return Rh(e,Ih)}function eu(e,t){return t.indexOf(e.nodeName)>=0}function Rh(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var lt={};lt.paragraph={filter:"p",replacement:function(e){return`
102
+ `;case o[H.hr]:return`---
103
+ `;default:return u}}function Gn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Rc(t)}`;if(r.length===e.length)return a;const i=t+r+Rc(t);return e.replace(n,i)}const Rc=e=>e.split("").reverse().join(""),Qw=e=>e.map(t=>Bm(t)).join("").trim();const Jw=({onFallbackClick:e=()=>{}})=>{const t=ae.useIntl(),n=qn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(cn),{show:l,selectedUser:u,possibleUsers:d}=i,m=dm(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const h=Am(a);return c.jsx(gr,{parent:h,children:c.jsx(hd,{ref:m,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:p,user:v},f)=>c.jsx(an,{element:"li",className:V({selected:f===u}),member:{id:p,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...i,selectedUser:f};r([{type:"mentionPopover",value:g}]),Fm(n,g,r,s),o&&o({id:p||"",name:v.name||""})}}},p)),c.jsx(an,{element:"li",className:V("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Gt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Zo=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Pe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Yo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ae.useIntl(),u=qn(),{id:d,tabbableOption:m,setFocus:h,openTooltip:p,dispatch:v}=y.useContext(cn),f={};return e!==m&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,C,D,F;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 _=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const P=E==null?void 0:E.previousElementSibling;P?_=P:_=(g=E==null?void 0:E.parentElement)==null?void 0:g.lastElementChild}else _||(_=(C=E==null?void 0:E.parentElement)==null?void 0:C.firstElementChild);const T=_==null?void 0:_.className.split(" ")[0];T&&(h(T),(D=_==null?void 0:_.querySelector("button"))==null||D.focus());break;default:const I=b.currentTarget.closest("fieldset");if(I){(F=I==null?void 0:I.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Ln,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ic=[H.ol,H.ul],Tm=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&fe.isElement(a)&&i.type===t}}));return!!r},Xw=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Sm=(e,t,n)=>{try{const r=Xw(e),a=Tm(e,t),i=Ic.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&fe.isElement(u)&&Ic.includes(u.type)},split:!0});const o={type:a?H.paragraph:i?H.li:t};if(X.setNodes(e,o),t===H.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),X.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:h=>{const p=h;return!x.isEditor(h)&&fe.isElement(h)&&p.type===H.li}})).forEach(([h,p])=>{le.string(h).trim()===""&&X.removeNodes(e,{at:p})})}else{if(r){const u={type:H.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},$c=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=Tm(a,e);return c.jsx(Yo,{id:e,active:i,hasDivider:t,callback:()=>{Sm(a,e,r),n(i?null:e)}})},$r=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&fe.isElement(n)&&r.type===H.link}});return!!t},eE=(e,t,n,r)=>{e.selection&&Go(e,t,n,r)},tE=(e,t,n,r)=>{const{selection:a}=e;if(a&&Y.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&fe.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Ko(n)}}else Go(e,t,n,r)},Go=(e,t,n,r=a=>{console.error(a)})=>{try{$r(e)&&jm(e);const{selection:a}=e,i=a&&Y.isCollapsed(a),s={type:H.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Ko(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},jm=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&fe.isElement(t)&&n.type===H.link}})};let ss=null;const nE=()=>{const e=ae.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(cn),u=qn(),d=pC(u),m=(d==null?void 0:d.text)||Hw(u),h=i!==!1,[p,v]=y.useState($r(u)),f=dm(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var E;!p&&r&&((E=b.current)==null||E.focus())},[p]),y.useEffect(()=>{ss&&clearTimeout(ss),ss=setTimeout(()=>{v($r(u))},500)},[u.selection]);const g=[],C=["open","edit","remove"].map(E=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${E}`},{link:d==null?void 0:d.pretty})};switch(g.push({className:E}),E){case"open":_.href=(d==null?void 0:d.full)||"",_.onClick=T=>{T.preventDefault(),T.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Pe,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":_.onClick=()=>{v(!1)};break;case"remove":_.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];$r(u)&&(jm(u),T.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return _}),D=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:E=>{if(E.key==="Tab"){if(!u)return;E.preventDefault(),E.stopPropagation();const _=x.end(u,[]);X.select(u,_),ee.focus(u)}}}}];m&&D.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",m]})});const F=Am(a);return c.jsx(gr,{parent:F,children:c.jsx(Ln,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=b.current)==null?void 0:E.focus()})}},children:p?c.jsx(pr,{wrappers:g,buttons:C}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":m}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async E=>{setTimeout(async()=>{const _=[{type:"showLinkEditor",value:!1}];let T=E.url;if(E.url){const{full:I}=oo(E.url);T=I,d!=null&&d.full?tE(u,T,n,l):eE(u,T,n,l),_.push({type:"lastAnchor",value:null})}if(s(_),E.url&&o&&(!h||i&&(d==null?void 0:d.full)===i.url)){const I=await o(T);I.url&&s([{type:"enrichedUrl",value:I}])}})}},fields:D,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},rE=()=>{const e=qn(),{setFocus:t,dispatch:n}=y.useContext(cn),[r,a]=y.useState(!1);return y.useEffect(()=>{a($r(e))},[e.selection]),c.jsx(Yo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},aE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Om=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Pm=(e,t,n)=>{try{Om(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},iE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=Om(a,e);return c.jsx(Yo,{id:e,active:i,hasDivider:t,callback:()=>{Pm(a,e,r),n(i?null:e)}})},ti=[H.bold,H.italic,H.strikethrough],sE=[H.ol,H.ul,H.blockquote];const oE=({styling:e={showHeadingOption:!1},...t})=>{const n=ae.useIntl(),{id:r}=y.useContext(cn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Pe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx($c,{format:H.h3,hasDivider:!0},H.h3),ti.map((a,i)=>c.jsx(iE,{format:a,hasDivider:i===ti.length-1},a)),c.jsx(rE,{}),sE.map((a,i)=>c.jsx($c,{format:a,hasDivider:i===1},a))]})]}),c.jsx(nE,{})]})};function uE(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 to(e,t){return Array(t+1).join(e)}function lE(e){return e.replace(/^\n*/,"")}function cE(e){for(var t=e.length;t>0&&e[t-1]===`
104
+ `;)t--;return e.substring(0,t)}var dE=["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 Qo(e){return Jo(e,dE)}var Mm=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Nm(e){return Jo(e,Mm)}function fE(e){return Im(e,Mm)}var Rm=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function mE(e){return Jo(e,Rm)}function hE(e){return Im(e,Rm)}function Jo(e,t){return t.indexOf(e.nodeName)>=0}function Im(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var dt={};dt.paragraph={filter:"p",replacement:function(e){return`
105
105
 
106
106
  `+e+`
107
107
 
108
- `}};lt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
109
- `}};lt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=ro(r===1?"=":"-",e.length);return`
108
+ `}};dt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
109
+ `}};dt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=to(r===1?"=":"-",e.length);return`
110
110
 
111
111
  `+e+`
112
112
  `+a+`
113
113
 
114
114
  `}else return`
115
115
 
116
- `+ro("#",r)+" "+e+`
116
+ `+to("#",r)+" "+e+`
117
117
 
118
- `}};lt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
118
+ `}};dt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
119
119
 
120
120
  `+e+`
121
121
 
122
- `}};lt.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
122
+ `}};dt.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
123
123
  `+e:`
124
124
 
125
125
  `+e+`
126
126
 
127
- `}};lt.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
127
+ `}};dt.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
128
128
  `).replace(/\n/gm,`
129
129
  `);var r=n.bulletListMarker+" ",a=t.parentNode;if(a.nodeName==="OL"){var i=a.getAttribute("start"),s=Array.prototype.indexOf.call(a.children,t);r=(i?Number(i)+s:s+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
130
- `:"")}};lt.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
130
+ `:"")}};dt.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
131
131
 
132
132
  `+t.firstChild.textContent.replace(/\n/g,`
133
133
  `)+`
134
134
 
135
- `}};lt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=ro(s,o);return`
135
+ `}};dt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=to(s,o);return`
136
136
 
137
137
  `+d+a+`
138
138
  `+i.replace(/\n$/,"")+`
139
139
  `+d+`
140
140
 
141
- `}};lt.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
141
+ `}};dt.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
142
142
 
143
143
  `+n.hr+`
144
144
 
145
- `}};lt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ti(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};lt.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ti(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
145
+ `}};dt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ni(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};dt.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ni(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
146
146
 
147
147
  `+this.references.join(`
148
148
  `)+`
149
149
 
150
- `,this.references=[]),t}};lt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};lt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};lt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};lt.image={filter:"img",replacement:function(e,t){var n=ti(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ti(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ti(e){return e?e.replace(/(\n+\s*)+/g,`
151
- `):""}function $h(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}$h.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ls(this.array,e,this.options))||(t=ls(this._keep,e,this.options))||(t=ls(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ls(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(_E(a,t,n))return a}}function _E(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function kE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=qc(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=cs(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=cs(l);continue}var d=qc(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||cs(i))}}function cs(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function qc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var tu=typeof window<"u"?window:{};function FE(){var e=tu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function AE(){var e=function(){};return BE()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function BE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{tu.ActiveXObject&&(e=!0)}return e}var TE=FE()?tu.DOMParser:AE();function SE(e,t){var n;if(typeof e=="string"){var r=jE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return kE({element:n,isBlock:Xo,isVoid:Nh,isPre:t.preformattedCode?OE:null}),n}var ds;function jE(){return ds=ds||new TE,ds}function OE(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function PE(e,t){return e.isBlock=Xo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=ME(e),e.flankingWhitespace=NE(e,t),e}function ME(e){return!Nh(e)&&!DE(e)&&/^\s*$/i.test(e.textContent)&&!wE(e)&&!EE(e)}function NE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=IE(e.textContent);return n.leadingAscii&&Uc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Uc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function IE(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Uc(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Xo(r)&&(i=a.test(r.textContent))),i}var RE=Array.prototype.reduce,$E=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Yr(e){if(!(this instanceof Yr))return new Yr(e);var t={rules:lt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
150
+ `,this.references=[]),t}};dt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};dt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};dt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};dt.image={filter:"img",replacement:function(e,t){var n=ni(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ni(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ni(e){return e?e.replace(/(\n+\s*)+/g,`
151
+ `):""}function $m(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}$m.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=os(this.array,e,this.options))||(t=os(this._keep,e,this.options))||(t=os(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function os(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(pE(a,t,n))return a}}function pE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function gE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Lc(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=us(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=us(l);continue}var d=Lc(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||us(i))}}function us(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Lc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Xo=typeof window<"u"?window:{};function vE(){var e=Xo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function bE(){var e=function(){};return yE()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function yE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Xo.ActiveXObject&&(e=!0)}return e}var xE=vE()?Xo.DOMParser:bE();function CE(e,t){var n;if(typeof e=="string"){var r=DE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return gE({element:n,isBlock:Qo,isVoid:Nm,isPre:t.preformattedCode?wE:null}),n}var ls;function DE(){return ls=ls||new xE,ls}function wE(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function EE(e,t){return e.isBlock=Qo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=_E(e),e.flankingWhitespace=kE(e,t),e}function _E(e){return!Nm(e)&&!mE(e)&&/^\s*$/i.test(e.textContent)&&!fE(e)&&!hE(e)}function kE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=FE(e.textContent);return n.leadingAscii&&zc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&zc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function FE(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function zc(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Qo(r)&&(i=a.test(r.textContent))),i}var AE=Array.prototype.reduce,BE=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Gr(e){if(!(this instanceof Gr))return new Gr(e);var t={rules:dt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
152
152
 
153
153
  `:""},keepReplacement:function(n,r){return r.isBlock?`
154
154
 
@@ -158,8 +158,8 @@ ${m}${h?"1.":"-"} ${u}${p?`
158
158
 
159
159
  `+n+`
160
160
 
161
- `:n}};this.options=bE({},t,e),this.rules=new $h(this.options)}Yr.prototype={turndown:function(e){if(!qE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Lh.call(this,new SE(e,this.options));return LE.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return $E.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Lh(e){var t=this;return RE.call(e.childNodes,function(n,r){r=new PE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=zE.call(t,r)),zh(n,a)},"")}function LE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=zh(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function zE(e){var t=this.rules.forNode(e),n=Lh.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function zh(e,t){var n=xE(e),r=yE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
161
+ `:n}};this.options=uE({},t,e),this.rules=new $m(this.options)}Gr.prototype={turndown:function(e){if(!jE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Lm.call(this,new CE(e,this.options));return TE.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return BE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Lm(e){var t=this;return AE.call(e.childNodes,function(n,r){r=new EE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=SE.call(t,r)),zm(n,a)},"")}function TE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=zm(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function SE(e){var t=this.rules.forNode(e),n=Lm.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function zm(e,t){var n=cE(e),r=lE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
162
162
 
163
- `.substring(0,a);return n+i+r}function qE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var UE={isHistory(e){return st(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||pn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||pn.isOperationList(e.undos[0].operations))}},fs=new WeakMap,hs=new WeakMap,Xn={isHistoryEditor(e){return UE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return hs.get(e)},isSaving(e){return fs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Xn.isMerging(e);hs.set(e,!1),t(),hs.set(e,n)},withoutSaving(e,t){var n=Xn.isSaving(e);fs.set(e,!1),t(),fs.set(e,n)}},WE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&J.setSelection(t,i.selectionBefore),Xn.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];Xn.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(pn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Xn.isSaving(t),d=Xn.isMerging(t);if(u==null&&(u=HE(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=VE(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},VE=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),HE=(e,t)=>e.type!=="set_selection";const KE=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===K.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var ZE=JE,YE=/^(?:\w+:)?\/\/(\S+)$/,GE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,QE=/^[^\s\.]+\.\S{2,}$/;function JE(e){if(typeof e!="string")return!1;var t=e.match(YE);if(!t)return!1;var n=t[1];return n?!!(GE.test(n)||QE.test(n)):!1}const XE=Mn(ZE),e_=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[K.link].includes(s.type)||a(i)},e.insertText=i=>{i&&XE(i)?Jo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},t_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===K.mention?!0:n(i),e.isVoid=i=>i.type===K.mention?!0:r(i),e.markableVoid=i=>i.type===K.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},n_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===K.link&&ue.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const nu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ae.useIntl(),h=Sm();typeof s>"u"&&(s=!0);const{isInOverlay:p=!1}=a||{},{listMembers:m,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:w=()=>{},reportError:E=j=>{console.error(j)}}=i||{},B=[{type:K.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const D={editorKey:null,originalValue:t||"",initialValue:t?null:B,tabbableOption:ei[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[k,T]=y.useReducer(Qr,D),{editorKey:$,originalValue:P,initialValue:z,stringValue:R,lastAnchor:A,lastKey:F,hasInteracted:O,hasLoaded:M,enrichedUrl:U,mentionPopover:W}=k,ie=j=>{j&&T([{type:"tabbableOption",value:j||ei[0]}])},se=async j=>{const L=await g(j);L.url&&T([{type:"enrichedUrl",value:L}])},C=`rte-${e}`,G=y.useCallback(j=>c.jsx(Iv,{...j}),[]),ne=y.useCallback(j=>c.jsx(Rv,{...j}),[]),_=y.useMemo(()=>KE(e_(t_(n_(WE(EC(Fx())),E),E),C,E),E),[]),S=j=>{if(!_||j!==C)return;const L=x.end(_,[]);J.select(_,L),ee.focus(_)};y.useEffect(()=>{const j=L=>{var X;const Q=L,Z=((X=Q==null?void 0:Q.detail)==null?void 0:X.id)||null;Z&&S(Z)};return window.addEventListener("focusEditor",j),()=>{window.removeEventListener("focusEditor",j)}},[]),y.useEffect(()=>{if(_.children.length>0&&!M){if(T([{type:"hasLoaded",value:!0}]),!s)return;S(C)}},[_.children.length,z]),y.useEffect(()=>{P&&(async()=>{let L=Rt(P);if(L.includes("<")){Yr.prototype.escape=Z=>Z;const Q=new Yr;Q.addRule("br",{filter:["br"],replacement:Z=>Z+`
163
+ `.substring(0,a);return n+i+r}function jE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var OE={isHistory(e){return st(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||vn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||vn.isOperationList(e.undos[0].operations))}},cs=new WeakMap,ds=new WeakMap,nr={isHistoryEditor(e){return OE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return ds.get(e)},isSaving(e){return cs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);ds.set(e,!1),t(),ds.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);cs.set(e,!1),t(),cs.set(e,n)}},PE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=nr.isSaving(t),d=nr.isMerging(t);if(u==null&&(u=NE(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=ME(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},ME=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&R.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&R.equals(e.path,t.path)),NE=(e,t)=>e.type!=="set_selection";const RE=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var IE=qE,$E=/^(?:\w+:)?\/\/(\S+)$/,LE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,zE=/^[^\s\.]+\.\S{2,}$/;function qE(e){if(typeof e!="string")return!1;var t=e.match($E);if(!t)return!1;var n=t[1];return n?!!(LE.test(n)||zE.test(n)):!1}const UE=In(IE),WE=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[H.link].includes(s.type)||a(i)},e.insertText=i=>{i&&UE(i)?Go(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},VE=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===H.mention?!0:n(i),e.isVoid=i=>i.type===H.mention?!0:r(i),e.markableVoid=i=>i.type===H.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},HE=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===H.link&&le.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const eu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ae.useIntl(),m=Th();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:C=()=>{},reportError:D=S=>{console.error(S)}}=i||{},F=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:F,tabbableOption:ti[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[_,T]=y.useReducer(Jr,E),{editorKey:I,originalValue:P,initialValue:z,stringValue:$,lastAnchor:B,lastKey:A,hasInteracted:O,hasLoaded:j,enrichedUrl:U,mentionPopover:W}=_,re=S=>{S&&T([{type:"tabbableOption",value:S||ti[0]}])},ne=async S=>{const L=await g(S);L.url&&T([{type:"enrichedUrl",value:L}])},w=`rte-${e}`,Q=y.useCallback(S=>c.jsx(Fv,{...S}),[]),se=y.useCallback(S=>c.jsx(Av,{...S}),[]),k=y.useMemo(()=>RE(WE(VE(HE(PE(hC(vx())),D),D),w,D),D),[]),M=S=>{if(!k||S!==w)return;const L=x.end(k,[]);X.select(k,L),ee.focus(k)};y.useEffect(()=>{const S=L=>{var te;const G=L,K=((te=G==null?void 0:G.detail)==null?void 0:te.id)||null;K&&M(K)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(k.children.length>0&&!j){if(T([{type:"hasLoaded",value:!0}]),!s)return;M(w)}},[k.children.length,z]),y.useEffect(()=>{P&&(async()=>{let L=Ot(P);if(L.includes("<")){Gr.prototype.escape=K=>K;const G=new Gr;G.addRule("br",{filter:["br"],replacement:K=>K+`
164
164
 
165
- `}),L=Q.turndown(L)}o&&o.mentions&&(L=await hd({text:L,template:`[${Gs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),eE(L,Q=>{const Z=[{type:"initialValue",value:Q},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(Z.push({type:"enrichedUrl",value:o.link}),o.link.url&&se(o.link.url)),T(Z),setTimeout(()=>{T([{type:"stringValue",value:Nc(_)}])},150)})})()},[P]),y.useEffect(()=>{if(U===void 0&&_){const L=rE(_);L&&se(L)}const j=L=>{var X;const Q=L,Z=((X=Q==null?void 0:Q.detail)==null?void 0:X.url)||null;Z&&U&&U.url===Z&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",j),()=>{window.removeEventListener("linkRemoved",j)}},[U]),y.useEffect(()=>{if(t){$r.lastIndex=0;const j=t.match($r);j&&j.length===1&&j[0].length===t.length&&!O&&T([{type:"originalValue",value:t}])}t!==""||!_||Ia(P,t)&&!O||(x.withoutNormalizing(_,()=>{J.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),J.deselect(_),_.children.length!==0&&J.unwrapNodes(_,{at:[0]}),J.insertNodes(_,B,{at:[0]})}),T([{type:"initialValue",value:B},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{R===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[R]);const q=td(()=>{iE({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:T})},100);return z?c.jsx("div",{id:C,className:"rich-text-editor",children:c.jsxs(un.Provider,{value:{...k,id:C,isInOverlay:p,setFocus:ie,dispatch:T,getLinkPreview:g,onMention:w,reportError:E},children:[c.jsxs(wC,{editor:_,initialValue:z,onChange:j=>{if(_.operations.some(Q=>Q.type!=="set_selection")){let Q=oE(j);Q==="<br>"&&(Q=""),f(Q,U),T([{type:"stringValue",value:Nc(_)}]),O||T([{type:"hasInteracted",value:!0}]),q(),h&&console.log({serialized:Q,json:j})}},...u,children:[c.jsx(hC,{className:"input",renderElement:G,renderLeaf:ne,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async j=>{const L=U!==!1,Q=j.clipboardData.getData("text");if((X=>{try{return new URL(X),!0}catch{return!1}})(Q)){let X=Q;if(Q){const{full:le}=lo(Q);X=le}if(Q&&g&&!L){const le=await g(X);le.url&&T([{type:"enrichedUrl",value:le}])}}},onKeyDown:j=>{if(j.key==="Enter"){W.show&&(j.preventDefault(),j.stopPropagation(),Fh(_,W,T,C));const{selection:L}=_;if(L){const Q=Y.isCollapsed(L),[Z,X]=x.node(_,L,{depth:1});let le=Z,te=le.type;const pe=le.children[0];if(pe&&(pe==null?void 0:pe[K.h3])===!0&&(j.stopPropagation(),j.preventDefault(),J.insertNodes(_,B)),pe&&[K.ol,K.ul].includes(pe.type)&&(le=pe,te=pe.type),le&&de.isElement(le)&&te!==K.paragraph){if(te===K.blockquote&&!j.shiftKey){j.stopPropagation(),j.preventDefault(),J.insertNodes(_,B);return}if(Q){const[fe,Ae]=x.parent(_,L,{edge:"end"}),Ee=fe.type;if([K.ul,K.ol].includes(te))if(j.stopPropagation(),j.preventDefault(),Ee===K.li&&F==="Enter"){fe.children.length===1&&"text"in fe.children[0]&&fe.children[0].text===""&&J.removeNodes(_,{at:Ae}),J.insertNodes(_,B,{at:I.next(X)}),J.select(_,x.end(_,I.next(X)));return}else{const[Le,Oe]=tE(_,K.li),ze={type:K.li,children:[{text:""}]};J.insertNodes(_,ze,{at:I.next(Oe)}),J.select(_,x.end(_,I.next(Oe)))}}}}}else if(j.key==="Escape"){if(W.show){j.preventDefault(),j.stopPropagation(),T([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(j.key)&&W.show){j.preventDefault(),j.stopPropagation();const{selectedUser:L,possibleUsers:Q}=W;let Z=j.key==="ArrowUp"?L-1:L+1;Z<0&&(Z=Q.length-1),Z>=Q.length+1&&(Z=0),T([{type:"mentionPopover",value:{...W,selectedUser:Z}}])}T([{type:"lastKey",value:j.key}]),aE(j,_,T,E)},onBlur:()=>{_.selection&&T([{type:"lastAnchor",value:_.selection.anchor}])},onFocus:()=>{if(A){if(!I.isPath(A.path)||!ue.has(_,A.path))return;const j=ue.get(_,A.path);let L=0;if(he.isText(j)?L=j.text.length:j.children&&(L=j.children.length),A.offset>L)return;try{J.select(_,{anchor:A,focus:A})}catch(Q){const Z=Q.message;E(`Error focusing editor: ${Z}`)}}}}),U?c.jsx(ko,{data:U,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const j=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(j)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(vE,{styling:l==null?void 0:l.toolbar}),m?c.jsx(uE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},$),c.jsx(Ao,{id:`character-limit-${e}`,limit:r,valueLength:hi(R)})]})}):c.jsx(c.Fragment,{})};const r_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:H("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:H("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function qh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,v]=y.useState(!1),f=y.useRef(null),b=async B=>{p(!0),v(!1);try{const D=B.target.files&&B.target.files[0];if(!D||!t)throw p(!1),new Error("Image file or userID is missing");const k=await a({fileObject:D,userId:t}),T={thumbnail:k.thumbnailURL,full:k.originalURL};d(T),s(T)}catch{v(!0)}finally{p(!1)}p(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:w=o.formatMessage({id:`${l}cta_change`}),uploading:E=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:H("profile-image-change-figure",e),children:[c.jsx(sn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Fe,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?E:u?w:g})]})}const Uh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Qt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const a_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(bm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Wh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,p]=y.useState([]),[m,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ae.useIntl(),w=async D=>{try{await u(h,D.message),p([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},E=D=>{D.preventDefault(),b("NOT_SUBMITTED"),v(!0),p([])},B=D=>{D.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"secondary",onClick:E,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Fe,{onClick:B,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Fe,{onClick:E,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Qt,{id:"invite-form",fields:[{component:a_,props:{emails:h,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:m}})]})},Na=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},i_=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Tt.NEW_PASSWORD]!==m[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!As(m[Tt.NEW_PASSWORD]).isValid,h=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Na(["required",d]),functions:{onChange:m=>l(As(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Na(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Na(["required"])}),i&&h.push({component:bf,props:{matchingRules:o}});const p={id:Tt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,v)=>{(v.includes(Tt.NEW_PASSWORD)||v.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{...p}),r&&c.jsx(yn,{variant:"error",text:r})]})};const Vh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var $;const s=ae.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[h,p]=y.useState(!1),{uploadImage:m=()=>{},onSuccess:v=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:w,predictPlaces:E}=t.useMaps(),{context:B="ProfileForm",event:D="profile-form-submit-click"}=a||{},k=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:($=l.location)==null?void 0:$.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!h?!1:!w(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{h||p(!0)},onKeyInput:E}}],T=[{component:qh,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},...k,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Qt,{id:"profile-details-form",fields:e?k:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:B,event:D},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:h?await g(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...z})),await v(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...i})},s_=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(jd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ms=null;const it="publishArticleForm_",Wc={},Vc=10,o_=({id:e="publish-article-form",values:t=Wc,functions:n,meta:r,gtm:a})=>{const i=ae.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,p]=y.useState(!1),[m,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,w]=y.useState("");y.useEffect(()=>{Ia(t,Wc)||$a(t.body)&&t.body!==m&&t.body!==void 0&&v(t.body)},[t.body]);const E=()=>{!s||!s.id?b(i.formatMessage({id:`${it}error_loggedOut`})):f&&b(!1)},B=$=>({condition:P=>{const z=P[$];return!z||typeof z!="string"?!0:z.length<Vc},error:i.formatMessage({id:`${it}error_underMinLength`},{length:Vc})}),D=!!m&&$a(m),k=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${it}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${it}title_label`}),placeholder:i.formatMessage({id:`${it}title_placeholder`}),functions:{onChange:E},validation:[{condition:"required"},B("title"),{condition:()=>!D,error:i.formatMessage({id:`${it}title_error`})}]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${it}subtitle_label`}),placeholder:i.formatMessage({id:`${it}subtitle_placeholder`}),functions:{onChange:E},validation:[{condition:"required"},B("subtitle")]},{component:Go,props:{formID:e,label:{visible:i.formatMessage({id:`${it}body_label`})},showLabel:!0}},{component:nu,props:{id:`${e}-input`,value:m,placeholder:i.formatMessage({id:`${it}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:$=>{v($),E()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return h?T.push({component:zt}):T.push({component:k}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Qt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async $=>{if(!s||!s.id||!D)return;ms&&clearTimeout(ms),p(!0);const P={...$,body:m};try{o&&await o(P),ms=setTimeout(()=>{w(i.formatMessage({id:`${it}aria_success`})),l(P)},500)}catch{b(i.formatMessage({id:`${it}error`})),w(""),u()}},onFailure:u},fields:T,intlPath:it,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!D,text:{default:i.formatMessage({id:`${it}cta_submit`}),submitting:i.formatMessage({id:`${it}cta_submitting`}),submitted:i.formatMessage({id:`${it}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(s_,{})},gtm:a}),f&&c.jsx(ir,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${it}error`})}),g&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const Hh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ae.useIntl(),u=y.useRef(null);ar(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:H("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Pe,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Pe,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Pe,{children:l.formatMessage({id:"search_cta"})})})]})})})},Hc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},u_=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"]}},l_=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=u_(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}])},c_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,v)=>{m.current&&s.validFields[v]!==m.current.validity.valid&&o([{type:`validFields.${v}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Hc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:ff,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const v=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Hc({ref:i.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const d_=({className:e=""})=>c.jsxs("div",{className:H("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const f_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},h_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ae.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,v={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Qr,f_),{validFields:g,emailDetails:w,shouldManuallyApprove:E,shouldDisableButton:B,showSuccessMessage:D,showError:k}=f,[T,$]=io.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{E===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[E]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{D&&T["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[D]);const z=y.useMemo(()=>c_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:P,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,v,f]),R=B?!0:E?!Object.values(g).every(A=>A===!0):!g.name||!g.email||["exists","pending","verify"].includes(w.boxType);return v.successMessage&&D?c.jsx(d_,{className:e}):c.jsxs("fieldset",{className:H("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(yn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Qt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:R?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await l_({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const wn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:H("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const m_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(wn,{className:H("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(fr,{buttons:r})]})})};const ao="editSection_";function Kh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const p_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${ao}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Fe,{href:r,variant:"secondary",size:"small",onClick:()=>Kh({href:r,setShowModal:i}),children:n||s({id:`${ao}placeholder_cta`})})})]})},g_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ae.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),v=!!n||!!r,f=typeof a=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:H("edit-section",t),children:[v&&c.jsx(on,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:H("edit-section-modal"),children:b||(n?c.jsx(Qt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async g=>{var w,E;(w=n==null?void 0:n.functions)!=null&&w.onSuccess&&await((E=n==null?void 0:n.functions)==null?void 0:E.onSuccess(g)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:H("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Fe,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Kh({href:a,setShowModal:p}),children:d({id:`${ao}edit`})})]}),e||c.jsx(p_,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(zt,{})]})};const v_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:H("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:H("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:H({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${v}`))})})]})};let ps;const gs="contactFooter_",b_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ps),ps=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ps),window.removeEventListener("resize",l)}),[]),c.jsx(wn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${gs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ae.FormattedMessage,{id:`${gs}text`})}),c.jsx(bn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${gs}email`})})]}),c.jsx(Uh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},y_=({activeLink:e,profile:t,...n})=>c.jsx(wn,{children:c.jsx(cf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(lf,{activeLink:e,profile:t}),c.jsx(xd,{...n})]})})});const vs="cookieBanner_",bs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ys=new Date(Date.now()+12*30*24*60*60*1e3),Zh=()=>{const e=ae.useIntl(),[t,n,r]=io.useCookies(bs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{bs.forEach(d=>{n(d,!0,{path:"/",expires:ys,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ys}),bs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:ys});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${vs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${vs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${vs}text`})}),c.jsx(fr,{buttons:u})]})},en={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Zn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Zn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Zn.support,gtmType:"concierge-email-click"},business:{email:Zn.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const er="footer_",ni="SiteFooter",Kc=({group:e})=>{const t=en[e].order||[];let n=!1;return"text"in en[e]&&(n=en[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.FormattedMessage,{id:`${er}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=en[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":i,...s,children:c.jsx(ae.FormattedMessage,{id:`${er}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${er}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.FormattedMessage,{id:`${er}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},ru=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(si,{element:"hr"}),c.jsx(Fo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Kc,{group:e}),Object.keys(en[e]).includes("child")&&c.jsx(Kc,{group:en[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(en.social.order)&&en.social.order.map(e=>{const t=en.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":ni,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${er}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${er}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),$e={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===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const i=Date.now();if(!a&&!t&&$e.handlerCalled[e]&&i-$e.handlerCalled[e]<500)return;$e.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 Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.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=Qc(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?$e.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 Et.SITE:if(n){const u=$e.findFirstChild(t.current.children,"className","has-submenu parent"),d=$e.findFirstChild(u.children,"id",Et.SITE);s=$e.findFirstChild(d.children,"href")}else s=$e.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=$e.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=$e.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($e.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout($e.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout($e.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{$e.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Gr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ri=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ae.useIntl(),o=Qc(Gr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let E=o.gtmType||`${e}-click`;if(E.includes(".")){const B=E.split("."),D=B[B.length-2];E=`${D==="topics"?`${D}-`:""}${B[B.length-1]}`}p={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":E,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],v=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},g={},w={};if(f&&(b={...b,"aria-current":"page"}),m){const E=o.menuId||e,B={onClick:D=>$e.events.onClick(D,{id:E,callback:a,isOpen:r[E]}),onFocus:()=>$e.events.onFocus({id:E}),onBlur:()=>$e.events.onBlur({id:E,callback:a}),onMouseLeave:()=>$e.events.onBlur({id:E,callback:a}),onMouseEnter:()=>$e.events.onMouseEnter({id:E,callback:a})};g={...B,id:E===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(v&&(w={...B,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&$e.events.onClick(D,{id:E,callback:a,isOpen:r[E]})},"aria-haspopup":!0,"aria-expanded":r[E],"aria-controls":E}),g={...g,hidden:E in r?!r[E]:!0}),v||(g={...g})}return c.jsxs("li",{className:H({[o.className]:o.className,"has-submenu":m,parent:v,active:f}),...b,children:[p?y.createElement(d?Fe:"a",p,s.formatMessage({id:h})):n&&o.order&&v?c.jsxs("button",{...w,children:[s.formatMessage({id:h}),c.jsx(Pe,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...g,children:o.order.map(E=>{if(!o[E])return null;const B={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[E].order?c.jsxs("li",{className:H({[o[E].className]:o[E].className}),children:[s.formatMessage({id:`${h}_${E}`}),c.jsx("ul",{children:o[E].order.map(D=>c.jsx(ri,{id:`${e}.${E}.${D}`,...B},D))})]},E):c.jsx(ri,{id:`${e}.${E}`,...B},E)})})]},e)};const x_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const au=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(at),r=Nn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>$e.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Qr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),rd({scrollPosition:x_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=h.current.menus;!i&&g["site-navigation"]||$e.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=h.current.menus;!i&&g["site-navigation"]||$e.shouldChangeHeaderIsVisible(!1,g,o)}}});const p=(g,w,E=!1)=>{$e.handleMenus({id:g,value:w,menus:h.current.menus,dispatch:o,forceHandle:E})},m=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(w=>{h.current.menus[w]&&p(w,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var w;(w=document.getElementById("header"))==null||w.removeEventListener("keydown",v)}},[]),ar(()=>{u["site-navigation"]&&$e.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),ar(()=>{u["account-navigation"]&&$e.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Pe,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Hh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Pe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Gr.order.map(g=>c.jsx(ri,{id:g,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:H({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Pe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Fo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:g=>$e.events.onClick(g,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>$e.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>$e.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Pe,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Gr.buttons.order.map(g=>c.jsx(ri,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:H("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const C_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(au,{}),c.jsx("div",{id:"content",children:c.jsx(yn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(ru,{})]})},Yh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,v=ed(),[f,b]=y.useState(""),g=k=>{const{detail:{message:T}}=k;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const w=Fa(e,{locale:o}),E=Fa(t,{locale:o}),B=Fa(n,{locale:o}),D={};return d!=="default"&&(D[d]=!0),h!=="default"&&(D[h]=!0),p!=="default"&&(D[p]=!0),c.jsx(vm.ErrorBoundary,{onError:r,fallback:c.jsx(C_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:H(s,D,{"has-footer":u}),children:[c.jsx(au,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[E&&c.jsx("div",{className:H("additional-content prepended",{"large-modal":m==="large"}),children:E}),y.createElement(d==="bold"?go:"div",{id:"content",children:w,className:H({"large-modal":m==="large"})})]}),B&&c.jsx("div",{className:"additional-content appended",children:B}),u&&c.jsx(ru,{}),c.jsx(Zh,{})]}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Zc={default:"tags_",headerTopics:"header_topics_topics_"},xs={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"},w_={getTagDetails:e=>{if(e.includes("topic_")){if(e=xs.topic[e.replace("topic_","")],e){const t=Gr.topics.topics[e].href;return t?{id:e,href:t,text:`${Zc.headerTopics}${e}`}:null}return null}return xs[e]?(e=xs[e],{id:e,text:`${Zc.default}${e}`}):null}};const D_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=w_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:H("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Gh=25,E_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const p=ae.useIntl(),m="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:H("members-list",h),children:[u?c.jsxs("h1",{children:[p.formatMessage({id:m}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(nn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),c.jsx(bn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:p.formatMessage({id:`${m}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,w)=>c.jsxs("li",{children:[c.jsx(nn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Zt,{children:p.formatMessage({id:`${m}_admin`})})]},w)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Gh))].map((g,w)=>c.jsx("li",{children:c.jsx(ci,{layout:"member"})},w)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Jr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(wi,{form:s,showModal:f,content:{title:p.formatMessage({id:`${m}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Qh=E_,__=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ae.useIntl();return t?c.jsx("small",{children:It(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},k_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(Go,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:It(r.formatMessage,`${e}label_action`,t,"action")},...n})};let wa=null;const Qe="discussion_form_",ea=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Je,Se,qe;const m=ae.useIntl(),v=y.useContext(at),[f,b]=y.useState(""),{isLoading:g=!1,isInWrapper:w=!1,isInOverlay:E=!1,isAutoFocused:B=!1,isEditing:D=!1,hasTitleField:k=!1,isPrepopulated:T=!1,showTitle:$=!1,showGuidelines:P=!0,showDivider:z=!1,showSuccessMessage:R=!0,showPostType:A=!1,postCategories:F=[]}=a||{},{onChange:O=()=>{},create:M=()=>{},handleSaveEdit:U=()=>{},handleCancel:W=()=>{},callback:ie=()=>{},onMention:se=()=>{},listMembers:C=()=>Promise.resolve([]),clickMentionFallback:G=()=>{},getLinkPreview:ne=()=>Promise.resolve({}),props:_={create:{projectNames:["questions-answers"]}}}=d,[S,q]=y.useState({title:k&&k.text||"",body:D&&D.text||T&&T.text||"",categories:D&&D.categories?D.categories:"",data:h!=null&&h.link?{link:h==null?void 0:h.link}:{}}),[j,L]=y.useState(l.error||!1),[Q,Z]=y.useState(!1);if(y.useEffect(()=>{u&&!D&&T&&T!==S.body&&q(xe=>({...xe,body:T.text||""}))},[T]),g)return c.jsx(Mt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const X=(xe,V)=>{q(me=>({...me,body:xe,data:{link:V}})),O({body:xe});let re;!v||!v.id?re=It(m.formatMessage,`${Qe}error_loggedOut`,n.type,"action"):r?s>0&&xe.length>=s&&(re=`${Qe}error_tooLong`):re=It(m.formatMessage,`${Qe}error_noPermission`,n.type,"action"),re?L(re):j&&L(!1)};let le=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const xe=((Je=n.slugs)==null?void 0:Je.reply)||((Se=n.slugs)==null?void 0:Se.answer)||((qe=n.slugs)==null?void 0:qe.question)||"";xe&&(le=`${le}-${xe.slice(-15)}`)}e&&(le=`${e}-${le}`);const te=async()=>{if(!v||!v.id||!r||Ee)return;wa&&clearTimeout(wa),Z("submitting");const xe=window.location.pathname;try{let V;switch(n.type){case"post":V=await M({title:S.title,content:S.body,categories:S.categories,data:S.data});break;case"question":V=await M({title:S.body,authorId:v&&v.id,data:S.data,..._==null?void 0:_.create});break;case"response":V=await M({questionSlug:n.slugs.question},{body:S.body,authorId:v&&v.id,contentPath:xe,data:S.data});break;case"reply":V=await M({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:S.body,authorId:v&&v.id,contentPath:xe,data:S.data});break;default:break}await Tm(1e3),ie&&await ie(V),wa=setTimeout(()=>{q({title:"",body:"",categories:"",data:{}}),Z("submitted"),b(It(m.formatMessage,`${Qe}success`,n.type,"action"));const re=new Event(tt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(re),pe()},500)}catch(V){const re=V;let me=`${Qe}error`;re!=null&&re.message.includes("entry already exists")&&(me=It(m.formatMessage,`${Qe}error_alreadyExists`,n.type,"action")),re!=null&&re.message.includes("429")?me=It(m.formatMessage,`${Qe}error_tooMany`,n.type,"action"):re!=null&&re.message.includes("400")&&(me=`${Qe}error`),L(me),pe()}},pe=()=>{wa=setTimeout(()=>{L(!1),Z(!1),b("")},5e3)},fe=xe=>{q(V=>({...V,data:xe}))},Ae=!S.title||!$a(S.title),ye=!S.body||!$a(S.body);let Ee=ye;k&&(Ee=Ae&&ye);const Le=Q==="submitting",Oe=[{component:k_,props:{formID:le,intlPath:Qe,showLabel:k!==!1,type:n.type}},{component:nu,props:{id:`${le}-input`,value:Q==="submitting"&&!j?"":S.body,placeholder:i||It(m.formatMessage,`${Qe}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:E},functions:{onChange:X,onChangeData:fe,onMention:se,listMembers:C,clickMentionFallback:G,getLinkPreview:ne},data:h,autoFocus:D!==!1||B&&!k,"aria-invalid":!!j,"aria-errormessage":"error-message"}},{component:__,props:{intlPath:Qe,showGuidelines:P,type:n.type,gtmContext:p}}];z&&Oe.push({component:zt}),k&&Oe.unshift({id:"title",type:"text",value:k.text,limit:250,label:m.formatMessage({id:`${Qe}titleField_label`}),placeholder:m.formatMessage({id:`${Qe}titleField_placeholder`}),functions:{onChange:xe=>{q({...S,title:xe}),O({title:xe})}},validation:[{condition:()=>Ee,error:m.formatMessage({id:`${Qe}titleField_error`})}]}),A&&Oe.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:m.formatMessage({id:`${Qe}postType_label`}),options:F.map(xe=>({id:xe.slug,label:xe.name})),validation:[{condition:"required"}],functions:{onChange:xe=>{q(V=>({...V,categories:xe})),O({postType:xe})}}});let ze=!v||!v.id||!r||Ee||Le;return D&&(k?ze=ze||S.body===D.text&&S.title===k.text:ze=ze||S.body===D.text),c.jsxs(c.Fragment,{children:[c.jsxs(Qt,{id:le,className:H("discussion-card discussion-form",{"no-styling":w&&D}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:D&&!Le||l.cancel},functions:{onSuccess:async xe=>{if(D){Z("submitting"),U(S);return}await te()},onCancel:W},fields:Oe,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`${D?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:ze,text:{default:!D&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Qe}${D?"save":"post"}`}),submitting:m.formatMessage({id:`${Qe}${D?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!v||!v.id||!S.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Qe}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[$&&!D&&["question"].includes(n.type)&&c.jsx("h2",{children:It(m.formatMessage,`${Qe}title`,n.type,"action")}),c.jsx(nn,{member:v?{...v,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]}})]}),Q==="submitted"&&R&&c.jsx(ir,{className:"success","data-testid":"success",children:It(m.formatMessage,`${Qe}success`,n.type,"action")}),j&&c.jsx(ir,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof j=="string"?j.includes(" ")?j:m.formatMessage({id:j},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):j}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:f})]})},F_=Object.freeze(Object.defineProperty({__proto__:null,default:ea},Symbol.toStringTag,{value:"Module"}));const A_={showForm:!1},Ci=y.createContext(A_),Jh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Ci.Provider,{value:{...t,updateConversation:n},children:e})};function B_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:a,gtmContext:i,badges:s}){var h;const o="discussion_",l=ae.useIntl(),u=(h=a==null?void 0:a.componentProps)==null?void 0:h.member.additionalContent,d=u?u.customMessage:{};return c.jsxs("div",{className:"author-section",children:[c.jsx(nn,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:typeof e!="string"&&e.id===t?"highlighted":"",styling:{additionalContentNewLine:!!d},gtmContext:i,gtmType:"profile-click",badges:s}),a.pinned&&c.jsx(Zt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Pe,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const Cs=({children:e,class:t,...n})=>{const r={...n,class:H("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function T_({content:e}){var t;return(t=e.categories)!=null&&t.length?c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>c.jsx(Zt,{size:"small",element:"li",children:n.name},n.slug))}):c.jsx(c.Fragment,{})}var ai=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(ai||{});const S_=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,j_=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const O_=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let h=0,p={};const m=(a||!s)&&!t.hasUserVoted;i&&(h=Math.round(t.numVotes/r*100)||0,p={"--vote-perc":`${h}%`});const v=g=>{g.stopPropagation(),m&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:H({"can-vote":m}),tabIndex:o&&m?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var w;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const E=g.code==="ArrowUp"?"prev":"next",{nextElement:B,nextIndex:D}=j_(g.currentTarget.parentElement,"selected",E,n);B&&((w=B.querySelector("label"))==null||w.focus(),l==null||l.setTabbableOption(D));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:p,className:H("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(sn,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[h,"%"]})]}),c.jsx("input",{type:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const Xh=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ae.useIntl(),s=y.useContext(at),{show_remove_vote:o=!0,allow_multiple_votes:l=!1,results_visibility:u=ai.AfterVoting}=n||{},[d,h]=y.useState(S_(t,l,s==null?void 0:s.id)),p=t.reduce((g,w)=>g+w.numVotes,0),m=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),f=y.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=y.useCallback(async()=>{t.forEach(async g=>{g.hasUserVoted&&g.userVote&&r.removeVote({reactionId:g.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:i.formatMessage({id:`${a}instructions`},{allow_multiple_votes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:p})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Fe,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:m===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:m})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((g,w)=>c.jsx(O_,{isTabbable:d===w,user:s,option:g,optionIndex:w,totalPollVotes:p,showResults:u==ai.Always||!!m,allowMultipleVotes:l,hasVotedOnPoll:!!m,functions:{createVote:f,setTabbableOption:h}},g.id))})})}),c.jsxs(Pe,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:m}),!!m&&c.jsx("ul",{children:v.map(g=>c.jsx("li",{children:g.label}))})]})]})};function P_({content:e,contentData:t,functions:n}){return c.jsx(Xh,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function M_({links:e={},contentData:t,postCutOff:n,content:r}){var a;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx(yd,{text:t.postBody,markdownOptions:{overrides:{a:Ts,blockquote:{component:Cs}}}}):c.jsx(Tn,{options:{overrides:{a:Ts,blockquote:{component:Cs}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(Tn,{options:{wrapper:r.type==="question"?"h1":y.Fragment,forceWrapper:r.type==="question",forceInline:r.type==="question",forceBlock:r.type!=="question",overrides:{blockquote:{component:Cs}}},children:t.postBody})]}),(a=t.data)!=null&&a.link?c.jsx(ko,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const Nt="discussion_",N_=195;let Da=null;const ta=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,setFocus:m=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g,locale:w="en"})=>{var xe,V,re,me,ve,ke;const E=ae.useIntl(),B=y.useContext(Ci),D=y.useContext(at),{createContent:k=async()=>{},deleteContent:T=async()=>{},updateContent:$=async()=>{}}=o.content||{},{createLike:P=()=>{},deleteLike:z=()=>{},listLikes:R=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:O=()=>{}}=o.form||{},{createVote:M=()=>{},removeVote:U=()=>{}}=o.polls||{},{author:W,canLike:ie,createdAt:se,id:C,likes:G=0,userLiked:ne,comments:_=0,data:S}=t,q=Zg(t.title,w),j=D&&D.id&&typeof W!="string"&&W.id&&W.id===D.id||!1,L=typeof ie=="boolean"?ie:!0,Q=j&&(!t.createdAt||Am(t.createdAt,10,"seconds")),Z=y.useRef(null),[X,le]=y.useState({title:t.body!==q&&q||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[te,pe]=y.useState(!1),[fe,Ae]=y.useState(Q?"highlighted":"default"),[ye,Ee]=y.useState("");y.useEffect(()=>{const ge=Z.current;if(!(!ge||fe==="default"))return document.addEventListener(tt.DISCUSSION_FORM_SUBMITTED,Le),ge.addEventListener("transitionend",Oe),()=>{document.removeEventListener(tt.DISCUSSION_FORM_SUBMITTED,Le),ge.removeEventListener("transitionend",Oe)}},[]),y.useEffect(()=>{le(ge=>({...ge,title:t&&q||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const _e=await Eo(X.body,p,S==null?void 0:S.mentions,F);le(Ye=>({...Ye,postBody:_e}))})()},[X.body,S==null?void 0:S.mentions]);const Le=()=>{setTimeout(()=>{Ae("fading")},1e3)},Oe=({propertyName:ge})=>{ge==="background-color"&&Ae(_e=>(_e==="default"&&(document.removeEventListener(tt.DISCUSSION_FORM_SUBMITTED,Le),Z.current&&Z.current.removeEventListener("transitionend",Oe)),_e==="fading"?"default":_e))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||X.postBody===""&&t.title==="")return c.jsx(Mt,{className:"discussion-card"});const ze=async({title:ge,body:_e,data:Ye})=>{ge||(ge=""),_e||(_e=""),Ee("");try{if(!Ia(ge,X.title)||!Ia(_e,X.body)){const nt=t.type==="question"?{title:_e}:{title:ge,body:_e,data:Ye};await $(Ms(t.slugs),nt)}le(nt=>({...nt,title:ge||"",body:_e||"",data:{...nt.data,...Ye},isEditing:!1,didEdit:!0}))}catch{Ee(`${Nt}form_error`)}},Je=()=>{if(B&&B.updateConversation){const ge={showForm:!0},_e=t.author;_e&&_e.id&&(v&&(ge.prepopulateForm=`@{{${_e.id}}}`),ge.mentionData={id:_e.id,name:_e.name}),B.updateConversation(ge)}setTimeout(()=>{var pt,Xe,wt;const _e=`reply-form-${(t.type==="answer"?t.slug:((pt=t.slugs)==null?void 0:pt.reply)||((Xe=t.slugs)==null?void 0:Xe.answer)||((wt=t.slugs)==null?void 0:wt.question)||"").toLowerCase().slice(-15)}`,Ye=document.getElementById(_e),nt=document.getElementById(`${_e}-input`);nt&&nt.focus(),Ye&&Ye.scrollIntoView({behavior:"smooth"})},0)},Se=async()=>{pe(!1);try{await T(Ms(t.slugs))}catch{Ee("delete-error")}},qe=[];return n&&j&&(t.type!=="poll"&&qe.push({text:E.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>le(ge=>({...ge,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),qe.push({text:E.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),pe(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Hd(`delete-${t.slug}-modal`,te)})),r&&o.pins&&qe.push({text:E.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),m&&((xe=Z==null?void 0:Z.current)==null||xe.focus(),(V=Z==null?void 0:Z.current)==null||V.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:H("discussion-post",u,{[fe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!X.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Z,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ge=>{if(!l.post||X.isEditing||t.type==="poll"&&Kg(ge,["poll-options","poll-info"],"discussion-post"))return;ge.preventDefault(),ge.stopPropagation(),Da&&clearTimeout(Da),Da=setTimeout(()=>{window.location.href=l.post},150);const _e=new CustomEvent(tt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Da}});document.dispatchEvent(_e)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:C||t.slug,className:H("discussion-card",t.type,{editing:X.isEditing,"has-link":l.post&&!X.isEditing}),children:[!X.isEditing&&c.jsx(B_,{author:W,originalAuthorId:i,createdAt:se,contentData:{didEdit:X.didEdit},content:t,gtmContext:d,badges:f}),X.isEditing?c.jsx(ea,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:X.title!==""?{text:X.title}:!1,isEditing:{text:X.body,categories:[]},isPrepopulated:!1},isCommunity:v,maxLength:t.type==="question"?250:5e4,forceShow:{error:ye!==""&&ye!=="delete-error"?E.formatMessage({id:ye},{action:E.formatMessage({id:`${Nt}action_${t.type}`})}):!1},functions:{create:k,handleSaveEdit:ze,handleCancel:()=>{Ee(""),le(ge=>({...ge,isEditing:!1}))},listMembers:F,clickMentionFallback:O},gtmContext:`${d}Form`,data:S}):c.jsxs(c.Fragment,{children:[t.type==="poll"?c.jsx(P_,{content:t,contentData:X,functions:{createVote:M,removeVote:U}}):c.jsx(M_,{links:l,contentData:X,postCutOff:N_,content:t}),c.jsx(T_,{content:t})]}),!X.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(sf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:G||0,userLiked:ne||!1,canLike:L,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:P,deleteLike:z,listLikes:R},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&(["question","post"].includes(t.type)||l.comments)?{count:_||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:Je}}:!1,shareLink:{url:`${window.location.origin}${(re=t.slugs)==null?void 0:re.question}/${(me=t.slugs)==null?void 0:me.answer}${(ve=t.slugs)!=null&&ve.reply?`#${(ke=t.slugs)==null?void 0:ke.reply}`:""}`},moreMenu:{options:qe,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),h,c.jsx(on,{id:`delete-${t.slug}-modal`,isOpen:te,functions:{onOpen:()=>{},onClose:()=>pe(!1)},forceShow:{error:ye==="delete-error"?E.formatMessage({id:"${intlPath}delete_error"},{action:E.formatMessage({id:`${Nt}action_${t.type}`})}):!1},title:E.formatMessage({id:`${Nt}delete_title`},{action:E.formatMessage({id:`${Nt}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>pe(!1),children:E.formatMessage({id:`${Nt}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Se,children:E.formatMessage({id:`${Nt}delete_delete`})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:ge=>c.jsx("p",{children:ge}),action:E.formatMessage({id:`${Nt}action_${t.type}`})}})})]})})};const I_=y.lazy(()=>Promise.resolve().then(()=>Y_)),R_=65,em=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(at)||"community",l=di(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||md("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const g=await Eo(p.title||p.body||"",R_,p.mentions);m(w=>({...w,prettifiedText:g}))})()},[p.showCachedText,p.title,p.body]);const v=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const w=b;w.preventDefault(),w.stopPropagation();const B=w.target.closest("a");g=B&&B.getAttribute("href")}h(w=>({...w,warning:g||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(tt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(tt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(tt.DISCUSSION_POST_CLICKED,v),document.addEventListener(tt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(tt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(tt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[p.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!p.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:H("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(sn,{name:l.name,src:l.image,alt:""}),c.jsx(Tn,{className:H("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:f})]}),c.jsxs(hr,{children:[c.jsx(I_,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(on,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},$_=y.lazy(()=>Promise.resolve().then(()=>F_)),iu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(yn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(yo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...p}=t,m={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(em,{form:m}):c.jsx($_,{...m})},su=({form:e})=>{const t=y.useContext(at),n=ae.useIntl(),[r,a]=y.useState(!1),i=()=>{Im(t)||a(!0)};y.useEffect(()=>(document.addEventListener(tt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(tt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(wi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ws="discussion_responses_",tm=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ws}title`},{action:r.formatMessage({id:`${ws}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:It(r.formatMessage,`${ws}empty`,e,e)})]})};const nm=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ae.useIntl(),s=y.useContext(Ci),o=Fa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:H("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Jr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ea,{...r})]})};function L_(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function z_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function q_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ue.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function U_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ue.useQueryClient(),l=li(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:xo(u),mutate:Co(u)},user:l,...u},h=z_({...d,mutationFn:t}),p=W_({...d,mutationFn:n}),m=V_({...d,mutationFn:r}),v=H_({...d,mutationFn:a}),f=K_({...d,mutationFn:i}),{activity:b,...g}=q_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:v,unpin:f},user:l,...g}}function W_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function V_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Yd({activity:s,user:r}),s)),onError:n});return a}function H_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function K_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Gd({activity:s,user:r}),s))),onError:n});return a}const Z_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:p,categories:m})=>{var W,ie,se,C,G,ne;const v=ae.useIntl(),{activity:f,error:b,isLoading:g,mutations:{edit:w,like:E,unlike:B,pin:D,unpin:k}}=U_({queryFns:s,queryKey:[e,t,n]});if(g)return c.jsx(Mt,{style:{height:"400px"}});if(b||!f)return c.jsx(yn,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:T,verb:$,latest_reactions:P,mentioned_users:z,additional_data:R}=f,A=(((W=P==null?void 0:P.like)==null?void 0:W.length)||0)>0,F=(((ie=T==null?void 0:T.like)==null?void 0:ie.length)||0)>0,O=F?T==null?void 0:T.like[0].id:"",M=A?(se=P==null?void 0:P.like)==null?void 0:se.map(_=>{var S,q,j;return{id:(S=_==null?void 0:_.user)==null?void 0:S.id,name:(j=(q=_==null?void 0:_.user)==null?void 0:q.data)==null?void 0:j.name}}):!1,U=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ta,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:_o((f==null?void 0:f.categories)||[],m||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:mr(U),userLiked:F,likes:((C=f==null?void 0:f.reaction_counts)==null?void 0:C.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:M,data:{mentions:z,...R||{}},pinned:((G=f==null?void 0:f.reaction_counts)==null?void 0:G.pin)&&((ne=f==null?void 0:f.reaction_counts)==null?void 0:ne.pin)>0||!1},originalAuthorId:U==null?void 0:U.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(_,{title:S,body:q})=>w({title:S,content:q})},likes:{createLike:()=>E({activityId:n}),deleteLike:()=>B({activityId:n,reactionId:O}),listLikes:_=>o.list({activityId:n,..._})},comments:{openComments:()=>{}},pins:{createPin:()=>D({activityId:n}),deletePin:()=>{var _;return k({activityId:n,reactionId:(_=P==null?void 0:P.pin)==null?void 0:_[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(tf,{basePath:e,parentId:t,activityId:n,showReplies:L_($,P),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:p})]})};const rm=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(on,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:H("discussion-form-modal",a),children:c.jsx(ea,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const w=v||{};w[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(E=>({...E,mentions:w}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},Y_=Object.freeze(Object.defineProperty({__proto__:null,default:rm},Symbol.toStringTag,{value:"Module"}));const G_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=ae.useIntl();return a||(a=h.formatMessage({id:"inviteModal_formTitle"})),i||(i=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(on,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:H("invite-modal",e,{success:!!n}),children:c.jsx(Wh,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const Q_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(md("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(on,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:H("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(Vh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},wi=Q_,J_=Object.freeze(Object.defineProperty({__proto__:null,default:wi},Symbol.toStringTag,{value:"Module"}));const X_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(sn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(on,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Tn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const ek=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:H("testimonial-block",a),children:[c.jsx(Kt,{className:"testimonial",children:n}),r?c.jsx(nn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:H("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:H("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),tk=y.memo(ek);const nk=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(_t,{variant:"subtle",className:H("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Di=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ae.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,v=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&v>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${v>0?i.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:H("time-to-complete",a),"aria-label":u,children:l})};const rk=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(Rn,{...n,className:H("banner",e),image:{...t,aspect:"banner"}})):null;const ak=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],ik=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:g,element:w}=t[b];if(w&&ak.includes(w.toLowerCase()))return;p[b]={text:g,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(wn,{className:H("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:g,element:w=""}=p[b];return b==="text"?c.jsx(Tn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(w,{key:b,className:b},g)}return null}),l,m&&c.jsx(Fe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:H({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Rn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sk=y.memo(ik);const ok=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(wn,{className:H("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const uk=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Tn,{children:n}):n;return c.jsxs(wn,{className:H("highlight-section",t),children:[r&&c.jsx("div",{className:H("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Rn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:H("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:H("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},lk=y.memo(uk);const ck=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:H("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Fe,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),dk=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&Fs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):uo(d)});if(o)return c.jsx(Zt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&Fs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},fk={title:66,text:3e3,secondaryText:1e3,partner:34},ii={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"}},hk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ae.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=ii[p])!=null&&f.gtmEvent&&(m=ii[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Fe,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(p)&&d!=="premium"){const g=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),w=async E=>{if(E.preventDefault(),E.stopPropagation(),!(g||!t||!t.onClick)){s(B=>({...B,loading:!0}));try{const B=await t.onClick(e);s(B==="success"?()=>({registered:!0,loading:!1}):D=>({...D,loading:!1}))}catch{s(D=>({...D,loading:!1}))}}};return c.jsx("p",{className:H("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Fe,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${g?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function mk({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(at),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Zt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const ou=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,O;const u=ae.useIntl(),d=y.useContext(at),h=!!(d!=null&&d.id),{isTabbable:p=!0,setFocus:m=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(M=>{b({data:M,isLoading:!1})}).catch(()=>b(M=>({...M,isLoading:!1})))},[a,h,n]);const{data:g,isLoading:w}=f;if(w||!g)return c.jsx(Mt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:E}=g;if(!E||!ii[E])return c.jsx(Mt,{element:"li",className:"card-wrapper"});const{basePath:B="",className:D,length:k,gtmEvent:T}=ii[E];let $=p&&g.slug?`${B}${g.slug}`:!1;p&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&($=g.slug);const P=M=>{$&&(M.preventDefault(),M.stopPropagation(),window.location.href=$)},z={...fk,...k};let R={className:"card"},A={};return $&&(A={href:$,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(A.target="_blank"),R={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),m&&(R={...R,tabIndex:"0"},(F=v==null?void 0:v.current)==null||F.focus(),(O=v==null?void 0:v.current)==null||O.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:H("card-wrapper text-medium",D,t,{"has-link":$,"no-link":!$,"has-image":g.banner}),"data-testid":`${E}-card`,children:c.jsxs("div",{...R,ref:v,children:[c.jsx(gd,{className:"card-label",contentType:E,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),E==="communityPage"&&(g==null?void 0:g.createdAt)&&Bm(g==null?void 0:g.createdAt,60)&&c.jsx(Zt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Zt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):dd(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Zt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Rn,{image:{...g.banner,description:""}})]}):D==="people"?c.jsx(sn,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(po,{contributors:{data:g.contributors},styling:{size:"small",showGap:D!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(E)?u.formatMessage({id:`card_contributors_${E}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):rr(g.partner[0],z.partner)}),["title","text","secondaryText"].map(M=>{const U=g[M];if(!U)return null;const W=sd(M),ie={key:M,className:W,"data-testid":W},se={wrapper:"p",forceWrapper:!0,forceInline:!0},C=rr(U,z[M]);return["title","text"].includes(M)&&$?(se.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Kt,{options:se,...A,children:C})})):c.jsx(Kt,{options:se,...ie,children:C})}),a.contentType==="communityPage"&&(a.slug||g.slug)&&r&&c.jsx(mk,{communitySlug:a.slug||g.slug,buildMemberData:r}),c.jsx(dk,{type:D||"",data:g}),c.jsx(hk,{data:g,cta:i,link:$||"",gtmContext:s})]})})};const am=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:H("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(ou,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),pk=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},gk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:H("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Ds={fourCards:1024,threeCards:769,twoCards:480};let Ea=null,Es=null;const vk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[w,E]=y.useState(""),B=t.length,D=Math.ceil(B/p),k=y.useRef(null),T=Nn(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let F=1;T&&(T>=Ds.fourCards?F=4:T>=Ds.threeCards?F=3:T>=Ds.twoCards&&(F=2),F>B&&(F=B)),h(O=>({...O,cardsPerPage:F,isLoading:!1}))},[T,B]);const $=(F="next")=>{Es&&clearTimeout(Es);let O=b;if(typeof F=="string")if(F==="next")if(b<D-1)O=b+1;else return;else if(b>0)O=b-1;else return;else O=F;E(""),f(U=>({...U,currentPage:O,loadedPages:[...new Set([...g,O])]}));const M=()=>{const U=O*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};Es=setTimeout(()=>{E(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:M()}))},500)},P=F=>{Ea=F.touches[0].clientX},z=F=>{if(Ea===null)return;const O=F.touches[0].clientX,M=Ea-O;M>5?$("next"):M<-5&&$("previous"),Ea=null},R={"--width":`${T||0}px`,"--total-cards":B,"--cards-per-page":p,"--page":b};if(m)return c.jsx(ci,{layout:`carousel${a?"-with-title":""}`});const A=(F,O)=>{var U;let M=null;return(U=F==null?void 0:F.sys)!=null&&U.id?M=`card-${F.sys.id}`:F!=null&&F.slug?M=`card-${F.slug}`:[n[O],F.contentType].includes("customCard")&&(M=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${O}`),M};return c.jsxs("section",{ref:k,className:H("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(gk,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:R,"data-testid":"carousel-list",children:t.map((F,O)=>{let M=A(F,O);const{inView:U,isLoaded:W}=pk(O,p,b,g);return M&&(U||W)?c.jsx(ou,{id:M,card:{...F,contentType:n[O]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},M):(M=M||`${e}-card-${O}`,c.jsx(Mt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},M))})}),D<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(D)].map((F,O)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:H("page-indicator",{selected:O===b}),onClick:M=>{M.preventDefault(),M.stopPropagation(),$(O)},children:c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:O+1,total:D})})})},`page-indicator-${O}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Fe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=D-1})})]}),c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:w})]})]})},bk=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(ci,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(vk,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(zt,{})]},`carousel-${d}`)});const yk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:H("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:H("img",{private:o,"no-image":!a}),children:a&&c.jsx(Rn,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const xk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:H("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(Di,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(mo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const im=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:H("lesson-name",a),"data-number":`${t}.${n}`,children:r});const sm=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ae.useIntl(),o=oi(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):ud(a||"");return c.jsxs("small",{className:H("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:H("type",n),children:o})," ",t>0&&!r&&c.jsx(Di,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const Ck=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ae.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(ui,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(Di,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:f,contentType:b,icon:g,image:w,isIntroduction:E,optional:B,slug:D,subsectionId:k,title:T,type:$})=>{const P=a&&t||E,z={};return w&&(z.style={"--image":`url(${w})`}),c.jsx("li",{className:H({article:b===kr.ARTICLE,discussion:b===kr.DISCUSSION,quiz:b===kr.QUIZ,completed:v&&b===kr.ARTICLE,locked:!P}),...z,children:c.jsx(bn,{href:P?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${od(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(im,{sectionId:i,subsectionId:k,title:T,className:"course-title"})," ",c.jsx(sm,{completionTime:f,icon:g,optional:B,type:$,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const wk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Fe,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:H("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Dk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Yc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const _a="notFoundError_",Ek=()=>{const e=ae.useIntl(),t=[];return Yc.forEach((n,r)=>{n.title=e.formatMessage({id:`${_a}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Yh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(wn,{children:[c.jsx(am,{cards:Yc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Fe,{href:"/solution-articles/",children:e.formatMessage({id:`${_a}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${_a}title`})}),c.jsx("p",{children:e.formatMessage({id:`${_a}text`})})]})};exports.ASSETS_BUCKET=Yt;exports.ActionBar=sf;exports.ActionButton=Lr;exports.ActivitiesFeed=Yg;exports.ActivitySection=Z_;exports.ActivityType=fi;exports.AddPost=iu;exports.Badge=Td;exports.BadgeScope=ut;exports.Badges=Sd;exports.BadgesContext=co;exports.BadgesProvider=wd;exports.Banner=rk;exports.BannerSection=sk;exports.Breadcrumbs=pv;exports.Buckets=Vm;exports.Button=Fe;exports.ButtonWrapper=fr;exports.COURSE_CONTENT_TYPES=kr;exports.CacheProvider=Dd;exports.Card=ou;exports.CardBlock=am;exports.Carousel=bk;exports.CharacterLimit=Ao;exports.CollapsibleSection=ui;exports.Columns=cf;exports.CommunityDetails=dg;exports.ContactFooter=b_;exports.ContactForm=Uh;exports.ContentTypeLabel=gd;exports.Contributors=po;exports.ConversationContext=Ci;exports.CookieBanner=Zh;exports.CourseProgression=xk;exports.CourseStructure=Ck;exports.CustomContentBanner=ok;exports.CustomEvents=tt;exports.DELETED_USER_ID=Rr;exports.Directory=X_;exports.DiscussionConversation=Jh;exports.DiscussionForm=ea;exports.DiscussionFormCard=em;exports.DiscussionFormModal=rm;exports.DiscussionPost=ta;exports.DiscussionThread=nm;exports.Divider=zt;exports.DownloadSection=m_;exports.EMAILS=Zn;exports.EditSection=g_;exports.EmailHelperTextBox=ff;exports.EmptyStateBox=yn;exports.EnrichedUrl=ko;exports.FeatureFlags=_d;exports.Filters=of;exports.FlagsProvider=Ed;exports.Footer=ru;exports.Form=Qt;exports.Formatting=K;exports.Fragment=St;exports.FullWidthSection=wn;exports.GET_STREAM_USER_PREFIX=ks;exports.GlobalProviders=ip;exports.Header=au;exports.HelperTextBox=bd;exports.HiddenFromScreenReaders=si;exports.HideShowTextBox=yd;exports.HighlightSection=lk;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=ld;exports.IconBulletedList=Zm;exports.ImageContainer=zm;exports.IntlProvider=kd;exports.InviteForm=Wh;exports.InviteModal=G_;exports.JoinButton=yo;exports.Label=Go;exports.LanguageContext=fo;exports.LanguageSwitcher=vv;exports.LessonName=im;exports.LessonType=sm;exports.LikesButton=Kd;exports.LikesFeed=nf;exports.LikesModal=rf;exports.Link=bn;exports.LoadMore=Jr;exports.LoadingBlock=jd;exports.LoadingPlaceholder=Mt;exports.LoadingState=ci;exports.Logo=Fo;exports.LogoSection=v_;exports.MEMBERS_PER_PAGE=Gh;exports.MENTION_REGEX=cd;exports.MarkCompleteButton=wk;exports.MarkdownText=Tn;exports.MarketingBlock=ck;exports.Marks=Ht;exports.Member=nn;exports.MembersList=Qh;exports.Modal=go;exports.MoreMenu=uf;exports.NUMBER_OF_COUNTRIES=km;exports.NUMBER_OF_USERS=_m;exports.NarrowCard=yk;exports.NavigationMenu=lf;exports.NotFoundError=Ek;exports.Overlay=on;exports.OverlayContext=ho;exports.OverlayProvider=Bd;exports.PageHeading=xd;exports.PageLayout=Yh;exports.PasswordForm=i_;exports.PasswordRules=bf;exports.Pill=Zt;exports.Poll=Xh;exports.Popover=pd;exports.Portal=hr;exports.ProfileForm=Vh;exports.ProfileImageChange=qh;exports.ProfileModal=wi;exports.ProfileModalLauncher=su;exports.ProfilePicture=sn;exports.ProgressBar=mo;exports.ProgressTracker=Um;exports.PublishArticleForm=o_;exports.Rating=Mv;exports.RepliesFeed=tf;exports.ResponsesHeading=tm;exports.ResponsiveImage=Rn;exports.ResultsVisibility=ai;exports.ReturnToNavButton=Wm;exports.RichTextEditor=nu;exports.SearchForm=Hh;exports.ShareLink=af;exports.ShareLinks=Dv;exports.SignupForm=h_;exports.Span=Ts;exports.StatusBanner=ir;exports.TableOfContents=nk;exports.Tabs=Ev;exports.Tags=D_;exports.TestimonialBlock=tk;exports.TimeToComplete=Di;exports.Toggle=r_;exports.Tooltip=In;exports.TopLevelPage=y_;exports.UUID_V4_REGEX=$r;exports.UserContext=at;exports.UserProvider=Fd;exports.VisuallyHidden=Pe;exports.addAriaProps=Hd;exports.basicReducer=Qr;exports.camelCaseToDashCase=sd;exports.checkIntlPathExists=oi;exports.enrichPostCategories=_o;exports.generateConditions=Na;exports.generateCssIcon=Fm;exports.getAuthorData=mr;exports.getCharacterLimitProps=df;exports.getLongDate=uo;exports.getMember=di;exports.getPostBody=Eo;exports.getShortDate=dd;exports.getValueLength=hi;exports.headerData=Gr;exports.likesResponseMock=hv;exports.mapGetStreamData=Dk;exports.pageReady=fd;exports.passwordValidator=As;exports.repliesFeedMock=Gg;exports.supportedLanguages=Aa;exports.toCamelCase=od;exports.toCapitalisedCase=Em;exports.toSentenceCase=ud;exports.transformSlugs=Ms;exports.useBadges=Cd;exports.useCurrentPath=ed;exports.useEffectAfterMount=ar;exports.useElementWidth=Nn;exports.useOverlay=Ad;exports.useScrollListener=rd;exports.useScrollToHash=so;exports.useTooltips=oo;exports.useUser=li;
165
+ `}),L=G.turndown(L)}o&&o.mentions&&(L=await fd({text:L,template:`[${Zs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),Ww(L,G=>{const K=[{type:"initialValue",value:G},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(K.push({type:"enrichedUrl",value:o.link}),o.link.url&&ne(o.link.url)),T(K),setTimeout(()=>{T([{type:"stringValue",value:Pc(k)}])},150)})})()},[P]),y.useEffect(()=>{if(U===void 0&&k){const L=Kw(k);L&&ne(L)}const S=L=>{var te;const G=L,K=((te=G==null?void 0:G.detail)==null?void 0:te.url)||null;K&&U&&U.url===K&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[U]),y.useEffect(()=>{if(t){zr.lastIndex=0;const S=t.match(zr);S&&S.length===1&&S[0].length===t.length&&!O&&T([{type:"originalValue",value:t}])}t!==""||!k||Ia(P,t)&&!O||(x.withoutNormalizing(k,()=>{X.delete(k,{at:{anchor:x.start(k,[]),focus:x.end(k,[])}}),X.deselect(k),k.children.length!==0&&X.unwrapNodes(k,{at:[0]}),X.insertNodes(k,F,{at:[0]})}),T([{type:"initialValue",value:F},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{$===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[$]);const q=ed(()=>{Yw({editor:k,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:w,className:"rich-text-editor",children:c.jsxs(cn.Provider,{value:{..._,id:w,isInOverlay:h,setFocus:re,dispatch:T,getLinkPreview:g,onMention:C,reportError:D},children:[c.jsxs(fC,{editor:k,initialValue:z,onChange:S=>{if(k.operations.some(G=>G.type!=="set_selection")){let G=Qw(S);G==="<br>"&&(G=""),f(G,U),T([{type:"stringValue",value:Pc(k)}]),O||T([{type:"hasInteracted",value:!0}]),q(),m&&console.log({serialized:G,json:S})}},...u,children:[c.jsx(rC,{className:"input",renderElement:Q,renderLeaf:se,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const L=U!==!1,G=S.clipboardData.getData("text");if((te=>{try{return new URL(te),!0}catch{return!1}})(G)){let te=G;if(G){const{full:ce}=oo(G);te=ce}if(G&&g&&!L){const ce=await g(te);ce.url&&T([{type:"enrichedUrl",value:ce}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),Fm(k,W,T,w));const{selection:L}=k;if(L){const G=Y.isCollapsed(L),[K,te]=x.node(k,L,{depth:1});let ce=K,J=ce.type;const he=ce.children[0];if(he&&(he==null?void 0:he[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),X.insertNodes(k,F)),he&&[H.ol,H.ul].includes(he.type)&&(ce=he,J=he.type),ce&&fe.isElement(ce)&&J!==H.paragraph){if(J===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),X.insertNodes(k,F);return}if(G){const[pe,we]=x.parent(k,L,{edge:"end"}),je=pe.type;if([H.ul,H.ol].includes(J))if(S.stopPropagation(),S.preventDefault(),je===H.li&&A==="Enter"){pe.children.length===1&&"text"in pe.children[0]&&pe.children[0].text===""&&X.removeNodes(k,{at:we}),X.insertNodes(k,F,{at:R.next(te)}),X.select(k,x.end(k,R.next(te)));return}else{const[Je,Ue]=Vw(k,H.li),Le={type:H.li,children:[{text:""}]};X.insertNodes(k,Le,{at:R.next(Ue)}),X.select(k,x.end(k,R.next(Ue)))}}}}}else if(S.key==="Escape"){if(W.show){S.preventDefault(),S.stopPropagation(),T([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(S.key)&&W.show){S.preventDefault(),S.stopPropagation();const{selectedUser:L,possibleUsers:G}=W;let K=S.key==="ArrowUp"?L-1:L+1;K<0&&(K=G.length-1),K>=G.length+1&&(K=0),T([{type:"mentionPopover",value:{...W,selectedUser:K}}])}T([{type:"lastKey",value:S.key}]),Zw(S,k,T,D)},onBlur:()=>{k.selection&&T([{type:"lastAnchor",value:k.selection.anchor}])},onFocus:()=>{if(B){if(!R.isPath(B.path)||!le.has(k,B.path))return;const S=le.get(k,B.path);let L=0;if(ge.isText(S)?L=S.text.length:S.children&&(L=S.children.length),B.offset>L)return;try{X.select(k,{anchor:B,focus:B})}catch(G){const K=G.message;D(`Error focusing editor: ${K}`)}}}}),U?c.jsx(Eo,{data:U,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const S=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(S)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(oE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(Jw,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},I),c.jsx(ko,{id:`character-limit-${e}`,limit:r,valueLength:mi($)})]})}):c.jsx(c.Fragment,{})};const KE=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:V("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function qm({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,v]=y.useState(!1),f=y.useRef(null),b=async F=>{h(!0),v(!1);try{const E=F.target.files&&F.target.files[0];if(!E||!t)throw h(!1),new Error("Image file or userID is missing");const _=await a({fileObject:E,userId:t}),T={thumbnail:_.thumbnailURL,full:_.originalURL};d(T),s(T)}catch{v(!0)}finally{h(!1)}h(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:C=o.formatMessage({id:`${l}cta_change`}),uploading:D=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?D:u?C:g})]})}const Um=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const ZE=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(vh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Wm=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ae.useIntl(),C=async E=>{try{await u(m,E.message),h([]),b("SUCCESS")}catch(_){b("ERROR"),l(_)}},D=E=>{E.preventDefault(),b("NOT_SUBMITTED"),v(!0),h([])},F=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:D,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:F,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:D,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Jt,{id:"invite-form",fields:[{component:ZE,props:{emails:m,setEmails:h,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:C},button:{text:r,size:"medium",disabled:p}})]})},Ra=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},YE=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Tt.NEW_PASSWORD]!==p[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!ks(p[Tt.NEW_PASSWORD]).isValid,m=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ra(["required",d]),functions:{onChange:p=>l(ks(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ra(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ra(["required"])}),i&&m.push({component:bf,props:{matchingRules:o}});const h={id:Tt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(Tt.NEW_PASSWORD)||v.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(Cn,{variant:"error",text:r})]})};const Vm=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var I;const s=ae.useIntl(),o="profileForm_",l=y.useContext(it),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:C,predictPlaces:D}=t.useMaps(),{context:F="ProfileForm",event:E="profile-form-submit-click"}=a||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(I=l.location)==null?void 0:I.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!m?!1:!C(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:D}}],T=[{component:qm,props:{userName:l.name,userId:l.id,src:u,uploadImage:p,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:F,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:m?await g(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails($=>({...$,...z})),await v(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...i})},GE=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Sd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let fs=null;const lt="publishArticleForm_",qc={},Uc=10,QE=({id:e="publish-article-form",values:t=qc,functions:n,meta:r,gtm:a})=>{const i=ae.useIntl(),s=y.useContext(it),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,C]=y.useState("");y.useEffect(()=>{Ia(t,qc)||La(t.body)&&t.body!==p&&t.body!==void 0&&v(t.body)},[t.body]);const D=()=>{!s||!s.id?b(i.formatMessage({id:`${lt}error_loggedOut`})):f&&b(!1)},F=I=>({condition:P=>{const z=P[I];return!z||typeof z!="string"?!0:z.length<Uc},error:i.formatMessage({id:`${lt}error_underMinLength`},{length:Uc})}),E=!!p&&La(p),_=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${lt}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${lt}title_label`}),placeholder:i.formatMessage({id:`${lt}title_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},F("title")]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${lt}subtitle_label`}),placeholder:i.formatMessage({id:`${lt}subtitle_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},F("subtitle")]},{component:Zo,props:{formID:e,label:{visible:i.formatMessage({id:`${lt}body_label`})},showLabel:!0}},{component:eu,props:{id:`${e}-input`,value:p,placeholder:i.formatMessage({id:`${lt}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:I=>{v(I),D()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:zt}):T.push({component:_}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async I=>{if(!s||!s.id||!E)return;fs&&clearTimeout(fs),h(!0);const P={...I,body:p};try{o&&await o(P),fs=setTimeout(()=>{C(i.formatMessage({id:`${lt}aria_success`})),l(P)},500)}catch{b(i.formatMessage({id:`${lt}error`})),C(""),u()}},onFailure:u},fields:T,intlPath:lt,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!E,text:{default:i.formatMessage({id:`${lt}cta_submit`}),submitting:i.formatMessage({id:`${lt}cta_submitting`}),submitted:i.formatMessage({id:`${lt}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(GE,{})},gtm:a}),f&&c.jsx(ur,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${lt}error`})}),g&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const Hm=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ae.useIntl(),u=y.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Pe,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Pe,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Pe,{children:l.formatMessage({id:"search_cta"})})})]})})})},Wc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},JE=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"]}},XE=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=JE(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}])},e_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(p,v)=>{p.current&&s.validFields[v]!==p.current.validity.valid&&o([{type:`validFields.${v}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Wc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:ff,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const v=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Wc({ref:i.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const t_=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const n_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},r_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ae.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=a,v={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(Jr,n_),{validFields:g,emailDetails:C,shouldManuallyApprove:D,shouldDisableButton:F,showSuccessMessage:E,showError:_}=f,[T,I]=ro.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{D===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[D]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&I("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>e_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:P,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,v,f]),$=F?!0:D?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(C.boxType);return v.successMessage&&E?c.jsx(t_,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(Cn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:$?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await XE({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const En=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const a_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(En,{className:V("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(pr,{buttons:r})]})})};const no="editSection_";function Km({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const i_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${no}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Km({href:r,setShowModal:i}),children:n||s({id:`${no}placeholder_cta`})})})]})},s_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ae.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),v=!!n||!!r,f=typeof a=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:V("edit-section",t),children:[v&&c.jsx(ln,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:V("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async g=>{var C,D;(C=n==null?void 0:n.functions)!=null&&C.onSuccess&&await((D=n==null?void 0:n.functions)==null?void 0:D.onSuccess(g)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:V("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Km({href:a,setShowModal:h}),children:d({id:`${no}edit`})})]}),e||c.jsx(i_,{...l,href:a,setShowModal:h,showEditButton:f}),u&&c.jsx(zt,{})]})};const o_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:V("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:h=!1,description:p=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:h?c.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${v}`))})})]})};let ms;const hs="contactFooter_",u_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ms),ms=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ms),window.removeEventListener("resize",l)}),[]),c.jsx(En,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${hs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ae.FormattedMessage,{id:`${hs}text`})}),c.jsx(xn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${hs}email`})})]}),c.jsx(Um,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},l_=({activeLink:e,profile:t,...n})=>c.jsx(En,{children:c.jsx(cf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(lf,{activeLink:e,profile:t}),c.jsx(yd,{...n})]})})});const ps="cookieBanner_",gs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],vs=new Date(Date.now()+12*30*24*60*60*1e3),Zm=()=>{const e=ae.useIntl(),[t,n,r]=ro.useCookies(gs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{gs.forEach(d=>{n(d,!0,{path:"/",expires:vs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:vs}),gs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:vs});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${ps}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${ps}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ps}text`})}),c.jsx(pr,{buttons:u})]})},nn={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Qn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Qn["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:Qn.support,gtmType:"concierge-email-click"},business:{email:Qn.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 rr="footer_",ri="SiteFooter",Vc=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":i,...s,children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},tu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(oi,{element:"hr"}),c.jsx(_o,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Vc,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(Vc,{group:nn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(nn.social.order)&&nn.social.order.map(e=>{const t=nn.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),qe={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===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const i=Date.now();if(!a&&!t&&qe.handlerCalled[e]&&i-qe.handlerCalled[e]<500)return;qe.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 Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.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=Gc(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?qe.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 Et.SITE:if(n){const u=qe.findFirstChild(t.current.children,"className","has-submenu parent"),d=qe.findFirstChild(u.children,"id",Et.SITE);s=qe.findFirstChild(d.children,"href")}else s=qe.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=qe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=qe.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(qe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(qe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(qe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{qe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ai=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ae.useIntl(),o=Gc(Qr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let D=o.gtmType||`${e}-click`;if(D.includes(".")){const F=D.split("."),E=F[F.length-2];D=`${E==="topics"?`${E}-`:""}${F[F.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":D,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],v=p&&o[o.order[0]].order,f=h&&window.location.pathname===o.href;let b={},g={},C={};if(f&&(b={...b,"aria-current":"page"}),p){const D=o.menuId||e,F={onClick:E=>qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]}),onFocus:()=>qe.events.onFocus({id:D}),onBlur:()=>qe.events.onBlur({id:D,callback:a}),onMouseLeave:()=>qe.events.onBlur({id:D,callback:a}),onMouseEnter:()=>qe.events.onMouseEnter({id:D,callback:a})};g={...F,id:D===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(v&&(C={...F,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]})},"aria-haspopup":!0,"aria-expanded":r[D],"aria-controls":D}),g={...g,hidden:D in r?!r[D]:!0}),v||(g={...g})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:v,active:f}),...b,children:[h?y.createElement(d?Ee:"a",h,s.formatMessage({id:m})):n&&o.order&&v?c.jsxs("button",{...C,children:[s.formatMessage({id:m}),c.jsx(Pe,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...g,children:o.order.map(D=>{if(!o[D])return null;const F={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[D].order?c.jsxs("li",{className:V({[o[D].className]:o[D].className}),children:[s.formatMessage({id:`${m}_${D}`}),c.jsx("ul",{children:o[D].order.map(E=>c.jsx(ai,{id:`${e}.${D}.${E}`,...F},E))})]},D):c.jsx(ai,{id:`${e}.${D}`,...F},D)})})]},e)};const c_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const nu=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(it),r=$n(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>qe.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Jr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),nd({scrollPosition:c_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=m.current.menus;!i&&g["site-navigation"]||qe.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=m.current.menus;!i&&g["site-navigation"]||qe.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,C,D=!1)=>{qe.handleMenus({id:g,value:C,menus:m.current.menus,dispatch:o,forceHandle:D})},p=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(C=>{m.current.menus[C]&&h(C,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var C;(C=document.getElementById("header"))==null||C.removeEventListener("keydown",v)}},[]),or(()=>{u["site-navigation"]&&qe.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&qe.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Pe,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Hm,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Pe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Qr.order.map(g=>c.jsx(ai,{id:g,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Pe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(_o,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:g=>qe.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>qe.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>qe.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Pe,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Qr.buttons.order.map(g=>c.jsx(ai,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const d_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(nu,{}),c.jsx("div",{id:"content",children:c.jsx(Cn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(tu,{})]})},Ym=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=i,v=Xc(),[f,b]=y.useState(""),g=_=>{const{detail:{message:T}}=_;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const C=Aa(e,{locale:o}),D=Aa(t,{locale:o}),F=Aa(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),m!=="default"&&(E[m]=!0),h!=="default"&&(E[h]=!0),c.jsx(gh.ErrorBoundary,{onError:r,fallback:c.jsx(d_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,E,{"has-footer":u}),children:[c.jsx(nu,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[D&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:D}),y.createElement(d==="bold"?ho:"div",{id:"content",children:C,className:V({"large-modal":p==="large"})})]}),F&&c.jsx("div",{className:"additional-content appended",children:F}),u&&c.jsx(tu,{}),c.jsx(Zm,{})]}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Hc={default:"tags_",headerTopics:"header_topics_topics_"},bs={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"},f_={getTagDetails:e=>{if(e.includes("topic_")){if(e=bs.topic[e.replace("topic_","")],e){const t=Qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Hc.headerTopics}${e}`}:null}return null}return bs[e]?(e=bs[e],{id:e,text:`${Hc.default}${e}`}):null}};const m_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=f_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Gm=25,h_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:m=""})=>{const h=ae.useIntl(),p="membersList",v=y.useContext(it),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:V("members-list",m),children:[u?c.jsxs("h1",{children:[h.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),c.jsx(xn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:h.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,C)=>c.jsxs("li",{children:[c.jsx(an,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},C)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Gm))].map((g,C)=>c.jsx("li",{children:c.jsx(di,{layout:"member"})},C)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Xr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Di,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Qm=h_,p_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ae.useIntl();return t?c.jsx("small",{children:It(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},g_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(Zo,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:It(r.formatMessage,`${e}label_action`,t,"action")},...n})},Kc=5,v_=2,b_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((a,i)=>{a!==""&&(t++,n.push({position:t,description:{en:a}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Da=null;const Ge="discussion_form_",ta=({id:e,parentId:t,content:n={type:Ae.Response,slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var We,Z,oe;const h=ae.useIntl(),p=y.useContext(it),[v,f]=y.useState(n.type),[b,g]=y.useState(""),{isLoading:C=!1,isInWrapper:D=!1,isInOverlay:F=!1,isAutoFocused:E=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:I=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:$=!0,showDivider:B=!1,showSuccessMessage:A=!0,showPostType:O=!1,postCategories:j=[]}=a||{},{onChange:U=()=>{},create:W=()=>{},createPoll:re=()=>{},handleSaveEdit:ne=()=>{},handleCancel:w=()=>{},callback:Q=()=>{},onMention:se=()=>{},listMembers:k=()=>Promise.resolve([]),clickMentionFallback:M=()=>{},getLinkPreview:q=()=>Promise.resolve({}),props:S={create:{projectNames:["questions-answers"]}}}=u,[L,G]=y.useState({body:_&&_.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[K,te]=y.useState(l.error||!1),ce={status:!1,title:T&&T.text||"",polls:0},[J,he]=y.useState(ce);if(y.useEffect(()=>{I&&!_&&P&&P!==L.body&&G(ie=>({...ie,body:P.text||""}))},[P]),y.useEffect(()=>{f(n.type)},[n.type]),C)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const pe=(ie,me)=>{G(ke=>({...ke,body:ie,data:{link:me}})),U({body:ie});let ve;!p||!p.id?ve=It(h.formatMessage,`${Ge}error_loggedOut`,v,"action"):r?s>0&&ie.length>=s&&(ve=`${Ge}error_tooLong`):ve=It(h.formatMessage,`${Ge}error_noPermission`,v,"action"),ve?te(ve):K&&te(!1)};let we=`${v}-form`;if(v===Ae.Response||v===Ae.Reply){const ie=((We=n.slugs)==null?void 0:We.reply)||((Z=n.slugs)==null?void 0:Z.answer)||((oe=n.slugs)==null?void 0:oe.question)||"";ie&&(we=`${we}-${ie.slice(-15)}`)}e&&(we=`${e}-${we}`);const Me=async ie=>{if(!p||!p.id||!r||Le)return;Da&&clearTimeout(Da),he(ve=>({...ve,status:"submitting"}));const me=window.location.pathname;try{let ve;switch(v){case Ae.Post:ve=await W({title:ie.title,content:ie.body,categories:ie.categories,data:ie.data});break;case Ae.Poll:ve=await re(b_(ie));break;case Ae.Question:ve=await W({title:ie.body,authorId:p&&p.id,data:ie.data,...S==null?void 0:S.create});break;case Ae.Response:ve=await W({questionSlug:n.slugs.question},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;case Ae.Reply:ve=await W({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;default:break}await Bh(1e3),Q&&await Q(ve),Da=setTimeout(()=>{G({body:"",data:{}}),f(Ae.Post),he(ze=>({...ze,status:"submitted"})),g(It(h.formatMessage,`${Ge}success`,v,"action"));const ke=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ke),je()},500)}catch(ve){const ke=ve;let ze=`${Ge}error`;ke!=null&&ke.message.includes("entry already exists")&&(ze=It(h.formatMessage,`${Ge}error_alreadyExists`,v,"action")),ke!=null&&ke.message.includes("429")?ze=It(h.formatMessage,`${Ge}error_tooMany`,v,"action"):ke!=null&&ke.message.includes("400")&&(ze=`${Ge}error`),te(ze),je()}},je=()=>{Da=setTimeout(()=>{te(!1),he(ce),g("")},5e3)},Je=!L.body||!La(L.body),Ue=!J.title||!La(J.title);let Le=!1;v!==Ae.Poll&&(Le=Je),T&&(Le=Le&&Ue);const Xe=J.status==="submitting",_e=[];v===Ae.Poll?_e.push({id:"poll-options",label:h.formatMessage({id:`${Ge}option_label`}),type:"multiple-inputs",placeholder:h.formatMessage({id:`${Ge}option_placeholder`}),multipleInputs:{showCount:!0,maxInputs:Kc,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Ge}option_cta`})}},functions:{onChange:ie=>{var ve;let me=0;ie&&Array.isArray(ie)&&(me=((ve=ie==null?void 0:ie.filter(ke=>ke!==""))==null?void 0:ve.length)||0),J.polls!==me&&he(ke=>({...ke,polls:me})),U({polls:ie})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Ge}multiplePollAnswers`}),className:"text-medium"}):_e.push({component:g_,props:{formID:we,intlPath:Ge,showLabel:T!==!1,type:v}},{component:eu,props:{id:`${we}-input`,value:J.status==="submitting"&&!K?"":L.body,placeholder:i||It(h.formatMessage,`${Ge}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:F},functions:{onChange:pe,onChangeData:ie=>{G(me=>({...me,data:ie}))},onMention:se,listMembers:k,clickMentionFallback:M,getLinkPreview:q},data:d,autoFocus:_!==!1||E&&!T,"aria-invalid":!!K,"aria-errormessage":"error-message"}},{component:p_,props:{intlPath:Ge,showGuidelines:$,type:v,gtmContext:m}}),B&&_e.push({component:zt}),T&&_e.unshift({id:"title",type:"text",value:T.text,limit:v===Ae.Poll?0:250,label:h.formatMessage({id:`${Ge}${v===Ae.Poll?"question":"titleField"}_label`}),placeholder:h.formatMessage({id:`${Ge}${v===Ae.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ie=>{he(me=>({...me,title:ie})),U({title:ie})}},validation:v===Ae.Poll?[{condition:"required"}]:[]}),O&&_e.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Ge}postType_label`}),options:j.map(ie=>({id:ie.slug,label:ie.name})),validation:[{condition:"required"}],functions:{onChange:ie=>{U({postType:ie}),ie.includes(Ae.Poll)?f(Ae.Poll):v!==Ae.Post&&f(Ae.Post)}}});let Oe=!p||!p.id||!r||Xe;if(v===Ae.Poll){const ie=J.polls;Oe=Oe||Ue||ie<v_||ie>Kc}else Oe=Oe||Le,_&&(T?Oe=Oe||L.body===_.text&&J.title===T.text:Oe=Oe||L.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:we,className:V("discussion-card discussion-form",{"no-styling":D&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Xe||l.cancel},functions:{onSuccess:async ie=>{const me={...L,...ie};if(_){he(ve=>({...ve,status:"submitting"})),ne(me);return}await Me(me)},onCancel:w},fields:_e,intlPath:Ge,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${_?"save":"submit"}-${v}-click`,"data-testid":"save-button",disabled:Oe,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Ge}${_?"save":"post"}`}),submitting:h.formatMessage({id:`${Ge}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Ge}cancel`})},gtm:{context:m,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===Ae.Question&&c.jsx("h2",{children:It(h.formatMessage,`${Ge}title`,v,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]}})]}),J.status==="submitted"&&A&&c.jsx(ur,{className:"success","data-testid":"success",children:It(h.formatMessage,`${Ge}success`,v,"action")}),K&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof K=="string"?K.includes(" ")?K:h.formatMessage({id:K},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):K}),b&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},y_=Object.freeze(Object.defineProperty({__proto__:null,default:ta},Symbol.toStringTag,{value:"Module"})),ys=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})};const x_={showForm:!1},Ci=y.createContext(x_),Jm=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Ci.Provider,{value:{...t,updateConversation:n},children:e})},wa="discussion_",C_=195;let Ea=null;const na=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g})=>{var Le,Xe,_e,Oe,We,Z,oe,ie,me,ve,ke,ze,ot,At,vt,tt;const C=ae.useIntl(),D=y.useContext(Ci),F=y.useContext(it),{createContent:E=async()=>{},deleteContent:_=async()=>{},updateContent:T=async()=>{}}=o.content||{},{createLike:I=()=>{},deleteLike:P=()=>{},listLikes:z=async()=>({})}=o.likes||{},{openComments:$=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:A=()=>{}}=o.form||{},{author:O,canLike:j,createdAt:U,id:W,likes:re=0,userLiked:ne,comments:w=0,data:Q}=t,se=F&&F.id&&typeof O!="string"&&O.id&&O.id===F.id||!1,k=typeof j=="boolean"?j:!0,M=se&&(!t.createdAt||Fh(t.createdAt,10,"seconds")),q=y.useRef(null),[S,L]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[G,K]=y.useState(!1),[te,ce]=y.useState(M?"highlighted":"default"),[J,he]=y.useState("");y.useEffect(()=>{const xe=q.current;if(!(!xe||te==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,pe),xe.addEventListener("transitionend",we),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,pe),xe.removeEventListener("transitionend",we)}},[]),y.useEffect(()=>{L(xe=>({...xe,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Be=await Do(S.body,h,Q==null?void 0:Q.mentions,B);L(Rt=>({...Rt,postBody:Be}))})()},[S.body,Q==null?void 0:Q.mentions]);const pe=()=>{setTimeout(()=>{ce("fading")},1e3)},we=({propertyName:xe})=>{xe==="background-color"&&ce(Be=>(Be==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,pe),q.current&&q.current.removeEventListener("transitionend",we)),Be==="fading"?"default":Be))};if(a||!t||t.type===Ae.Answer&&(!t.slugs||!t.slugs.question)||S.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const Me=async({title:xe,body:Be,data:Rt})=>{xe||(xe=""),Be||(Be=""),he("");try{if(!Ia(xe,S.title)||!Ia(Be,S.body)){const bt=t.type===Ae.Question?{title:Be}:{title:xe,body:Be,data:Rt};await T(Os(t.slugs),bt)}L(bt=>({...bt,title:xe||"",body:Be||"",data:{...bt.data,...Rt},isEditing:!1,didEdit:!0}))}catch{he(`${wa}form_error`)}},je=()=>{if(D&&D.updateConversation){const xe={showForm:!0},Be=t.author;Be&&Be.id&&(v&&(xe.prepopulateForm=`@{{${Be.id}}}`),xe.mentionData={id:Be.id,name:Be.name}),D.updateConversation(xe)}setTimeout(()=>{var _n,Xt,Un;const Be=`reply-form-${(t.type===Ae.Answer?t.slug:((_n=t.slugs)==null?void 0:_n.reply)||((Xt=t.slugs)==null?void 0:Xt.answer)||((Un=t.slugs)==null?void 0:Un.question)||"").toLowerCase().slice(-15)}`,Rt=document.getElementById(Be),bt=document.getElementById(`${Be}-input`);bt&&bt.focus(),Rt&&Rt.scrollIntoView({behavior:"smooth"})},0)},Je=async()=>{K(!1);try{await _(Os(t.slugs))}catch{he("delete-error")}},Ue=[];return n&&se&&Ue.push({text:C.formatMessage({id:`${wa}moreMenu_edit`}),onClick:()=>L(xe=>({...xe,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:C.formatMessage({id:`${wa}moreMenu_delete`}),onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),K(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Vd(`delete-${t.slug}-modal`,G)}),r&&o.pins&&Ue.push({text:C.formatMessage({id:`${wa}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),p&&((Le=q==null?void 0:q.current)==null||Le.focus(),(Xe=q==null?void 0:q.current)==null||Xe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[te]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!S.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:q,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:xe=>{if(!l.post||S.isEditing)return;xe.preventDefault(),xe.stopPropagation(),Ea&&clearTimeout(Ea),Ea=setTimeout(()=>{window.location.href=l.post},150);const Be=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ea}});document.dispatchEvent(Be)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:S.isEditing,"has-link":l.post&&!S.isEditing}),children:[!S.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:O,additionalContent:{createdAt:U,didEdit:S.didEdit,customMessage:(_e=t.componentProps)!=null&&_e.member.additionalContent?(Z=(We=(Oe=t.componentProps)==null?void 0:Oe.member)==null?void 0:We.additionalContent)==null?void 0:Z.customMessage:{}},className:typeof O!="string"&&O.id===i?"highlighted":"",styling:{additionalContentNewLine:!!((oe=t.componentProps)!=null&&oe.member.additionalContent&&((ve=(me=(ie=t.componentProps)==null?void 0:ie.member)==null?void 0:me.additionalContent)!=null&&ve.customMessage))},gtmContext:d,gtmType:"profile-click",badges:f}),t.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Pe,{children:"Pinned Post"})})]}),S.isEditing?c.jsx(ta,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:S.title!==""?{text:S.title}:!1,isEditing:{text:S.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Ae.Question?250:5e4,forceShow:{error:J!==""&&J!=="delete-error"?C.formatMessage({id:J},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:E,handleSaveEdit:Me,handleCancel:()=>{he(""),L(xe=>({...xe,isEditing:!1}))},listMembers:B,clickMentionFallback:A},gtmContext:`${d}Form`,data:Q}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),S.postBody.length>C_?c.jsx(bd,{text:S.postBody,markdownOptions:{overrides:{a:As,blockquote:{component:ys}}}}):c.jsx(On,{options:{overrides:{a:As,blockquote:{component:ys}}},children:S.postBody})]}):c.jsxs(c.Fragment,{children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),c.jsx(On,{options:{wrapper:t.type===Ae.Question?"h1":y.Fragment,forceWrapper:t.type===Ae.Question,forceInline:t.type===Ae.Question,forceBlock:t.type!==Ae.Question,overrides:{blockquote:{component:ys}}},children:S.postBody})]}),(ke=S.data)!=null&&ke.link?c.jsx(Eo,{data:S.data.link}):c.jsx(c.Fragment,{}),(ze=t.categories)!=null&&ze.length?c.jsx("ul",{className:"categories-list",children:t.categories.map(xe=>c.jsx(Yt,{size:"small",element:"li",children:xe.name},xe.slug))}):c.jsx(c.Fragment,{})]}),!S.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(sf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:re||0,userLiked:ne||!1,canLike:k,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:I,deleteLike:P,listLikes:z},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Ae.Question,Ae.Post].includes(t.type)||l.comments)?{count:w||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof $=="function"&&$()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:je}}:!1,shareLink:{url:`${window.location.origin}${(ot=t.slugs)==null?void 0:ot.question}/${(At=t.slugs)==null?void 0:At.answer}${(vt=t.slugs)!=null&&vt.reply?`#${(tt=t.slugs)==null?void 0:tt.reply}`:""}`},moreMenu:{options:Ue,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),m,c.jsx(ln,{id:`delete-${t.slug}-modal`,isOpen:G,functions:{onOpen:()=>{},onClose:()=>K(!1)},forceShow:{error:J==="delete-error"?C.formatMessage({id:"discussion_delete_error"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:C.formatMessage({id:"discussion_delete_title"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>K(!1),children:C.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Je,children:C.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:xe=>c.jsx("p",{children:xe}),action:C.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const D_=y.lazy(()=>Promise.resolve().then(()=>P_)),w_=65,Xm=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=fi(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||md("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const g=await Do(h.title||h.body||"",w_,h.mentions);p(C=>({...C,prettifiedText:g}))})()},[h.showCachedText,h.title,h.body]);const v=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const C=b;C.preventDefault(),C.stopPropagation();const F=C.target.closest("a");g=F&&F.getAttribute("href")}m(C=>({...C,warning:g||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,v),document.addEventListener(rt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[h.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!h.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return h.showCachedText&&(h.title||h.body)&&(f=h.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:l.name,src:l.image,alt:""}),c.jsx(On,{className:V("input",{placeholder:!h.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:f})]}),c.jsxs(gr,{children:[c.jsx(D_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},E_=y.lazy(()=>Promise.resolve().then(()=>y_)),ru=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(Cn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(vo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:m,...h}=t,p={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...m,isEditing:(m==null?void 0:m.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?c.jsx(Xm,{form:p}):c.jsx(E_,{...p})},au=({form:e})=>{const t=y.useContext(it),n=ae.useIntl(),[r,a]=y.useState(!1),i=()=>{Nh(t)||a(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Di,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const xs="discussion_responses_",eh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${xs}title`},{action:r.formatMessage({id:`${xs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:It(r.formatMessage,`${xs}empty`,e,e)})]})};const th=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ae.useIntl(),s=y.useContext(Ci),o=Aa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Xr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ta,{...r})]})};function __(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function k_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function F_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function A_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:bo(u),mutate:yo(u)},user:l,...u},m=k_({...d,mutationFn:t}),h=B_({...d,mutationFn:n}),p=T_({...d,mutationFn:r}),v=S_({...d,mutationFn:a}),f=j_({...d,mutationFn:i}),{activity:b,...g}=F_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:h,unlike:p,pin:v,unpin:f},user:l,...g}}function B_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function T_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Zd({activity:s,user:r}),s)),onError:n});return a}function S_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function j_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Yd({activity:s,user:r}),s))),onError:n});return a}const O_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:m},profile:h,categories:p})=>{var W,re,ne,w,Q,se;const v=ae.useIntl(),{activity:f,error:b,isLoading:g,mutations:{edit:C,like:D,unlike:F,pin:E,unpin:_}}=A_({queryFns:s,queryKey:[e,t,n]});if(g)return c.jsx(Nt,{style:{height:"400px"}});if(b||!f)return c.jsx(Cn,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:T,verb:I,latest_reactions:P,mentioned_users:z,additional_data:$}=f,B=(((W=P==null?void 0:P.like)==null?void 0:W.length)||0)>0,A=(((re=T==null?void 0:T.like)==null?void 0:re.length)||0)>0,O=A?T==null?void 0:T.like[0].id:"",j=B?(ne=P==null?void 0:P.like)==null?void 0:ne.map(k=>{var M,q,S;return{id:(M=k==null?void 0:k.user)==null?void 0:M.id,name:(S=(q=k==null?void 0:k.user)==null?void 0:q.data)==null?void 0:S.name}}):!1,U=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(na,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:Ae.Post,title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:wo((f==null?void 0:f.categories)||[],p||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:vr(U),userLiked:A,likes:((w=f==null?void 0:f.reaction_counts)==null?void 0:w.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:j,data:{mentions:z,...$||{}},pinned:((Q=f==null?void 0:f.reaction_counts)==null?void 0:Q.pin)&&((se=f==null?void 0:f.reaction_counts)==null?void 0:se.pin)>0||!1},originalAuthorId:U==null?void 0:U.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(k,{title:M,body:q})=>C({title:M,content:q})},likes:{createLike:()=>D({activityId:n}),deleteLike:()=>F({activityId:n,reactionId:O}),listLikes:k=>o.list({activityId:n,...k})},comments:{openComments:()=>{}},pins:{createPin:()=>E({activityId:n}),deletePin:()=>{var k;return _({activityId:n,reactionId:(k=P==null?void 0:P.pin)==null?void 0:k[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(tf,{basePath:e,parentId:t,activityId:n,showReplies:__(I,P),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:h})]})};const nh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(ln,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(ta,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:h},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const C=v||{};C[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(D=>({...D,mentions:C}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},P_=Object.freeze(Object.defineProperty({__proto__:null,default:nh},Symbol.toStringTag,{value:"Module"}));const M_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=ae.useIntl();return a||(a=m.formatMessage({id:"inviteModal_formTitle"})),i||(i=m.formatMessage({id:"inviteModal_formLabel"})),s||(s=m.formatMessage({id:"inviteModal_cta"})),c.jsx(ln,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:V("invite-modal",e,{success:!!n}),children:c.jsx(Wm,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const N_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(md("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(Vm,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var h;try{(h=i==null?void 0:i.functions)!=null&&h.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},Di=N_,R_=Object.freeze(Object.defineProperty({__proto__:null,default:Di},Symbol.toStringTag,{value:"Module"}));const I_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(ln,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(On,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const $_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(an,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),L_=y.memo($_);const z_=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(_t,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const wi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ae.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,h=Math.floor(m),p=(m-h)*60,v=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:h})}${h>0&&v>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${h>0?`${i.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${v>0?i.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const q_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(zn,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const U_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],W_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},h={};d.forEach(b=>{if(!t[b]){h[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){h[b]=t[b];const{text:g,element:C}=t[b];if(C&&U_.includes(C.toLowerCase()))return;h[b]={text:g,element:m[b]};return}h[b]={text:t[b],element:m[b]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(En,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&h.eyebrow&&h.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(h[b]&&typeof h[b]=="object"){const{text:g,element:C=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:g},b):y.createElement(C,{key:b,className:b},g)}return null}),l,p&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(zn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},V_=y.memo(W_);const H_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(En,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const K_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(En,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(zn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},Z_=y.memo(K_);const Y_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),G_=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&_s(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):so(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&_s(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},Q_={title:66,text:3e3,secondaryText:1e3,partner:34},ii={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"}},J_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ae.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=ii[h])!=null&&f.gtmEvent&&(p=ii[h].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(h)&&d!=="premium"){const g=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),C=async D=>{if(D.preventDefault(),D.stopPropagation(),!(g||!t||!t.onClick)){s(F=>({...F,loading:!0}));try{const F=await t.onClick(e);s(F==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:C,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${h}${g?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function X_({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const iu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var A,O;const u=ae.useIntl(),d=y.useContext(it),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(j=>{b({data:j,isLoading:!1})}).catch(()=>b(j=>({...j,isLoading:!1})))},[a,m,n]);const{data:g,isLoading:C}=f;if(C||!g)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:D}=g;if(!D||!ii[D])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:F="",className:E,length:_,gtmEvent:T}=ii[D];let I=h&&g.slug?`${F}${g.slug}`:!1;h&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(I=g.slug);const P=j=>{I&&(j.preventDefault(),j.stopPropagation(),window.location.href=I)},z={...Q_,..._};let $={className:"card"},B={};return I&&(B={href:I,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),$={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&($={...$,tabIndex:"0"},(A=v==null?void 0:v.current)==null||A.focus(),(O=v==null?void 0:v.current)==null||O.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",E,t,{"has-link":I,"no-link":!I,"has-image":g.banner}),"data-testid":`${D}-card`,children:c.jsxs("div",{...$,ref:v,children:[c.jsx(pd,{className:"card-label",contentType:D,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),D==="communityPage"&&(g==null?void 0:g.createdAt)&&Ah(g==null?void 0:g.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):cd(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(zn,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(un,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(mo,{contributors:{data:g.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(D)?u.formatMessage({id:`card_contributors_${D}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):sr(g.partner[0],z.partner)}),["title","text","secondaryText"].map(j=>{const U=g[j];if(!U)return null;const W=id(j),re={key:j,className:W,"data-testid":W},ne={wrapper:"p",forceWrapper:!0,forceInline:!0},w=sr(U,z[j]);return["title","text"].includes(j)&&I?(ne.wrapper="a",c.jsx("p",{...re,children:c.jsx(Zt,{options:ne,...B,children:w})})):c.jsx(Zt,{options:ne,...re,children:w})}),a.contentType==="communityPage"&&(a.slug||g.slug)&&r&&c.jsx(X_,{communitySlug:a.slug||g.slug,buildMemberData:r}),c.jsx(G_,{type:E||"",data:g}),c.jsx(J_,{data:g,cta:i,link:I||"",gtmContext:s})]})})};const rh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(iu,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),ek=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},tk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Cs={fourCards:1024,threeCards:769,twoCards:480};let _a=null,Ds=null;const nk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[C,D]=y.useState(""),F=t.length,E=Math.ceil(F/h),_=y.useRef(null),T=$n(!0,!0,_==null?void 0:_.current);y.useEffect(()=>{let A=1;T&&(T>=Cs.fourCards?A=4:T>=Cs.threeCards?A=3:T>=Cs.twoCards&&(A=2),A>F&&(A=F)),m(O=>({...O,cardsPerPage:A,isLoading:!1}))},[T,F]);const I=(A="next")=>{Ds&&clearTimeout(Ds);let O=b;if(typeof A=="string")if(A==="next")if(b<E-1)O=b+1;else return;else if(b>0)O=b-1;else return;else O=A;D(""),f(U=>({...U,currentPage:O,loadedPages:[...new Set([...g,O])]}));const j=()=>{const U=O*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};Ds=setTimeout(()=>{D(l.formatMessage({id:`${u}ariaLive${typeof A=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof A=="string"?A:"next"}`}),slide:typeof A=="string"?1:A+1,count:j()}))},500)},P=A=>{_a=A.touches[0].clientX},z=A=>{if(_a===null)return;const O=A.touches[0].clientX,j=_a-O;j>5?I("next"):j<-5&&I("previous"),_a=null},$={"--width":`${T||0}px`,"--total-cards":F,"--cards-per-page":h,"--page":b};if(p)return c.jsx(di,{layout:`carousel${a?"-with-title":""}`});const B=(A,O)=>{var U;let j=null;return(U=A==null?void 0:A.sys)!=null&&U.id?j=`card-${A.sys.id}`:A!=null&&A.slug?j=`card-${A.slug}`:[n[O],A.contentType].includes("customCard")&&(j=`card-${window.btoa(`${A.title} ${A.createdAt}`)}-${O}`),j};return c.jsxs("section",{ref:_,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(tk,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:$,"data-testid":"carousel-list",children:t.map((A,O)=>{let j=B(A,O);const{inView:U,isLoaded:W}=ek(O,h,b,g);return j&&(U||W)?c.jsx(iu,{id:j,card:{...A,contentType:n[O]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},j):(j=j||`${e}-card-${O}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),E<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:A=>{A.preventDefault(),A.stopPropagation(),I("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((A,O)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:O===b}),onClick:j=>{j.preventDefault(),j.stopPropagation(),I(O)},children:c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:O+1,total:E})})})},`page-indicator-${O}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:A=>{A.preventDefault(),A.stopPropagation(),I("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:C})]})]})},rk=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(di,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(nk,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(zt,{})]},`carousel-${d}`)});const ak=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:m=>{l&&(m.preventDefault(),m.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:V("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:V("img",{private:o,"no-image":!a}),children:a&&c.jsx(zn,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const ik=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(wi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(fo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const ah=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const ih=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ae.useIntl(),o=ui(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):od(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(wi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const sk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=ae.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(li,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(wi,{time:s,appendedText:a?m.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:f,contentType:b,icon:g,image:C,isIntroduction:D,optional:F,slug:E,subsectionId:_,title:T,type:I})=>{const P=a&&t||D,z={};return C&&(z.style={"--image":`url(${C})`}),c.jsx("li",{className:V({article:b===Ar.ARTICLE,discussion:b===Ar.DISCUSSION,quiz:b===Ar.QUIZ,completed:v&&b===Ar.ARTICLE,locked:!P}),...z,children:c.jsx(xn,{href:P?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${sd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(ah,{sectionId:i,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(ih,{completionTime:f,icon:g,optional:F,type:I,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const ok=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},uk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Zc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ka="notFoundError_",lk=()=>{const e=ae.useIntl(),t=[];return Zc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ka}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Ym,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(En,{children:[c.jsx(rh,{cards:Zc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ka}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ka}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ka}text`})})]})};var si=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(si||{});const ck=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,dk=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const fk=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let m=0,h={};const p=(a||!s)&&!t.hasUserVoted;i&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const v=g=>{g.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:V({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var C;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const D=g.code==="ArrowUp"?"prev":"next",{nextElement:F,nextIndex:E}=dk(g.currentTarget.parentElement,"selected",D,n);F&&((C=F.querySelector("label"))==null||C.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:V("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(un,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[m,"%"]})]}),c.jsx("input",{type:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const mk=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ae.useIntl(),s=y.useContext(it),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=si.AfterVoting}=n||{},[d,m]=y.useState(ck(t,l,s==null?void 0:s.id)),{createVote:h=async()=>{},removeVote:p=()=>{}}=r||{},v=t.reduce((D,F)=>D+F.numVotes,0),f=t.filter(D=>D.hasUserVoted).length,b=t.filter(D=>D.hasUserVoted),g=y.useCallback(async D=>{await h(D.id)},[]),C=y.useCallback(async()=>{t.forEach(async D=>{D.hasUserVoted&&D.userVote&&await p(D.userVote.id)})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:i.formatMessage({id:`${a}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:v})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ee,{variant:"tertiary",onClick:C,"data-testid":"remove-votes-button",disabled:f===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:f})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll",children:t==null?void 0:t.map((D,F)=>c.jsx(fk,{isTabbable:d===F,user:s,option:D,optionIndex:F,totalPollVotes:v,showResults:u==si.Always||!!f,allowMultipleVotes:l,hasVotedOnPoll:!!f,functions:{createVote:g,setTabbableOption:m}},D.id))})})}),c.jsxs(Pe,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:f}),!!f&&c.jsx("ul",{children:b.map(D=>c.jsx("li",{children:D.label}))})]})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=sf;exports.ActionButton=qr;exports.ActivitiesFeed=$g;exports.ActivitySection=O_;exports.AddPost=ru;exports.Badge=Bd;exports.BadgeScope=ct;exports.Badges=Td;exports.BadgesContext=uo;exports.BadgesProvider=Cd;exports.Banner=q_;exports.BannerSection=V_;exports.Breadcrumbs=iv;exports.Buckets=Wh;exports.Button=Ee;exports.ButtonWrapper=pr;exports.COURSE_CONTENT_TYPES=Ar;exports.CacheProvider=Dd;exports.Card=iu;exports.CardBlock=rh;exports.Carousel=rk;exports.CharacterLimit=ko;exports.CollapsibleSection=li;exports.Columns=cf;exports.CommunityDetails=cg;exports.ContactFooter=u_;exports.ContactForm=Um;exports.ContentTypeLabel=pd;exports.Contributors=mo;exports.ConversationContext=Ci;exports.CookieBanner=Zm;exports.CourseProgression=ik;exports.CourseStructure=sk;exports.CustomContentBanner=H_;exports.CustomEvents=rt;exports.DELETED_USER_ID=Lr;exports.Directory=I_;exports.DiscussionConversation=Jm;exports.DiscussionForm=ta;exports.DiscussionFormCard=Xm;exports.DiscussionFormModal=nh;exports.DiscussionPost=na;exports.DiscussionThread=th;exports.Divider=zt;exports.DownloadSection=a_;exports.EMAILS=Qn;exports.EditSection=s_;exports.EmailHelperTextBox=ff;exports.EmptyStateBox=Cn;exports.EnrichedUrl=Eo;exports.FeatureFlags=Ed;exports.Filters=of;exports.FlagsProvider=wd;exports.Footer=tu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=St;exports.FullWidthSection=En;exports.GET_STREAM_USER_PREFIX=Es;exports.GlobalProviders=ap;exports.Header=nu;exports.HelperTextBox=vd;exports.HiddenFromScreenReaders=oi;exports.HideShowTextBox=bd;exports.HighlightSection=Z_;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=ud;exports.IconBulletedList=Kh;exports.ImageContainer=Lh;exports.IntlProvider=_d;exports.InviteForm=Wm;exports.InviteModal=M_;exports.JoinButton=vo;exports.Label=Zo;exports.LanguageContext=lo;exports.LanguageSwitcher=ov;exports.LessonName=ah;exports.LessonType=ih;exports.LikesButton=Xd;exports.LikesFeed=nf;exports.LikesModal=rf;exports.Link=xn;exports.LoadMore=Xr;exports.LoadingBlock=Sd;exports.LoadingPlaceholder=Nt;exports.LoadingState=di;exports.Logo=_o;exports.LogoSection=o_;exports.MEMBERS_PER_PAGE=Gm;exports.MENTION_REGEX=ld;exports.MarkCompleteButton=ok;exports.MarkdownText=On;exports.MarketingBlock=Y_;exports.Marks=Kt;exports.Member=an;exports.MembersList=Qm;exports.Modal=ho;exports.MoreMenu=uf;exports.NUMBER_OF_COUNTRIES=_h;exports.NUMBER_OF_USERS=Eh;exports.NarrowCard=ak;exports.NavigationMenu=lf;exports.NotFoundError=lk;exports.Overlay=ln;exports.OverlayContext=co;exports.OverlayProvider=Ad;exports.PageHeading=yd;exports.PageLayout=Ym;exports.PasswordForm=YE;exports.PasswordRules=bf;exports.Pill=Yt;exports.Poll=mk;exports.Popover=hd;exports.Portal=gr;exports.ProfileForm=Vm;exports.ProfileImageChange=qm;exports.ProfileModal=Di;exports.ProfileModalLauncher=au;exports.ProfilePicture=un;exports.ProgressBar=fo;exports.ProgressTracker=qh;exports.PublishArticleForm=QE;exports.Rating=_v;exports.RepliesFeed=tf;exports.ResponsesHeading=eh;exports.ResponsiveImage=zn;exports.ResultsVisibility=si;exports.ReturnToNavButton=Uh;exports.RichTextEditor=eu;exports.SearchForm=Hm;exports.ShareLink=af;exports.ShareLinks=mv;exports.SignupForm=r_;exports.Span=As;exports.StatusBanner=ur;exports.TableOfContents=z_;exports.Tabs=hv;exports.Tags=m_;exports.TestimonialBlock=L_;exports.TimeToComplete=wi;exports.Toggle=KE;exports.Tooltip=Ln;exports.TopLevelPage=l_;exports.UUID_V4_REGEX=zr;exports.UserContext=it;exports.UserProvider=kd;exports.VisuallyHidden=Pe;exports.addAriaProps=Vd;exports.basicReducer=Jr;exports.camelCaseToDashCase=id;exports.checkIntlPathExists=ui;exports.enrichPostCategories=wo;exports.generateConditions=Ra;exports.generateCssIcon=kh;exports.getAuthorData=vr;exports.getCharacterLimitProps=df;exports.getLongDate=so;exports.getMember=fi;exports.getPostBody=Do;exports.getShortDate=cd;exports.getValueLength=mi;exports.headerData=Qr;exports.likesResponseMock=rv;exports.mapGetStreamData=uk;exports.pageReady=dd;exports.passwordValidator=ks;exports.repliesFeedMock=Lg;exports.supportedLanguages=Ba;exports.toCamelCase=sd;exports.toCapitalisedCase=wh;exports.toSentenceCase=od;exports.transformSlugs=Os;exports.useBadges=xd;exports.useCurrentPath=Xc;exports.useEffectAfterMount=or;exports.useElementWidth=$n;exports.useOverlay=Fd;exports.useScrollListener=nd;exports.useScrollToHash=ao;exports.useTooltips=io;exports.useUser=ci;