@apolitical/component-library 8.3.18-re.11 → 8.3.18-re.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -62,7 +62,7 @@ Valid keys: `+JSON.stringify(Object.keys(O),null," "));var ee=se($,ne,H,q,U+"."
62
62
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
63
63
  */function W0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function V0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?W0(Object(n),!0).forEach(function(r){ox(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ox(e,t,n){return t=ux(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lx(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 ux(e){var t=lx(e,"string");return typeof t=="symbol"?t:String(t)}var K0={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,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()}},cx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},dx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},No=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},fx=function(t){return No(t)&&!t.shiftKey},hx=function(t){return No(t)&&t.shiftKey},G0=function(t){return setTimeout(t,0)},Y0=function(t,n){var r=-1;return t.every(function(i,a){return n(i)?(r=a,!1):!0}),r},Xs=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,r):t},Ml=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},px=[],mx=function(t,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||px,a=V0({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:fx,isKeyBackward:hx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(N,k,I){return N&&N[k]!==void 0?N[k]:a[I||k]},u=function(N,k){var I=typeof(k==null?void 0:k.composedPath)=="function"?k.composedPath():void 0;return s.containerGroups.findIndex(function(j){var z=j.container,P=j.tabbableNodes;return z.contains(N)||(I==null?void 0:I.includes(z))||P.find(function(ae){return ae===N})})},c=function(N){var k=a[N];if(typeof k=="function"){for(var I=arguments.length,j=new Array(I>1?I-1:0),z=1;z<I;z++)j[z-1]=arguments[z];k=k.apply(void 0,j)}if(k===!0&&(k=void 0),!k){if(k===void 0||k===!1)return k;throw new Error("`".concat(N,"` was specified but was not a node, or did not return a node"))}var P=k;if(typeof k=="string"&&(P=r.querySelector(k),!P))throw new Error("`".concat(N,"` as selector refers to no known node"));return P},d=function(){var N=c("initialFocus");if(N===!1)return!1;if(N===void 0||!Hu(N,a.tabbableOptions))if(u(r.activeElement)>=0)N=r.activeElement;else{var k=s.tabbableGroups[0],I=k&&k.firstTabbableNode;N=I||c("fallbackFocus")}if(!N)throw new Error("Your focus-trap needs to have at least one focusable element");return N},f=function(){if(s.containerGroups=s.containers.map(function(N){var k=w4(N,a.tabbableOptions),I=A4(N,a.tabbableOptions),j=k.length>0?k[0]:void 0,z=k.length>0?k[k.length-1]:void 0,P=I.find(function(O){return ca(O)}),ae=I.slice().reverse().find(function(O){return ca(O)}),X=!!k.find(function(O){return Mi(O)>0});return{container:N,tabbableNodes:k,focusableNodes:I,posTabIndexesFound:X,firstTabbableNode:j,lastTabbableNode:z,firstDomTabbableNode:P,lastDomTabbableNode:ae,nextTabbableNode:function(C){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,M=k.indexOf(C);return M<0?Y?I.slice(I.indexOf(C)+1).find(function(H){return ca(H)}):I.slice(0,I.indexOf(C)).reverse().find(function(H){return ca(H)}):k[M+(Y?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(N){return N.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(N){return N.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 R(N){var k=N.activeElement;if(k)return k.shadowRoot&&k.shadowRoot.activeElement!==null?R(k.shadowRoot):k},g=function R(N){if(N!==!1&&N!==p(document)){if(!N||!N.focus){R(d());return}N.focus({preventScroll:!!a.preventScroll}),s.mostRecentlyFocusedNode=N,cx(N)&&N.select()}},m=function(N){var k=c("setReturnFocus",N);return k||(k===!1?!1:N)},E=function(N){var k=N.target,I=N.event,j=N.isBackward,z=j===void 0?!1:j;k=k||Ml(I),f();var P=null;if(s.tabbableGroups.length>0){var ae=u(k,I),X=ae>=0?s.containerGroups[ae]:void 0;if(ae<0)z?P=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:P=s.tabbableGroups[0].firstTabbableNode;else if(z){var O=Y0(s.tabbableGroups,function(U){var $=U.firstTabbableNode;return k===$});if(O<0&&(X.container===k||Hu(k,a.tabbableOptions)&&!ca(k,a.tabbableOptions)&&!X.nextTabbableNode(k,!1))&&(O=ae),O>=0){var C=O===0?s.tabbableGroups.length-1:O-1,Y=s.tabbableGroups[C];P=Mi(k)>=0?Y.lastTabbableNode:Y.lastDomTabbableNode}else No(I)||(P=X.nextTabbableNode(k,!1))}else{var M=Y0(s.tabbableGroups,function(U){var $=U.lastTabbableNode;return k===$});if(M<0&&(X.container===k||Hu(k,a.tabbableOptions)&&!ca(k,a.tabbableOptions)&&!X.nextTabbableNode(k))&&(M=ae),M>=0){var H=M===s.tabbableGroups.length-1?0:M+1,q=s.tabbableGroups[H];P=Mi(k)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else No(I)||(P=X.nextTabbableNode(k))}}else P=c("fallbackFocus");return P},v=function(N){var k=Ml(N);if(!(u(k,N)>=0)){if(Xs(a.clickOutsideDeactivates,N)){o.deactivate({returnFocus:a.returnFocusOnDeactivate});return}Xs(a.allowOutsideClick,N)||N.preventDefault()}},b=function(N){var k=Ml(N),I=u(k,N)>=0;if(I||k instanceof Document)I&&(s.mostRecentlyFocusedNode=k);else{N.stopImmediatePropagation();var j,z=!0;if(s.mostRecentlyFocusedNode)if(Mi(s.mostRecentlyFocusedNode)>0){var P=u(s.mostRecentlyFocusedNode),ae=s.containerGroups[P].tabbableNodes;if(ae.length>0){var X=ae.findIndex(function(O){return O===s.mostRecentlyFocusedNode});X>=0&&(a.isKeyForward(s.recentNavEvent)?X+1<ae.length&&(j=ae[X+1],z=!1):X-1>=0&&(j=ae[X-1],z=!1))}}else s.containerGroups.some(function(O){return O.tabbableNodes.some(function(C){return Mi(C)>0})})||(z=!1);else z=!1;z&&(j=E({target:s.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(s.recentNavEvent)})),g(j||s.mostRecentlyFocusedNode||d())}s.recentNavEvent=void 0},T=function(N){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=N;var I=E({event:N,isBackward:k});I&&(No(N)&&N.preventDefault(),g(I))},_=function(N){if(dx(N)&&Xs(a.escapeDeactivates,N)!==!1){N.preventDefault(),o.deactivate();return}(a.isKeyForward(N)||a.isKeyBackward(N))&&T(N,a.isKeyBackward(N))},w=function(N){var k=Ml(N);u(k,N)>=0||Xs(a.clickOutsideDeactivates,N)||Xs(a.allowOutsideClick,N)||(N.preventDefault(),N.stopImmediatePropagation())},A=function(){if(s.active)return K0.activateTrap(i,o),s.delayInitialFocusTimer=a.delayInitialFocus?G0(function(){g(d())}):g(d()),r.addEventListener("focusin",b,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",b,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",_,!0),o},B=function(N){var k=N.some(function(I){var j=Array.from(I.removedNodes);return j.some(function(z){return z===s.mostRecentlyFocusedNode})});k&&g(d())},F=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(B):void 0,L=function(){F&&(F.disconnect(),s.active&&!s.paused&&s.containers.map(function(N){F.observe(N,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(N){if(s.active)return this;var k=l(N,"onActivate"),I=l(N,"onPostActivate"),j=l(N,"checkCanFocusTrap");j||f(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,k==null||k();var z=function(){j&&f(),A(),L(),I==null||I()};return j?(j(s.containers.concat()).then(z,z),this):(z(),this)},deactivate:function(N){if(!s.active)return this;var k=V0({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},N);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,L(),K0.deactivateTrap(i,o);var I=l(k,"onDeactivate"),j=l(k,"onPostDeactivate"),z=l(k,"checkCanReturnFocus"),P=l(k,"returnFocus","returnFocusOnDeactivate");I==null||I();var ae=function(){G0(function(){P&&g(m(s.nodeFocusedBeforeActivation)),j==null||j()})};return P&&z?(z(m(s.nodeFocusedBeforeActivation)).then(ae,ae),this):(ae(),this)},pause:function(N){if(s.paused||!s.active)return this;var k=l(N,"onPause"),I=l(N,"onPostPause");return s.paused=!0,k==null||k(),S(),L(),I==null||I(),this},unpause:function(N){if(!s.paused||!s.active)return this;var k=l(N,"onUnpause"),I=l(N,"onPostUnpause");return s.paused=!1,k==null||k(),f(),A(),L(),I==null||I(),this},updateContainerElements:function(N){var k=[].concat(N).filter(Boolean);return s.containers=k.map(function(I){return typeof I=="string"?r.querySelector(I):I}),s.active&&f(),L(),this}},o.updateContainerElements(t),o};const gx=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:mx},Symbol.toStringTag,{value:"Module"})),vx=Iy(gx),Ex=Iy(sx);function Cs(e){"@babel/helpers - typeof";return Cs=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},Cs(e)}function yx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z0(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,S4(r.key),r)}}function bx(e,t,n){return t&&Z0(e.prototype,t),n&&Z0(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tx(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&&Jf(e,t)}function Jf(e,t){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Jf(e,t)}function _x(e){var t=xx();return function(){var r=mc(e),i;if(t){var a=mc(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return Cx(this,i)}}function Cx(e,t){if(t&&(Cs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Co(e)}function Co(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xx(){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 mc(e){return mc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},mc(e)}function wx(e,t,n){return t=S4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S4(e){var t=Ax(e,"string");return Cs(t)==="symbol"?t:String(t)}function Ax(e,t){if(Cs(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Cs(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ll=y,$e=E4,Sx=vx,kx=Sx.createFocusTrap,Dx=Ex,Ox=Dx.isFocusable,pp=function(e){Tx(n,e);var t=_x(n);function n(r){var i;yx(this,n),i=t.call(this,r),wx(Co(i),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];u=u.apply(void 0,d)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(Co(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(Co(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(Co(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var a=r.focusTrapOptions;for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){i.originalOptions[s]=a[s];continue}i.internalOptions[s]=a[s]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return bx(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.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(i){var a=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return a&&(this.outsideClick={target:i.target,allowDeactivation:a}),a}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,a=function(){var o=i.getReturnFocusNode(),l=!!(i.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!Ox(i.outsideClick.target,i.internalOptions.tabbableOptions))),u=i.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(a,a):a()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(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(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var a=!i.active&&this.props.active,s=i.active&&!this.props.active,o=!i.paused&&this.props.paused,l=i.paused&&!this.props.paused;if(a&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else i.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 i=this,a=this.props.children?Ll.Children.only(this.props.children):void 0;if(a){if(a.type&&a.type===Ll.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=i.props.containerElements;a&&(typeof a.ref=="function"?a.ref(u):a.ref&&(a.ref.current=u)),i.focusTrapElements=c||[u]},o=Ll.cloneElement(a,{ref:s});return o}return null}}]),n}(Ll.Component),Js=typeof Element>"u"?Function:Element;pp.propTypes={active:$e.bool,paused:$e.bool,focusTrapOptions:$e.shape({document:$e.object,onActivate:$e.func,onPostActivate:$e.func,checkCanFocusTrap:$e.func,onPause:$e.func,onPostPause:$e.func,onUnpause:$e.func,onPostUnpause:$e.func,onDeactivate:$e.func,onPostDeactivate:$e.func,checkCanReturnFocus:$e.func,initialFocus:$e.oneOfType([$e.instanceOf(Js),$e.string,$e.bool,$e.func]),fallbackFocus:$e.oneOfType([$e.instanceOf(Js),$e.string,$e.func]),escapeDeactivates:$e.oneOfType([$e.bool,$e.func]),clickOutsideDeactivates:$e.oneOfType([$e.bool,$e.func]),returnFocusOnDeactivate:$e.bool,setReturnFocus:$e.oneOfType([$e.instanceOf(Js),$e.string,$e.bool,$e.func]),allowOutsideClick:$e.oneOfType([$e.bool,$e.func]),preventScroll:$e.bool,tabbableOptions:$e.shape({displayCheck:$e.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:$e.oneOfType([$e.bool,$e.func])}),trapStack:$e.array,isKeyForward:$e.func,isKeyBackward:$e.func}),containerElements:$e.arrayOf($e.instanceOf(Js)),children:$e.oneOfType([$e.element,$e.instanceOf(Js)])};pp.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:kx};var Nx=pp;const Ix=Tr(Nx);const vi=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:a=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:d="Modal"})=>{const f=he.useIntl(),{registerOverlay:p,unregisterOverlay:g}=l4(),[m,E]=y.useState(t),[v,b]=y.useState(null),T=y.useRef(null),_=F=>{m&&F.key==="Escape"&&S(!1)},w=F=>{b(F.target)},A=F=>{v===T.current&&F.target===T.current&&S(!1),b(null)};y.useEffect(()=>{if(m)return window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}},[m]),y.useEffect(()=>{const F=T.current;return F&&(F.addEventListener("mousedown",w),F.addEventListener("mouseup",A)),()=>{F&&(F.removeEventListener("mousedown",w),F.removeEventListener("mouseup",A))}},[v]);const S=F=>{if(E(F),F)i(),p(e);else{if(m===F)return;a(),g(e)}};y.useEffect(()=>(S(t),()=>{m&&g(e)}),[t]);const B=r?{"--max-width":`${r/16}rem`}:{};return h.jsx("div",{id:`${e}-overlay`,ref:T,className:J("overlay",{open:m,"in-portal":c.includes("in-portal")}),role:"dialog",children:h.jsx(dp,{id:e,className:J("overlay-modal",c,{"has-max-width":r}),hidden:!m,style:B,children:t&&h.jsx(Ix,{containerElements:[T.current],children:h.jsxs("div",{className:"overlay-content",children:[h.jsxs("div",{className:"top",children:[o&&h.jsx("h2",{className:"modal-title",children:o}),h.jsx(je,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":d,screenreaderText:f.formatMessage({id:"overlay_close"})})]}),n&&h.jsx(br,{}),l,u&&h.jsxs("div",{className:"bottom",children:[h.jsx(br,{}),h.jsx(Bs,{buttons:u})]}),s&&h.jsx(_s,{className:"error",children:s})]})})})})},k4=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const eo="joinCommunityButton",mp=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:i,leave:a}={join:()=>{},leave:()=>{}}})=>{const s=he.useIntl(),o=y.useContext(Ht),l=o&&typeof o.id=="string",u=r||!l,[c,d]=y.useState(e),[f,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{f==="joining"?p("joined"):f==="leaving"&&p("notJoined")},[c]);const g={},m={};return c&&f!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${eo}_leave`}),g["aria-label"]=s.formatMessage({id:`${eo}_member_aria`}),m["aria-hidden"]="true"),h.jsx(je,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&f!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${eo}_closed_tooltip`}):"",onClick:async E=>{if(u)return;E.currentTarget.blur(),p(c?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${eo}_aria_live`},{action:c?"leaving":"joining"})}});document.dispatchEvent(v);const b=c?a:i;typeof b=="function"&&setTimeout(async()=>{await b()},500),d(!c)},className:J("join-community-button",f,{active:f==="joining"}),disabled:u,"data-testid":"join-button",...g,children:h.jsx("span",{className:"text",...m,children:s.formatMessage({id:`${eo}${["joining","leaving"].includes(f)?`_${f}`:c?"_member":n?"_short":""}`})})})};const W1="communityDetails_",Px=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:i=0,data:a=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=he.useIntl(),{id:u}=y.useContext(Ht),c=u,d=5,f=i||a.length,p=a.length?a:Array(d).fill({}),g=`/communities/${r}/members`===window.location.pathname,m=t||n,E=!n&&!t;return h.jsxs("div",{className:J("community-details",e),children:[m?h.jsxs("div",{className:"member-details",children:[h.jsxs("div",{className:"top",children:[h.jsxs("h4",{children:[l.formatMessage({id:`${W1}members`}),h.jsx("span",{className:"count",children:f})]}),g?h.jsx(h.Fragment,{}):h.jsx("p",{className:"text-small",children:h.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${W1}viewAll`})})})]}),c&&h.jsx(cp,{contributors:{total:i,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:f===0},cutoff:d})]}):h.jsx(h.Fragment,{}),c?h.jsxs(h.Fragment,{children:[h.jsx(mp,{isMember:t,isOpen:n,disabled:E,functions:{...o}}),t&&h.jsx(je,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${W1}invite`})})]}):h.jsx(h.Fragment,{})]})};const fs=({icon:e,className:t="",children:n,shortText:r,...i})=>{const a={};return r&&(a["data-short-text"]=r),h.jsx(je,{className:J("action-button",t),variant:"tertiary",size:{mobile:"small",769:"medium"},icon:e,...i,...a,children:h.jsx("span",{className:"inner-text",children:n})})},Rx="reply",Ui="00000000-0000-0000-0000-000000000000",xs="en";function gp({queryClient:e,queryKey:t}){function n(r,i,a){e.setQueryData(t,a)}return n}function vp({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),i}return n}var Ls=(e=>(e.Post="post",e.Poll="poll",e))(Ls||{});const _n="poll-vote",D4=(e,t="en")=>{var r;return e.verb!==Ls.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(i=>{var o,l,u,c,d;const a=((o=i==null?void 0:i.own_children)==null?void 0:o["poll-vote"])||[],s=((l=i.data)==null?void 0:l.description)||{[t]:""};return{id:i.id,label:s[t],numVotes:((u=i==null?void 0:i.children_counts)==null?void 0:u["poll-vote"])||0,hasUserVoted:a.length>0,userVote:{id:(c=a[0])==null?void 0:c.id},position:((d=i.data)==null?void 0:d.position)||0}}).sort((i,a)=>i.position-a.position)};function O4({activity:e,reactionId:t,user:n}){var a;const r=n==null?void 0:n.id;if(!r)return;const i=(a=e.latest_reactions)==null?void 0:a["poll-option"];if(i){for(const s of i)if(s.id===t){const o={id:Ui,activity_id:e.id,kind:_n,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[_n]=s.latest_children[_n]||[],s.latest_children[_n].push(o),s.own_children=s.own_children||{},s.own_children[_n]=s.own_children[_n]||[],s.own_children[_n].push(o),s.children_counts=s.children_counts||{},s.children_counts[_n]=(s.children_counts[_n]||0)+1;break}}}function N4({activity:e,reactionId:t,correctReactionId:n,user:r}){var i;(i=e.latest_reactions)==null||i["poll-option"].forEach(a=>{var s;a.id===t&&(a.latest_children[_n].forEach(o=>{o.id===Ui&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=a.own_children)==null||s[_n].forEach(o=>{o.id===Ui&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function I4({activity:e,reactionId:t}){var r,i,a;const n=(r=e.latest_reactions)==null?void 0:r["poll-option"];if(n)for(const s of n){const o=(i=s.own_children)==null?void 0:i[_n],l=(a=s.latest_children)==null?void 0:a[_n];if(l){const u=l.findIndex(c=>c.id===t);u!==-1&&(l.splice(u,1),s.children_counts[_n]--)}if(o){const u=o.findIndex(c=>c.id===t);u!==-1&&o.splice(u,1)}}}function Fx({id:e,position:t,description:n},r){if(r!=null&&r.id)return{created_at:new Date().toISOString(),updated_at:new Date().toISOString(),id:e||Ui,kind:"poll-option",data:{description:n,position:t},parent:""}}function Bx(){return{latest_reactions:{like:[],reply:[],"poll-option":[]},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Mx(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Lx(e,t){const n=e.map(r=>Fx(r,t));return{latest_reactions:{like:[],reply:[],"poll-option":n},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Ep(e){const{id:t="",name:n="",organization:r="",jobTitle:i="",image:a={}}=e,{thumbnail:s=""}=a;return{id:t,data:{name:n,organization:r,jobTitle:i,thumbnail:s}}}function $x({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Ui,time:new Date().toISOString(),verb:Ls.Post}}function Q0({title:e,options:t,settings:n,user:r,correctActivityId:i}){return{title:e,content:"",id:i||Ui,time:new Date().toISOString(),verb:Ls.Poll}}function X0({activity:e,user:t}){return{...e,actor:Ep(t),...Bx()}}function J0({activity:e,options:t,user:n}){return{...e,actor:Ep(n),...Lx(t,n)}}function gc({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function P4({activity:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((i=e.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}function vc({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function R4({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 jx(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Hx(e,t,n){const r=t.pages.length-1,i=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[i]=e:t.pages[r].results.push(e),t}function Ux(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 ws(e,t,n){return t?n!=null&&n.append?Hx(e,t,n):Ux(e,t,n):jx(e)}function Dn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:i})=>i===e);if(r)return r}}function F4(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:i})=>i===e);if(r!==-1){n.splice(r,1);break}}return t}function yp(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],[]))||[]}function zx({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Ui,kind:Rx,parent:t||""}}function eg({reply:e,user:t}){const n=Ep(t);return{...e,user_id:n.id,user:n,...Mx()}}function tg({reply:e,reaction:t}){var n,r,i;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:[...((i=e.own_children)==null?void 0:i.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function qx({reply:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_children={...e.own_children||{},like:(((i=e.own_children)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}const bp=(e,t)=>{const n=new CustomEvent(Gt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)},Wx=({content:e,locale:t})=>e[t]||e[xs],Vx=({content:e})=>e.original;let ng,V1=0;const B4=()=>{y.useEffect(()=>(document.addEventListener(Gt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Gt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(ng);const i=document.getElementById(n);if(i){i.scrollIntoView({behavior:"smooth",block:"start"}),V1=0;return}V1++,!(V1>10)&&(ng=setTimeout(()=>{e(t)},50))}};var Yt=(e=>(e.Communities="communities",e.Courses="courses",e))(Yt||{}),Ge=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Ge||{});const As=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}),qr=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}),Tp=Object.freeze({actor:`SU:${As.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"}),Kx=Object.freeze({actor:`SU:${qr.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"}),Gx=Object.freeze({actor:`SU:${As.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"}),Yx=Object.freeze({actor:`SU:${qr.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:Tp.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:qr.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:qr.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:Tp.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:qr.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:qr.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:qr.id,user:{id:qr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Tp.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:As.id,user:{id:As.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Kx.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:qr.id,user:{id:qr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Gx.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:As.id,user:{id:As.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Yx.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const Zx=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Qx=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function Xx(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 i=r==null?void 0:r.nextElementSibling;if(n==="up"){const c=r==null?void 0:r.previousElementSibling;c?i=c:(i=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(i==null?void 0:i.getAttribute("data-index"))==="-1"&&(i=i==null?void 0:i.previousElementSibling))}else(!i||(i==null?void 0:i.getAttribute("data-index"))==="-1")&&(i=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!i)return;const a=Number((i==null?void 0:i.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:a}]),(u=i==null?void 0:i.querySelector("a,button"))==null||u.focus()},[e])}const Jx=y.lazy(()=>Promise.resolve().then(()=>P6));let Io=!1;const K1=()=>{Io!==!1&&(clearTimeout(Io),Io=!1)},e6=5;let G1=null;const M4=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:a={type:Ge.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:c=()=>{},deleteLike:d=()=>{},listLikes:f=async()=>({next:"",results:[]})}})=>{const p=he.useIntl(),g={numberOfLikes:t,userLikedContent:i,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[m,E]=y.useReducer(Fs,g),{numberOfLikes:v,userLikedContent:b,ignoreInteractions:T,showLikers:_,tabbableLink:w,showLikesModal:A}=m,S=Xx(E);y.useEffect(()=>{E([{type:"userLikedContent",value:i}])},[i]);const B=y.useMemo(()=>Qx(n,e6),[n]),F=k=>{if(k.preventDefault(),k.stopPropagation(),E([{type:"showLikers",value:!1}]),Io)return K1(),!1;if(K1(),T||!s)return!1;Io=setTimeout(L,350)},L=async()=>{if(K1(),T||!s)return!1;let k=b?v-1:v+1;k<0&&(k=0),E([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:k},{type:"userLikedContent",value:!b}]);try{if(a&&a.slugs){const I=Zx(a.slugs);b?await d(I):await c({...I,payload:{contentPath:window.location.pathname}})}}catch{E([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:i}])}finally{E([{type:"ignoreInteractions",value:!1}])}},R=()=>{G1=setTimeout(()=>{E([{type:"showLikers",value:!1}])},500)},N=()=>{G1&&clearTimeout(G1)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:k=>{k.key==="Escape"&&E([{type:"showLikers",value:!1}])},onMouseEnter:()=>{N(),E([{type:"showLikers",value:!0}])},onMouseLeave:()=>{R()}},h.jsxs(h.Fragment,{children:[h.jsx(fs,{className:J("discussion-button text-medium action-button likes-button",{"show-spinner":T,"is-liked":b,disabled:!s}),icon:{icon:b?"heart":"heart_empty",animate:"bounce"},shortText:`${v}`,disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${a.type}-click`,onClick:F,screenreaderText:s?p.formatMessage({id:`discussion_likes_${b?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${a.type}`})}):!1,"aria-pressed":b,children:h.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:v})})}),n&&h.jsxs(h.Fragment,{children:[h.jsx(ut,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{N()},onBlur:()=>R,onClick:k=>{var j;k.preventDefault(),k.stopPropagation(),N(),E([{type:"showLikers",value:!0}]);const I=(j=k.currentTarget.nextSibling)==null?void 0:j.childNodes[0];if(I){const z=I.querySelector("li:first-child a");z&&(E([{type:"tabbableLink",value:0}]),setTimeout(()=>{z.focus()},100))}},onKeyDown:k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),R())},"aria-expanded":_,"aria-controls":`likes-tooltip-${a.slug}`,children:h.jsx(ut,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:a.type})})}),h.jsx(Da,{id:`likes-tooltip-${a.slug}`,isOpen:_,isLoading:n.length===0,children:n.length&&h.jsxs("ul",{children:[B.map((k,I)=>{if(typeof k=="string")return null;const j={};return w!==I&&(j.tabIndex=-1),h.jsx("li",{"data-index":I,children:h.jsx(Ki,{href:k.id?`/profiles/${k.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>N(),onKeyDown:S,...j,children:k.name?k.name:h.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},k.id||window.btoa(k.name||""))}),h.jsx("li",{"data-index":B.length,className:"show-all",children:h.jsx(je,{variant:"tertiary",size:{mobile:"small",769:"medium"},onClick:()=>{N(),R(),E([{type:"showLikesModal",value:!0}])},onKeyDown:S,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),A&&h.jsx(Ms,{children:h.jsx(y.Suspense,{children:h.jsx(Jx,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:A,functions:{onClose:()=>E([{type:"showLikesModal",value:!1}]),likes:{list:f}}})})})]})]}))},eh=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},$s=e=>{var t,n,r,i,a,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:(i=e==null?void 0:e.data)==null?void 0:i.location,image:{thumbnail:((a=e==null?void 0:e.data)==null?void 0:a.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function t6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=vt.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=X0({activity:$x(o),user:a});return ws(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=X0({activity:o,user:a});r.setQueryData(i,ws(c,u,{replace:!0})),setTimeout(()=>{bp(c.id,"activity")},0)}});return s}function n6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutateAsync:s}=vt.useMutation({mutationFn:e,onMutate:({options:o,title:l,settings:u})=>t(c=>{const d=J0({activity:Q0({title:l,options:o,settings:u,user:a}),options:o,user:a});return ws(d,c)}),onError:(o,l,u)=>{const c=d=>{const f=d.pages;return f.forEach(p=>{p.results=p.results.filter(g=>g.id!==Ui)}),{...d,pages:f}};r.setQueryData(i,d=>c(d)),n&&n(o,l,u)},onSuccess:async(o,{options:l,title:u,settings:c},d)=>{const f=o,p=J0({activity:Q0({title:u,options:l,settings:c,user:a,correctActivityId:f.body.id}),options:l.map((g,m)=>({...g,id:f.body.options[m]})),user:a});r.setQueryData(i,ws(p,d,{replace:!0})),setTimeout(()=>{bp(f.body.id,"activity")},0)}});return s}function r6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=vt.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:l})=>t(u=>{const c=Dn(o,u);return c&&O4({activity:c,reactionId:l,user:a}),u}),onError:n,onSuccess:(o,{activityId:l,reactionId:u},c)=>{const d=Dn(l,c);d&&N4({activity:d,reactionId:u,correctReactionId:o.body.id,user:a}),r.setQueryData(i,c)}});return s}function i6({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({activityId:i,content:a,title:s})=>t(o=>{const l=Dn(i,o);return l&&(l.content=a,l.title=s),o}),onError:n});return r}function a6({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a,pin:s,unpin:o,createVote:l,createPoll:u,removeVote:c,removePoll:d},queryKey:f,filterOption:p}){const g=vt.useQueryClient(),m=qc(),E={queryClient:g,queryKey:f},v={mutationHandlers:{error:gp(E),mutate:vp(E)},user:m,...E},b=t6({...v,mutationFn:e}),T=i6({...v,mutationFn:t}),_=s6({...v,mutationFn:n}),w=rg({...v,mutationFn:i}),A=c6({...v,mutationFn:a}),S=l6({...v,mutationFn:s}),B=d6({...v,mutationFn:o}),F=r6({...v,mutationFn:l}),L=n6({...v,mutationFn:u}),R=u6({...v,mutationFn:c}),N=rg({...v,mutationFn:d}),{activities:k,...I}=o6({queryKey:f,queryFn:r,filterOption:p});return{activities:k,mutations:{create:b,edit:T,remove:w,like:_,unlike:A,pin:S,unpin:B,createVote:F,createPoll:L,removeVote:R,removePoll:N},user:m,...I}}function s6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=vt.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Dn(s,o);return l&&gc({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Dn(o,l);u&&gc({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function o6({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}=vt.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:yp(r),error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}}function l6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=vt.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Dn(s,o);return l&&vc({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Dn(o,l);u&&vc({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function rg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(a=>F4(i,a)),onError:n});return r}function u6({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=vt.useMutation({mutationFn:e,onMutate:({activityId:a,reactionId:s})=>t(o=>{const l=Dn(a,o);return l&&I4({activity:l,reactionId:s}),o}),onError:n});return i}function c6({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=vt.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Dn(a,s);return o&&P4({activity:o,user:r}),s}),onError:n});return i}function d6({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=vt.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Dn(a,s);return o&&R4({activity:o,user:r}),s}),onError:n});return i}const f6=280,_p=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?bs(e,typeof t=="number"?t:f6):e;i=i.trim();const a=`<br>
64
64
 
65
- `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await Ky({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Cp=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),h6=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},p6=(e,t)=>e?typeof e=="string"?e:e[t]:"";const m6=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:c},profile:d,locale:f=xs})=>{const p=he.useIntl(),[g,m]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[E,v]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),b={...a,...c},{activities:T,error:_,fetchNextPage:w,hasNextPage:A,isLoading:S,mutations:{create:B,edit:F,remove:L,like:R,unlike:N,pin:k,unpin:I,createPoll:j,createVote:z,removeVote:P,removePoll:ae}}=a6({queryKey:[e,t,"activities",g],queryFns:b,filterOption:g[0]});y.useEffect(()=>{i&&v(E.concat(i==null?void 0:i.map(({slug:Y,name:M})=>({id:Y,text:M,type:"category"}))))},[i]);const[X,O]=y.useState(null),C=()=>{O(T.length),w()};return B4(),_?h.jsx(zr,{variant:"error",text:_.message}):h.jsxs("section",{className:"activities-feed",children:[h.jsx(d0,{isCard:!0,parentId:t,categories:i,form:{content:{type:Ls.Post,slugs:{}},functions:{create:B,createPoll:j,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),h.jsx(q4,{className:"activities-feed-filtering",options:E.map(({id:Y,text:M})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${M}`,defaultMessage:M})})),defaultOptions:g.map(({id:Y,text:M})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${M}`,defaultMessage:M})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:Y,previous:M})=>{if(Y[0]===M[0])return;m([E.find(U=>U.id===Y[0])]);const H=E.find(U=>U.id===Y[0]);if(!H)return;const q=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${H.text}`,defaultMessage:H.text})})}});document.dispatchEvent(q)},gtm:{context:"activitiesFeed_sorting"}}),T==null?void 0:T.map((Y,M)=>{var be,ie,me,we,Ie,Xe,tt,qe,Ke;const{id:H,own_reactions:q,latest_reactions:U,reaction_counts:$,mentioned_users:oe,total_replies:Z,additional_data:ne}=Y,se=(((be=U==null?void 0:U.like)==null?void 0:be.length)||0)>0,ee=(((ie=q==null?void 0:q.like)==null?void 0:ie.length)||0)>0,xe=ee?q==null?void 0:q.like[0].id:"",ke=se?(me=U==null?void 0:U.like)==null?void 0:me.map(Fe=>{var te,pe,De;return{id:(te=Fe==null?void 0:Fe.user)==null?void 0:te.id,name:(De=(pe=Fe==null?void 0:Fe.user)==null?void 0:pe.data)==null?void 0:De.name}}):!1;return h.jsx(y.Fragment,{children:h.jsx(Il,{content:{type:Y.verb,title:Y==null?void 0:Y.title,body:Y==null?void 0:Y.content,createdAt:(Y==null?void 0:Y.time)||"",slugs:{question:`${e}/${t}`,answer:H},slug:H,author:$s(Y==null?void 0:Y.actor),userLiked:ee,likes:($==null?void 0:$.like)||0,comments:Z||0,peopleWhoLiked:ke,data:{mentions:oe,...ne||{}},pinned:($==null?void 0:$.pin)&&($==null?void 0:$.pin)>0||!1,categories:Cp((Y==null?void 0:Y.categories)||[],i||[]),pollOptions:D4(Y,f),pollSettings:{showRemoveVote:(we=Y==null?void 0:Y.settings)==null?void 0:we.show_remove_vote,allowMultipleVotes:(Ie=Y==null?void 0:Y.settings)==null?void 0:Ie.allow_multiple_votes,deadlineAt:(Xe=Y==null?void 0:Y.settings)==null?void 0:Xe.deadline_at,hideParticipants:(tt=Y==null?void 0:Y.settings)==null?void 0:tt.hide_participants,numberOfWinners:(qe=Y==null?void 0:Y.settings)==null?void 0:qe.number_of_winners,resultsVisibility:(Ke=Y==null?void 0:Y.settings)==null?void 0:Ke.results_visibility}},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>L({activityId:H}),updateContent:(Fe,{body:te,title:pe})=>F({activityId:H,content:te,title:pe})},likes:{createLike:()=>R({activityId:H}),deleteLike:()=>N({activityId:H,reactionId:xe}),listLikes:Fe=>u.list({activityId:H,...Fe})},comments:{openComments:()=>null},pins:{createPin:()=>k({activityId:H}),deletePin:()=>I({activityId:H,reactionId:U==null?void 0:U.pin[0].id})},polls:{createVote:({reactionId:Fe})=>z({activityId:H,reactionId:Fe}),removeVote:({reactionId:Fe})=>P({activityId:H,reactionId:Fe}),removePoll:()=>ae({activityId:H})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:M===X,userHasOwnerPermissions:r,userHasPermissions:n,badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:t||""},{scope:ln.Platform,area:"all"}]},basePath:e,parentId:t})},H)}),!S&&h.jsx(gl,{hasNextPage:A,loadNextPage:C,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),T.length===0&&!S&&h.jsx(Ln,{className:"no-activities",variant:"muted",icon:"text--input",children:g[0].type==="category"?h.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):h.jsxs(h.Fragment,{children:[h.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),h.jsx("p",{children:h.jsx(je,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),h.jsx(f0,{form:d})]})},g6={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"},v6={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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"Testing 12..."}},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function E6({parentId:e,isMember:t,formFunctions:n,leave:r,join:i,meta:a}){const s=he.useIntl();return h.jsx(d0,{form:{content:{type:Ge.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1,...a},placeholder:s.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}})}function y6({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=he.useIntl(),a=()=>{n(r),t()};return h.jsx(gl,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function b6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=vt.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=eg({reply:zx(o),user:a});return ws(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=eg({reply:o,user:a});r.setQueryData(i,ws(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{bp(c.id,"reply")},0)}});return s}function T6({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=Dn(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function _6({replies:e,user:t,replyType:n}){return!e||!(t!=null&&t.id)?[]:e.map(({id:r,own_children:i,latest_children:a,children_counts:s,data:o,created_at:l,parent:u,...c})=>{var E,v,b,T;const d=(((E=i==null?void 0:i.like)==null?void 0:E.length)||0)>0,f=(((v=a==null?void 0:a.like)==null?void 0:v.length)||0)>0,p=d?(b=i==null?void 0:i.like)==null?void 0:b.find(_=>{var w;return((w=_==null?void 0:_.user)==null?void 0:w.id)===(t==null?void 0:t.id)}):!1,g=typeof p=="object"?(p==null?void 0:p.id)??"":"",m=f?(T=a==null?void 0:a.like)==null?void 0:T.map(_=>{var w,A,S;return{id:(w=_==null?void 0:_.user)==null?void 0:w.id,name:(S=(A=_==null?void 0:_.user)==null?void 0:A.data)==null?void 0:S.name}}):!1;return{user:c==null?void 0:c.user,body:n===Yt.Courses?Vx({content:o.content}):x6(o),createdAt:l,data:C6(o),likeId:g,liked:f,likes:(s==null?void 0:s.like)||0,peopleWhoLiked:m,replyId:r,parent:u,userLiked:!!p}})}function C6(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 x6(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function L4({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s,type:o=Yt.Communities}){const l=vt.useQueryClient(),u=qc(),c={queryClient:l,queryKey:s},d={mutationHandlers:{error:gp(c),mutate:vp(c)},user:u,...c},f=b6({...d,mutationFn:e}),p=T6({...d,mutationFn:t}),g=w6({...d,mutationFn:n}),m=S6({...d,mutationFn:i}),E=k6({...d,mutationFn:a}),{replies:v,...b}=A6({queryKey:s,queryFn:r});return{replies:_6({replies:v,user:u,replyType:o}),mutations:{create:f,edit:p,remove:m,like:g,unlike:E},user:u,...b}}function w6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=vt.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Dn(s,o);return l&&tg({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Dn(o,l);u&&tg({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function A6({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=vt.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:yp(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function S6({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>F4(i,a)),onError:n});return r}function k6({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=vt.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=Dn(a,s);return o&&qx({reply:o,user:r}),s}),onError:n});return i}const D6=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o},type:l=Yt.Communities})=>{const u=he.useIntl(),c=3,{replies:d,fetchNextPage:f,hasNextPage:p,isLoading:g,mutations:{create:m,edit:E,like:v,remove:b,unlike:T}}=L4({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:A=>a.list({...A,reactionId:i})},type:l});Jh([g]);const[_,w]=y.useState(!0);return h.jsxs(h.Fragment,{children:[(d==null?void 0:d.length)>=c&&h.jsx(je,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>w(!_),children:u.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:d==null?void 0:d.length})}),_&&h.jsx(v3,{loadMore:{isLoading:g,hasNextPage:p,loadNextPage:()=>f()},form:{parentId:r,content:{type:Ge.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(A,{body:S})=>m({activityId:e,replyId:i,content:S}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:A,likes:S,data:B,body:F,createdAt:L,userLiked:R,peopleWhoLiked:N,parent:k,user:I,likeId:j})=>h.jsx(Il,{isCommunity:!0,content:{id:A,type:Ge.Reply,body:F,createdAt:L,slugs:{question:`${t}/${r}`,answer:e,reply:k},slug:"",author:$s(I),userLiked:R,likes:S,peopleWhoLiked:l===Yt.Courses?!1:N,data:B},forceHide:{shareLink:l===Yt.Courses},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:A}),updateContent:(z,{body:P})=>E({replyId:A,content:P})},likes:{createLike:()=>v({replyId:A}),deleteLike:()=>T({replyId:A,reactionId:j}),listLikes:z=>o.list({replyId:A,...z})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:r||""},{scope:ln.Platform,area:"all"}]},disableMentions:l===Yt.Courses,basePath:t,parentId:r},A)):null})]})};function O6({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s,type:o=Yt.Communities}){const{body:l,data:u,likeId:c,likes:d,peopleWhoLiked:f,replyId:p,createdAt:g,user:m,userLiked:E}=s,{edit:v,like:b,remove:T,unlike:_}=e.mutations;return h.jsx(h3,{children:h.jsx(Il,{isCommunity:!0,content:{id:p,type:Ge.Reply,body:l,createdAt:g,slugs:{question:`${n}/${a}`,answer:t,reply:p},slug:p,author:$s(m),userLiked:E,likes:d,peopleWhoLiked:o===Yt.Courses?!1:f,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>T({replyId:p}),updateContent:(w,{body:A})=>v({replyId:p,content:A})},likes:{createLike:()=>b({replyId:p}),deleteLike:()=>_({replyId:p,reactionId:c}),listLikes:w=>e.likes.list({replyId:p,...w})},comments:{},form:e.form},forceHide:{shareLink:o===Yt.Courses},badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:a||""},{scope:ln.Platform,area:"all"}]},disableMentions:o===Yt.Courses,children:h.jsx(D6,{basePath:n,parentId:a,activityId:t,replyId:p,isMember:i,functions:e,type:o}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},p)},p)}const $4=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:c,showReplies:d,type:f=Yt.Communities})=>{const{fetchNextPage:p,hasNextPage:g,isLoading:m,replies:E,mutations:{create:v,remove:b,edit:T,like:_,unlike:w}}=L4({queryKey:[t,n,e,"replies"],queryFns:u,type:f}),[A,S]=y.useState(null);Jh([m]),B4();const B={create:(F,L)=>{const{body:R}=L;v({activityId:e,content:R})},...a};return h.jsxs("section",{className:"replies-feed",children:[h.jsx(g3,{type:"comment",responses:r,isLoading:m}),d?h.jsxs(h.Fragment,{children:[h.jsx(E6,{parentId:n,isMember:i,join:s,leave:o,formFunctions:B,meta:{isAutoFocused:f===Yt.Courses||!1}}),E==null?void 0:E.map((F,L)=>h.jsx(O6,{activityId:e,basePath:t,focus:A===L,formFns:{form:a,likes:l,reactions:u,mutations:{remove:b,edit:T,like:_,unlike:w}},isMember:i,parentId:n,reply:F,type:f},F.replyId)),m?h.jsx(h.Fragment,{children:" "}):h.jsx(y6,{hasNextPage:g,fetchNextPage:p,setFocusReplyIndex:S,totalReplies:E.length})]}):h.jsx(Ln,{children:h.jsx(he.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),h.jsx(f0,{form:c})]})};function N6({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=vt.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:c=>(c==null?void 0:c.next)||null}),l=yp(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function I6({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=N6({queryKey:t,queryFn:e});return{likes:n,...r}}function j4({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=I6({queryKey:[e,t,n,"likes"],queryFns:i.likes});y.useEffect(()=>{l()},[l]);const u=a.map(({user:c})=>c).map(c=>c?$s(c):void 0).filter(c=>c&&typeof c!="string");return h.jsx("section",{className:"likes-feed",children:h.jsx(f3,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const H4=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=he.useIntl();return h.jsx(vi,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:J("profile-modal in-portal",i,{open:e}),maxWidth:600,children:h.jsx(j4,{...a,likeCount:r??0,functions:{likes:n}})})},P6=Object.freeze(Object.defineProperty({__proto__:null,default:H4},Symbol.toStringTag,{value:"Module"})),R6={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 F6=3e3,U4=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=he.useIntl(),r="discussion_share_copy_link",[i,a]=y.useState({isOpen:!1,isCopied:!1});return h.jsxs("li",{className:"share-link-wrapper",children:[h.jsx(fs,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},F6)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),h.jsx(Da,{className:J({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const na="discussion_",z4=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,edit:s,shareLink:o,moreMenu:l})=>{const u=he.useIntl(),c=[];return l&&l.reportData&&c.push({text:u.formatMessage({id:`${na}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${na}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${na}report_body`},{contentType:n||"",contentSlug:l&&l.reportData&&l.contentSlug||"",contentUrl:l&&l.reportData&&l.reportData.contentUrl||""}))}`,icon:"flag"}),h.jsxs("ul",{className:J("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?h.jsx(M4,{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||""}):h.jsx(h.Fragment,{}),i?h.jsx("li",{children:h.jsx(fs,{shortText:`${i.count??0}`,onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:u.formatMessage({id:`${na}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${na}comments${i.count===null?"_loading":""}`},{count:i.count})})}):h.jsx(h.Fragment,{}),a?h.jsx("li",{children:h.jsx(fs,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${na}reply`})})}):h.jsx(h.Fragment,{}),h.jsxs("div",{className:"action-bar-right",children:[s?h.jsx("li",{children:h.jsx(fs,{styling:{muted:!0},onClick:s.onClick,icon:{icon:"pencil-paper"},"data-testid":"edit",children:u.formatMessage({id:`${na}action_edit`})})}):h.jsx(h.Fragment,{}),o?h.jsx(U4,{url:o.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):h.jsx(h.Fragment,{})]}),l?h.jsx(Ec,{element:"li",id:`more-${l.contentSlug}`,options:[...l.options||[],...c]}):h.jsx(h.Fragment,{})]})};const B6=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=he.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(ut,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),h.jsx("ul",{className:J("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),h.jsxs("li",{children:[s&&h.jsx(ut,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),h.jsx(Ki,{href:s?void 0:a,...l,children:bs(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const xp=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{if(!n)return h.jsx(h.Fragment,{});let l=n.split("//");l.length>1?l=l[1]:l=l[0],l=l.split("/"),l=l[0];const{context:u="EnrichedLink",event:c="enriched-link-click"}=s??{};return h.jsxs("aside",{className:J("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:d=>{if(d.preventDefault(),d.stopPropagation(),a){a(d);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":c,children:[h.jsx("small",{children:l}),h.jsx("p",{className:"title text-medium",children:h.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),i&&e!=="condensed"?h.jsx("p",{className:"text-small",children:i}):h.jsx(h.Fragment,{}),t&&t.src?h.jsx("p",{className:"img",children:h.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):h.jsx(h.Fragment,{})]})};const q4=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",styling:o,gtm:l})=>{const u=he.useIntl(),{muted:c,large:d}=o||{},f=n?[{id:"all",text:typeof n!="boolean"&&n.text||u.formatMessage({id:"filters_all"})},...e]:e,[p,g]=y.useState(n?["all"]:t.length?t.map(b=>b.id):[]),[m,E]=y.useState(0),v=(b,T)=>{let _=[];p.includes(b)&&!a?_=p.filter(w=>w!==b):b==="all"?_=["all"]:r?_=[...p.filter(w=>w!=="all"),b]:_=[b],g(w=>(i&&typeof i=="function"&&i({current:_,previous:w}),_)),T&&typeof T=="function"&&T()};return h.jsx("ul",{className:J("filters",s),children:f.map(({id:b,text:T,disabled:_=!1,callback:w=()=>{},content:A},S)=>{let B={tabIndex:m===S?0:-1};return _&&(B={disabled:!0,"aria-label":u.formatMessage({id:"filters_disabled"},{name:T})}),h.jsx("li",{children:h.jsx("button",{"data-gtm-event-context":(l==null?void 0:l.context)||"filters","data-gtm-event-type":(l==null?void 0:l.type)||`${T.toLowerCase().replace(" ","-")}-click`,className:J(b,{selected:p.includes(b),large:d,muted:c}),onClick:F=>{F.preventDefault(),F.stopPropagation(),v(b,w)},onKeyDown:F=>{var k,I;let L=S+1,R,N;switch(F.code){case"Enter":case"Space":F.preventDefault(),F.stopPropagation(),v(b,w);break;case"ArrowLeft":case"ArrowRight":F.preventDefault(),F.stopPropagation(),F.code==="ArrowLeft"?(L=S-1,L<0&&(L=f.length-1)):L>=f.length&&(L=0),E(L),R=F.currentTarget.closest("li"),N=(k=R==null?void 0:R.parentElement)==null?void 0:k.children[L],(I=N==null?void 0:N.querySelector("button"))==null||I.focus();break}},"aria-selected":p.includes(b),...B,children:A||T})},b)})})},M6=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const $l="languageSwitcher_",L6=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=he.useIntl(),{updateLanguage:c=()=>{}}=y.useContext(ap),[d,f]=y.useState(e);if(y.useEffect(()=>{e!==d&&f(e)},[e]),!r||!Object.values(r).some(E=>E&&E.post_name))return null;const g=Object.keys(r),m=d!==e;return h.jsxs("div",{className:J("language-switcher text-small",s,l),children:[h.jsxs("nav",{children:[s!=="short"&&h.jsx("p",{children:o||u.formatMessage({id:`${$l}label`})}),h.jsx("ul",{children:g.map(E=>{var T;if(!ju[E])return null;const v=(T=r[E])==null?void 0:T.post_name;let b={className:E};if(d===E)b["aria-label"]=u.formatMessage({id:`${$l}selected`},{language:ju[E]});else{const _=M6(E,v,a);b={...b,href:typeof _=="string"?_:_.url,onClick:w=>{f(E),c(E),typeof i<"u"&&(w.preventDefault(),w.stopPropagation(),i(E,typeof _=="string"?_:_.urlForRouter))}}}return h.jsx("li",{children:h.jsx(Ki,{...b,fallbackElement:"span",children:ju[E]})},E)})}),s!=="short"&&!m&&h.jsx("p",{children:u.formatMessage({id:`${$l}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&h.jsx("small",{children:u.formatMessage({id:`${$l}disclaimer`},{email:rs.support,link:E=>{const v=`mailto:${E}`;return h.jsx("a",{href:v,children:E})}})})]})};const Y1=he.createIntl({locale:"en",messages:Wi}),gl=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Y1.formatMessage({id:"loadMore_button"}),endOfFeed:Y1.formatMessage({id:"loadMore_endOfFeed"}),error:Y1.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,d]=y.useState(""),f=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?d(g.message):d("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:h.jsx("footer",{className:J("load-more",l),children:!c&&e?h.jsx(je,{variant:r,size:i,styling:a,icon:s,onClick:f,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?h.jsx("p",{children:o.endOfFeed}):c&&h.jsx("p",{className:"error",children:o.error})})};const wp=({variant:e="default",version:t="default",className:n="",...r})=>h.jsx("p",{className:"logo-wrapper",children:h.jsx("a",{href:"/home/",className:J("logo",e,t,n),...r,children:h.jsx(ut,{children:h.jsx(he.FormattedMessage,{id:"apolitical"})})})});let jl=!1;const Ec=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=he.useIntl(),a=y.useRef(null),[s,o]=y.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:a,className:J("more-menu text-medium",r),children:h.jsxs(h.Fragment,{children:[h.jsx(je,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),h.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:d,icon:f,...p},g)=>{const m={...p,onClick:E=>{o(!1),typeof c=="function"&&c(E)},onFocus:()=>{jl&&(clearTimeout(jl),jl=!1)},onBlur:()=>{jl=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),h.jsx("li",{className:"more-menu-list-item",children:h.jsx(je,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...m,children:d})},`${window.btoa(d)}_${g}`)})})]})})},$6=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const j6=y.lazy(()=>Promise.resolve().then(()=>B7)),H6=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],W4=({activeLink:e,profile:t})=>{const n=he.useIntl(),r=y.useContext(Ht),i=r&&typeof r.id=="string";return h.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[H6.map(({key:a,href:s})=>{const o=$6(s,e),l={};return o&&(l["aria-current"]="page"),h.jsx("li",{className:J(a,{active:o}),children:h.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&h.jsx(j6,{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"})]})},to=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,U6=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${to(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(`${to(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(`${to(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
+ `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await Ky({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Cp=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),h6=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},p6=(e,t)=>e?typeof e=="string"?e:e[t]:"";const m6=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:c},profile:d,locale:f=xs})=>{const p=he.useIntl(),[g,m]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[E,v]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),b={...a,...c},{activities:T,error:_,fetchNextPage:w,hasNextPage:A,isLoading:S,mutations:{create:B,edit:F,remove:L,like:R,unlike:N,pin:k,unpin:I,createPoll:j,createVote:z,removeVote:P,removePoll:ae}}=a6({queryKey:[e,t,"activities",g],queryFns:b,filterOption:g[0]});y.useEffect(()=>{i&&v(E.concat(i==null?void 0:i.map(({slug:Y,name:M})=>({id:Y,text:M,type:"category"}))))},[i]);const[X,O]=y.useState(null),C=()=>{O(T.length),w()};return B4(),_?h.jsx(zr,{variant:"error",text:_.message}):h.jsxs("section",{className:"activities-feed",children:[h.jsx(d0,{isCard:!0,parentId:t,categories:i,form:{content:{type:Ls.Post,slugs:{}},functions:{create:B,createPoll:j,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),h.jsx(q4,{className:"activities-feed-filtering",options:E.map(({id:Y,text:M})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${M}`,defaultMessage:M})})),defaultOptions:g.map(({id:Y,text:M})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${M}`,defaultMessage:M})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:Y,previous:M})=>{if(Y[0]===M[0])return;m([E.find(U=>U.id===Y[0])]);const H=E.find(U=>U.id===Y[0]);if(!H)return;const q=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${H.text}`,defaultMessage:H.text})})}});document.dispatchEvent(q)},gtm:{context:"activitiesFeed_sorting"}}),T==null?void 0:T.map((Y,M)=>{var be,ie,me,we,Ie,Xe,tt,qe,Ke;const{id:H,own_reactions:q,latest_reactions:U,reaction_counts:$,mentioned_users:oe,total_replies:Z,additional_data:ne}=Y,se=(((be=U==null?void 0:U.like)==null?void 0:be.length)||0)>0,ee=(((ie=q==null?void 0:q.like)==null?void 0:ie.length)||0)>0,xe=ee?q==null?void 0:q.like[0].id:"",ke=se?(me=U==null?void 0:U.like)==null?void 0:me.map(Fe=>{var te,pe,De;return{id:(te=Fe==null?void 0:Fe.user)==null?void 0:te.id,name:(De=(pe=Fe==null?void 0:Fe.user)==null?void 0:pe.data)==null?void 0:De.name}}):!1;return h.jsx(y.Fragment,{children:h.jsx(Il,{content:{type:Y.verb,title:Y==null?void 0:Y.title,body:Y==null?void 0:Y.content,createdAt:(Y==null?void 0:Y.time)||"",slugs:{question:`${e}/${t}`,answer:H},slug:H,author:$s(Y==null?void 0:Y.actor),userLiked:ee,likes:($==null?void 0:$.like)||0,comments:Z||0,peopleWhoLiked:ke,data:{mentions:oe,...ne||{}},pinned:($==null?void 0:$.pin)&&($==null?void 0:$.pin)>0||!1,categories:Cp((Y==null?void 0:Y.categories)||[],i||[]),pollOptions:D4(Y,f),pollSettings:{showRemoveVote:(we=Y==null?void 0:Y.settings)==null?void 0:we.show_remove_vote,allowMultipleVotes:(Ie=Y==null?void 0:Y.settings)==null?void 0:Ie.allow_multiple_votes,deadlineAt:(Xe=Y==null?void 0:Y.settings)==null?void 0:Xe.deadline_at,hideParticipants:(tt=Y==null?void 0:Y.settings)==null?void 0:tt.hide_participants,numberOfWinners:(qe=Y==null?void 0:Y.settings)==null?void 0:qe.number_of_winners,resultsVisibility:(Ke=Y==null?void 0:Y.settings)==null?void 0:Ke.results_visibility}},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>L({activityId:H}),updateContent:(Fe,{body:te,title:pe})=>F({activityId:H,content:te,title:pe})},likes:{createLike:()=>R({activityId:H}),deleteLike:()=>N({activityId:H,reactionId:xe}),listLikes:Fe=>u.list({activityId:H,...Fe})},comments:{openComments:()=>null},pins:{createPin:()=>k({activityId:H}),deletePin:()=>I({activityId:H,reactionId:U==null?void 0:U.pin[0].id})},polls:{createVote:({reactionId:Fe})=>z({activityId:H,reactionId:Fe}),removeVote:({reactionId:Fe})=>P({activityId:H,reactionId:Fe}),removePoll:()=>ae({activityId:H})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:M===X,userHasOwnerPermissions:r,userHasPermissions:n,badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:t||""},{scope:ln.Platform,area:"all"}]},basePath:e,parentId:t})},H)}),!S&&h.jsx(gl,{hasNextPage:A,loadNextPage:C,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),T.length===0&&!S&&h.jsx(Ln,{className:"no-activities",variant:"muted",icon:"text--input",children:g[0].type==="category"?h.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):h.jsxs(h.Fragment,{children:[h.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),h.jsx("p",{children:h.jsx(je,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),h.jsx(f0,{form:d})]})},g6={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"},v6={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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"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:{original:"Testing 12..."}},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function E6({parentId:e,isMember:t,formFunctions:n,leave:r,join:i,meta:a}){const s=he.useIntl();return h.jsx(d0,{form:{content:{type:Ge.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1,...a},placeholder:s.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}})}function y6({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=he.useIntl(),a=()=>{n(r),t()};return h.jsx(gl,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function b6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=vt.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=eg({reply:zx(o),user:a});return ws(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=eg({reply:o,user:a});r.setQueryData(i,ws(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{bp(c.id,"reply")},0)}});return s}function T6({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=Dn(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function _6({replies:e,user:t,replyType:n}){return!e||!(t!=null&&t.id)?[]:e.map(({id:r,own_children:i,latest_children:a,children_counts:s,data:o,created_at:l,parent:u,...c})=>{var E,v,b,T;const d=(((E=i==null?void 0:i.like)==null?void 0:E.length)||0)>0,f=(((v=a==null?void 0:a.like)==null?void 0:v.length)||0)>0,p=d?(b=i==null?void 0:i.like)==null?void 0:b.find(_=>{var w;return((w=_==null?void 0:_.user)==null?void 0:w.id)===(t==null?void 0:t.id)}):!1,g=typeof p=="object"?(p==null?void 0:p.id)??"":"",m=f?(T=a==null?void 0:a.like)==null?void 0:T.map(_=>{var w,A,S;return{id:(w=_==null?void 0:_.user)==null?void 0:w.id,name:(S=(A=_==null?void 0:_.user)==null?void 0:A.data)==null?void 0:S.name}}):!1;return{user:c==null?void 0:c.user,body:n===Yt.Courses?Vx({content:o.content}):x6(o),createdAt:l,data:C6(o),likeId:g,liked:f,likes:(s==null?void 0:s.like)||0,peopleWhoLiked:m,replyId:r,parent:u,userLiked:!!p}})}function C6(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 x6(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function L4({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s,type:o=Yt.Communities}){const l=vt.useQueryClient(),u=qc(),c={queryClient:l,queryKey:s},d={mutationHandlers:{error:gp(c),mutate:vp(c)},user:u,...c},f=b6({...d,mutationFn:e}),p=T6({...d,mutationFn:t}),g=w6({...d,mutationFn:n}),m=S6({...d,mutationFn:i}),E=k6({...d,mutationFn:a}),{replies:v,...b}=A6({queryKey:s,queryFn:r});return{replies:_6({replies:v,user:u,replyType:o}),mutations:{create:f,edit:p,remove:m,like:g,unlike:E},user:u,...b}}function w6({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=vt.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Dn(s,o);return l&&tg({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Dn(o,l);u&&tg({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function A6({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=vt.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:yp(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function S6({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=vt.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>F4(i,a)),onError:n});return r}function k6({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=vt.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=Dn(a,s);return o&&qx({reply:o,user:r}),s}),onError:n});return i}const D6=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o},type:l=Yt.Communities})=>{const u=he.useIntl(),c=3,{replies:d,fetchNextPage:f,hasNextPage:p,isLoading:g,mutations:{create:m,edit:E,like:v,remove:b,unlike:T}}=L4({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:A=>a.list({...A,reactionId:i})},type:l});Jh([g]);const[_,w]=y.useState(!0);return h.jsxs(h.Fragment,{children:[(d==null?void 0:d.length)>=c&&h.jsx(je,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>w(!_),children:u.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:d==null?void 0:d.length})}),_&&h.jsx(v3,{loadMore:{isLoading:g,hasNextPage:p,loadNextPage:()=>f()},form:{parentId:r,content:{type:Ge.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(A,{body:S})=>m({activityId:e,replyId:i,content:S}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:A,likes:S,data:B,body:F,createdAt:L,userLiked:R,peopleWhoLiked:N,parent:k,user:I,likeId:j})=>h.jsx(Il,{isCommunity:!0,content:{id:A,type:Ge.Reply,body:F,createdAt:L,slugs:{question:`${t}/${r}`,answer:e,reply:k},slug:"",author:$s(I),userLiked:R,likes:S,peopleWhoLiked:l===Yt.Courses?!1:N,data:B},forceHide:{shareLink:l===Yt.Courses},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:A}),updateContent:(z,{body:P})=>E({replyId:A,content:P})},likes:{createLike:()=>v({replyId:A}),deleteLike:()=>T({replyId:A,reactionId:j}),listLikes:z=>o.list({replyId:A,...z})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:r||""},{scope:ln.Platform,area:"all"}]},disableMentions:l===Yt.Courses,basePath:t,parentId:r},A)):null})]})};function O6({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s,type:o=Yt.Communities}){const{body:l,data:u,likeId:c,likes:d,peopleWhoLiked:f,replyId:p,createdAt:g,user:m,userLiked:E}=s,{edit:v,like:b,remove:T,unlike:_}=e.mutations;return h.jsx(h3,{children:h.jsx(Il,{isCommunity:!0,content:{id:p,type:Ge.Reply,body:l,createdAt:g,slugs:{question:`${n}/${a}`,answer:t,reply:p},slug:p,author:$s(m),userLiked:E,likes:d,peopleWhoLiked:o===Yt.Courses?!1:f,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>T({replyId:p}),updateContent:(w,{body:A})=>v({replyId:p,content:A})},likes:{createLike:()=>b({replyId:p}),deleteLike:()=>_({replyId:p,reactionId:c}),listLikes:w=>e.likes.list({replyId:p,...w})},comments:{},form:e.form},forceHide:{shareLink:o===Yt.Courses},badges:{showBadges:!0,scopes:[{scope:ln.Communities,area:a||""},{scope:ln.Platform,area:"all"}]},disableMentions:o===Yt.Courses,children:h.jsx(D6,{basePath:n,parentId:a,activityId:t,replyId:p,isMember:i,functions:e,type:o}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},p)},p)}const $4=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:c,showReplies:d,type:f=Yt.Communities})=>{const{fetchNextPage:p,hasNextPage:g,isLoading:m,replies:E,mutations:{create:v,remove:b,edit:T,like:_,unlike:w}}=L4({queryKey:[t,n,e,"replies"],queryFns:u,type:f}),[A,S]=y.useState(null);Jh([m]),B4();const B={create:(F,L)=>{const{body:R}=L;v({activityId:e,content:R})},...a};return h.jsxs("section",{className:"replies-feed",children:[h.jsx(g3,{type:"comment",responses:r,isLoading:m}),d?h.jsxs(h.Fragment,{children:[h.jsx(E6,{parentId:n,isMember:i,join:s,leave:o,formFunctions:B,meta:{isAutoFocused:f===Yt.Courses||!1}}),E==null?void 0:E.map((F,L)=>h.jsx(O6,{activityId:e,basePath:t,focus:A===L,formFns:{form:a,likes:l,reactions:u,mutations:{remove:b,edit:T,like:_,unlike:w}},isMember:i,parentId:n,reply:F,type:f},F.replyId)),m?h.jsx(h.Fragment,{children:" "}):h.jsx(y6,{hasNextPage:g,fetchNextPage:p,setFocusReplyIndex:S,totalReplies:E.length})]}):h.jsx(Ln,{children:h.jsx(he.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),h.jsx(f0,{form:c})]})};function N6({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=vt.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:c=>(c==null?void 0:c.next)||null}),l=yp(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function I6({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=N6({queryKey:t,queryFn:e});return{likes:n,...r}}function j4({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=I6({queryKey:[e,t,n,"likes"],queryFns:i.likes});y.useEffect(()=>{l()},[l]);const u=a.map(({user:c})=>c).map(c=>c?$s(c):void 0).filter(c=>c&&typeof c!="string");return h.jsx("section",{className:"likes-feed",children:h.jsx(f3,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const H4=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=he.useIntl();return h.jsx(vi,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:J("profile-modal in-portal",i,{open:e}),maxWidth:600,children:h.jsx(j4,{...a,likeCount:r??0,functions:{likes:n}})})},P6=Object.freeze(Object.defineProperty({__proto__:null,default:H4},Symbol.toStringTag,{value:"Module"})),R6={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 F6=3e3,U4=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=he.useIntl(),r="discussion_share_copy_link",[i,a]=y.useState({isOpen:!1,isCopied:!1});return h.jsxs("li",{className:"share-link-wrapper",children:[h.jsx(fs,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},F6)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),h.jsx(Da,{className:J({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const na="discussion_",z4=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,edit:s,shareLink:o,moreMenu:l})=>{const u=he.useIntl(),c=[];return l&&l.reportData&&c.push({text:u.formatMessage({id:`${na}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${na}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${na}report_body`},{contentType:n||"",contentSlug:l&&l.reportData&&l.contentSlug||"",contentUrl:l&&l.reportData&&l.reportData.contentUrl||""}))}`,icon:"flag"}),h.jsxs("ul",{className:J("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?h.jsx(M4,{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||""}):h.jsx(h.Fragment,{}),i?h.jsx("li",{children:h.jsx(fs,{shortText:`${i.count??0}`,onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:u.formatMessage({id:`${na}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${na}comments${i.count===null?"_loading":""}`},{count:i.count})})}):h.jsx(h.Fragment,{}),a?h.jsx("li",{children:h.jsx(fs,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${na}reply`})})}):h.jsx(h.Fragment,{}),s?h.jsx("li",{className:"edit-button-item",children:h.jsx(fs,{styling:{muted:!0},onClick:s.onClick,icon:{icon:"pencil-paper"},"data-testid":"edit",children:u.formatMessage({id:`${na}action_edit`})})}):h.jsx(h.Fragment,{}),o?h.jsx(U4,{url:o.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):h.jsx(h.Fragment,{}),l?h.jsx(Ec,{element:"li",id:`more-${l.contentSlug}`,options:[...l.options||[],...c]}):h.jsx(h.Fragment,{})]})};const B6=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=he.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(ut,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),h.jsx("ul",{className:J("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),h.jsxs("li",{children:[s&&h.jsx(ut,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),h.jsx(Ki,{href:s?void 0:a,...l,children:bs(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const xp=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{if(!n)return h.jsx(h.Fragment,{});let l=n.split("//");l.length>1?l=l[1]:l=l[0],l=l.split("/"),l=l[0];const{context:u="EnrichedLink",event:c="enriched-link-click"}=s??{};return h.jsxs("aside",{className:J("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:d=>{if(d.preventDefault(),d.stopPropagation(),a){a(d);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":c,children:[h.jsx("small",{children:l}),h.jsx("p",{className:"title text-medium",children:h.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),i&&e!=="condensed"?h.jsx("p",{className:"text-small",children:i}):h.jsx(h.Fragment,{}),t&&t.src?h.jsx("p",{className:"img",children:h.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):h.jsx(h.Fragment,{})]})};const q4=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",styling:o,gtm:l})=>{const u=he.useIntl(),{muted:c,large:d}=o||{},f=n?[{id:"all",text:typeof n!="boolean"&&n.text||u.formatMessage({id:"filters_all"})},...e]:e,[p,g]=y.useState(n?["all"]:t.length?t.map(b=>b.id):[]),[m,E]=y.useState(0),v=(b,T)=>{let _=[];p.includes(b)&&!a?_=p.filter(w=>w!==b):b==="all"?_=["all"]:r?_=[...p.filter(w=>w!=="all"),b]:_=[b],g(w=>(i&&typeof i=="function"&&i({current:_,previous:w}),_)),T&&typeof T=="function"&&T()};return h.jsx("ul",{className:J("filters",s),children:f.map(({id:b,text:T,disabled:_=!1,callback:w=()=>{},content:A},S)=>{let B={tabIndex:m===S?0:-1};return _&&(B={disabled:!0,"aria-label":u.formatMessage({id:"filters_disabled"},{name:T})}),h.jsx("li",{children:h.jsx("button",{"data-gtm-event-context":(l==null?void 0:l.context)||"filters","data-gtm-event-type":(l==null?void 0:l.type)||`${T.toLowerCase().replace(" ","-")}-click`,className:J(b,{selected:p.includes(b),large:d,muted:c}),onClick:F=>{F.preventDefault(),F.stopPropagation(),v(b,w)},onKeyDown:F=>{var k,I;let L=S+1,R,N;switch(F.code){case"Enter":case"Space":F.preventDefault(),F.stopPropagation(),v(b,w);break;case"ArrowLeft":case"ArrowRight":F.preventDefault(),F.stopPropagation(),F.code==="ArrowLeft"?(L=S-1,L<0&&(L=f.length-1)):L>=f.length&&(L=0),E(L),R=F.currentTarget.closest("li"),N=(k=R==null?void 0:R.parentElement)==null?void 0:k.children[L],(I=N==null?void 0:N.querySelector("button"))==null||I.focus();break}},"aria-selected":p.includes(b),...B,children:A||T})},b)})})},M6=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const $l="languageSwitcher_",L6=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=he.useIntl(),{updateLanguage:c=()=>{}}=y.useContext(ap),[d,f]=y.useState(e);if(y.useEffect(()=>{e!==d&&f(e)},[e]),!r||!Object.values(r).some(E=>E&&E.post_name))return null;const g=Object.keys(r),m=d!==e;return h.jsxs("div",{className:J("language-switcher text-small",s,l),children:[h.jsxs("nav",{children:[s!=="short"&&h.jsx("p",{children:o||u.formatMessage({id:`${$l}label`})}),h.jsx("ul",{children:g.map(E=>{var T;if(!ju[E])return null;const v=(T=r[E])==null?void 0:T.post_name;let b={className:E};if(d===E)b["aria-label"]=u.formatMessage({id:`${$l}selected`},{language:ju[E]});else{const _=M6(E,v,a);b={...b,href:typeof _=="string"?_:_.url,onClick:w=>{f(E),c(E),typeof i<"u"&&(w.preventDefault(),w.stopPropagation(),i(E,typeof _=="string"?_:_.urlForRouter))}}}return h.jsx("li",{children:h.jsx(Ki,{...b,fallbackElement:"span",children:ju[E]})},E)})}),s!=="short"&&!m&&h.jsx("p",{children:u.formatMessage({id:`${$l}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&h.jsx("small",{children:u.formatMessage({id:`${$l}disclaimer`},{email:rs.support,link:E=>{const v=`mailto:${E}`;return h.jsx("a",{href:v,children:E})}})})]})};const Y1=he.createIntl({locale:"en",messages:Wi}),gl=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Y1.formatMessage({id:"loadMore_button"}),endOfFeed:Y1.formatMessage({id:"loadMore_endOfFeed"}),error:Y1.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,d]=y.useState(""),f=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?d(g.message):d("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:h.jsx("footer",{className:J("load-more",l),children:!c&&e?h.jsx(je,{variant:r,size:i,styling:a,icon:s,onClick:f,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?h.jsx("p",{children:o.endOfFeed}):c&&h.jsx("p",{className:"error",children:o.error})})};const wp=({variant:e="default",version:t="default",className:n="",...r})=>h.jsx("p",{className:"logo-wrapper",children:h.jsx("a",{href:"/home/",className:J("logo",e,t,n),...r,children:h.jsx(ut,{children:h.jsx(he.FormattedMessage,{id:"apolitical"})})})});let jl=!1;const Ec=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=he.useIntl(),a=y.useRef(null),[s,o]=y.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:a,className:J("more-menu text-medium",r),children:h.jsxs(h.Fragment,{children:[h.jsx(je,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),h.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:d,icon:f,...p},g)=>{const m={...p,onClick:E=>{o(!1),typeof c=="function"&&c(E)},onFocus:()=>{jl&&(clearTimeout(jl),jl=!1)},onBlur:()=>{jl=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),h.jsx("li",{className:"more-menu-list-item",children:h.jsx(je,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...m,children:d})},`${window.btoa(d)}_${g}`)})})]})})},$6=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const j6=y.lazy(()=>Promise.resolve().then(()=>B7)),H6=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],W4=({activeLink:e,profile:t})=>{const n=he.useIntl(),r=y.useContext(Ht),i=r&&typeof r.id=="string";return h.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[H6.map(({key:a,href:s})=>{const o=$6(s,e),l={};return o&&(l["aria-current"]="page"),h.jsx("li",{className:J(a,{active:o}),children:h.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&h.jsx(j6,{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"})]})},to=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,U6=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${to(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(`${to(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(`${to(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
66
66
 
67
67
  ${to(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:to(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const z6="shareLinks_",q6=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=he.useIntl(),l=U6({title:e,link:t,referrer:n});return h.jsxs("aside",{className:J("share-links",i,a,s),children:[h.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),h.jsx("ul",{children:l.map(({key:u,icon:c,url:d,shouldRender:f=!0,onClick:p})=>{if(typeof f=="function"&&!f())return null;const g={};return p&&(g.onClick=m=>p(m,d)),h.jsx("li",{children:h.jsx(je,{size:i,variant:"tertiary",icon:{icon:c||u},href:d,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:`${z6}link_${u}`}),...g})},u)})})]})};const W6=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(m,E,v)=>(m||(m=`panel-${window.btoa(E)}-${v}`),m),i=qi(!0)||0;let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(v=>v.id===m)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===m){a=v;break}}}const[s,o]=y.useState((g=e[a])!=null&&g.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=y.useState(""),c=(m,E)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let v=E;m.key==="ArrowLeft"?E>0?v=E-1:v=e.length-1:m.key==="ArrowRight"&&(E<e.length-1?v=E+1:v=0);const b=r(e[v].id,e[v].text,v),T=document.getElementById(`tab-${b}`);T==null||T.focus(),u(b);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},d=m=>{let E=!1;return m.target==="min-width"&&i>=m.value&&(E=!0),m.target==="max-width"&&i<=m.value&&(E=!0),E};y.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(m)}},[s]);const f=[],p=[];return e.forEach(({id:m,text:E,content:v,href:b,hasCarousel:T,breakpoint:_},w)=>{if(_&&!d(_))return;m=r(m,E,w);const A=s===m,S={};b||(S["aria-controls"]=m,S.onClick=B=>{B.preventDefault(),B.stopPropagation(),o(m),!n&&window.history.replaceState(null,"",`#${m}`)},p.push(h.jsx("section",{id:m,hidden:!A,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":A?"assertive":"off",children:typeof v=="string"?h.jsx("p",{children:v}):v},`section-${m}`))),f.push(h.jsx("li",{"data-testid":"navigation-tab",children:h.jsx("a",{href:b||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:J({selected:A}),role:"tab",tabIndex:A?0:-1,"aria-selected":A,onKeyDown:B=>c(B,w),...S,children:E})},`tab-${m}`))}),h.jsxs("div",{className:J("tabs-wrapper",t),children:[h.jsx("ul",{className:"tabs",role:"tablist",children:f}),h.jsx("div",{className:"tab-content",children:p})]})};const V6={"2-1":901,"1-3":769,"1-1":769},V4=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=qi(!0);let s=i;return y.Children.count(i)===1&&(s=y.Children.toArray(i)[0],s.props&&(s=s.props.children)),h.jsx("section",{className:J("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<V6[e]?null:o)})};const Ap=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=he.useIntl(),a="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,c=n>t;return h.jsxs(h.Fragment,{children:[h.jsx("small",{id:e,className:J("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":c?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:c?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),h.jsx(ut,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},Kc=e=>(e==null?void 0:e.toString().length)||0,K4=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{Kc(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const Hl="emailHelperTextBox_",G4=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=he.useIntl(),[s,o]=y.useState({path:`${Hl}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),c=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const m=E=>{o({path:`${Hl}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>c(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:E})};if(typeof i!="function"){m(a.formatMessage({id:`${Hl}error_noFunction`}));return}u(!0),i(n).then(()=>{sessionStorage.setItem(tp.SESSION_STORAGE.EMAIL,n),window.location.href=r||"/signup/verify-email"}).catch(E=>{m(E.message)}).finally(()=>{u(!1)})},[n,r,i]);y.useEffect(()=>{let g=Hl,m="default",E={},v={};switch(t){case"gov":g+="autoApproved",m="success";break;case"nonGov":g+="unrecognisedEmail",m="error",E={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",m="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",m="error",E={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>c(b),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",m="error",E={href:"/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",E={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:m,link:E,mail:v})},[t]);const d={};return["link","mail"].forEach(g=>{d[g]=Object.keys(s[g]).length?m=>h.jsx("a",{...s[g],children:m}):m=>m}),h.jsx(Xy,{id:e,type:s.type,heading:l?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?h.jsxs(h.Fragment,{children:[h.jsx(ar,{element:"span"}),h.jsx(ar,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...d,strong:g=>h.jsx("strong",{children:g}),em:g=>h.jsx("em",{children:g}),br:h.jsxs(h.Fragment,{children:[h.jsx("br",{}),h.jsx("br",{})]}),error:s.error})})},is=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:c,styling:d={},...f})=>{const p=y.useRef(),g=r||p,{autosizeToFit:m=!1}=d;Ry(m&&t==="textarea",g),y.useEffect(()=>{var v;u&&((v=g.current)==null||v.focus())},[]),!(f!=null&&f.autoComplete)&&["email"].includes(o)&&(f.autoComplete="email");const E={};return t==="input"&&(E.type=o),y.createElement(t,{ref:g,...f,...E,id:n,name:a,className:J(e,t,{autoresize:m}),value:l,placeholder:s,autoFocus:u,...i,onChange:v=>{const b=v.target;i.onChange(b.value)}})};const La={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},K6=500,G6=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:l,displayInput:u,debouncedInput:c},d]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:f,activePredictionIndex:p,isPredictionSelected:g},m]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:E}=he.useIntl();r||(r=E({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const _=setTimeout(()=>{g||d(w=>({...w,debouncedInput:l}))},K6);return()=>{clearTimeout(_)}},[l,g]),y.useEffect(()=>{c&&!g?(async()=>{try{const w=await o(c)||[];m(A=>({...A,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),m(A=>({...A,predictions:[]}))}})():m(_=>({..._,predictions:[]}))},[c,g]),y.useEffect(()=>{p>=0&&f[p]&&d(_=>({..._,displayInput:f[p].description}))},[p,f]);const v=_=>{[La.DOWN,La.UP,La.ENTER].includes(_.key)&&(_.preventDefault(),_.key===La.DOWN&&p<f.length-1?m(w=>({...w,activePredictionIndex:p+1})):_.key===La.UP&&p>0?m(w=>({...w,activePredictionIndex:p-1})):_.key===La.ENTER&&p>-1&&(s(f[p].description),d(w=>({...w,input:f[p].description})),m(w=>({...w,predictions:[],isPredictionSelected:!0}))))},b=_=>{s(_.target.value),d(w=>({...w,input:_.target.value,displayInput:_.target.value})),m(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},T=_=>{s(_.description),d(w=>({...w,input:_.description,displayInput:_.description})),m(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:u,onChange:b,onKeyDown:v,placeholder:r,name:t,id:e,...a}),h.jsx("ul",{className:"predictions-list",children:f.map((_,w)=>h.jsx("li",{onClick:()=>T(_),onMouseEnter:()=>m(A=>({...A,activePredictionIndex:w})),className:J("predictions-list-item",{active:w===p}),children:_.description},w))})]})};const Sp=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:d=!1}={}}={},...f})=>{const p=he.useIntl(),{onChange:g,...m}=r,E=()=>{t||g(c?null:l)},v=h.jsxs(h.Fragment,{children:[h.jsx("input",{ref:a,id:i,name:i,type:u,value:l,checked:c,readOnly:!0,disabled:t,tabIndex:-1}),h.jsx("span",{className:J("pretty-checkbox",{radio:u==="radio"}),"data-testid":"pretty-checkbox"}),h.jsx("label",{htmlFor:i,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),E())},tabIndex:c||!d?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return y.createElement(n,{onClick:b=>{const T=b.target;T.nodeName.toLowerCase()==="a"||T.parentNode&&T.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),E())},onKeyDown:d?b=>{var T,_,w;if(b.key!=="Tab")switch(b.code){case"Enter":case"Space":b.stopPropagation(),b.preventDefault(),E();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const A=b.currentTarget;let S=A==null?void 0:A.nextElementSibling;if(b.key==="ArrowLeft"){const B=A==null?void 0:A.previousElementSibling;B?S=B:S=(T=A==null?void 0:A.parentElement)==null?void 0:T.lastElementChild}else S||(S=(_=A==null?void 0:A.parentElement)==null?void 0:_.firstElementChild);S&&((w=S==null?void 0:S.querySelector("label"))==null||w.focus());break}}:void 0,className:J(i,"checkbox-wrapper",e,{"is-checked":c}),...f,...m},v)};const Y6=y.memo(function({direction:t="down"}){return h.jsx(Hc,{className:J("rotating-chevron",`direction-${t}`)})});const Z6=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=he.useIntl(),[d,f]=y.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[m,E]=y.useState(g);let v;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?v=t&&m?t.find(S=>S.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?v=m[0]:v={id:"",label:""},y.useEffect(()=>{E(g)},[r,n]);const{onChange:b,onMultiSelectSubmit:T,..._}=i,w=S=>{if(o){let B=[];m!=null&&m.includes(S.id)?B=m.filter(F=>F!==S.id):B=[...m,S.id],E([...B]),b&&b([...B])}else E([S]),b&&b(S.id),f(!1)},A=S=>{if(S==="all"){const B=(t==null?void 0:t.map(F=>F.id))||[];E(B),b&&b(B)}else E([]),b&&b([])};return h.jsxs("div",{className:J("dropdown-wrapper",e),children:[h.jsxs("button",{className:"input","aria-expanded":d,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),f(!d)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${m.length}`:v.label,h.jsx(Y6,{direction:d?"up":"down"})]}),h.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const B=t&&t.find(F=>F.id===S.target.value);w(B)},hidden:!d,..._,children:t==null?void 0:t.map(S=>h.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":a,children:S.label},S.id))}),h.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!d,children:[h.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&h.jsxs("div",{className:"action-bar",children:[h.jsx("p",{children:`${m==null?void 0:m.length} selected`}),h.jsxs("ul",{children:[h.jsx("li",{children:h.jsx(je,{variant:"tertiary",size:"small",onClick:()=>A("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),h.jsx("li",{children:h.jsx(je,{variant:"tertiary",size:"small",onClick:()=>A("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),h.jsx("ul",{children:t==null?void 0:t.map(S=>{const B=S.id===v.id||(m==null?void 0:m.includes(S))||(m==null?void 0:m.includes(S.id));return h.jsx("li",{"data-testid":"dropdown-options",children:h.jsxs("button",{className:J("gtm-trackable",{selected:B,"selected-single":B&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":a,onClick:F=>{F.preventDefault(),F.stopPropagation(),w(S)},role:"menuitem","aria-current":B,"data-testid":B?"current-selection":"",children:[o&&h.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),h.jsx("span",{className:J({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&h.jsx("p",{className:"submit",children:h.jsx(je,{variant:"secondary",onClick:()=>{T&&T(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),f(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})},xo=(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};let Z1=null;const Q6=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:c,...d})=>{const f=he.useIntl(),{showCount:p=!1,label:g,defaultInputs:m=1,maxInputs:E=100,hasButton:v=!1,allowDuplicateValues:b=!1}=o||{},[T,_]=y.useState(r?Array.isArray(r)?r:[r]:Array(m).fill("")),w=T.filter(L=>L!==""),A=()=>{if(!u)return;const L=er(u.fields).filter(({id:k,name:I})=>(k||(k=I||""),k!==e&&!k.includes(`${e}-`))),R=[];T.map((k,I)=>{if(E&&I>=E)return;const j=er(l??[]);e&&(b||j.push({condition:z=>{var O;const P=z[e].toLowerCase(),ae=((O=z[`${e}-all`])==null?void 0:O.length)??0,X=new Set(z[`${e}-all`].map(C=>C.toLowerCase()));return X.has(P)&&X.size<ae},error:f==null?void 0:f.formatMessage({id:"form_error_multipleInputs_same"})}),j.forEach(z=>{const{condition:P,error:ae}=z;if(typeof P=="function")z.condition=X=>{var Y;let O=(Y=X==null?void 0:X[e])==null?void 0:Y[I];O||(X[e]&&!Array.isArray(X[e])?O=X[e]:O="");const C=er(X);return C[e]=O,C[`${e}-all`]=X[e],typeof P=="function"&&P(C)?ae:!1};else{const X=P;z.condition=O=>{var Y;let C=(Y=O==null?void 0:O[e])==null?void 0:Y[I];switch(C||(O[e]&&!Array.isArray(O[e])?C=O[e]:C=""),X){case"required":ae||(z.error=f==null?void 0:f.formatMessage({id:"form_error_required"}));break;case"no-numbers":ae||(z.error=f==null?void 0:f.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ae||(z.error=ae||(f==null?void 0:f.formatMessage({id:"form_error_email"})));break;case"valid-url":ae||(z.error=f==null?void 0:f.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return xo(X,C)?z.error:!1}}}),R.push({id:`${e}-${I}`,validation:j,value:k}))});const N={fieldsToValidate:L.concat(R)};u.multipleInputs.includes(e)&&(N.multipleInputs=u.multipleInputs.filter(k=>k!==e)),u.setFields(k=>({...k,...N}))};y.useEffect(()=>{A()},[T.length]),y.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&A()},[u==null?void 0:u.multipleInputs]);const S=()=>{(!E||T.length<E)&&_([...T,""])},B=L=>{const R=document.getElementById(`${e}-${L+1}`);R==null||R.focus()},F=(L,R)=>L.replace("{number}",R+1);return h.jsxs("fieldset",{className:J("multiple-inputs field-wrapper",{"has-button":v,"has-legend":t}),children:[t?h.jsxs("legend",{className:"legend-as-label text-small",children:[t,p?h.jsxs(h.Fragment,{children:[" ",h.jsx("small",{className:"filled-in-count","aria-label":f.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:w.length,total:E}),children:f.formatMessage({id:"form_multipleInputs_filledInCount"},{number:w.length,total:E})})]}):""]}):h.jsx(h.Fragment,{}),T.map((L,R)=>{if(E&&R>=E)return h.jsx(h.Fragment,{});let N=!1;t?N=h.jsx(ut,{showOnFocus:!1,children:f.formatMessage({id:"form_multipleInputs_label"},{number:R+1})}):g&&(N=F(g,R));const k=`${e}-${R}`,I=R+1>m;return h.jsx(Z4,{id:k,type:"text",label:N,value:L,placeholder:i?F(i,R):void 0,className:J({"has-remove-button":I}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[k]:void 0,functions:{...a,onFocus:()=>{v||R!==T.length-1||S()},onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),Z1&&clearTimeout(Z1),R!==T.length-1?B(R):(S(),Z1=setTimeout(()=>B(R),100)))},onChange:j=>{const z=T[R].toLowerCase(),P=er(T);P[R]=j,_(P),u==null||u.dispatch({type:"removeError",payload:{key:k}}),b||P.forEach((ae,X)=>{Jo(ae)&&X!==R&&ae.toLowerCase()===z&&(u==null||u.dispatch({type:"removeError",payload:{key:`${e}-${X}`}}))}),a==null||a.onChange(P)}},siblings:I?h.jsx(je,{variant:"tertiary",size:"small",icon:"close",screenreaderText:f.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const j=er(T);j.splice(R,1),_(j),u==null||u.dispatch({type:"removeError",payload:{key:k}}),a==null||a.onChange(j)}}):void 0,...d},k)}),v?h.jsx(je,{...v,onClick:S,disabled:!!(E&&E<=T.length)}):h.jsx(h.Fragment,{})]})};const ig=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,accessibilityOptions:d,styling:{displayOptionsAsPills:f=!1}={},multipleOptions:p,...g})=>{const m=he.useIntl(),E=a?c:[],v=c;return h.jsx("ul",{...g,className:J("options-wrapper",e,{"with-pills filters":f}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:b,label:T=!1,value:_=b,disabled:w=void 0})=>{const A=`${r}_${b}`;w===void 0&&(w=p!=null&&p.limit?E.length>=p.limit&&!E.includes(_):!1);const S=()=>{if(w)return;let B;if(a){const F=E==null?void 0:E.indexOf(_);Array.isArray(E)&&F>=0?(B=E,B.splice(F,1)):(!E||E.length===0?B=[]:B=E,B.push(_))}else B=v===_?void 0:_;t.onChange(B)};return h.jsx(Sp,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:_,value:a?E==null?void 0:E.includes(_):v===_,functions:{...t,onChange:S},intlPath:n,label:T||m.formatMessage({id:n?`${n}_${b}`:b}),disabled:w,accessibilityOptions:d,className:J({disabled:w})},A)})})};const Y4=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=he.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[c,d]=y.useState(t),f=()=>{var p;u(!l),d(l?"password":"text"),(p=o.current)==null||p.focus()};return h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:J("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),h.jsx(is,{inputRef:o,type:c,autoComplete:r,...i})]})};const $a={text:{component:is},email:{component:is},url:{component:is},textarea:{component:is,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Sp},checkboxes:{component:ig,props:{multiSelect:!0}},radio:{component:ig,props:{multiSelect:!1}},select:{component:Z6},password:{component:Y4},autocomplete:{component:G6},"multiple-inputs":{component:h.jsx(h.Fragment,{})}},Z4=e=>{const t=he.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:c,value:d,submitOnEnter:f,fieldData:p,siblings:g,...m}=e;if(u&&u==="multiple-inputs")return h.jsx(Q6,{...e});const E=c&&c.some(({condition:I})=>I==="required"),v=Kc(d),b=u&&$a[u]&&$a[u].component?$a[u].component:is,T=u&&["checkboxes","radio"].includes(u),_=u&&["autocomplete"].includes(u),w=a&&`error-${n}`,A=`character-limit-${n}`,S={};T?S.element="legend":S.htmlFor=n;let B={...m,id:n,name:n,className:a?"error":"",type:u,required:E,"aria-required":E,functions:er(s),value:d};const F=I=>{B["aria-describedby"]?B["aria-describedby"]+=` ${I}`:B["aria-describedby"]=I};if(o>0){const I=K4(o,s);F(`${A}-info`),B={...B,...I},I.functions&&typeof I.functions=="object"&&(B.functions={...B.functions,...I.functions})}u&&$a[u]&&$a[u].props&&(B={...B,...$a[u].props}),T&&(B.intlPath=`${r}_${n}`),a&&(B["aria-invalid"]=!0,B["aria-errormessage"]=w,F(w));const L=m.label||t.formatMessage({id:r?`${r}_${n}`:n}),R=({...I})=>a?y.createElement(I.as||"p",{id:w,className:"error text-small",...I},a):null;if(u&&["checkbox"].includes(u))return h.jsxs(h.Fragment,{children:[h.jsx(b,{...B,label:L,className:J("field-wrapper",i)}),h.jsx(R,{as:"p"})]});const N={};T?S.className="legend-as-label text-small":N.className="field-label";const k=({element:I,...j})=>y.createElement(I||"label",{...j,"data-testid":`label-${n}`});return h.jsx(h.Fragment,{children:y.createElement(T?"fieldset":"div",{className:J("field-wrapper text-small",i,`${u}-wrapper`,{"multiple-options-wrapper":T})},h.jsxs(h.Fragment,{children:[m.label===!1?h.jsx(h.Fragment,{}):y.createElement(T?y.Fragment:"p",N,h.jsxs(k,{...S,children:[L,E&&l&&h.jsxs(h.Fragment,{children:[" ",h.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(T||_?"div":"p",{className:"field-component"},h.jsxs(h.Fragment,{children:[h.jsx(b,{...B}),h.jsx(Ap,{id:A,limit:o,valueLength:v}),g]})),h.jsx(R,{})]}))})},X6=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?er(e.errors):{},a=e.values?er(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,d=er(Object.keys(i));for(const f of s)if(f.validation)for(let p=0;p<f.validation.length;p++){const{condition:g="required",error:m=!1}=f.validation[p];let E=!1;if(typeof g=="function"){const v=g(a);v&&(E=m||v)}else{const v=a[f.id],b=g;switch(b){case"required":xo(b,v)&&(E=m||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{xo(b,v)&&(E=m||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{xo(b,v)&&(E=m||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{xo(b,v)&&(E=m||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(E){o({type:"addError",payload:{key:f.id,value:E}}),d.push(f.id);break}}return d.length===0?l(a):u(a,d),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Q1=null;const Gr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:c={context:"Form",event:"form-submit-click"},functions:d,...f})=>{const p=(t||[]).filter(Z=>Z.type==="multiple-inputs").map(Z=>Z.id),[g,m]=y.useState({fieldsToValidate:t,multipleInputs:p});y.useEffect(()=>{g.multipleInputs.length||m(Z=>({...Z,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:E,hideButton:v,...b}=s,T=40,{shouldShowCancelButton:_=!1,shouldReset:w=!0,shouldHide:A=!0,showRequiredLabels:S=!0,showSuccessMessage:B=!1,shouldScrollOnSuccess:F=!0}=l||{},{onSuccess:L=async()=>{},onCancel:R=()=>{},onCatch:N=()=>{},onFailure:k=()=>{}}=d||{},I=he.useIntl(),j={};t.length&&t.forEach(Z=>{const ne=Z.id||Z.name;ne&&(j[ne]=Z.value||"")});const[z,P]=y.useReducer(X6,{isSubmitting:!1,formSubmitted:!1,errors:{},values:j}),{errors:ae,isSubmitting:X,formSubmitted:O,values:C}=z;y.useEffect(()=>{w&&O&&(Q1=setTimeout(()=>{P({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[O]),y.useEffect(()=>()=>{Q1&&clearTimeout(Q1)},[]),y.useEffect(()=>{const Z=ne=>{P({type:"updateValue",payload:{key:ne.detail.id,value:ne.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",Z),()=>{document.removeEventListener("dropdownMultiSelectSubmit",Z)}},[]);const Y=y.useRef(null),M=i||Y,H=Zo(()=>{if(!X){if(P({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&P({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:P,intl:I}});return}P({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:P,onSuccess:async Z=>{F&&U();try{await L(Z),P({type:w?"formSubmittedAndReset":"formSubmitted"})}catch(ne){N(ne),P({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(Z,ne)=>{U(),k(Z,ne),P({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},100);if(!t.length)return null;const q={};s.children&&(q.default=s.children),b.text&&typeof b.text=="string"&&(q.default=b.text),["default","submitting","submitted"].forEach(Z=>{b.text&&typeof b.text!="string"&&Z in b.text?q[Z]=b.text[Z]:q[Z]||(q[Z]=I.formatMessage({id:`form_${Z==="default"?"submit":Z}`}))}),delete b.text;const U=()=>{var se;let Z=0;if((se=M==null?void 0:M.current)!=null&&se.id){const ee=document.getElementById(M.current.id);ee&&(Z=ee.getBoundingClientRect().top+window.scrollY)}const ne=document.getElementById("header");ne&&(Z=Z-ne.offsetHeight-T),Z<0&&(Z=0),window.scrollTo({top:Z,behavior:"smooth"})},$=Z=>{Z.preventDefault(),Z.stopPropagation(),!X&&H()},oe=[{...b,icon:O?{icon:"tick",position:"left"}:!1,className:J("gtm-trackable",b.className),onClick:$,disabled:X||O||s.disabled,"data-gtm-event-context":c.context,"data-gtm-event-type":c.event,children:q[X?"submitting":O?"submitted":"default"]}];return _&&oe.unshift({...o,className:J("gtm-trackable",o.className),"data-gtm-event-context":c.context,"data-gtm-event-type":c.event,disabled:X||O,onClick:R,children:o.text||I.formatMessage({id:"form_cancel"})}),h.jsxs(h.Fragment,{children:[y.createElement(e,{...f,id:r,className:J("form",n),ref:M},h.jsxs(h.Fragment,{children:[ae!=null&&ae.general?h.jsx(zr,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!A||!X&&!O||E)&&t.map((Z,ne)=>{const{id:se=Z.name||ne,component:ee,functions:xe={onChange:()=>{}},submitOnEnter:ke=!1}=Z;if(ee)return h.jsx(ee,{...Z.props||{}},`component-${se}-${ne}`);const be=(C==null?void 0:C[se])||"",ie={...xe,onChange:me=>{P({type:"updateValue",payload:{key:se,value:me}}),xe.onChange(me,P)}};return ke&&(ie.onKeyDown=me=>{me.key==="Enter"&&(me.stopPropagation(),me.preventDefault(),H()),xe.onKeyDown&&xe.onKeyDown(me)}),h.jsx(Z4,{intlPath:a,...Z,showRequiredLabels:S,value:be,error:Z.type==="multiple-inputs"?ae:ae==null?void 0:ae[se],functions:ie,fieldData:{fields:g.fieldsToValidate,multipleInputs:g.multipleInputs,setFields:m,dispatch:P}},se)}),v?null:(X||O)&&E?E:h.jsx(Bs,{className:J("cta",{center:X||O,submitted:O}),buttons:oe})]})),B&&O&&h.jsx(_s,{className:"success",children:typeof B=="string"?B:I.formatMessage({id:"form_success"})})]})};const Ul="passwordRules_",Q4="isMoreThanEightCharacters",X4="includesNumberAndSymbol",J4="includesLowerAndUppercase",J6={[Q4]:"8Characters",[X4]:"numberSymbol",[J4]:"lowercaseUppercase"},ew=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=he.useIntl();return h.jsxs("aside",{className:J("password-rules",t),children:[h.jsx("small",{children:n.formatMessage({id:`${Ul}intro`})}),h.jsx("ul",{children:[Q4,X4,J4].map(r=>h.jsxs("li",{className:J({matches:e[r]}),children:[h.jsxs(ut,{children:[n.formatMessage({id:`${Ul}rule_label`})," "]}),h.jsx("span",{children:n.formatMessage({id:`${Ul}rule_${J6[r]}`})}),!e[r]&&h.jsxs(ut,{element:"strong",children:[" ",n.formatMessage({id:`${Ul}notMet`})]})]},`rule-${r}`))})]})},eb=y.memo(ew);const tw=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=he.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(b=>({...b,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(b=>({...b,setUp:!0,disabled:!0})),i(v)}};if(y.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return h.jsx(ar,{className:"rating-placeholder"});const{id:d,rating:f,disabled:p}=l,g="ratings_",m={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},E=async v=>{if(!(!d||p))try{u(b=>({...b,rating:v,disabled:!0})),await r({id:d,value:v})}catch(b){u(T=>({...T,rating:null})),i(b)}finally{u(b=>({...b,disabled:!1}))}};return h.jsxs("div",{className:J("rating",a),children:[h.jsx("span",{className:"label",children:m[f?"success":"text"]}),h.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const b=v+1;return h.jsx("li",{className:J({selected:f&&b<=f}),children:h.jsx(je,{variant:"tertiary",size:"small",icon:{icon:`star${!f||b>f?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:b,total:t})}${b===1||b===t?` - ${m[b===1?"low":"high"]}`:""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),E(b)},disabled:p})},`rating-${b}`)})})]})},nw={id:"",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)}},Ei=y.createContext(nw),rw={tabbableOption:"",setFocus:()=>{},openTooltip:null,dispatch:()=>{}},vl=y.createContext(rw);var re=(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))(re||{}),Fr=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Fr||{});const iw=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case re.blockquote:return h.jsx("blockquote",{className:"subtle",...e,children:t});case re.link:return h.jsx("a",{...e,children:t});case re.li:return h.jsx("li",{...e,children:t});case re.mention:const i=r;return i!=null&&i.name&&i.name===Qo?h.jsxs("span",{...e,className:"mention deleted-user",children:["@",h.jsx(he.FormattedMessage,{id:"member_deleted"}),t]}):h.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case re.ol:return h.jsx("ol",{...e,children:t});case re.ul:return h.jsx("ul",{...e,children:t});case re.span:return h.jsx("span",{...e,children:t});case re.paragraph:return h.jsx("p",{...e,children:t});default:return h.jsx("span",{...e,children:t})}},aw=({attributes:e,children:t,leaf:n})=>{const r=n;return r[re.bold]&&(t=h.jsx("strong",{children:t})),r[re.italic]&&(t=h.jsx("em",{children:t})),r[re.strikethrough]&&(t=h.jsx("s",{children:t})),r[re.h3]&&(t=h.jsx("h3",{children:t})),h.jsx("span",{...e,children:t})};var sw=uw,tb="֑-߿יִ-﷽ﹰ-ﻼ",nb="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",ow=new RegExp("^[^"+nb+"]*["+tb+"]"),lw=new RegExp("^[^"+tb+"]*["+nb+"]");function uw(e){return e=String(e||""),ow.test(e)?"rtl":lw.test(e)?"ltr":"neutral"}const rb=Tr(sw);function cw(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var kp=cw,dw=typeof Pl=="object"&&Pl&&Pl.Object===Object&&Pl,fw=dw,hw=fw,pw=typeof self=="object"&&self&&self.Object===Object&&self,mw=hw||pw||Function("return this")(),ib=mw,gw=ib,vw=function(){return gw.Date.now()},Ew=vw,yw=/\s/;function bw(e){for(var t=e.length;t--&&yw.test(e.charAt(t)););return t}var Tw=bw,_w=Tw,Cw=/^\s+/;function xw(e){return e&&e.slice(0,_w(e)+1).replace(Cw,"")}var ww=xw,Aw=ib,Sw=Aw.Symbol,ab=Sw,ag=ab,sb=Object.prototype,kw=sb.hasOwnProperty,Dw=sb.toString,no=ag?ag.toStringTag:void 0;function Ow(e){var t=kw.call(e,no),n=e[no];try{e[no]=void 0;var r=!0}catch{}var i=Dw.call(e);return r&&(t?e[no]=n:delete e[no]),i}var Nw=Ow,Iw=Object.prototype,Pw=Iw.toString;function Rw(e){return Pw.call(e)}var Fw=Rw,sg=ab,Bw=Nw,Mw=Fw,Lw="[object Null]",$w="[object Undefined]",og=sg?sg.toStringTag:void 0;function jw(e){return e==null?e===void 0?$w:Lw:og&&og in Object(e)?Bw(e):Mw(e)}var Hw=jw;function Uw(e){return e!=null&&typeof e=="object"}var zw=Uw,qw=Hw,Ww=zw,Vw="[object Symbol]";function Kw(e){return typeof e=="symbol"||Ww(e)&&qw(e)==Vw}var Gw=Kw,Yw=ww,lg=kp,Zw=Gw,ug=0/0,Qw=/^[-+]0x[0-9a-f]+$/i,Xw=/^0b[01]+$/i,Jw=/^0o[0-7]+$/i,eA=parseInt;function tA(e){if(typeof e=="number")return e;if(Zw(e))return ug;if(lg(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=lg(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Yw(e);var n=Xw.test(e);return n||Jw.test(e)?eA(e.slice(2),n?2:8):Qw.test(e)?ug:+e}var nA=tA,rA=kp,X1=Ew,cg=nA,iA="Expected a function",aA=Math.max,sA=Math.min;function oA(e,t,n){var r,i,a,s,o,l,u=0,c=!1,d=!1,f=!0;if(typeof e!="function")throw new TypeError(iA);t=cg(t)||0,rA(n)&&(c=!!n.leading,d="maxWait"in n,a=d?aA(cg(n.maxWait)||0,t):a,f="trailing"in n?!!n.trailing:f);function p(A){var S=r,B=i;return r=i=void 0,u=A,s=e.apply(B,S),s}function g(A){return u=A,o=setTimeout(v,t),c?p(A):s}function m(A){var S=A-l,B=A-u,F=t-S;return d?sA(F,a-B):F}function E(A){var S=A-l,B=A-u;return l===void 0||S>=t||S<0||d&&B>=a}function v(){var A=X1();if(E(A))return b(A);o=setTimeout(v,m(A))}function b(A){return o=void 0,f&&r?p(A):(r=i=void 0,s)}function T(){o!==void 0&&clearTimeout(o),u=0,r=l=i=o=void 0}function _(){return o===void 0?s:b(X1())}function w(){var A=X1(),S=E(A);if(r=arguments,i=this,l=A,S){if(o===void 0)return g(l);if(d)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=T,w.flush=_,w}var ob=oA;const lA=Tr(ob);var uA=ob,cA=kp,dA="Expected a function";function fA(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(dA);return cA(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),uA(e,t,{leading:r,maxWait:t,trailing:i})}var hA=fA;const pA=Tr(hA),dg=e=>typeof e=="object"&&e!=null&&e.nodeType===1,fg=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",J1=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return fg(n.overflowY,t)||fg(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},zl=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,mA=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},hg=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,d=typeof u=="function"?u:z=>z!==u;if(!dg(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,p=[];let g=e;for(;dg(g)&&d(g);){if(g=mA(g),g===f){p.push(g);break}g!=null&&g===document.body&&J1(g)&&!J1(document.documentElement)||g!=null&&J1(g,c)&&p.push(g)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,E=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:v,scrollY:b}=window,{height:T,width:_,top:w,right:A,bottom:S,left:B}=e.getBoundingClientRect(),{top:F,right:L,bottom:R,left:N}=(z=>{const P=window.getComputedStyle(z);return{top:parseFloat(P.scrollMarginTop)||0,right:parseFloat(P.scrollMarginRight)||0,bottom:parseFloat(P.scrollMarginBottom)||0,left:parseFloat(P.scrollMarginLeft)||0}})(e);let k=o==="start"||o==="nearest"?w-F:o==="end"?S+R:w+T/2-F+R,I=l==="center"?B+_/2-N+L:l==="end"?A+L:B-N;const j=[];for(let z=0;z<p.length;z++){const P=p[z],{height:ae,width:X,top:O,right:C,bottom:Y,left:M}=P.getBoundingClientRect();if(s==="if-needed"&&w>=0&&B>=0&&S<=E&&A<=m&&w>=O&&S<=Y&&B>=M&&A<=C)return j;const H=getComputedStyle(P),q=parseInt(H.borderLeftWidth,10),U=parseInt(H.borderTopWidth,10),$=parseInt(H.borderRightWidth,10),oe=parseInt(H.borderBottomWidth,10);let Z=0,ne=0;const se="offsetWidth"in P?P.offsetWidth-P.clientWidth-q-$:0,ee="offsetHeight"in P?P.offsetHeight-P.clientHeight-U-oe:0,xe="offsetWidth"in P?P.offsetWidth===0?0:X/P.offsetWidth:0,ke="offsetHeight"in P?P.offsetHeight===0?0:ae/P.offsetHeight:0;if(f===P)Z=o==="start"?k:o==="end"?k-E:o==="nearest"?zl(b,b+E,E,U,oe,b+k,b+k+T,T):k-E/2,ne=l==="start"?I:l==="center"?I-m/2:l==="end"?I-m:zl(v,v+m,m,q,$,v+I,v+I+_,_),Z=Math.max(0,Z+b),ne=Math.max(0,ne+v);else{Z=o==="start"?k-O-U:o==="end"?k-Y+oe+ee:o==="nearest"?zl(O,Y,ae,U,oe+ee,k,k+T,T):k-(O+ae/2)+ee/2,ne=l==="start"?I-M-q:l==="center"?I-(M+X/2)+se/2:l==="end"?I-C+$+se:zl(M,C,X,q,$+se,I,I+_,_);const{scrollLeft:be,scrollTop:ie}=P;Z=ke===0?0:Math.max(0,Math.min(ie+Z/ke,P.scrollHeight-ae/ke+ee)),ne=xe===0?0:Math.max(0,Math.min(be+ne/xe,P.scrollWidth-X/xe+se)),k+=ie-Z,I+=be-ne}j.push({el:P,top:Z,left:ne})}return j},gA=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function vA(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(hg(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of hg(e,gA(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:o,left:l,behavior:r})}}/*!
68
68
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
@@ -163,7 +163,7 @@ ${p}${d?"1.":"-"} ${u}${f?`
163
163
 
164
164
  `.substring(0,i);return n+a+r}function uR(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var cR={isHistory(e){return tn(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Li.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Li.isOperationList(e.undos[0].operations))}},_d=new WeakMap,Cd=new WeakMap,ls={isHistoryEditor(e){return cR.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return Cd.get(e)},isSaving(e){return _d.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=ls.isMerging(e);Cd.set(e,!1),t(),Cd.set(e,n)},withoutSaving(e,t){var n=ls.isSaving(e);_d.set(e,!1),t(),_d.set(e,n)}},dR=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&ue.setSelection(t,a.selectionBefore),ls.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];ls.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=a.operations.map(Li.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&ue.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=ls.isSaving(t),c=ls.isMerging(t);if(u==null&&(u=hR(r)),u){if(c==null&&(o==null?c=!1:i.length!==0?c=!0:c=fR(r,l)),o&&c)o.operations.push(r);else{var d={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",d)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},fR=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&K.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&K.equals(e.path,t.path)),hR=(e,t)=>e.type!=="set_selection";const pR=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===re.link){const i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var mR=yR,gR=/^(?:\w+:)?\/\/(\S+)$/,vR=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,ER=/^[^\s\.]+\.\S{2,}$/;function yR(e){if(typeof e!="string")return!1;var t=e.match(gR);if(!t)return!1;var n=t[1];return n?!!(vR.test(n)||ER.test(n)):!1}const bR=Tr(mR),TR=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[re.link].includes(s.type)||i(a)},e.insertText=a=>{a&&bR(a)?Zp(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},_R=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===re.mention?!0:n(a),e.isVoid=a=>a.type===re.mention?!0:r(a),e.markableVoid=a=>a.type===re.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},CR=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===re.link&&Ee.string(r).trim()===""){ue.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const em=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:l,...u})=>{const c=he.useIntl(),d=Y3();typeof s>"u"&&(s=!0);const{isInOverlay:f=!1}=i||{},{listMembers:p,clickMentionFallback:g,onChange:m=()=>{},onChangeData:E=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:b=()=>{},reportError:T=q=>{console.error(q)}}=a||{},_=[{type:re.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const w={editorKey:null,originalValue:t||"",initialValue:t?null:_,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[A,S]=y.useReducer(Fs,w),{editorKey:B,originalValue:F,initialValue:L,stringValue:R,lastAnchor:N,lastKey:k,hasInteracted:I,hasLoaded:j,enrichedUrl:z,mentionPopover:P}=A,ae=async q=>{const U=await v(q);U.url&&S([{type:"enrichedUrl",value:U}])},X=`rte-${e}`,O=y.useCallback(q=>h.jsx(iw,{...q}),[]),C=y.useCallback(q=>h.jsx(aw,{...q}),[]),Y=y.useMemo(()=>pR(TR(_R(CR(dR(WO(Gk())),T),T),X,T),T),[]),M=q=>{if(!Y||q!==X)return;const U=D.end(Y,[]);ue.select(Y,U),ce.focus(Y)};y.useEffect(()=>{const q=U=>{var Z;const $=U,oe=((Z=$==null?void 0:$.detail)==null?void 0:Z.id)||null;oe&&M(oe)};return window.addEventListener("focusEditor",q),()=>{window.removeEventListener("focusEditor",q)}},[]),y.useEffect(()=>{if(Y.children.length>0&&!j){if(S([{type:"hasLoaded",value:!0}]),!s)return;M(X)}},[Y.children.length,L]),y.useEffect(()=>{F&&(async()=>{let U=er(F);if(U.includes("<")){ol.prototype.escape=oe=>oe;const $=new ol;$.addRule("br",{filter:["br"],replacement:oe=>oe+`
165
165
 
166
- `}),U=$.turndown(U)}o&&o.mentions&&(U=await Ky({text:U,template:`[${mh}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),bP(U,$=>{const oe=[{type:"initialValue",value:$},{type:"editorKey",value:F.toString()}];o!=null&&o.link&&(oe.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),S(oe),setTimeout(()=>{S([{type:"stringValue",value:Yv(Y)}])},150)})})()},[F]),y.useEffect(()=>{if(z===void 0&&Y){const U=CP(Y);U&&ae(U)}const q=U=>{var Z;const $=U,oe=((Z=$==null?void 0:$.detail)==null?void 0:Z.url)||null;oe&&z&&z.url===oe&&S([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",q),()=>{window.removeEventListener("linkRemoved",q)}},[z]),y.useEffect(()=>{if(t){Xo.lastIndex=0;const q=t.match(Xo);q&&q.length===1&&q[0].length===t.length&&!I&&S([{type:"originalValue",value:t}])}t!==""||!Y||uc(F,t)&&!I||(D.withoutNormalizing(Y,()=>{ue.delete(Y,{at:{anchor:D.start(Y,[]),focus:D.end(Y,[])}}),ue.deselect(Y),Y.children.length!==0&&ue.unwrapNodes(Y,{at:[0]}),ue.insertNodes(Y,_,{at:[0]})}),S([{type:"initialValue",value:_},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{E({link:z})},[z]),y.useEffect(()=>{R===""&&z&&S([{type:"enrichedUrl",value:void 0}])},[R]);const H=Zo(()=>{wP({editor:Y,isShowing:P.show,numberOfUsers:P.numberOfUsers,listMembers:p,dispatch:S})},100);return L?h.jsx("div",{id:X,className:"rich-text-editor input text-medium",children:h.jsxs(Ei.Provider,{value:{...A,id:X,isInOverlay:f,dispatch:S,onMention:b,reportError:T},children:[h.jsxs(zO,{editor:Y,initialValue:L,onChange:q=>{if(Y.operations.some($=>$.type!=="set_selection")){let $=SP(q);$==="<br>"&&($=""),m($,z),S([{type:"stringValue",value:Yv(Y)}]),I||S([{type:"hasInteracted",value:!0}]),H(),d&&console.log({serialized:$,json:q})}},...u,children:[h.jsx(RO,{className:"editor",renderElement:O,renderLeaf:C,placeholder:n||c.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async q=>{const U=z!==!1,$=q.clipboardData.getData("text");if((Z=>{try{return new URL(Z),!0}catch{return!1}})($)){let Z=$;if($){const{full:ne}=rp($);Z=ne}if($&&v&&!U){const ne=await v(Z);ne.url&&S([{type:"enrichedUrl",value:ne}])}}},onKeyDown:q=>{if(q.key==="Enter"){P.show&&(q.preventDefault(),q.stopPropagation(),cT(Y,P,S,X));const{selection:U}=Y;if(U){const $=le.isCollapsed(U),[oe,Z]=D.node(Y,U,{depth:1});let ne=oe,se=ne.type;const ee=ne.children[0];if(ee&&(ee==null?void 0:ee[re.h3])===!0&&(q.stopPropagation(),q.preventDefault(),ue.insertNodes(Y,_)),ee&&[re.ol,re.ul].includes(ee.type)&&(ne=ee,se=ee.type),ne&&Se.isElement(ne)&&se!==re.paragraph){if(se===re.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),ue.insertNodes(Y,_);return}if($){const[xe,ke]=D.parent(Y,U,{edge:"end"}),ie=xe.type;if([re.ul,re.ol].includes(se))if(q.stopPropagation(),q.preventDefault(),ie===re.li&&k==="Enter"){xe.children.length===1&&"text"in xe.children[0]&&xe.children[0].text===""&&ue.removeNodes(Y,{at:ke}),ue.insertNodes(Y,_,{at:K.next(Z)}),ue.select(Y,D.end(Y,K.next(Z)));return}else{const[me,we]=TP(Y,re.li),Ie={type:re.li,children:[{text:""}]};ue.insertNodes(Y,Ie,{at:K.next(we)}),ue.select(Y,D.end(Y,K.next(we)))}}}}}else if(q.key==="Escape"){if(P.show){q.preventDefault(),q.stopPropagation(),S([{type:"mentionPopover",value:{...P,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&P.show){q.preventDefault(),q.stopPropagation();const{selectedUser:U,possibleUsers:$}=P;let oe=q.key==="ArrowUp"?U-1:U+1;oe<0&&(oe=$.length-1),oe>=$.length+1&&(oe=0),S([{type:"mentionPopover",value:{...P,selectedUser:oe}}])}S([{type:"lastKey",value:q.key}]),xP(q,Y,S,T)},onBlur:()=>{Y.selection&&S([{type:"lastAnchor",value:Y.selection.anchor}])},onFocus:()=>{if(N){if(!K.isPath(N.path)||!Ee.has(Y,N.path))return;const q=Ee.get(Y,N.path);let U=0;if(Oe.isText(q)?U=q.text.length:q.children&&(U=q.children.length),N.offset>U)return;try{ue.select(Y,{anchor:N,focus:N})}catch($){const oe=$.message;T(`Error focusing editor: ${oe}`)}}}}),z?h.jsx(xp,{data:z,variant:"condensed",onClick:()=>{S([{type:"enrichedUrl",value:!1}]);const q=new CustomEvent("ariaLive",{detail:{message:c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(q)},"aria-label":c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:z.title||c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):h.jsx(h.Fragment,{}),h.jsx(LP,{styling:l==null?void 0:l.toolbar}),p?h.jsx(kP,{onFallbackClick:g}):h.jsx(h.Fragment,{})]},B),h.jsx(Ap,{id:`character-limit-${e}`,limit:r,valueLength:Kc(R)})]})}):h.jsx(h.Fragment,{})};const xR=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=c=>{a||(l(c),i(c))};return h.jsxs("div",{className:J("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[h.jsx("p",{children:t}),h.jsx("ul",{className:J("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(c=>{const d=`${e}-${c.value}`;return h.jsxs("li",{className:"hidden",children:[h.jsx("input",{type:"radio",id:d,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:a}),h.jsx("label",{htmlFor:d,children:c.label})]},d)})})]})};function wT({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=he.useIntl(),l="profileImageChange_",[u,c]=y.useState(r),[d,f]=y.useState(!1),[p,g]=y.useState(!1),m=y.useRef(null),E=async _=>{f(!0),g(!1);try{const w=_.target.files&&_.target.files[0];if(!w||!t)throw f(!1),new Error("Image file or userID is missing");const A=await i({fileObject:w,userId:t}),S={thumbnail:A.thumbnailURL,full:A.originalURL};c(S),s(S)}catch{g(!0)}finally{f(!1)}f(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:b=o.formatMessage({id:`${l}cta_change`}),uploading:T=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return h.jsxs("div",{className:J("profile-image-change-figure",e),children:[h.jsx(gi,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&h.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),h.jsx("input",{id:"file",type:"file",accept:"image/*",ref:m,onChange:E,hidden:!0,"data-testid":"file-input"}),h.jsx(je,{onClick:()=>m.current&&m.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:d,children:d?T:u?b:v})]})}const AT=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return h.jsx(Gr,{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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const wR=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=he.useIntl();return h.jsx(P3.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>h.jsxs("div",{className:"email text-medium",children:[h.jsx("div",{"data-tag-item":!0,children:i}),h.jsx(je,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},ST=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:c="NOT_SUBMITTED",gtm:d={context:"Form",event:"form-submit-click"},secondaryActionButton:f,meta:p})=>{const[g,m]=y.useState([]),[E,v]=y.useState(!0),[b,T]=y.useState(c),{formatMessage:_}=he.useIntl(),w=async B=>{try{await u(g,B.message),m([]),T("SUCCESS")}catch(F){T("ERROR"),l(F)}},A=B=>{B.preventDefault(),T("NOT_SUBMITTED"),v(!0),m([])},S=B=>{B.preventDefault(),o(),T("CLOSED")};return b==="CLOSED"?null:b==="ERROR"||b==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?h.jsxs("div",{className:"invite-form-wrapper",children:[h.jsx("div",{className:"content centred",children:b==="SUCCESS"?h.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):h.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),h.jsx(br,{}),h.jsx("div",{className:"footer",children:b==="SUCCESS"?h.jsxs(h.Fragment,{children:[h.jsx(je,{variant:"secondary",onClick:A,children:_({id:"inviteForm_ctaSendMoreInvites"})}),h.jsx(je,{onClick:S,children:_({id:"inviteForm_ctaDone"})})]}):h.jsx(je,{onClick:A,children:_({id:"inviteForm_ctaTryAgain"})})})]}):h.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[h.jsxs("div",{className:"content",children:[h.jsx("h2",{className:"title",style:{color:i},children:e}),h.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),h.jsx(Gr,{id:"invite-form",fields:[{component:wR,props:{emails:g,setEmails:m,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:_({id:"inviteForm_message_label"}),placeholder:n||_({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:E},gtm:d,meta:p,secondaryActionButton:f})]})},Gu=e=>e.map(t=>({condition:t}));const Wn={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},AR=({functions:e,...t})=>{const{formatMessage:n}=he.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Wn.NEW_PASSWORD]!==p[Wn.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!Kf(p[Wn.NEW_PASSWORD]).isValid,d=[{"data-testid":Wn.NEW_PASSWORD,id:Wn.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Gu(["required",c]),functions:{onChange:p=>l(Kf(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Wn.CONFIRMED_PASSWORD,id:Wn.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Gu(["required",u])}];t.isPasswordChange&&d.unshift({"data-testid":Wn.CURRENT_PASSWORD,id:Wn.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Gu(["required"])}),a&&d.push({component:eb,props:{matchingRules:o}});const f={id:Wn.FORM_ID,fields:d,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Wn.NEW_PASSWORD)||g.includes(Wn.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return h.jsxs(h.Fragment,{children:[h.jsx(Gr,{...f}),r&&h.jsx(zr,{variant:"error",text:r})]})};const kT=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var B;const s=he.useIntl(),o="profileForm_",l=y.useContext(Ht),[u,c]=y.useState(l.image),[d,f]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async F=>{},onCancel:m=()=>{},onFailure:E=()=>{}}=n,{buildLocation:v,isValidPlace:b,predictPlaces:T}=t.useMaps(),{context:_="ProfileForm",event:w="profile-form-submit-click"}=i||{},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:(B=l.location)==null?void 0:B.en,validation:[{condition:"required"},{condition:({location:F})=>F&&!d?!1:!b(F),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{d||f(!0)},onKeyInput:T}}],S=[{component:wT,props:{userName:l.name,userId:l.id,src:u,uploadImage:p,callback:c,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"}]},...A,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:br}];return h.jsx(Gr,{id:"profile-details-form",fields:e?A:S,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:_,event:w},functions:{onSuccess:async F=>{try{const L={...F,image:u||null,location:d?await v(F==null?void 0:F.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...L})),await g(L)}catch{E()}},onCancel:m,onFailure:E},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},SR=()=>{const e=he.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),h.jsx(p4,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function kR({coverImage:e,setShowImagePicker:t}){return e&&e.url?h.jsx(zr,{className:"cover-image-preview",text:h.jsx(Vi,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:h.jsx(je,{variant:"tertiary",onClick:()=>t(!0),children:h.jsx(he.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):h.jsx(zr,{button:{component:h.jsx(je,{variant:"secondary",onClick:()=>t(!0),children:h.jsx(he.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var DT=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(DT||{});let xd=null;const jt="publishArticleForm_",r9={},i9=10,DR=({id:e="publish-article-form",values:t=r9,setShowImagePicker:n,functions:r,meta:i,gtm:a,isEditMode:s=!1})=>{var R;const o=he.useIntl(),l=y.useContext(Ht);console.log("values in publish-article-form",t);const{create:u,edit:c,onSuccess:d=()=>{},onFailure:f=()=>{}}=r||{},{isInOverlay:p=!1}=i||{},[g,m]=y.useState(!1),[E,v]=y.useState(t.body||""),[b,T]=y.useState(!1),[_,w]=y.useState("");y.useEffect(()=>{uc(t,r9)||Jo(t.body)&&t.body!==E&&t.body!==void 0&&v(t.body)},[t.body]);const A=()=>{!l||!l.id?T(o.formatMessage({id:`${jt}error_loggedOut`})):b&&T(!1)},S=N=>({condition:k=>{const I=k[N];return!I||typeof I!="string"?!0:I.length<i9},error:o.formatMessage({id:`${jt}error_underMinLength`},{length:i9})}),B=!!E&&Jo(E),F=()=>h.jsxs(h.Fragment,{children:[h.jsx(br,{}),h.jsx("p",{className:"text-medium",children:o.formatMessage({id:`${jt}disclaimer`})})]}),L=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:o.formatMessage({id:`${jt}title_label`}),placeholder:o.formatMessage({id:`${jt}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:A},validation:[{condition:"required"},S("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:o.formatMessage({id:`${jt}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:o.formatMessage({id:`${jt}subtitle_placeholder`}),functions:{onChange:A},validation:[{condition:"required"},S("subtitle")]},{component:wc,props:{formID:e,label:{visible:o.formatMessage({id:`${jt}body_label`})},showLabel:!0}},{component:em,props:{id:`${e}-input`,value:E,placeholder:o.formatMessage({id:`${jt}body_placeholder`}),meta:{isInOverlay:p},autoFocus:!1,functions:{onChange:N=>{v(N),A()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:o.formatMessage({id:`${jt}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(DT).map(N=>({id:N,label:o.formatMessage({id:`${jt}_tags_${N}`})})),value:t.tags||[],multipleOptions:{limit:3},validation:[{condition:"required",error:o.formatMessage({id:`${jt}tags_error_required`})},{condition:N=>{var k;return((k=N==null?void 0:N.tags)==null?void 0:k.length)>3},error:o.formatMessage({id:`${jt}tags_error_over_three`})}]},{component:wc,props:{formID:e,label:{visible:o.formatMessage({id:`${jt}cover_image_label`})},showLabel:!0}},{component:kR,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return g?L.push({component:br}):L.push({component:F}),h.jsxs("section",{className:"publish-article-form",children:[h.jsx(Gr,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async N=>{if(!l||!l.id||!B)return;xd&&clearTimeout(xd),m(!0);const k={...N,body:E,coverImage:t.coverImage};try{s&&c?await c(k):u&&await u(k),xd=setTimeout(()=>{w(o.formatMessage({id:`${jt}aria_success${s?"_edit":""}`})),d(k)},500)}catch{T(o.formatMessage({id:`${jt}error`})),w(""),f()}},onFailure:f},fields:L,intlPath:jt,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:!l||!l.id||!B||!((R=t==null?void 0:t.coverImage)!=null&&R.url),text:{default:o.formatMessage({id:`${jt}cta_submit${s?"_edit":""}`}),submitting:o.formatMessage({id:`${jt}cta_submitting${s?"_edit":""}`}),submitted:o.formatMessage({id:`${jt}cta_submitted${s?"_edit":""}`})},customOnSubmit:b?h.jsx(h.Fragment,{}):h.jsx(SR,{})},gtm:a}),b&&h.jsx(_s,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:o.formatMessage({id:`${jt}error`})}),_&&h.jsx(ut,{"aria-live":"polite",showOnFocus:!1,children:_})]})};const OT=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=he.useIntl(),u=y.useRef(null);Ts(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=d=>{d.preventDefault(),d.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return h.jsx("form",{onSubmit:c,className:J("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:h.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:h.jsxs("p",{children:[h.jsx(ut,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),h.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&c(d)}}),h.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:h.jsx(ut,{children:l.formatMessage({id:"search_clear"})})}),h.jsx("button",{className:"search",onClick:c,children:h.jsx(ut,{children:l.formatMessage({id:"search_cta"})})})]})})})},a9=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 i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:i,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},OR=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"]}},NR=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{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=OR(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),sessionStorage.setItem(tp.SESSION_STORAGE.EMAIL,s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},IR=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,d=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},f=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>d(a.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:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{a9({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:G4,props:{email:c.email,type:c.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(f.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>d(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{d(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&f.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>h.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&f.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>h.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>h.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=>h.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(m=>{s.validFields[m]!==a[m].current.validity.valid&&(g.push({type:`validFields.${m}`,value:a[m].current.validity.valid}),m==="email"&&a9({ref:a.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const PR=({className:e=""})=>h.jsxs("div",{className:J("success-message",e),"data-testid":"success-message",children:[h.jsx("p",{className:"success-title",children:h.jsx(he.FormattedMessage,{id:"signup_success_title"})}),h.jsx(he.FormattedMessage,{id:"signup_success_text",values:{p:t=>h.jsx("p",{children:t})}})]});const RR={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},FR=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=he.useIntl(),u=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname}`,{title:c=!0,expectation:d=!1,url:f=!0,logInButton:p=!0,successMessage:g=!0}=i,m={title:c,expectation:d,url:f,logInButton:p,successMessage:g},[E,v]=y.useReducer(Fs,RR),{validFields:b,emailDetails:T,shouldManuallyApprove:_,shouldDisableButton:w,showSuccessMessage:A,showError:S}=E,[B,F]=Xh.useCookies(["signup-this-session","functional-cookie-consent"]),L={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{_===!0&&L.jobTitle.current&&L.jobTitle.current.focus()},[_]),y.useEffect(()=>{B["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[B]),y.useEffect(()=>{A&&B["functional-cookie-consent"]&&F("signup-this-session","true",{path:"/",maxAge:3600})},[A]);const R=y.useMemo(()=>IR({placeholders:n,labels:t,shouldShow:m,functions:r,refs:L,state:E,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,L,m,E]),N=w?!0:_?!Object.values(b).every(k=>k===!0):!b.name||!b.email||["exists","pending","verify"].includes(T.boxType);return m.successMessage&&A?h.jsx(PR,{className:e}):h.jsxs("fieldset",{className:J("signup-form-fieldset",e),"data-testid":"signup-form",children:[m.title&&h.jsx("p",{className:"signup-title",children:h.jsx(he.FormattedMessage,{id:"signup_title"})}),S&&h.jsx(zr,{variant:"error",text:l.formatMessage({id:"signup_error"})}),h.jsx(Gr,{className:"signup-form",formRef:L.form,id:"sign-up-form",fields:R,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:N?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:u,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:m.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await NR({refs:L,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:E})},onCatch:k=>{r.handleError(k),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),h.jsx("button",{className:"validation-button",ref:L.hiddenValidation})]})};const Zi=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return h.jsx("section",{className:J("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const BR=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),h.jsx(Zi,{className:J("download-section",n),styling:{background:"dark"},children:h.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),h.jsx(Bs,{buttons:r})]})})};const Ch="editSection_";function NT({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const MR=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=he.useIntl();return h.jsxs(Ln,{variant:"muted",icon:e,children:[h.jsx("p",{children:t||s({id:`${Ch}placeholder_description`})}),i&&h.jsx("p",{children:h.jsx(je,{href:r,variant:"secondary",size:"small",onClick:()=>NT({href:r,setShowModal:a}),children:n||s({id:`${Ch}placeholder_cta`})})})]})},LR=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:c}=he.useIntl(),[d,f]=y.useState(!1),p=()=>f(!1),g=!!n||!!r,m=typeof i=="string"||g;let E;return r&&(E=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),h.jsxs("section",{className:J("edit-section",t),children:[g&&h.jsx(vi,{title:o||`Edit ${a}`,isOpen:d,showDivider:!1,showIcon:!1,functions:{onClose:p},className:J("edit-section-modal"),children:E||(n?h.jsx(Gr,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var b,T;(b=n==null?void 0:n.functions)!=null&&b.onSuccess&&await((T=n==null?void 0:n.functions)==null?void 0:T.onSuccess(v)),f(!1)},onCancel:p}}):h.jsx(h.Fragment,{}))}),h.jsxs("div",{className:J("edit-section-header",{"no-title":!s}),children:[s&&h.jsx("h2",{className:"edit-section-header-title",children:a}),m&&h.jsx(je,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>NT({href:i,setShowModal:f}),children:c({id:`${Ch}edit`})})]}),e||h.jsx(MR,{...l,href:i,setShowModal:f,showEditButton:m}),u&&h.jsx(br,{})]})};const $R=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===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 h.jsxs("div",{className:J("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:J("title",s.className)},s.text),t&&h.jsx("p",{children:t}),h.jsx("ul",{className:J({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:c,nameOfBusiness:d,link:f=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const m=h.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:d});return h.jsxs("li",{children:[h.jsx("p",{className:"img-wrapper",children:f?h.jsx("a",{href:f,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),p&&h.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};let wd;const Ad="contactFooter_",jR=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(wd),wd=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(wd),window.removeEventListener("resize",l)}),[]),h.jsx(Zi,{id:"contactForm",className:"contact-footer",children:h.jsxs("div",{className:"inner-wrapper",children:[h.jsx("h2",{children:h.jsx(he.FormattedMessage,{id:`${Ad}title`})}),h.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[h.jsxs("aside",{children:[h.jsx("p",{children:h.jsx(he.FormattedMessage,{id:`${Ad}text`})}),h.jsx(Ki,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:h.jsx(he.FormattedMessage,{id:`${Ad}email`})})]}),h.jsx(AT,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},HR=({activeLink:e,profile:t,...n})=>h.jsx(Zi,{children:h.jsx(V4,{layout:"1-3",children:h.jsxs(h.Fragment,{children:[h.jsx(W4,{activeLink:e,profile:t}),h.jsx(c4,{...n})]})})});const Sd="cookieBanner_",kd=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Dd=new Date(Date.now()+12*30*24*60*60*1e3),IT=()=>{const e=he.useIntl(),[t,n,r]=Xh.useCookies(kd),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{kd.forEach(c=>{n(c,!0,{path:"/",expires:Dd,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Dd}),kd.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Dd});return}r(c)}),a(!1)};if(!i)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Sd}buttons_${c.id}`})})}),h.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[h.jsx("h6",{children:e.formatMessage({id:`${Sd}title`})}),h.jsx("p",{children:e.formatMessage({id:`${Sd}text`})}),h.jsx(Bs,{buttons:u})]})},li={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:rs["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:rs["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:rs.support,gtmType:"concierge-email-click"},business:{email:rs.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 us="footer_",Sc="SiteFooter",s9=({group:e})=>{const t=li[e].order||[];let n=!1;return"text"in li[e]&&(n=li[e].text),h.jsxs(y.Fragment,{children:[h.jsx("p",{className:"pre-title",children:h.jsx(he.FormattedMessage,{id:`${us}${e}`})}),Array.isArray(t)&&t.length>0&&h.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=li[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),h.jsx("li",{children:h.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":a,...s,children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&h.jsx("dl",{className:"text-medium",children:n.order.map(r=>h.jsxs(y.Fragment,{children:[h.jsx("dt",{children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}`})}),h.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&h.jsx("address",{children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}_address`,values:{br:h.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&h.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},tm=()=>h.jsx("div",{id:"footer",children:h.jsxs("div",{className:"wrapper",children:[h.jsx(Hc,{element:"hr"}),h.jsx(wp,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":"logo-homepage-link"}),h.jsx("footer",{children:["platform","community","company","contact"].map(e=>h.jsxs("div",{className:"group",children:[h.jsx(s9,{group:e}),Object.keys(li[e]).includes("child")&&h.jsx(s9,{group:li[e].child})]},e))}),h.jsx("hr",{}),h.jsxs("div",{className:"sub-footer",children:[h.jsx("ul",{children:Array.isArray(li.social.order)&&li.social.order.map(e=>{const t=li.social[e];return h.jsx("li",{className:e,children:h.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":"social-click",children:h.jsx("span",{className:"hidden",children:h.jsx(he.FormattedMessage,{id:`${us}social_${e}`})})})},e)})}),h.jsx("small",{children:h.jsx(he.FormattedMessage,{id:`${us}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Wr=Object.create(null);Wr.open="0";Wr.close="1";Wr.ping="2";Wr.pong="3";Wr.message="4";Wr.upgrade="5";Wr.noop="6";const Yu=Object.create(null);Object.keys(Wr).forEach(e=>{Yu[Wr[e]]=e});const xh={type:"error",data:"parser error"},PT=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",RT=typeof ArrayBuffer=="function",FT=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,nm=({type:e,data:t},n,r)=>PT&&t instanceof Blob?n?r(t):o9(t,r):RT&&(t instanceof ArrayBuffer||FT(t))?n?r(t):o9(new Blob([t]),r):r(Wr[e]+(t||"")),o9=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function l9(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Od;function UR(e,t){if(PT&&e.data instanceof Blob)return e.data.arrayBuffer().then(l9).then(t);if(RT&&(e.data instanceof ArrayBuffer||FT(e.data)))return t(l9(e.data));nm(e,!1,n=>{Od||(Od=new TextEncoder),t(Od.encode(n))})}const u9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ao=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<u9.length;e++)Ao[u9.charCodeAt(e)]=e;const zR=e=>{let t=e.length*.75,n=e.length,r,i=0,a,s,o,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r<n;r+=4)a=Ao[e.charCodeAt(r)],s=Ao[e.charCodeAt(r+1)],o=Ao[e.charCodeAt(r+2)],l=Ao[e.charCodeAt(r+3)],c[i++]=a<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|l&63;return u},qR=typeof ArrayBuffer=="function",rm=(e,t)=>{if(typeof e!="string")return{type:"message",data:BT(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:WR(e.substring(1),t)}:Yu[n]?e.length>1?{type:Yu[n],data:e.substring(1)}:{type:Yu[n]}:xh},WR=(e,t)=>{if(qR){const n=zR(e);return BT(n,t)}else return{base64:!0,data:e}},BT=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},MT=String.fromCharCode(30),VR=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,s)=>{nm(a,!1,o=>{r[s]=o,++i===n&&t(r.join(MT))})})},KR=(e,t)=>{const n=e.split(MT),r=[];for(let i=0;i<n.length;i++){const a=rm(n[i],t);if(r.push(a),a.type==="error")break}return r};function GR(){return new TransformStream({transform(e,t){UR(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Nd;function Jl(e){return e.reduce((t,n)=>t+n.length,0)}function eu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function YR(e,t){Nd||(Nd=new TextDecoder);const n=[];let r=0,i=-1,a=!1;return new TransformStream({transform(s,o){for(n.push(s);;){if(r===0){if(Jl(n)<1)break;const l=eu(n,1);a=(l[0]&128)===128,i=l[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Jl(n)<2)break;const l=eu(n,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(Jl(n)<8)break;const l=eu(n,8),u=new DataView(l.buffer,l.byteOffset,l.length),c=u.getUint32(0);if(c>Math.pow(2,53-32)-1){o.enqueue(xh);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Jl(n)<i)break;const l=eu(n,i);o.enqueue(rm(a?l:Nd.decode(l),t)),r=0}if(i===0||i>e){o.enqueue(xh);break}}}})}const LT=4;function Wt(e){if(e)return ZR(e)}function ZR(e){for(var t in Wt.prototype)e[t]=Wt.prototype[t];return e}Wt.prototype.on=Wt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Wt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Wt.prototype.off=Wt.prototype.removeListener=Wt.prototype.removeAllListeners=Wt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Wt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this};Wt.prototype.emitReserved=Wt.prototype.emit;Wt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Wt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const t1=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Jn=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),QR="arraybuffer";function $T(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const XR=Jn.setTimeout,JR=Jn.clearTimeout;function n1(e,t){t.useNativeTimers?(e.setTimeoutFn=XR.bind(Jn),e.clearTimeoutFn=JR.bind(Jn)):(e.setTimeoutFn=Jn.setTimeout.bind(Jn),e.clearTimeoutFn=Jn.clearTimeout.bind(Jn))}const eF=1.33;function tF(e){return typeof e=="string"?nF(e):Math.ceil((e.byteLength||e.size)*eF)}function nF(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function jT(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rF(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function iF(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let a=n[r].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class aF extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class im extends Wt{constructor(t){super(),this.writable=!1,n1(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new aF(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=rm(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=rF(t);return n.length?"?"+n:""}}class sF extends im{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};KR(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,VR(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jT()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let HT=!1;try{HT=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const oF=HT;function lF(){}class uF extends sF{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Lr extends Wt{constructor(t,n,r){super(),this.createRequest=t,n1(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=$T(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Lr.requestsCount++,Lr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=lF,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Lr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Lr.requestsCount=0;Lr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",c9);else if(typeof addEventListener=="function"){const e="onpagehide"in Jn?"pagehide":"unload";addEventListener(e,c9,!1)}}function c9(){for(let e in Lr.requests)Lr.requests.hasOwnProperty(e)&&Lr.requests[e].abort()}const cF=function(){const e=UT({xdomain:!1});return e&&e.responseType!==null}();class dF extends uF{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=cF&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Lr(UT,this.uri(),t)}}function UT(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||oF))return new XMLHttpRequest}catch{}if(!t)try{return new Jn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zT=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fF extends im{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=zT?{}:$T(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;nm(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}i&&t1(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jT()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Id=Jn.WebSocket||Jn.MozWebSocket;class hF extends fF{createSocket(t,n,r){return zT?new Id(t,n,r):n?new Id(t,n):new Id(t)}doWrite(t,n){this.ws.send(n)}}class pF extends im{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=YR(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=GR();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{r.read().then(({done:o,value:l})=>{o||(this.onPacket(l),a())}).catch(o=>{})};a();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&t1(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const mF={websocket:hF,webtransport:pF,polling:dF},gF=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vF=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function wh(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=gF.exec(e||""),a={},s=14;for(;s--;)a[vF[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=EF(a,a.path),a.queryKey=yF(a,a.query),a}function EF(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function yF(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}const Ah=typeof addEventListener=="function"&&typeof removeEventListener=="function",Zu=[];Ah&&addEventListener("offline",()=>{Zu.forEach(e=>e())},!1);class Hi extends Wt{constructor(t,n){if(super(),this.binaryType=QR,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=wh(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=wh(n.host).host);n1(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=iF(this.opts.query)),Ah&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Zu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=LT,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Hi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Hi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=tF(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,t1(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Hi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ah&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Zu.indexOf(this._offlineEventListener);r!==-1&&Zu.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Hi.protocol=LT;class bF extends Hi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Hi.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Hi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function a(){r||(r=!0,c(),n.close(),n=null)}const s=d=>{const f=new Error("probe error: "+d);f.transport=n.name,a(),this.emitReserved("upgradeError",f)};function o(){s("transport closed")}function l(){s("socket closed")}function u(d){n&&d.name!==n.name&&a()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",o),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",o),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let TF=class extends bF{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>mF[i]).filter(i=>!!i)),super(t,r)}};function _F(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=wh(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const CF=typeof ArrayBuffer=="function",xF=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qT=Object.prototype.toString,wF=typeof Blob=="function"||typeof Blob<"u"&&qT.call(Blob)==="[object BlobConstructor]",AF=typeof File=="function"||typeof File<"u"&&qT.call(File)==="[object FileConstructor]";function am(e){return CF&&(e instanceof ArrayBuffer||xF(e))||wF&&e instanceof Blob||AF&&e instanceof File}function Qu(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Qu(e[n]))return!0;return!1}if(am(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Qu(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Qu(e[n]))return!0;return!1}function SF(e){const t=[],n=e.data,r=e;return r.data=Sh(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Sh(e,t){if(!e)return e;if(am(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Sh(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Sh(e[r],t));return n}return e}function kF(e,t){return e.data=kh(e.data,t),delete e.attachments,e}function kh(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=kh(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=kh(e[n],t));return e}const DF=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],OF=5;var ot;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ot||(ot={}));class NF{constructor(t){this.replacer=t}encode(t){return(t.type===ot.EVENT||t.type===ot.ACK)&&Qu(t)?this.encodeAsBinary({type:t.type===ot.EVENT?ot.BINARY_EVENT:ot.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ot.BINARY_EVENT||t.type===ot.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=SF(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function d9(e){return Object.prototype.toString.call(e)==="[object Object]"}class sm extends Wt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===ot.BINARY_EVENT;r||n.type===ot.BINARY_ACK?(n.type=r?ot.EVENT:ot.ACK,this.reconstructor=new IF(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(am(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(ot[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ot.BINARY_EVENT||r.type===ot.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(a,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(a,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const a=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}r.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(sm.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ot.CONNECT:return d9(n);case ot.DISCONNECT:return n===void 0;case ot.CONNECT_ERROR:return typeof n=="string"||d9(n);case ot.EVENT:case ot.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&DF.indexOf(n[0])===-1);case ot.ACK:case ot.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class IF{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=kF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const PF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:sm,Encoder:NF,get PacketType(){return ot},protocol:OF},Symbol.toStringTag,{value:"Module"}));function vr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const RF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class WT extends Wt{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[vr(t,"open",this.onopen.bind(this)),vr(t,"packet",this.onpacket.bind(this)),vr(t,"error",this.onerror.bind(this)),vr(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,a;if(RF.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:ot.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const c=this.ids++,d=n.pop();this._registerAckCallback(c,d),s.id=c}const o=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,l=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===t&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},i),s=(...o)=>{this.io.clearTimeoutFn(a),n.apply(this,o)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const a=(s,o)=>s?i(s):r(o);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ot.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ot.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ot.EVENT:case ot.BINARY_EVENT:this.onevent(t);break;case ot.ACK:case ot.BINARY_ACK:this.onack(t);break;case ot.DISCONNECT:this.ondisconnect();break;case ot.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:ot.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ot.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Hs(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Hs.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Hs.prototype.reset=function(){this.attempts=0};Hs.prototype.setMin=function(e){this.ms=e};Hs.prototype.setMax=function(e){this.max=e};Hs.prototype.setJitter=function(e){this.jitter=e};class Dh extends Wt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,n1(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Hs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||PF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new TF(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=vr(n,"open",function(){r.onopen(),t&&t()}),a=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),t?t(o):this.maybeReconnectOnOpen()},s=vr(n,"error",a);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(vr(t,"ping",this.onping.bind(this)),vr(t,"data",this.ondata.bind(this)),vr(t,"error",this.onerror.bind(this)),vr(t,"close",this.onclose.bind(this)),vr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){t1(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new WT(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ao={};function Xu(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=_F(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=ao[i]&&a in ao[i].nsps,o=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return o?l=new Dh(r,t):(ao[i]||(ao[i]=new Dh(r,t)),l=ao[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Xu,{Manager:Dh,Socket:WT,io:Xu,connect:Xu});const f9=e=>{let t;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const p=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,p))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}},u=t=e(r,i,l);return l},VT=e=>e?f9(e):f9;function FF(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(i){i(n)}),(r=e.get("*"))&&r.slice().map(function(i){i(t,n)})}}}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}class BF extends Error{constructor(t){super(t),this.name=void 0,this.name="SuprSendError"}}function ga(){return Math.round(Date.now())}function ra(){var e=new Date().getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?r:r&3|8).toString(16)});return t}const pn=VT()(()=>({apiUrl:"https://inboxs.live",collectorApiUrl:"https://hub.suprsend.com",socketUrl:"https://betainbox.suprsend.com",pageSize:20})),MF={unseenCount:0,stores:{},activeStoreId:null,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null},st=VT()(()=>MF);class LF{constructor(t){this.socket=void 0,this.config=void 0,this.config=t;const n=pn.getState();this.socket=Xu(n.socketUrl,{transports:["websocket"],auth:{subscriber_id:this.config.subscriberId,distinct_id:this.config.distinctId,authorization:`${this.config.workspaceKey}:${ra()}`,tenant_id:this.config.tenantId},reconnectionAttempts:25,reconnectionDelay:5e3,reconnectionDelayMax:1e4}),this._initializeSocketEvents()}orderNotifications(t,n){if(t.is_pinned)return[t,...n];{let r=!1,i=[];return n.forEach(a=>{a.is_pinned||r?i.push(a):(i.push(t),i.push(a),r=!0)}),r?i:[...n,t]}}_initializeSocketEvents(){var t=this;this.socket.on("new_notification",async function(n){n.n_id&&setTimeout(async function(){try{const i=await(await t.getNotificationDetails(n.n_id)).json(),a=st.getState();if(t.config.stores){let s=!1;for(let o of t.config.stores){const l=a.stores[o.storeId];t._notificationBelongToStore(i.data,o)&&(s=!0,l.notifications=t.orderNotifications(i.data,l.notifications),l.unseenCount+=1)}s&&(a.unseenCount+=1,t.config.emitter.emit("new_notification",i.data)),st.setState({unseenCount:a.unseenCount,stores:Mn({},a.stores)})}else{if(!a.activeStoreId)return;let s=a.stores[a.activeStoreId];a.unseenCount+=1,s.unseenCount+=1,s.notifications=t.orderNotifications(i.data,s.notifications),st.setState({unseenCount:a.unseenCount,stores:Mn({},a.stores)}),t.config.emitter.emit("new_notification",i.data)}t.config.emitter.emit("sync_notif_store")}catch(r){console.log("SuprSend: error in new_notification event",r)}},1e3)}),this.socket.on("notification_updated",async function(n){n.n_id&&setTimeout(async function(){try{const a=await Promise.allSettled([t.getNotificationDetails(n.n_id),t.getNotificationsCount()]),s=st.getState();let o=s.activeStoreId;if(a[0].status==="fulfilled"){var r;const u=await a[0].value.json(),c=u.data;if(!o)return;let d=s.stores[o];const f=(r=t.config.stores)==null?void 0:r.find(p=>p.storeId===o);if((n==null?void 0:n.type)==="archive"){var i;f!=null&&(i=f.query)!=null&&i.archived?t._notificationBelongToStore(c,f)&&(s.stores[o].notifications=[c,...d.notifications]):s.stores[o].notifications=d.notifications.filter(p=>p.n_id!==n.n_id)}else s.stores[o].notifications=d.notifications.map(p=>p.n_id===n.n_id?u.data:p);st.setState({stores:Mn({},s.stores)})}if(a[1].status==="fulfilled"){const u=await a[1].value.json();st.setState(c=>{for(let d in c.stores){const f=c.stores[d];f.unseenCount=u[d]||0}return{unseenCount:u.ss_bell_count,stores:Mn({},c.stores)}})}t.config.emitter.emit("sync_notif_store")}catch(a){console.log("SuprSend: error in notification_updated event",a)}},1e3)}),this.socket.on("update_badge",async function(){st.setState({unseenCount:0}),t.config.emitter.emit("sync_notif_store")}),this.socket.on("mark_all_read",async function(){const n=st.getState(),r=ga();for(let i in n.stores){const a=n.stores[i];a.notifications.forEach(s=>{s.seen_on||(s.seen_on=r)}),a.unseenCount=0}st.setState({stores:n.stores}),t.config.emitter.emit("sync_notif_store")})}_notificationBelongToStore(t,n){var r,i,a,s;const o=!!t.seen_on,l=t.archived,u=t.tags,c=t.n_category,d=n==null||(r=n.query)==null?void 0:r.read,f=n==null||(i=n.query)==null?void 0:i.archived,p=n==null||(a=n.query)==null?void 0:a.tags,g=n==null||(s=n.query)==null?void 0:s.categories,m=!d||o===d,E=!f||l===f;let v,b;return Array.isArray(p)&&p.length>0?p.forEach(T=>{u!=null&&u.includes(T)&&(v=!0)}):v=!0,Array.isArray(g)&&g.length>0?g.includes(c)&&(b=!0):b=!0,m&&v&&b&&E}_getStoreQueryString(t){const n=t==null?void 0:t.query;let r=(n==null?void 0:n.tags)||[],i=(n==null?void 0:n.categories)||[];const a=n==null?void 0:n.read,s=n==null?void 0:n.archived;return{store_id:t.storeId,query:{read:a,archived:s,tags:{or:r},categories:{or:i}}}}_getStoresQueryString(){const t=this.config.stores;return t==null?void 0:t.map(r=>this._getStoreQueryString(r))}getNotificationsCount(){const{apiUrl:t}=pn.getState();let n=`/notification_count/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}`;if(this.config.stores){const r=this._getStoresQueryString();n+=`&stores=${encodeURIComponent(JSON.stringify(r))}`}return fetch(`${t}${n}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}getNotifications(t,n,r=20,i){const{apiUrl:a}=pn.getState();let s=`/notifications/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}&page_no=${n}&page_size=${r}&before=${i}`;if(t){const o=this._getStoreQueryString(t);s+=`&store=${encodeURIComponent(JSON.stringify(o))}`}return fetch(`${a}${s}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}getNotificationDetails(t){const{apiUrl:n}=pn.getState(),r=`/notification/${t}/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}`;return fetch(`${n}${r}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}markBellClicked(){const{apiUrl:t}=pn.getState(),n="/bell-clicked/",r=JSON.stringify({time:ga(),distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId,tenant_id:this.config.tenantId});return fetch(`${t}${n}`,{method:"POST",body:r,headers:{Authorization:`${this.config.workspaceKey}:${ra()}`,"Content-Type":"application/json"}})}markAllRead(){const{apiUrl:t}=pn.getState(),n="/mark-all-read/",r=JSON.stringify({time:ga(),distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId,tenant_id:this.config.tenantId});return fetch(`${t}${n}`,{method:"POST",body:r,headers:{Authorization:`${this.config.workspaceKey}:${ra()}`,"Content-Type":"application/json"}})}markNotificationClicked(t){const{collectorApiUrl:n}=pn.getState(),r={event:"$notification_clicked",env:this.config.workspaceKey,$insert_id:ra(),$time:ga(),properties:{id:t}};return fetch(`${n}/event/`,{method:"POST",body:JSON.stringify(r),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationRead(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"read",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationUnRead(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"unread",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationArchive(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"archive",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}}let h9=class{constructor(t){this.config=void 0,this.config=t}_overallFirstApiCall(){const t=st.getState();for(let n in t.stores)if(t.stores[n].isFirstCall===!1)return!1;return!0}async fetchNotifications(){var t,n;const r=this.config.client,i=st.getState(),a=pn.getState(),s=i.activeStoreId;if(!s||!((t=i.stores)!=null&&t[s]))return;const o=i.stores[s],l=o.isFirstCall,u=i.initialFetchTime||Date.now(),c=(n=this.config.stores)==null?void 0:n.find(d=>d.storeId===s);try{if(!r||!i.hasNext)return;l?(st.setState({initialLoading:!0}),this._overallFirstApiCall()&&this.getNotificationsCount()):i.pageNumber>1&&st.setState({fetchMoreLoading:!0}),this.config.emitter.emit("sync_notif_store");const f=await(await r.getNotifications(c,i.pageNumber,a.pageSize,u)).json();let p;l||!l&&i.pageNumber===1?p=f.results:p=[...o.notifications,...f.results],i.stores[s].notifications=p,i.stores[s].isFirstCall=!1,st.setState({stores:i.stores,pageNumber:i.pageNumber+1,hasNext:f.meta.current_page<f.meta.total_pages,initialFetchTime:u,initialLoading:!1,fetchMoreLoading:!1}),this.config.emitter.emit("sync_notif_store"),this.config._startExipryCheck()}catch(d){console.log("SUPRSEND: error getting latest notifications",d),st.setState({initialLoading:!1,fetchMoreLoading:!1}),this.config.emitter.emit("sync_notif_store")}}async getNotificationsCount(){const t=this.config.client;if(t)try{const r=await(await t.getNotificationsCount()).json();st.setState(i=>{for(let a in i.stores){const s=i.stores[a];s.unseenCount=r[a]||0}return{unseenCount:r.ss_bell_count,stores:Mn({},i.stores)}}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error getting notifications count",n)}}async markClicked(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&(!l.interacted_on||!l.seen_on)){if(!r)return;try{l.interacted_on?l.seen_on||r.markNotificationRead(t):r.markNotificationClicked(t);const c=ga();if(l.interacted_on=c,!l.seen_on)for(let d in i==null?void 0:i.stores){var u;const f=i.stores[d];(u=f.notifications)==null||u.forEach(p=>{p.n_id===l.n_id&&(p.seen_on=c,p.interacted_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification clicked",c)}}}async markAllSeen(){const t=this.config.client;try{if(!t)return;t.markBellClicked(),st.setState({unseenCount:0}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error marking all notifications seen",n)}}async markAllRead(){const t=this.config.client;try{if(!t)return;t.markAllRead();const n=st.getState(),r=ga();for(let i in n.stores){const a=n.stores[i];a.notifications.forEach(s=>{s.seen_on||(s.seen_on=r)}),a.unseenCount=0}st.setState({stores:n.stores}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error marking all notifications read",n)}}async markRead(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&!l.seen_on){if(!r)return;try{r.markNotificationRead(t);const c=ga();if(!l.seen_on)for(let d in i==null?void 0:i.stores){var u;const f=i.stores[d];(u=f.notifications)==null||u.forEach(p=>{p.n_id===l.n_id&&(p.seen_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification read",c)}}}async markUnRead(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&l.seen_on){if(!r)return;try{if(r.markNotificationUnRead(t),l.seen_on)for(let c in i==null?void 0:i.stores){var u;const d=i.stores[c];(u=d.notifications)==null||u.forEach(f=>{f.n_id===l.n_id&&(f.seen_on=void 0,d.unseenCount>=0&&(d.unseenCount+=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification read",c)}}}markArchived(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const o=(i==null?void 0:i.stores)[a],l=o.notifications.find(u=>u.n_id===t);if(l&&!l.archived){if(!r)return;try{r.markNotificationArchive(t),o.notifications=o.notifications.filter(u=>u.n_id!==t),!l.seen_on&&o.unseenCount>0&&(o.unseenCount-=1),st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(u){console.log("SUPRSEND: error marking notification archived",u)}}}get stores(){return this.config.stores}get data(){const t=st.getState(),n=t.activeStoreId,r=this.stores;if(n)return{unseenCount:t.unseenCount,activeStoreId:t.activeStoreId,stores:t.stores,hasStores:r?(r==null?void 0:r.length)>0:!1,hasNext:t.hasNext,initialLoading:t.initialLoading,fetchMoreLoading:t.fetchMoreLoading}}};class $F{constructor(t,n){this.workspaceKey="",this.tenantId=void 0,this.stores=void 0,this.distinctId=void 0,this.subscriberId=void 0,this._client=void 0,this._expiryTimerId=void 0,this.feed=new h9(this),this.emitter=FF(),this._validateConfig(t),this._setConfigStoreState((n==null?void 0:n.host)||{}),this.tenantId=(n==null?void 0:n.tenantID)||"default",this._validateStore(n==null?void 0:n.stores),this._validatePageSize(n==null?void 0:n.pageSize),this._initializeStoreState()}_validateConfig(t){if(t)this.workspaceKey=t;else throw new BF("workspaceKey missing")}_validateStore(t){if(!t||!Array.isArray(t))return;const n=[];t.forEach(r=>{if(!r.storeId){console.log("SuprSendInbox: storeId is mandatory if stores are used");return}const i=r==null?void 0:r.query;let a,s=[],o=[],l;typeof(i==null?void 0:i.read)=="boolean"&&(a=i.read),typeof(i==null?void 0:i.archived)=="boolean"&&(l=i.archived),typeof(i==null?void 0:i.tags)=="string"?s=[i.tags]:Array.isArray(i==null?void 0:i.tags)&&(s=i==null?void 0:i.tags.filter(u=>typeof u=="string")),typeof(i==null?void 0:i.categories)=="string"?o=[i.categories]:Array.isArray(i==null?void 0:i.categories)&&(o=i==null?void 0:i.categories.filter(u=>typeof u=="string")),n.push({storeId:r.storeId,label:r.label||r.storeId,query:{archived:l,read:a,tags:s,categories:o}})}),this.stores=n}_validatePageSize(t){if(t&&typeof t=="number"){const r=t<=50?t:50;pn.setState({pageSize:r})}}_setConfigStoreState(t){t&&(t!=null&&t.socketHost&&pn.setState({socketUrl:t.socketHost}),t!=null&&t.apiHost&&pn.setState({apiUrl:t.apiHost}),t!=null&&t.collectorHost&&pn.setState({collectorApiUrl:t.collectorHost}))}_initializeStoreState(){const t="default_store",n={notifications:[],unseenCount:0,isFirstCall:!0};if(this.stores&&Array.isArray(this.stores)&&this.stores.length>0){const r={};this.stores.map(i=>{r[i.storeId]=Mn({},n)}),st.setState({stores:r,activeStoreId:this.stores[0].storeId})}else st.setState({stores:{[t]:Mn({},n)},activeStoreId:t});setTimeout(()=>{this.emitter.emit("sync_notif_store")},0)}_startExipryCheck(){var t=this;this._expiryTimerId||(this._expiryTimerId=setInterval(async function(){const r=st.getState().stores;let i=!1;for(let a in r){let s=r[a].notifications;s=s.filter(o=>(o.expiry?Date.now()>o.expiry:!1)?(i=!0,!1):!0),r[a].notifications=s}i&&(st.setState({stores:r}),await t.feed.getNotificationsCount(),t.emitter.emit("sync_notif_store"))},3e4))}get client(){return this.distinctId&&this.subscriberId&&(this._client||(this._client=new LF(this))),this._client}identifyUser(t,n){this.distinctId=t,this.subscriberId=n}changeActiveStore(t){var n;const r=st.getState(),i={};if(r.activeStoreId!==t&&(n=r.stores)!=null&&n[t]){for(let a in r.stores){const s=r.stores[a],o=s.notifications.slice(0,20);i[a]={notifications:o,unseenCount:s.unseenCount,isFirstCall:s.isFirstCall}}st.setState({activeStoreId:t,stores:i,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null}),this.client&&this.feed.fetchNotifications()}}resetUser(){var t;st.setState({unseenCount:0,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null}),this._initializeStoreState(),(t=this._client)==null||t.socket.disconnect(),this.distinctId=void 0,this.subscriberId=void 0,this._client=void 0,clearInterval(this._expiryTimerId),this._expiryTimerId=void 0,this.feed=new h9(this)}}var p9=function(t){return t.reduce(function(n,r){var i=r[0],a=r[1];return n[i]=a,n},{})},m9=typeof window<"u"&&window.document&&window.document.createElement?rn.useLayoutEffect:rn.useEffect,Sn="top",sr="bottom",or="right",kn="left",om="auto",yl=[Sn,sr,or,kn],Os="start",ll="end",jF="clippingParents",KT="viewport",so="popper",HF="reference",g9=yl.reduce(function(e,t){return e.concat([t+"-"+Os,t+"-"+ll])},[]),GT=[].concat(yl,[om]).reduce(function(e,t){return e.concat([t,t+"-"+Os,t+"-"+ll])},[]),UF="beforeRead",zF="read",qF="afterRead",WF="beforeMain",VF="main",KF="afterMain",GF="beforeWrite",YF="write",ZF="afterWrite",QF=[UF,zF,qF,WF,VF,KF,GF,YF,ZF];function Vr(e){return e?(e.nodeName||"").toLowerCase():null}function Un(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Sa(e){var t=Un(e).Element;return e instanceof t||e instanceof Element}function rr(e){var t=Un(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lm(e){if(typeof ShadowRoot>"u")return!1;var t=Un(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function XF(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},a=t.elements[n];!rr(a)||!Vr(a)||(Object.assign(a.style,r),Object.keys(i).forEach(function(s){var o=i[s];o===!1?a.removeAttribute(s):a.setAttribute(s,o===!0?"":o)}))})}function JF(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],a=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),o=s.reduce(function(l,u){return l[u]="",l},{});!rr(i)||!Vr(i)||(Object.assign(i.style,o),Object.keys(a).forEach(function(l){i.removeAttribute(l)}))})}}const eB={name:"applyStyles",enabled:!0,phase:"write",fn:XF,effect:JF,requires:["computeStyles"]};function $r(e){return e.split("-")[0]}var Ta=Math.max,kc=Math.min,Ns=Math.round;function Oh(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function YT(){return!/^((?!chrome|android).)*safari/i.test(Oh())}function Is(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&rr(e)&&(i=e.offsetWidth>0&&Ns(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Ns(r.height)/e.offsetHeight||1);var s=Sa(e)?Un(e):window,o=s.visualViewport,l=!YT()&&n,u=(r.left+(l&&o?o.offsetLeft:0))/i,c=(r.top+(l&&o?o.offsetTop:0))/a,d=r.width/i,f=r.height/a;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function um(e){var t=Is(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function ZT(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lm(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hi(e){return Un(e).getComputedStyle(e)}function tB(e){return["table","td","th"].indexOf(Vr(e))>=0}function Qi(e){return((Sa(e)?e.ownerDocument:e.document)||window.document).documentElement}function r1(e){return Vr(e)==="html"?e:e.assignedSlot||e.parentNode||(lm(e)?e.host:null)||Qi(e)}function v9(e){return!rr(e)||hi(e).position==="fixed"?null:e.offsetParent}function nB(e){var t=/firefox/i.test(Oh()),n=/Trident/i.test(Oh());if(n&&rr(e)){var r=hi(e);if(r.position==="fixed")return null}var i=r1(e);for(lm(i)&&(i=i.host);rr(i)&&["html","body"].indexOf(Vr(i))<0;){var a=hi(i);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return i;i=i.parentNode}return null}function bl(e){for(var t=Un(e),n=v9(e);n&&tB(n)&&hi(n).position==="static";)n=v9(n);return n&&(Vr(n)==="html"||Vr(n)==="body"&&hi(n).position==="static")?t:n||nB(e)||t}function cm(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function $o(e,t,n){return Ta(e,kc(t,n))}function rB(e,t,n){var r=$o(e,t,n);return r>n?n:r}function QT(){return{top:0,right:0,bottom:0,left:0}}function XT(e){return Object.assign({},QT(),e)}function JT(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var iB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,XT(typeof t!="number"?t:JT(t,yl))};function aB(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,o=$r(n.placement),l=cm(o),u=[kn,or].indexOf(o)>=0,c=u?"height":"width";if(!(!a||!s)){var d=iB(i.padding,n),f=um(a),p=l==="y"?Sn:kn,g=l==="y"?sr:or,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],E=s[l]-n.rects.reference[l],v=bl(a),b=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,T=m/2-E/2,_=d[p],w=b-f[c]-d[g],A=b/2-f[c]/2+T,S=$o(_,A,w),B=l;n.modifiersData[r]=(t={},t[B]=S,t.centerOffset=S-A,t)}}function sB(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||ZT(t.elements.popper,i)&&(t.elements.arrow=i))}const oB={name:"arrow",enabled:!0,phase:"main",fn:aB,effect:sB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ps(e){return e.split("-")[1]}var lB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uB(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Ns(n*i)/i||0,y:Ns(r*i)/i||0}}function E9(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,o=e.position,l=e.gpuAcceleration,u=e.adaptive,c=e.roundOffsets,d=e.isFixed,f=s.x,p=f===void 0?0:f,g=s.y,m=g===void 0?0:g,E=typeof c=="function"?c({x:p,y:m}):{x:p,y:m};p=E.x,m=E.y;var v=s.hasOwnProperty("x"),b=s.hasOwnProperty("y"),T=kn,_=Sn,w=window;if(u){var A=bl(n),S="clientHeight",B="clientWidth";if(A===Un(n)&&(A=Qi(n),hi(A).position!=="static"&&o==="absolute"&&(S="scrollHeight",B="scrollWidth")),A=A,i===Sn||(i===kn||i===or)&&a===ll){_=sr;var F=d&&A===w&&w.visualViewport?w.visualViewport.height:A[S];m-=F-r.height,m*=l?1:-1}if(i===kn||(i===Sn||i===sr)&&a===ll){T=or;var L=d&&A===w&&w.visualViewport?w.visualViewport.width:A[B];p-=L-r.width,p*=l?1:-1}}var R=Object.assign({position:o},u&&lB),N=c===!0?uB({x:p,y:m},Un(n)):{x:p,y:m};if(p=N.x,m=N.y,l){var k;return Object.assign({},R,(k={},k[_]=b?"0":"",k[T]=v?"0":"",k.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",k))}return Object.assign({},R,(t={},t[_]=b?m+"px":"",t[T]=v?p+"px":"",t.transform="",t))}function cB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,a=n.adaptive,s=a===void 0?!0:a,o=n.roundOffsets,l=o===void 0?!0:o,u={placement:$r(t.placement),variation:Ps(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,E9(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,E9(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const dB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:cB,data:{}};var tu={passive:!0};function fB(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0?!0:i,s=r.resize,o=s===void 0?!0:s,l=Un(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&u.forEach(function(c){c.addEventListener("scroll",n.update,tu)}),o&&l.addEventListener("resize",n.update,tu),function(){a&&u.forEach(function(c){c.removeEventListener("scroll",n.update,tu)}),o&&l.removeEventListener("resize",n.update,tu)}}const hB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:fB,data:{}};var pB={left:"right",right:"left",bottom:"top",top:"bottom"};function Ju(e){return e.replace(/left|right|bottom|top/g,function(t){return pB[t]})}var mB={start:"end",end:"start"};function y9(e){return e.replace(/start|end/g,function(t){return mB[t]})}function dm(e){var t=Un(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fm(e){return Is(Qi(e)).left+dm(e).scrollLeft}function gB(e,t){var n=Un(e),r=Qi(e),i=n.visualViewport,a=r.clientWidth,s=r.clientHeight,o=0,l=0;if(i){a=i.width,s=i.height;var u=YT();(u||!u&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:a,height:s,x:o+fm(e),y:l}}function vB(e){var t,n=Qi(e),r=dm(e),i=(t=e.ownerDocument)==null?void 0:t.body,a=Ta(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ta(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),o=-r.scrollLeft+fm(e),l=-r.scrollTop;return hi(i||n).direction==="rtl"&&(o+=Ta(n.clientWidth,i?i.clientWidth:0)-a),{width:a,height:s,x:o,y:l}}function hm(e){var t=hi(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function e8(e){return["html","body","#document"].indexOf(Vr(e))>=0?e.ownerDocument.body:rr(e)&&hm(e)?e:e8(r1(e))}function jo(e,t){var n;t===void 0&&(t=[]);var r=e8(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),a=Un(r),s=i?[a].concat(a.visualViewport||[],hm(r)?r:[]):r,o=t.concat(s);return i?o:o.concat(jo(r1(s)))}function Nh(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function EB(e,t){var n=Is(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function b9(e,t,n){return t===KT?Nh(gB(e,n)):Sa(t)?EB(t,n):Nh(vB(Qi(e)))}function yB(e){var t=jo(r1(e)),n=["absolute","fixed"].indexOf(hi(e).position)>=0,r=n&&rr(e)?bl(e):e;return Sa(r)?t.filter(function(i){return Sa(i)&&ZT(i,r)&&Vr(i)!=="body"}):[]}function bB(e,t,n,r){var i=t==="clippingParents"?yB(e):[].concat(t),a=[].concat(i,[n]),s=a[0],o=a.reduce(function(l,u){var c=b9(e,u,r);return l.top=Ta(c.top,l.top),l.right=kc(c.right,l.right),l.bottom=kc(c.bottom,l.bottom),l.left=Ta(c.left,l.left),l},b9(e,s,r));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function t8(e){var t=e.reference,n=e.element,r=e.placement,i=r?$r(r):null,a=r?Ps(r):null,s=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2,l;switch(i){case Sn:l={x:s,y:t.y-n.height};break;case sr:l={x:s,y:t.y+t.height};break;case or:l={x:t.x+t.width,y:o};break;case kn:l={x:t.x-n.width,y:o};break;default:l={x:t.x,y:t.y}}var u=i?cm(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(a){case Os:l[u]=l[u]-(t[c]/2-n[c]/2);break;case ll:l[u]=l[u]+(t[c]/2-n[c]/2);break}}return l}function ul(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,s=a===void 0?e.strategy:a,o=n.boundary,l=o===void 0?jF:o,u=n.rootBoundary,c=u===void 0?KT:u,d=n.elementContext,f=d===void 0?so:d,p=n.altBoundary,g=p===void 0?!1:p,m=n.padding,E=m===void 0?0:m,v=XT(typeof E!="number"?E:JT(E,yl)),b=f===so?HF:so,T=e.rects.popper,_=e.elements[g?b:f],w=bB(Sa(_)?_:_.contextElement||Qi(e.elements.popper),l,c,s),A=Is(e.elements.reference),S=t8({reference:A,element:T,strategy:"absolute",placement:i}),B=Nh(Object.assign({},T,S)),F=f===so?B:A,L={top:w.top-F.top+v.top,bottom:F.bottom-w.bottom+v.bottom,left:w.left-F.left+v.left,right:F.right-w.right+v.right},R=e.modifiersData.offset;if(f===so&&R){var N=R[i];Object.keys(L).forEach(function(k){var I=[or,sr].indexOf(k)>=0?1:-1,j=[Sn,sr].indexOf(k)>=0?"y":"x";L[k]+=N[j]*I})}return L}function TB(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,s=n.padding,o=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?GT:l,c=Ps(r),d=c?o?g9:g9.filter(function(g){return Ps(g)===c}):yl,f=d.filter(function(g){return u.indexOf(g)>=0});f.length===0&&(f=d);var p=f.reduce(function(g,m){return g[m]=ul(e,{placement:m,boundary:i,rootBoundary:a,padding:s})[$r(m)],g},{});return Object.keys(p).sort(function(g,m){return p[g]-p[m]})}function _B(e){if($r(e)===om)return[];var t=Ju(e);return[y9(e),t,y9(t)]}function CB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0?!0:i,s=n.altAxis,o=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,g=p===void 0?!0:p,m=n.allowedAutoPlacements,E=t.options.placement,v=$r(E),b=v===E,T=l||(b||!g?[Ju(E)]:_B(E)),_=[E].concat(T).reduce(function(H,q){return H.concat($r(q)===om?TB(t,{placement:q,boundary:c,rootBoundary:d,padding:u,flipVariations:g,allowedAutoPlacements:m}):q)},[]),w=t.rects.reference,A=t.rects.popper,S=new Map,B=!0,F=_[0],L=0;L<_.length;L++){var R=_[L],N=$r(R),k=Ps(R)===Os,I=[Sn,sr].indexOf(N)>=0,j=I?"width":"height",z=ul(t,{placement:R,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),P=I?k?or:kn:k?sr:Sn;w[j]>A[j]&&(P=Ju(P));var ae=Ju(P),X=[];if(a&&X.push(z[N]<=0),o&&X.push(z[P]<=0,z[ae]<=0),X.every(function(H){return H})){F=R,B=!1;break}S.set(R,X)}if(B)for(var O=g?3:1,C=function(q){var U=_.find(function($){var oe=S.get($);if(oe)return oe.slice(0,q).every(function(Z){return Z})});if(U)return F=U,"break"},Y=O;Y>0;Y--){var M=C(Y);if(M==="break")break}t.placement!==F&&(t.modifiersData[r]._skip=!0,t.placement=F,t.reset=!0)}}const xB={name:"flip",enabled:!0,phase:"main",fn:CB,requiresIfExists:["offset"],data:{_skip:!1}};function T9(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function _9(e){return[Sn,or,sr,kn].some(function(t){return e[t]>=0})}function wB(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,s=ul(t,{elementContext:"reference"}),o=ul(t,{altBoundary:!0}),l=T9(s,r),u=T9(o,i,a),c=_9(l),d=_9(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const AB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:wB};function SB(e,t,n){var r=$r(e),i=[kn,Sn].indexOf(r)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=a[0],o=a[1];return s=s||0,o=(o||0)*i,[kn,or].indexOf(r)>=0?{x:o,y:s}:{x:s,y:o}}function kB(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,s=GT.reduce(function(c,d){return c[d]=SB(d,t.rects,a),c},{}),o=s[t.placement],l=o.x,u=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=s}const DB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:kB};function OB(e){var t=e.state,n=e.name;t.modifiersData[n]=t8({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const NB={name:"popperOffsets",enabled:!0,phase:"read",fn:OB,data:{}};function IB(e){return e==="x"?"y":"x"}function PB(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0?!0:i,s=n.altAxis,o=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,g=n.tetherOffset,m=g===void 0?0:g,E=ul(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),v=$r(t.placement),b=Ps(t.placement),T=!b,_=cm(v),w=IB(_),A=t.modifiersData.popperOffsets,S=t.rects.reference,B=t.rects.popper,F=typeof m=="function"?m(Object.assign({},t.rects,{placement:t.placement})):m,L=typeof F=="number"?{mainAxis:F,altAxis:F}:Object.assign({mainAxis:0,altAxis:0},F),R=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,N={x:0,y:0};if(A){if(a){var k,I=_==="y"?Sn:kn,j=_==="y"?sr:or,z=_==="y"?"height":"width",P=A[_],ae=P+E[I],X=P-E[j],O=p?-B[z]/2:0,C=b===Os?S[z]:B[z],Y=b===Os?-B[z]:-S[z],M=t.elements.arrow,H=p&&M?um(M):{width:0,height:0},q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:QT(),U=q[I],$=q[j],oe=$o(0,S[z],H[z]),Z=T?S[z]/2-O-oe-U-L.mainAxis:C-oe-U-L.mainAxis,ne=T?-S[z]/2+O+oe+$+L.mainAxis:Y+oe+$+L.mainAxis,se=t.elements.arrow&&bl(t.elements.arrow),ee=se?_==="y"?se.clientTop||0:se.clientLeft||0:0,xe=(k=R==null?void 0:R[_])!=null?k:0,ke=P+Z-xe-ee,be=P+ne-xe,ie=$o(p?kc(ae,ke):ae,P,p?Ta(X,be):X);A[_]=ie,N[_]=ie-P}if(o){var me,we=_==="x"?Sn:kn,Ie=_==="x"?sr:or,Xe=A[w],tt=w==="y"?"height":"width",qe=Xe+E[we],Ke=Xe-E[Ie],Fe=[Sn,kn].indexOf(v)!==-1,te=(me=R==null?void 0:R[w])!=null?me:0,pe=Fe?qe:Xe-S[tt]-B[tt]-te+L.altAxis,De=Fe?Xe+S[tt]+B[tt]-te-L.altAxis:Ke,ge=p&&Fe?rB(pe,Xe,De):$o(p?pe:qe,Xe,p?De:Ke);A[w]=ge,N[w]=ge-Xe}t.modifiersData[r]=N}}const RB={name:"preventOverflow",enabled:!0,phase:"main",fn:PB,requiresIfExists:["offset"]};function FB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function BB(e){return e===Un(e)||!rr(e)?dm(e):FB(e)}function MB(e){var t=e.getBoundingClientRect(),n=Ns(t.width)/e.offsetWidth||1,r=Ns(t.height)/e.offsetHeight||1;return n!==1||r!==1}function LB(e,t,n){n===void 0&&(n=!1);var r=rr(t),i=rr(t)&&MB(t),a=Qi(t),s=Is(e,i,n),o={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Vr(t)!=="body"||hm(a))&&(o=BB(t)),rr(t)?(l=Is(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):a&&(l.x=fm(a))),{x:s.left+o.scrollLeft-l.x,y:s.top+o.scrollTop-l.y,width:s.width,height:s.height}}function $B(e){var t=new Map,n=new Set,r=[];e.forEach(function(a){t.set(a.name,a)});function i(a){n.add(a.name);var s=[].concat(a.requires||[],a.requiresIfExists||[]);s.forEach(function(o){if(!n.has(o)){var l=t.get(o);l&&i(l)}}),r.push(a)}return e.forEach(function(a){n.has(a.name)||i(a)}),r}function jB(e){var t=$B(e);return QF.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function HB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function UB(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var C9={placement:"bottom",modifiers:[],strategy:"absolute"};function x9(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function zB(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?C9:i;return function(o,l,u){u===void 0&&(u=a);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},C9,a),modifiersData:{},elements:{reference:o,popper:l},attributes:{},styles:{}},d=[],f=!1,p={state:c,setOptions:function(v){var b=typeof v=="function"?v(c.options):v;m(),c.options=Object.assign({},a,c.options,b),c.scrollParents={reference:Sa(o)?jo(o):o.contextElement?jo(o.contextElement):[],popper:jo(l)};var T=jB(UB([].concat(r,c.options.modifiers)));return c.orderedModifiers=T.filter(function(_){return _.enabled}),g(),p.update()},forceUpdate:function(){if(!f){var v=c.elements,b=v.reference,T=v.popper;if(x9(b,T)){c.rects={reference:LB(b,bl(T),c.options.strategy==="fixed"),popper:um(T)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(L){return c.modifiersData[L.name]=Object.assign({},L.data)});for(var _=0;_<c.orderedModifiers.length;_++){if(c.reset===!0){c.reset=!1,_=-1;continue}var w=c.orderedModifiers[_],A=w.fn,S=w.options,B=S===void 0?{}:S,F=w.name;typeof A=="function"&&(c=A({state:c,options:B,name:F,instance:p})||c)}}}},update:HB(function(){return new Promise(function(E){p.forceUpdate(),E(c)})}),destroy:function(){m(),f=!0}};if(!x9(o,l))return p;p.setOptions(u).then(function(E){!f&&u.onFirstUpdate&&u.onFirstUpdate(E)});function g(){c.orderedModifiers.forEach(function(E){var v=E.name,b=E.options,T=b===void 0?{}:b,_=E.effect;if(typeof _=="function"){var w=_({state:c,name:v,instance:p,options:T}),A=function(){};d.push(w||A)}})}function m(){d.forEach(function(E){return E()}),d=[]}return p}}var qB=[hB,NB,dB,eB,DB,xB,RB,oB,AB],WB=zB({defaultModifiers:qB}),VB=typeof Element<"u",KB=typeof Map=="function",GB=typeof Set=="function",YB=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ec(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ec(e[r],t[r]))return!1;return!0}var a;if(KB&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(r=a.next()).done;)if(!t.has(r.value[0]))return!1;for(a=e.entries();!(r=a.next()).done;)if(!ec(r.value[1],t.get(r.value[0])))return!1;return!0}if(GB&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(r=a.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(YB&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(VB&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!ec(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var ZB=function(t,n){try{return ec(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const QB=Tr(ZB);var XB=[],JB=function(t,n,r){r===void 0&&(r={});var i=rn.useRef(null),a={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||XB},s=rn.useState({styles:{popper:{position:a.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=s[0],l=s[1],u=rn.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(p){var g=p.state,m=Object.keys(g.elements);R3.flushSync(function(){l({styles:p9(m.map(function(E){return[E,g.styles[E]||{}]})),attributes:p9(m.map(function(E){return[E,g.attributes[E]]}))})})},requires:["computeStyles"]}},[]),c=rn.useMemo(function(){var f={onFirstUpdate:a.onFirstUpdate,placement:a.placement,strategy:a.strategy,modifiers:[].concat(a.modifiers,[u,{name:"applyStyles",enabled:!1}])};return QB(i.current,f)?i.current||f:(i.current=f,f)},[a.onFirstUpdate,a.placement,a.strategy,a.modifiers,u]),d=rn.useRef();return m9(function(){d.current&&d.current.setOptions(c)},[c]),m9(function(){if(!(t==null||n==null)){var f=r.createPopper||WB,p=f(t,n,c);return d.current=p,function(){p.destroy(),d.current=null}}},[t,n,r.createPopper]),{state:d.current?d.current.state:null,styles:o.styles,attributes:o.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}};function Ih(){return Ih=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ih.apply(this,arguments)}function n8(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var eM=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,tM=n8(function(e){return eM.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),nM=!1;function rM(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function iM(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var aM=function(){function e(n){var r=this;this._insertTag=function(i){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(i,a),r.tags.push(i)},this.isSpeedy=n.speedy===void 0?!nM:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(iM(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=rM(i);try{a.insertRule(r,a.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var i;return(i=r.parentNode)==null?void 0:i.removeChild(r)}),this.tags=[],this.ctr=0},e}(),sn="-ms-",Dc="-moz-",pt="-webkit-",r8="comm",pm="rule",mm="decl",sM="@import",i8="@keyframes",oM="@layer",lM=Math.abs,i1=String.fromCharCode,uM=Object.assign;function cM(e,t){return nn(e,0)^45?(((t<<2^nn(e,0))<<2^nn(e,1))<<2^nn(e,2))<<2^nn(e,3):0}function a8(e){return e.trim()}function dM(e,t){return(e=t.exec(e))?e[0]:e}function mt(e,t,n){return e.replace(t,n)}function Ph(e,t){return e.indexOf(t)}function nn(e,t){return e.charCodeAt(t)|0}function cl(e,t,n){return e.slice(t,n)}function Nr(e){return e.length}function gm(e){return e.length}function nu(e,t){return t.push(e),e}function fM(e,t){return e.map(t).join("")}var a1=1,Rs=1,s8=0,On=0,qt=0,Us="";function s1(e,t,n,r,i,a,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:a1,column:Rs,length:s,return:""}}function oo(e,t){return uM(s1("",null,null,"",null,null,0),e,{length:-e.length},t)}function hM(){return qt}function pM(){return qt=On>0?nn(Us,--On):0,Rs--,qt===10&&(Rs=1,a1--),qt}function $n(){return qt=On<s8?nn(Us,On++):0,Rs++,qt===10&&(Rs=1,a1++),qt}function jr(){return nn(Us,On)}function tc(){return On}function Tl(e,t){return cl(Us,e,t)}function dl(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function o8(e){return a1=Rs=1,s8=Nr(Us=e),On=0,[]}function l8(e){return Us="",e}function nc(e){return a8(Tl(On-1,Rh(e===91?e+2:e===40?e+1:e)))}function mM(e){for(;(qt=jr())&&qt<33;)$n();return dl(e)>2||dl(qt)>3?"":" "}function gM(e,t){for(;--t&&$n()&&!(qt<48||qt>102||qt>57&&qt<65||qt>70&&qt<97););return Tl(e,tc()+(t<6&&jr()==32&&$n()==32))}function Rh(e){for(;$n();)switch(qt){case e:return On;case 34:case 39:e!==34&&e!==39&&Rh(qt);break;case 40:e===41&&Rh(e);break;case 92:$n();break}return On}function vM(e,t){for(;$n()&&e+qt!==47+10;)if(e+qt===42+42&&jr()===47)break;return"/*"+Tl(t,On-1)+"*"+i1(e===47?e:$n())}function EM(e){for(;!dl(jr());)$n();return Tl(e,On)}function yM(e){return l8(rc("",null,null,null,[""],e=o8(e),0,[0],e))}function rc(e,t,n,r,i,a,s,o,l){for(var u=0,c=0,d=s,f=0,p=0,g=0,m=1,E=1,v=1,b=0,T="",_=i,w=a,A=r,S=T;E;)switch(g=b,b=$n()){case 40:if(g!=108&&nn(S,d-1)==58){Ph(S+=mt(nc(b),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:S+=nc(b);break;case 9:case 10:case 13:case 32:S+=mM(g);break;case 92:S+=gM(tc()-1,7);continue;case 47:switch(jr()){case 42:case 47:nu(bM(vM($n(),tc()),t,n),l);break;default:S+="/"}break;case 123*m:o[u++]=Nr(S)*v;case 125*m:case 59:case 0:switch(b){case 0:case 125:E=0;case 59+c:v==-1&&(S=mt(S,/\f/g,"")),p>0&&Nr(S)-d&&nu(p>32?A9(S+";",r,n,d-1):A9(mt(S," ","")+";",r,n,d-2),l);break;case 59:S+=";";default:if(nu(A=w9(S,t,n,u,c,i,o,T,_=[],w=[],d),a),b===123)if(c===0)rc(S,t,A,A,_,a,d,o,w);else switch(f===99&&nn(S,3)===110?100:f){case 100:case 108:case 109:case 115:rc(e,A,A,r&&nu(w9(e,A,A,0,0,i,o,T,i,_=[],d),w),i,w,d,o,r?_:w);break;default:rc(S,A,A,A,[""],w,0,o,w)}}u=c=p=0,m=v=1,T=S="",d=s;break;case 58:d=1+Nr(S),p=g;default:if(m<1){if(b==123)--m;else if(b==125&&m++==0&&pM()==125)continue}switch(S+=i1(b),b*m){case 38:v=c>0?1:(S+="\f",-1);break;case 44:o[u++]=(Nr(S)-1)*v,v=1;break;case 64:jr()===45&&(S+=nc($n())),f=jr(),c=d=Nr(T=S+=EM(tc())),b++;break;case 45:g===45&&Nr(S)==2&&(m=0)}}return a}function w9(e,t,n,r,i,a,s,o,l,u,c){for(var d=i-1,f=i===0?a:[""],p=gm(f),g=0,m=0,E=0;g<r;++g)for(var v=0,b=cl(e,d+1,d=lM(m=s[g])),T=e;v<p;++v)(T=a8(m>0?f[v]+" "+b:mt(b,/&\f/g,f[v])))&&(l[E++]=T);return s1(e,t,n,i===0?pm:o,l,u,c)}function bM(e,t,n){return s1(e,t,n,r8,i1(hM()),cl(e,2,-2),0)}function A9(e,t,n,r){return s1(e,t,n,mm,cl(e,0,r),cl(e,r+1,-1),r)}function ms(e,t){for(var n="",r=gm(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function TM(e,t,n,r){switch(e.type){case oM:if(e.children.length)break;case sM:case mm:return e.return=e.return||e.value;case r8:return"";case i8:return e.return=e.value+"{"+ms(e.children,r)+"}";case pm:e.value=e.props.join(",")}return Nr(n=ms(e.children,r))?e.return=e.value+"{"+n+"}":""}function _M(e){var t=gm(e);return function(n,r,i,a){for(var s="",o=0;o<t;o++)s+=e[o](n,r,i,a)||"";return s}}function CM(e){return function(t){t.root||(t=t.return)&&e(t)}}var xM=function(t,n,r){for(var i=0,a=0;i=a,a=jr(),i===38&&a===12&&(n[r]=1),!dl(a);)$n();return Tl(t,On)},wM=function(t,n){var r=-1,i=44;do switch(dl(i)){case 0:i===38&&jr()===12&&(n[r]=1),t[r]+=xM(On-1,n,r);break;case 2:t[r]+=nc(i);break;case 4:if(i===44){t[++r]=jr()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=i1(i)}while(i=$n());return t},AM=function(t,n){return l8(wM(o8(t),n))},S9=new WeakMap,SM=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,i=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!S9.get(r))&&!i){S9.set(t,!0);for(var a=[],s=AM(n,a),o=r.props,l=0,u=0;l<s.length;l++)for(var c=0;c<o.length;c++,u++)t.props[u]=a[l]?s[l].replace(/&\f/g,o[c]):o[c]+" "+s[l]}}},kM=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function u8(e,t){switch(cM(e,t)){case 5103:return pt+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return pt+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return pt+e+Dc+e+sn+e+e;case 6828:case 4268:return pt+e+sn+e+e;case 6165:return pt+e+sn+"flex-"+e+e;case 5187:return pt+e+mt(e,/(\w+).+(:[^]+)/,pt+"box-$1$2"+sn+"flex-$1$2")+e;case 5443:return pt+e+sn+"flex-item-"+mt(e,/flex-|-self/,"")+e;case 4675:return pt+e+sn+"flex-line-pack"+mt(e,/align-content|flex-|-self/,"")+e;case 5548:return pt+e+sn+mt(e,"shrink","negative")+e;case 5292:return pt+e+sn+mt(e,"basis","preferred-size")+e;case 6060:return pt+"box-"+mt(e,"-grow","")+pt+e+sn+mt(e,"grow","positive")+e;case 4554:return pt+mt(e,/([^-])(transform)/g,"$1"+pt+"$2")+e;case 6187:return mt(mt(mt(e,/(zoom-|grab)/,pt+"$1"),/(image-set)/,pt+"$1"),e,"")+e;case 5495:case 3959:return mt(e,/(image-set\([^]*)/,pt+"$1$`$1");case 4968:return mt(mt(e,/(.+:)(flex-)?(.*)/,pt+"box-pack:$3"+sn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+pt+e+e;case 4095:case 3583:case 4068:case 2532:return mt(e,/(.+)-inline(.+)/,pt+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Nr(e)-1-t>6)switch(nn(e,t+1)){case 109:if(nn(e,t+4)!==45)break;case 102:return mt(e,/(.+:)(.+)-([^]+)/,"$1"+pt+"$2-$3$1"+Dc+(nn(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ph(e,"stretch")?u8(mt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(nn(e,t+1)!==115)break;case 6444:switch(nn(e,Nr(e)-3-(~Ph(e,"!important")&&10))){case 107:return mt(e,":",":"+pt)+e;case 101:return mt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+pt+(nn(e,14)===45?"inline-":"")+"box$3$1"+pt+"$2$3$1"+sn+"$2box$3")+e}break;case 5936:switch(nn(e,t+11)){case 114:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return pt+e+sn+e+e}return e}var DM=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case mm:t.return=u8(t.value,t.length);break;case i8:return ms([oo(t,{value:mt(t.value,"@","@"+pt)})],i);case pm:if(t.length)return fM(t.props,function(a){switch(dM(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ms([oo(t,{props:[mt(a,/:(read-\w+)/,":"+Dc+"$1")]})],i);case"::placeholder":return ms([oo(t,{props:[mt(a,/:(plac\w+)/,":"+pt+"input-$1")]}),oo(t,{props:[mt(a,/:(plac\w+)/,":"+Dc+"$1")]}),oo(t,{props:[mt(a,/:(plac\w+)/,sn+"input-$1")]})],i)}return""})}},OM=[DM],NM=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var E=m.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||OM,a={},s,o=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var E=m.getAttribute("data-emotion").split(" "),v=1;v<E.length;v++)a[E[v]]=!0;o.push(m)});var l,u=[SM,kM];{var c,d=[TM,CM(function(m){c.insert(m)})],f=_M(u.concat(i,d)),p=function(E){return ms(yM(E),f)};l=function(E,v,b,T){c=b,p(E?E+"{"+v.styles+"}":v.styles),T&&(g.inserted[v.name]=!0)}}var g={key:n,sheet:new aM({key:n,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:l};return g.sheet.hydrate(o),g},c8=fp(),IM={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},PM={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},d8={};d8[c8.ForwardRef]=IM;d8[c8.Memo]=PM;var RM=!0;function FM(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(r+=i+" ")}),r}var f8=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||RM===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},BM=function(t,n,r){f8(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var a=n;do t.insert(n===a?"."+i:"",a,t.sheet,!0),a=a.next;while(a!==void 0)}};function MM(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var LM={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$M=!1,jM=/[A-Z]|^ms/g,HM=/_EMO_([^_]+?)_([^]*?)_EMO_/g,h8=function(t){return t.charCodeAt(1)===45},k9=function(t){return t!=null&&typeof t!="boolean"},Pd=n8(function(e){return h8(e)?e:e.replace(jM,"-$&").toLowerCase()}),D9=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(HM,function(r,i,a){return Ir={name:i,styles:a,next:Ir},i})}return LM[t]!==1&&!h8(t)&&typeof n=="number"&&n!==0?n+"px":n},UM="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function fl(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return Ir={name:i.name,styles:i.styles,next:Ir},i.name;var a=n;if(a.styles!==void 0){var s=a.next;if(s!==void 0)for(;s!==void 0;)Ir={name:s.name,styles:s.styles,next:Ir},s=s.next;var o=a.styles+";";return o}return zM(e,t,n)}case"function":{if(e!==void 0){var l=Ir,u=n(e);return Ir=l,fl(e,t,u)}break}}var c=n;if(t==null)return c;var d=t[c];return d!==void 0?d:c}function zM(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=fl(e,t,n[i])+";";else for(var a in n){var s=n[a];if(typeof s!="object"){var o=s;t!=null&&t[o]!==void 0?r+=a+"{"+t[o]+"}":k9(o)&&(r+=Pd(a)+":"+D9(a,o)+";")}else{if(a==="NO_COMPONENT_SELECTOR"&&$M)throw new Error(UM);if(Array.isArray(s)&&typeof s[0]=="string"&&(t==null||t[s[0]]===void 0))for(var l=0;l<s.length;l++)k9(s[l])&&(r+=Pd(a)+":"+D9(a,s[l])+";");else{var u=fl(e,t,s);switch(a){case"animation":case"animationName":{r+=Pd(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}}return r}var O9=/label:\s*([^\s;{]+)\s*(;|$)/g,Ir;function p8(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,i="";Ir=void 0;var a=e[0];if(a==null||a.raw===void 0)r=!1,i+=fl(n,t,a);else{var s=a;i+=s[0]}for(var o=1;o<e.length;o++)if(i+=fl(n,t,e[o]),r){var l=a;i+=l[o]}O9.lastIndex=0;for(var u="",c;(c=O9.exec(i))!==null;)u+="-"+c[1];var d=MM(i)+u;return{name:d,styles:i,next:Ir}}var qM=function(t){return t()},WM=rn["useInsertionEffect"]?rn["useInsertionEffect"]:!1,VM=WM||qM,m8=rn.createContext(typeof HTMLElement<"u"?NM({key:"css"}):null);m8.Provider;var KM=function(t){return y.forwardRef(function(n,r){var i=y.useContext(m8);return t(n,i,r)})},GM=rn.createContext({});function YM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p8(t)}var ZM=function(){var t=YM.apply(void 0,arguments),n="animation-"+t.name;return{name:n,styles:"@keyframes "+n+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}},QM=tM,XM=function(t){return t!=="theme"},N9=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?QM:XM},I9=function(t,n,r){var i;if(n){var a=n.shouldForwardProp;i=t.__emotion_forwardProp&&a?function(s){return t.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},JM=!1,eL=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return f8(n,r,i),VM(function(){return BM(n,r,i)}),null},tL=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,a,s;n!==void 0&&(a=n.label,s=n.target);var o=I9(t,n,r),l=o||N9(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(a!==void 0&&d.push("label:"+a+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,p=1;p<f;p++)d.push(c[p],c[0][p])}var g=KM(function(m,E,v){var b=u&&m.as||i,T="",_=[],w=m;if(m.theme==null){w={};for(var A in m)w[A]=m[A];w.theme=rn.useContext(GM)}typeof m.className=="string"?T=FM(E.registered,_,m.className):m.className!=null&&(T=m.className+" ");var S=p8(d.concat(_),E.registered,w);T+=E.key+"-"+S.name,s!==void 0&&(T+=" "+s);var B=u&&o===void 0?N9(b):l,F={};for(var L in m)u&&L==="as"||B(L)&&(F[L]=m[L]);return F.className=T,v&&(F.ref=v),rn.createElement(rn.Fragment,null,rn.createElement(eL,{cache:E,serialized:S,isStringTag:typeof b=="string"}),rn.createElement(b,F))});return g.displayName=a!==void 0?a:"Styled("+(typeof i=="string"?i:i.displayName||i.name||"Component")+")",g.defaultProps=t.defaultProps,g.__emotion_real=g,g.__emotion_base=i,g.__emotion_styles=d,g.__emotion_forwardProp=o,Object.defineProperty(g,"toString",{value:function(){return s===void 0&&JM?"NO_COMPONENT_SELECTOR":"."+s}}),g.withComponent=function(m,E){return e(m,Ih({},n,E,{shouldForwardProp:I9(g,E,!0)})).apply(void 0,d)},g}},nL=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],Pe=tL.bind();nL.forEach(function(e){Pe[e]=Pe(e)});var za={}.hasOwnProperty,g8=rL;function rL(e){return!e||typeof e!="object"?"":za.call(e,"position")||za.call(e,"type")?P9(e.position):za.call(e,"start")||za.call(e,"end")?P9(e):za.call(e,"line")||za.call(e,"column")?Fh(e):""}function Fh(e){return(!e||typeof e!="object")&&(e={}),R9(e.line)+":"+R9(e.column)}function P9(e){return(!e||typeof e!="object")&&(e={}),Fh(e.start)+"-"+Fh(e.end)}function R9(e){return e&&typeof e=="number"?e:1}var iL=g8,aL=vm;function v8(){}v8.prototype=Error.prototype;vm.prototype=new v8;var Xi=vm.prototype;Xi.file="";Xi.name="";Xi.reason="";Xi.message="";Xi.stack="";Xi.fatal=null;Xi.column=null;Xi.line=null;function vm(e,t,n){var r,i,a;typeof t=="string"&&(n=t,t=null),r=sL(n),i=iL(t)||"1:1",a={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(a=t,t=t.start):a.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=i,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=a,this.source=r[0],this.ruleId=r[1]}function sL(e){var t=[null,null],n;return typeof e=="string"&&(n=e.indexOf(":"),n===-1?t[1]=e:(t[0]=e.slice(0,n),t[1]=e.slice(n+1))),t}var zs={};zs.basename=oL;zs.dirname=lL;zs.extname=uL;zs.join=cL;zs.sep="/";function oL(e,t){var n=0,r=-1,i,a,s,o;if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');if(_l(e),i=e.length,t===void 0||!t.length||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";for(a=-1,o=t.length-1;i--;)if(e.charCodeAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.charCodeAt(i)===t.charCodeAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function lL(e){var t,n,r;if(_l(e),!e.length)return".";for(t=-1,r=e.length;--r;)if(e.charCodeAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.charCodeAt(0)===47?"/":".":t===1&&e.charCodeAt(0)===47?"//":e.slice(0,t)}function uL(e){var t=-1,n=0,r=-1,i=0,a,s,o;for(_l(e),o=e.length;o--;){if(s=e.charCodeAt(o),s===47){if(a){n=o+1;break}continue}r<0&&(a=!0,r=o+1),s===46?t<0?t=o:i!==1&&(i=1):t>-1&&(i=-1)}return t<0||r<0||i===0||i===1&&t===r-1&&t===n+1?"":e.slice(t,r)}function cL(){for(var e=-1,t;++e<arguments.length;)_l(arguments[e]),arguments[e]&&(t=t===void 0?arguments[e]:t+"/"+arguments[e]);return t===void 0?".":dL(t)}function dL(e){var t,n;return _l(e),t=e.charCodeAt(0)===47,n=fL(e,!t),!n.length&&!t&&(n="."),n.length&&e.charCodeAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function fL(e,t){for(var n="",r=0,i=-1,a=0,s=-1,o,l;++s<=e.length;){if(s<e.length)o=e.charCodeAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(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("/")),i=s,a=0;continue}}else if(n.length){n="",r=0,i=s,a=0;continue}}t&&(n=n.length?n+"/..":"..",r=2)}else n.length?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function _l(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var E8={};E8.cwd=hL;function hL(){return"/"}/*!
166
+ `}),U=$.turndown(U)}o&&o.mentions&&(U=await Ky({text:U,template:`[${mh}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),bP(U,$=>{const oe=[{type:"initialValue",value:$},{type:"editorKey",value:F.toString()}];o!=null&&o.link&&(oe.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),S(oe),setTimeout(()=>{S([{type:"stringValue",value:Yv(Y)}])},150)})})()},[F]),y.useEffect(()=>{if(z===void 0&&Y){const U=CP(Y);U&&ae(U)}const q=U=>{var Z;const $=U,oe=((Z=$==null?void 0:$.detail)==null?void 0:Z.url)||null;oe&&z&&z.url===oe&&S([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",q),()=>{window.removeEventListener("linkRemoved",q)}},[z]),y.useEffect(()=>{if(t){Xo.lastIndex=0;const q=t.match(Xo);q&&q.length===1&&q[0].length===t.length&&!I&&S([{type:"originalValue",value:t}])}t!==""||!Y||uc(F,t)&&!I||(D.withoutNormalizing(Y,()=>{ue.delete(Y,{at:{anchor:D.start(Y,[]),focus:D.end(Y,[])}}),ue.deselect(Y),Y.children.length!==0&&ue.unwrapNodes(Y,{at:[0]}),ue.insertNodes(Y,_,{at:[0]})}),S([{type:"initialValue",value:_},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{E({link:z})},[z]),y.useEffect(()=>{R===""&&z&&S([{type:"enrichedUrl",value:void 0}])},[R]);const H=Zo(()=>{wP({editor:Y,isShowing:P.show,numberOfUsers:P.numberOfUsers,listMembers:p,dispatch:S})},100);return L?h.jsx("div",{id:X,className:"rich-text-editor input text-medium",children:h.jsxs(Ei.Provider,{value:{...A,id:X,isInOverlay:f,dispatch:S,onMention:b,reportError:T},children:[h.jsxs(zO,{editor:Y,initialValue:L,onChange:q=>{if(Y.operations.some($=>$.type!=="set_selection")){let $=SP(q);$==="<br>"&&($=""),m($,z),S([{type:"stringValue",value:Yv(Y)}]),I||S([{type:"hasInteracted",value:!0}]),H(),d&&console.log({serialized:$,json:q})}},...u,children:[h.jsx(RO,{className:"editor",renderElement:O,renderLeaf:C,placeholder:n||c.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async q=>{const U=z!==!1,$=q.clipboardData.getData("text");if((Z=>{try{return new URL(Z),!0}catch{return!1}})($)){let Z=$;if($){const{full:ne}=rp($);Z=ne}if($&&v&&!U){const ne=await v(Z);ne.url&&S([{type:"enrichedUrl",value:ne}])}}},onKeyDown:q=>{if(q.key==="Enter"){P.show&&(q.preventDefault(),q.stopPropagation(),cT(Y,P,S,X));const{selection:U}=Y;if(U){const $=le.isCollapsed(U),[oe,Z]=D.node(Y,U,{depth:1});let ne=oe,se=ne.type;const ee=ne.children[0];if(ee&&(ee==null?void 0:ee[re.h3])===!0&&(q.stopPropagation(),q.preventDefault(),ue.insertNodes(Y,_)),ee&&[re.ol,re.ul].includes(ee.type)&&(ne=ee,se=ee.type),ne&&Se.isElement(ne)&&se!==re.paragraph){if(se===re.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),ue.insertNodes(Y,_);return}if($){const[xe,ke]=D.parent(Y,U,{edge:"end"}),ie=xe.type;if([re.ul,re.ol].includes(se))if(q.stopPropagation(),q.preventDefault(),ie===re.li&&k==="Enter"){xe.children.length===1&&"text"in xe.children[0]&&xe.children[0].text===""&&ue.removeNodes(Y,{at:ke}),ue.insertNodes(Y,_,{at:K.next(Z)}),ue.select(Y,D.end(Y,K.next(Z)));return}else{const[me,we]=TP(Y,re.li),Ie={type:re.li,children:[{text:""}]};ue.insertNodes(Y,Ie,{at:K.next(we)}),ue.select(Y,D.end(Y,K.next(we)))}}}}}else if(q.key==="Escape"){if(P.show){q.preventDefault(),q.stopPropagation(),S([{type:"mentionPopover",value:{...P,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&P.show){q.preventDefault(),q.stopPropagation();const{selectedUser:U,possibleUsers:$}=P;let oe=q.key==="ArrowUp"?U-1:U+1;oe<0&&(oe=$.length-1),oe>=$.length+1&&(oe=0),S([{type:"mentionPopover",value:{...P,selectedUser:oe}}])}S([{type:"lastKey",value:q.key}]),xP(q,Y,S,T)},onBlur:()=>{Y.selection&&S([{type:"lastAnchor",value:Y.selection.anchor}])},onFocus:()=>{if(N){if(!K.isPath(N.path)||!Ee.has(Y,N.path))return;const q=Ee.get(Y,N.path);let U=0;if(Oe.isText(q)?U=q.text.length:q.children&&(U=q.children.length),N.offset>U)return;try{ue.select(Y,{anchor:N,focus:N})}catch($){const oe=$.message;T(`Error focusing editor: ${oe}`)}}}}),z?h.jsx(xp,{data:z,variant:"condensed",onClick:()=>{S([{type:"enrichedUrl",value:!1}]);const q=new CustomEvent("ariaLive",{detail:{message:c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(q)},"aria-label":c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:z.title||c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):h.jsx(h.Fragment,{}),h.jsx(LP,{styling:l==null?void 0:l.toolbar}),p?h.jsx(kP,{onFallbackClick:g}):h.jsx(h.Fragment,{})]},B),h.jsx(Ap,{id:`character-limit-${e}`,limit:r,valueLength:Kc(R)})]})}):h.jsx(h.Fragment,{})};const xR=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=c=>{a||(l(c),i(c))};return h.jsxs("div",{className:J("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[h.jsx("p",{children:t}),h.jsx("ul",{className:J("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(c=>{const d=`${e}-${c.value}`;return h.jsxs("li",{className:"hidden",children:[h.jsx("input",{type:"radio",id:d,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:a}),h.jsx("label",{htmlFor:d,children:c.label})]},d)})})]})};function wT({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=he.useIntl(),l="profileImageChange_",[u,c]=y.useState(r),[d,f]=y.useState(!1),[p,g]=y.useState(!1),m=y.useRef(null),E=async _=>{f(!0),g(!1);try{const w=_.target.files&&_.target.files[0];if(!w||!t)throw f(!1),new Error("Image file or userID is missing");const A=await i({fileObject:w,userId:t}),S={thumbnail:A.thumbnailURL,full:A.originalURL};c(S),s(S)}catch{g(!0)}finally{f(!1)}f(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:b=o.formatMessage({id:`${l}cta_change`}),uploading:T=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return h.jsxs("div",{className:J("profile-image-change-figure",e),children:[h.jsx(gi,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&h.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),h.jsx("input",{id:"file",type:"file",accept:"image/*",ref:m,onChange:E,hidden:!0,"data-testid":"file-input"}),h.jsx(je,{onClick:()=>m.current&&m.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:d,children:d?T:u?b:v})]})}const AT=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return h.jsx(Gr,{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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const wR=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=he.useIntl();return h.jsx(P3.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>h.jsxs("div",{className:"email text-medium",children:[h.jsx("div",{"data-tag-item":!0,children:i}),h.jsx(je,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},ST=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:c="NOT_SUBMITTED",gtm:d={context:"Form",event:"form-submit-click"},secondaryActionButton:f,meta:p})=>{const[g,m]=y.useState([]),[E,v]=y.useState(!0),[b,T]=y.useState(c),{formatMessage:_}=he.useIntl(),w=async B=>{try{await u(g,B.message),m([]),T("SUCCESS")}catch(F){T("ERROR"),l(F)}},A=B=>{B.preventDefault(),T("NOT_SUBMITTED"),v(!0),m([])},S=B=>{B.preventDefault(),o(),T("CLOSED")};return b==="CLOSED"?null:b==="ERROR"||b==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?h.jsxs("div",{className:"invite-form-wrapper",children:[h.jsx("div",{className:"content centred",children:b==="SUCCESS"?h.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):h.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),h.jsx(br,{}),h.jsx("div",{className:"footer",children:b==="SUCCESS"?h.jsxs(h.Fragment,{children:[h.jsx(je,{variant:"secondary",onClick:A,children:_({id:"inviteForm_ctaSendMoreInvites"})}),h.jsx(je,{onClick:S,children:_({id:"inviteForm_ctaDone"})})]}):h.jsx(je,{onClick:A,children:_({id:"inviteForm_ctaTryAgain"})})})]}):h.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[h.jsxs("div",{className:"content",children:[h.jsx("h2",{className:"title",style:{color:i},children:e}),h.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),h.jsx(Gr,{id:"invite-form",fields:[{component:wR,props:{emails:g,setEmails:m,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:_({id:"inviteForm_message_label"}),placeholder:n||_({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:E},gtm:d,meta:p,secondaryActionButton:f})]})},Gu=e=>e.map(t=>({condition:t}));const Wn={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},AR=({functions:e,...t})=>{const{formatMessage:n}=he.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Wn.NEW_PASSWORD]!==p[Wn.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!Kf(p[Wn.NEW_PASSWORD]).isValid,d=[{"data-testid":Wn.NEW_PASSWORD,id:Wn.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Gu(["required",c]),functions:{onChange:p=>l(Kf(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Wn.CONFIRMED_PASSWORD,id:Wn.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Gu(["required",u])}];t.isPasswordChange&&d.unshift({"data-testid":Wn.CURRENT_PASSWORD,id:Wn.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Gu(["required"])}),a&&d.push({component:eb,props:{matchingRules:o}});const f={id:Wn.FORM_ID,fields:d,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Wn.NEW_PASSWORD)||g.includes(Wn.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return h.jsxs(h.Fragment,{children:[h.jsx(Gr,{...f}),r&&h.jsx(zr,{variant:"error",text:r})]})};const kT=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var B;const s=he.useIntl(),o="profileForm_",l=y.useContext(Ht),[u,c]=y.useState(l.image),[d,f]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async F=>{},onCancel:m=()=>{},onFailure:E=()=>{}}=n,{buildLocation:v,isValidPlace:b,predictPlaces:T}=t.useMaps(),{context:_="ProfileForm",event:w="profile-form-submit-click"}=i||{},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:(B=l.location)==null?void 0:B.en,validation:[{condition:"required"},{condition:({location:F})=>F&&!d?!1:!b(F),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{d||f(!0)},onKeyInput:T}}],S=[{component:wT,props:{userName:l.name,userId:l.id,src:u,uploadImage:p,callback:c,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"}]},...A,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:br}];return h.jsx(Gr,{id:"profile-details-form",fields:e?A:S,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:_,event:w},functions:{onSuccess:async F=>{try{const L={...F,image:u||null,location:d?await v(F==null?void 0:F.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...L})),await g(L)}catch{E()}},onCancel:m,onFailure:E},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},SR=()=>{const e=he.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),h.jsx(p4,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function kR({coverImage:e,setShowImagePicker:t}){return e&&e.url?h.jsx(zr,{className:"cover-image-preview",text:h.jsx(Vi,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:h.jsx(je,{variant:"tertiary",onClick:()=>t(!0),children:h.jsx(he.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):h.jsx(zr,{button:{component:h.jsx(je,{variant:"secondary",onClick:()=>t(!0),children:h.jsx(he.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var DT=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(DT||{});let xd=null;const jt="publishArticleForm_",r9={},i9=10,DR=({id:e="publish-article-form",values:t=r9,setShowImagePicker:n,functions:r,meta:i,gtm:a,isEditMode:s=!1})=>{var R;const o=he.useIntl(),l=y.useContext(Ht),{create:u,edit:c,onSuccess:d=()=>{},onFailure:f=()=>{}}=r||{},{isInOverlay:p=!1}=i||{},[g,m]=y.useState(!1),[E,v]=y.useState(t.body||""),[b,T]=y.useState(!1),[_,w]=y.useState("");y.useEffect(()=>{uc(t,r9)||Jo(t.body)&&t.body!==E&&t.body!==void 0&&v(t.body)},[t.body]);const A=()=>{!l||!l.id?T(o.formatMessage({id:`${jt}error_loggedOut`})):b&&T(!1)},S=N=>({condition:k=>{const I=k[N];return!I||typeof I!="string"?!0:I.length<i9},error:o.formatMessage({id:`${jt}error_underMinLength`},{length:i9})}),B=!!E&&Jo(E),F=()=>h.jsxs(h.Fragment,{children:[h.jsx(br,{}),h.jsx("p",{className:"text-medium",children:o.formatMessage({id:`${jt}disclaimer`})})]}),L=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:o.formatMessage({id:`${jt}title_label`}),placeholder:o.formatMessage({id:`${jt}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:A},validation:[{condition:"required"},S("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:o.formatMessage({id:`${jt}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:o.formatMessage({id:`${jt}subtitle_placeholder`}),functions:{onChange:A},validation:[{condition:"required"},S("subtitle")]},{component:wc,props:{formID:e,label:{visible:o.formatMessage({id:`${jt}body_label`})},showLabel:!0}},{component:em,props:{id:`${e}-input`,value:E,placeholder:o.formatMessage({id:`${jt}body_placeholder`}),meta:{isInOverlay:p},autoFocus:!1,functions:{onChange:N=>{v(N),A()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:o.formatMessage({id:`${jt}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(DT).map(N=>({id:N,label:o.formatMessage({id:`${jt}_tags_${N}`})})),value:t.tags||[],multipleOptions:{limit:3},validation:[{condition:"required",error:o.formatMessage({id:`${jt}tags_error_required`})},{condition:N=>{var k;return((k=N==null?void 0:N.tags)==null?void 0:k.length)>3},error:o.formatMessage({id:`${jt}tags_error_over_three`})}]},{component:wc,props:{formID:e,label:{visible:o.formatMessage({id:`${jt}cover_image_label`})},showLabel:!0}},{component:kR,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return g?L.push({component:br}):L.push({component:F}),h.jsxs("section",{className:"publish-article-form",children:[h.jsx(Gr,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async N=>{if(!l||!l.id||!B)return;xd&&clearTimeout(xd),m(!0);const k={...N,body:E,coverImage:t.coverImage};try{s&&c?await c(k):u&&await u(k),xd=setTimeout(()=>{w(o.formatMessage({id:`${jt}aria_success${s?"_edit":""}`})),d(k)},500)}catch{T(o.formatMessage({id:`${jt}error`})),w(""),f()}},onFailure:f},fields:L,intlPath:jt,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:!l||!l.id||!B||!((R=t==null?void 0:t.coverImage)!=null&&R.url),text:{default:o.formatMessage({id:`${jt}cta_submit${s?"_edit":""}`}),submitting:o.formatMessage({id:`${jt}cta_submitting${s?"_edit":""}`}),submitted:o.formatMessage({id:`${jt}cta_submitted${s?"_edit":""}`})},customOnSubmit:b?h.jsx(h.Fragment,{}):h.jsx(SR,{})},gtm:a}),b&&h.jsx(_s,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:o.formatMessage({id:`${jt}error`})}),_&&h.jsx(ut,{"aria-live":"polite",showOnFocus:!1,children:_})]})};const OT=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=he.useIntl(),u=y.useRef(null);Ts(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=d=>{d.preventDefault(),d.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return h.jsx("form",{onSubmit:c,className:J("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:h.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:h.jsxs("p",{children:[h.jsx(ut,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),h.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&c(d)}}),h.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:h.jsx(ut,{children:l.formatMessage({id:"search_clear"})})}),h.jsx("button",{className:"search",onClick:c,children:h.jsx(ut,{children:l.formatMessage({id:"search_cta"})})})]})})})},a9=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 i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:i,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},OR=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"]}},NR=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{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=OR(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),sessionStorage.setItem(tp.SESSION_STORAGE.EMAIL,s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},IR=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,d=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},f=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>d(a.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:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{a9({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:G4,props:{email:c.email,type:c.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(f.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>d(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{d(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&f.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>h.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&f.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>h.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>h.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=>h.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(m=>{s.validFields[m]!==a[m].current.validity.valid&&(g.push({type:`validFields.${m}`,value:a[m].current.validity.valid}),m==="email"&&a9({ref:a.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const PR=({className:e=""})=>h.jsxs("div",{className:J("success-message",e),"data-testid":"success-message",children:[h.jsx("p",{className:"success-title",children:h.jsx(he.FormattedMessage,{id:"signup_success_title"})}),h.jsx(he.FormattedMessage,{id:"signup_success_text",values:{p:t=>h.jsx("p",{children:t})}})]});const RR={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},FR=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=he.useIntl(),u=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname}`,{title:c=!0,expectation:d=!1,url:f=!0,logInButton:p=!0,successMessage:g=!0}=i,m={title:c,expectation:d,url:f,logInButton:p,successMessage:g},[E,v]=y.useReducer(Fs,RR),{validFields:b,emailDetails:T,shouldManuallyApprove:_,shouldDisableButton:w,showSuccessMessage:A,showError:S}=E,[B,F]=Xh.useCookies(["signup-this-session","functional-cookie-consent"]),L={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{_===!0&&L.jobTitle.current&&L.jobTitle.current.focus()},[_]),y.useEffect(()=>{B["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[B]),y.useEffect(()=>{A&&B["functional-cookie-consent"]&&F("signup-this-session","true",{path:"/",maxAge:3600})},[A]);const R=y.useMemo(()=>IR({placeholders:n,labels:t,shouldShow:m,functions:r,refs:L,state:E,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,L,m,E]),N=w?!0:_?!Object.values(b).every(k=>k===!0):!b.name||!b.email||["exists","pending","verify"].includes(T.boxType);return m.successMessage&&A?h.jsx(PR,{className:e}):h.jsxs("fieldset",{className:J("signup-form-fieldset",e),"data-testid":"signup-form",children:[m.title&&h.jsx("p",{className:"signup-title",children:h.jsx(he.FormattedMessage,{id:"signup_title"})}),S&&h.jsx(zr,{variant:"error",text:l.formatMessage({id:"signup_error"})}),h.jsx(Gr,{className:"signup-form",formRef:L.form,id:"sign-up-form",fields:R,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:N?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:u,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:m.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await NR({refs:L,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:E})},onCatch:k=>{r.handleError(k),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),h.jsx("button",{className:"validation-button",ref:L.hiddenValidation})]})};const Zi=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return h.jsx("section",{className:J("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const BR=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),h.jsx(Zi,{className:J("download-section",n),styling:{background:"dark"},children:h.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),h.jsx(Bs,{buttons:r})]})})};const Ch="editSection_";function NT({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const MR=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=he.useIntl();return h.jsxs(Ln,{variant:"muted",icon:e,children:[h.jsx("p",{children:t||s({id:`${Ch}placeholder_description`})}),i&&h.jsx("p",{children:h.jsx(je,{href:r,variant:"secondary",size:"small",onClick:()=>NT({href:r,setShowModal:a}),children:n||s({id:`${Ch}placeholder_cta`})})})]})},LR=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:c}=he.useIntl(),[d,f]=y.useState(!1),p=()=>f(!1),g=!!n||!!r,m=typeof i=="string"||g;let E;return r&&(E=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),h.jsxs("section",{className:J("edit-section",t),children:[g&&h.jsx(vi,{title:o||`Edit ${a}`,isOpen:d,showDivider:!1,showIcon:!1,functions:{onClose:p},className:J("edit-section-modal"),children:E||(n?h.jsx(Gr,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var b,T;(b=n==null?void 0:n.functions)!=null&&b.onSuccess&&await((T=n==null?void 0:n.functions)==null?void 0:T.onSuccess(v)),f(!1)},onCancel:p}}):h.jsx(h.Fragment,{}))}),h.jsxs("div",{className:J("edit-section-header",{"no-title":!s}),children:[s&&h.jsx("h2",{className:"edit-section-header-title",children:a}),m&&h.jsx(je,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>NT({href:i,setShowModal:f}),children:c({id:`${Ch}edit`})})]}),e||h.jsx(MR,{...l,href:i,setShowModal:f,showEditButton:m}),u&&h.jsx(br,{})]})};const $R=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===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 h.jsxs("div",{className:J("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:J("title",s.className)},s.text),t&&h.jsx("p",{children:t}),h.jsx("ul",{className:J({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:c,nameOfBusiness:d,link:f=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const m=h.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:d});return h.jsxs("li",{children:[h.jsx("p",{className:"img-wrapper",children:f?h.jsx("a",{href:f,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),p&&h.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};let wd;const Ad="contactFooter_",jR=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(wd),wd=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(wd),window.removeEventListener("resize",l)}),[]),h.jsx(Zi,{id:"contactForm",className:"contact-footer",children:h.jsxs("div",{className:"inner-wrapper",children:[h.jsx("h2",{children:h.jsx(he.FormattedMessage,{id:`${Ad}title`})}),h.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[h.jsxs("aside",{children:[h.jsx("p",{children:h.jsx(he.FormattedMessage,{id:`${Ad}text`})}),h.jsx(Ki,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:h.jsx(he.FormattedMessage,{id:`${Ad}email`})})]}),h.jsx(AT,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},HR=({activeLink:e,profile:t,...n})=>h.jsx(Zi,{children:h.jsx(V4,{layout:"1-3",children:h.jsxs(h.Fragment,{children:[h.jsx(W4,{activeLink:e,profile:t}),h.jsx(c4,{...n})]})})});const Sd="cookieBanner_",kd=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Dd=new Date(Date.now()+12*30*24*60*60*1e3),IT=()=>{const e=he.useIntl(),[t,n,r]=Xh.useCookies(kd),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{kd.forEach(c=>{n(c,!0,{path:"/",expires:Dd,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Dd}),kd.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Dd});return}r(c)}),a(!1)};if(!i)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Sd}buttons_${c.id}`})})}),h.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[h.jsx("h6",{children:e.formatMessage({id:`${Sd}title`})}),h.jsx("p",{children:e.formatMessage({id:`${Sd}text`})}),h.jsx(Bs,{buttons:u})]})},li={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:rs["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:rs["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:rs.support,gtmType:"concierge-email-click"},business:{email:rs.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 us="footer_",Sc="SiteFooter",s9=({group:e})=>{const t=li[e].order||[];let n=!1;return"text"in li[e]&&(n=li[e].text),h.jsxs(y.Fragment,{children:[h.jsx("p",{className:"pre-title",children:h.jsx(he.FormattedMessage,{id:`${us}${e}`})}),Array.isArray(t)&&t.length>0&&h.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=li[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),h.jsx("li",{children:h.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":a,...s,children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&h.jsx("dl",{className:"text-medium",children:n.order.map(r=>h.jsxs(y.Fragment,{children:[h.jsx("dt",{children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}`})}),h.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&h.jsx("address",{children:h.jsx(he.FormattedMessage,{id:`${us}${e}_${r}_address`,values:{br:h.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&h.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},tm=()=>h.jsx("div",{id:"footer",children:h.jsxs("div",{className:"wrapper",children:[h.jsx(Hc,{element:"hr"}),h.jsx(wp,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":"logo-homepage-link"}),h.jsx("footer",{children:["platform","community","company","contact"].map(e=>h.jsxs("div",{className:"group",children:[h.jsx(s9,{group:e}),Object.keys(li[e]).includes("child")&&h.jsx(s9,{group:li[e].child})]},e))}),h.jsx("hr",{}),h.jsxs("div",{className:"sub-footer",children:[h.jsx("ul",{children:Array.isArray(li.social.order)&&li.social.order.map(e=>{const t=li.social[e];return h.jsx("li",{className:e,children:h.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Sc,"data-gtm-event-type":"social-click",children:h.jsx("span",{className:"hidden",children:h.jsx(he.FormattedMessage,{id:`${us}social_${e}`})})})},e)})}),h.jsx("small",{children:h.jsx(he.FormattedMessage,{id:`${us}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Wr=Object.create(null);Wr.open="0";Wr.close="1";Wr.ping="2";Wr.pong="3";Wr.message="4";Wr.upgrade="5";Wr.noop="6";const Yu=Object.create(null);Object.keys(Wr).forEach(e=>{Yu[Wr[e]]=e});const xh={type:"error",data:"parser error"},PT=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",RT=typeof ArrayBuffer=="function",FT=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,nm=({type:e,data:t},n,r)=>PT&&t instanceof Blob?n?r(t):o9(t,r):RT&&(t instanceof ArrayBuffer||FT(t))?n?r(t):o9(new Blob([t]),r):r(Wr[e]+(t||"")),o9=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function l9(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Od;function UR(e,t){if(PT&&e.data instanceof Blob)return e.data.arrayBuffer().then(l9).then(t);if(RT&&(e.data instanceof ArrayBuffer||FT(e.data)))return t(l9(e.data));nm(e,!1,n=>{Od||(Od=new TextEncoder),t(Od.encode(n))})}const u9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ao=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<u9.length;e++)Ao[u9.charCodeAt(e)]=e;const zR=e=>{let t=e.length*.75,n=e.length,r,i=0,a,s,o,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r<n;r+=4)a=Ao[e.charCodeAt(r)],s=Ao[e.charCodeAt(r+1)],o=Ao[e.charCodeAt(r+2)],l=Ao[e.charCodeAt(r+3)],c[i++]=a<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|l&63;return u},qR=typeof ArrayBuffer=="function",rm=(e,t)=>{if(typeof e!="string")return{type:"message",data:BT(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:WR(e.substring(1),t)}:Yu[n]?e.length>1?{type:Yu[n],data:e.substring(1)}:{type:Yu[n]}:xh},WR=(e,t)=>{if(qR){const n=zR(e);return BT(n,t)}else return{base64:!0,data:e}},BT=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},MT=String.fromCharCode(30),VR=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,s)=>{nm(a,!1,o=>{r[s]=o,++i===n&&t(r.join(MT))})})},KR=(e,t)=>{const n=e.split(MT),r=[];for(let i=0;i<n.length;i++){const a=rm(n[i],t);if(r.push(a),a.type==="error")break}return r};function GR(){return new TransformStream({transform(e,t){UR(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Nd;function Jl(e){return e.reduce((t,n)=>t+n.length,0)}function eu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function YR(e,t){Nd||(Nd=new TextDecoder);const n=[];let r=0,i=-1,a=!1;return new TransformStream({transform(s,o){for(n.push(s);;){if(r===0){if(Jl(n)<1)break;const l=eu(n,1);a=(l[0]&128)===128,i=l[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Jl(n)<2)break;const l=eu(n,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(Jl(n)<8)break;const l=eu(n,8),u=new DataView(l.buffer,l.byteOffset,l.length),c=u.getUint32(0);if(c>Math.pow(2,53-32)-1){o.enqueue(xh);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Jl(n)<i)break;const l=eu(n,i);o.enqueue(rm(a?l:Nd.decode(l),t)),r=0}if(i===0||i>e){o.enqueue(xh);break}}}})}const LT=4;function Wt(e){if(e)return ZR(e)}function ZR(e){for(var t in Wt.prototype)e[t]=Wt.prototype[t];return e}Wt.prototype.on=Wt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Wt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Wt.prototype.off=Wt.prototype.removeListener=Wt.prototype.removeAllListeners=Wt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Wt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this};Wt.prototype.emitReserved=Wt.prototype.emit;Wt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Wt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const t1=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Jn=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),QR="arraybuffer";function $T(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const XR=Jn.setTimeout,JR=Jn.clearTimeout;function n1(e,t){t.useNativeTimers?(e.setTimeoutFn=XR.bind(Jn),e.clearTimeoutFn=JR.bind(Jn)):(e.setTimeoutFn=Jn.setTimeout.bind(Jn),e.clearTimeoutFn=Jn.clearTimeout.bind(Jn))}const eF=1.33;function tF(e){return typeof e=="string"?nF(e):Math.ceil((e.byteLength||e.size)*eF)}function nF(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function jT(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rF(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function iF(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let a=n[r].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class aF extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class im extends Wt{constructor(t){super(),this.writable=!1,n1(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new aF(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=rm(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=rF(t);return n.length?"?"+n:""}}class sF extends im{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};KR(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,VR(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jT()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let HT=!1;try{HT=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const oF=HT;function lF(){}class uF extends sF{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Lr extends Wt{constructor(t,n,r){super(),this.createRequest=t,n1(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=$T(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Lr.requestsCount++,Lr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=lF,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Lr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Lr.requestsCount=0;Lr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",c9);else if(typeof addEventListener=="function"){const e="onpagehide"in Jn?"pagehide":"unload";addEventListener(e,c9,!1)}}function c9(){for(let e in Lr.requests)Lr.requests.hasOwnProperty(e)&&Lr.requests[e].abort()}const cF=function(){const e=UT({xdomain:!1});return e&&e.responseType!==null}();class dF extends uF{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=cF&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Lr(UT,this.uri(),t)}}function UT(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||oF))return new XMLHttpRequest}catch{}if(!t)try{return new Jn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zT=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fF extends im{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=zT?{}:$T(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;nm(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}i&&t1(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jT()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Id=Jn.WebSocket||Jn.MozWebSocket;class hF extends fF{createSocket(t,n,r){return zT?new Id(t,n,r):n?new Id(t,n):new Id(t)}doWrite(t,n){this.ws.send(n)}}class pF extends im{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=YR(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=GR();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{r.read().then(({done:o,value:l})=>{o||(this.onPacket(l),a())}).catch(o=>{})};a();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&t1(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const mF={websocket:hF,webtransport:pF,polling:dF},gF=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vF=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function wh(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=gF.exec(e||""),a={},s=14;for(;s--;)a[vF[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=EF(a,a.path),a.queryKey=yF(a,a.query),a}function EF(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function yF(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}const Ah=typeof addEventListener=="function"&&typeof removeEventListener=="function",Zu=[];Ah&&addEventListener("offline",()=>{Zu.forEach(e=>e())},!1);class Hi extends Wt{constructor(t,n){if(super(),this.binaryType=QR,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=wh(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=wh(n.host).host);n1(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=iF(this.opts.query)),Ah&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Zu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=LT,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Hi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Hi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=tF(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,t1(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Hi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ah&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Zu.indexOf(this._offlineEventListener);r!==-1&&Zu.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Hi.protocol=LT;class bF extends Hi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Hi.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Hi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function a(){r||(r=!0,c(),n.close(),n=null)}const s=d=>{const f=new Error("probe error: "+d);f.transport=n.name,a(),this.emitReserved("upgradeError",f)};function o(){s("transport closed")}function l(){s("socket closed")}function u(d){n&&d.name!==n.name&&a()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",o),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",o),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let TF=class extends bF{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>mF[i]).filter(i=>!!i)),super(t,r)}};function _F(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=wh(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const CF=typeof ArrayBuffer=="function",xF=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qT=Object.prototype.toString,wF=typeof Blob=="function"||typeof Blob<"u"&&qT.call(Blob)==="[object BlobConstructor]",AF=typeof File=="function"||typeof File<"u"&&qT.call(File)==="[object FileConstructor]";function am(e){return CF&&(e instanceof ArrayBuffer||xF(e))||wF&&e instanceof Blob||AF&&e instanceof File}function Qu(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Qu(e[n]))return!0;return!1}if(am(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Qu(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Qu(e[n]))return!0;return!1}function SF(e){const t=[],n=e.data,r=e;return r.data=Sh(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Sh(e,t){if(!e)return e;if(am(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Sh(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Sh(e[r],t));return n}return e}function kF(e,t){return e.data=kh(e.data,t),delete e.attachments,e}function kh(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=kh(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=kh(e[n],t));return e}const DF=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],OF=5;var ot;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ot||(ot={}));class NF{constructor(t){this.replacer=t}encode(t){return(t.type===ot.EVENT||t.type===ot.ACK)&&Qu(t)?this.encodeAsBinary({type:t.type===ot.EVENT?ot.BINARY_EVENT:ot.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ot.BINARY_EVENT||t.type===ot.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=SF(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function d9(e){return Object.prototype.toString.call(e)==="[object Object]"}class sm extends Wt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===ot.BINARY_EVENT;r||n.type===ot.BINARY_ACK?(n.type=r?ot.EVENT:ot.ACK,this.reconstructor=new IF(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(am(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(ot[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ot.BINARY_EVENT||r.type===ot.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(a,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(a,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const a=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}r.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(sm.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ot.CONNECT:return d9(n);case ot.DISCONNECT:return n===void 0;case ot.CONNECT_ERROR:return typeof n=="string"||d9(n);case ot.EVENT:case ot.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&DF.indexOf(n[0])===-1);case ot.ACK:case ot.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class IF{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=kF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const PF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:sm,Encoder:NF,get PacketType(){return ot},protocol:OF},Symbol.toStringTag,{value:"Module"}));function vr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const RF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class WT extends Wt{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[vr(t,"open",this.onopen.bind(this)),vr(t,"packet",this.onpacket.bind(this)),vr(t,"error",this.onerror.bind(this)),vr(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,a;if(RF.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:ot.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const c=this.ids++,d=n.pop();this._registerAckCallback(c,d),s.id=c}const o=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,l=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===t&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},i),s=(...o)=>{this.io.clearTimeoutFn(a),n.apply(this,o)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const a=(s,o)=>s?i(s):r(o);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ot.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ot.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ot.EVENT:case ot.BINARY_EVENT:this.onevent(t);break;case ot.ACK:case ot.BINARY_ACK:this.onack(t);break;case ot.DISCONNECT:this.ondisconnect();break;case ot.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:ot.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ot.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Hs(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Hs.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Hs.prototype.reset=function(){this.attempts=0};Hs.prototype.setMin=function(e){this.ms=e};Hs.prototype.setMax=function(e){this.max=e};Hs.prototype.setJitter=function(e){this.jitter=e};class Dh extends Wt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,n1(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Hs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||PF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new TF(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=vr(n,"open",function(){r.onopen(),t&&t()}),a=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),t?t(o):this.maybeReconnectOnOpen()},s=vr(n,"error",a);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(vr(t,"ping",this.onping.bind(this)),vr(t,"data",this.ondata.bind(this)),vr(t,"error",this.onerror.bind(this)),vr(t,"close",this.onclose.bind(this)),vr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){t1(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new WT(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ao={};function Xu(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=_F(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=ao[i]&&a in ao[i].nsps,o=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return o?l=new Dh(r,t):(ao[i]||(ao[i]=new Dh(r,t)),l=ao[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Xu,{Manager:Dh,Socket:WT,io:Xu,connect:Xu});const f9=e=>{let t;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const p=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,p))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}},u=t=e(r,i,l);return l},VT=e=>e?f9(e):f9;function FF(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(i){i(n)}),(r=e.get("*"))&&r.slice().map(function(i){i(t,n)})}}}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}class BF extends Error{constructor(t){super(t),this.name=void 0,this.name="SuprSendError"}}function ga(){return Math.round(Date.now())}function ra(){var e=new Date().getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?r:r&3|8).toString(16)});return t}const pn=VT()(()=>({apiUrl:"https://inboxs.live",collectorApiUrl:"https://hub.suprsend.com",socketUrl:"https://betainbox.suprsend.com",pageSize:20})),MF={unseenCount:0,stores:{},activeStoreId:null,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null},st=VT()(()=>MF);class LF{constructor(t){this.socket=void 0,this.config=void 0,this.config=t;const n=pn.getState();this.socket=Xu(n.socketUrl,{transports:["websocket"],auth:{subscriber_id:this.config.subscriberId,distinct_id:this.config.distinctId,authorization:`${this.config.workspaceKey}:${ra()}`,tenant_id:this.config.tenantId},reconnectionAttempts:25,reconnectionDelay:5e3,reconnectionDelayMax:1e4}),this._initializeSocketEvents()}orderNotifications(t,n){if(t.is_pinned)return[t,...n];{let r=!1,i=[];return n.forEach(a=>{a.is_pinned||r?i.push(a):(i.push(t),i.push(a),r=!0)}),r?i:[...n,t]}}_initializeSocketEvents(){var t=this;this.socket.on("new_notification",async function(n){n.n_id&&setTimeout(async function(){try{const i=await(await t.getNotificationDetails(n.n_id)).json(),a=st.getState();if(t.config.stores){let s=!1;for(let o of t.config.stores){const l=a.stores[o.storeId];t._notificationBelongToStore(i.data,o)&&(s=!0,l.notifications=t.orderNotifications(i.data,l.notifications),l.unseenCount+=1)}s&&(a.unseenCount+=1,t.config.emitter.emit("new_notification",i.data)),st.setState({unseenCount:a.unseenCount,stores:Mn({},a.stores)})}else{if(!a.activeStoreId)return;let s=a.stores[a.activeStoreId];a.unseenCount+=1,s.unseenCount+=1,s.notifications=t.orderNotifications(i.data,s.notifications),st.setState({unseenCount:a.unseenCount,stores:Mn({},a.stores)}),t.config.emitter.emit("new_notification",i.data)}t.config.emitter.emit("sync_notif_store")}catch(r){console.log("SuprSend: error in new_notification event",r)}},1e3)}),this.socket.on("notification_updated",async function(n){n.n_id&&setTimeout(async function(){try{const a=await Promise.allSettled([t.getNotificationDetails(n.n_id),t.getNotificationsCount()]),s=st.getState();let o=s.activeStoreId;if(a[0].status==="fulfilled"){var r;const u=await a[0].value.json(),c=u.data;if(!o)return;let d=s.stores[o];const f=(r=t.config.stores)==null?void 0:r.find(p=>p.storeId===o);if((n==null?void 0:n.type)==="archive"){var i;f!=null&&(i=f.query)!=null&&i.archived?t._notificationBelongToStore(c,f)&&(s.stores[o].notifications=[c,...d.notifications]):s.stores[o].notifications=d.notifications.filter(p=>p.n_id!==n.n_id)}else s.stores[o].notifications=d.notifications.map(p=>p.n_id===n.n_id?u.data:p);st.setState({stores:Mn({},s.stores)})}if(a[1].status==="fulfilled"){const u=await a[1].value.json();st.setState(c=>{for(let d in c.stores){const f=c.stores[d];f.unseenCount=u[d]||0}return{unseenCount:u.ss_bell_count,stores:Mn({},c.stores)}})}t.config.emitter.emit("sync_notif_store")}catch(a){console.log("SuprSend: error in notification_updated event",a)}},1e3)}),this.socket.on("update_badge",async function(){st.setState({unseenCount:0}),t.config.emitter.emit("sync_notif_store")}),this.socket.on("mark_all_read",async function(){const n=st.getState(),r=ga();for(let i in n.stores){const a=n.stores[i];a.notifications.forEach(s=>{s.seen_on||(s.seen_on=r)}),a.unseenCount=0}st.setState({stores:n.stores}),t.config.emitter.emit("sync_notif_store")})}_notificationBelongToStore(t,n){var r,i,a,s;const o=!!t.seen_on,l=t.archived,u=t.tags,c=t.n_category,d=n==null||(r=n.query)==null?void 0:r.read,f=n==null||(i=n.query)==null?void 0:i.archived,p=n==null||(a=n.query)==null?void 0:a.tags,g=n==null||(s=n.query)==null?void 0:s.categories,m=!d||o===d,E=!f||l===f;let v,b;return Array.isArray(p)&&p.length>0?p.forEach(T=>{u!=null&&u.includes(T)&&(v=!0)}):v=!0,Array.isArray(g)&&g.length>0?g.includes(c)&&(b=!0):b=!0,m&&v&&b&&E}_getStoreQueryString(t){const n=t==null?void 0:t.query;let r=(n==null?void 0:n.tags)||[],i=(n==null?void 0:n.categories)||[];const a=n==null?void 0:n.read,s=n==null?void 0:n.archived;return{store_id:t.storeId,query:{read:a,archived:s,tags:{or:r},categories:{or:i}}}}_getStoresQueryString(){const t=this.config.stores;return t==null?void 0:t.map(r=>this._getStoreQueryString(r))}getNotificationsCount(){const{apiUrl:t}=pn.getState();let n=`/notification_count/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}`;if(this.config.stores){const r=this._getStoresQueryString();n+=`&stores=${encodeURIComponent(JSON.stringify(r))}`}return fetch(`${t}${n}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}getNotifications(t,n,r=20,i){const{apiUrl:a}=pn.getState();let s=`/notifications/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}&page_no=${n}&page_size=${r}&before=${i}`;if(t){const o=this._getStoreQueryString(t);s+=`&store=${encodeURIComponent(JSON.stringify(o))}`}return fetch(`${a}${s}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}getNotificationDetails(t){const{apiUrl:n}=pn.getState(),r=`/notification/${t}/?subscriber_id=${this.config.subscriberId}&distinct_id=${this.config.distinctId}&tenant_id=${this.config.tenantId}`;return fetch(`${n}${r}`,{method:"GET",headers:{Authorization:`${this.config.workspaceKey}:${ra()}`}})}markBellClicked(){const{apiUrl:t}=pn.getState(),n="/bell-clicked/",r=JSON.stringify({time:ga(),distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId,tenant_id:this.config.tenantId});return fetch(`${t}${n}`,{method:"POST",body:r,headers:{Authorization:`${this.config.workspaceKey}:${ra()}`,"Content-Type":"application/json"}})}markAllRead(){const{apiUrl:t}=pn.getState(),n="/mark-all-read/",r=JSON.stringify({time:ga(),distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId,tenant_id:this.config.tenantId});return fetch(`${t}${n}`,{method:"POST",body:r,headers:{Authorization:`${this.config.workspaceKey}:${ra()}`,"Content-Type":"application/json"}})}markNotificationClicked(t){const{collectorApiUrl:n}=pn.getState(),r={event:"$notification_clicked",env:this.config.workspaceKey,$insert_id:ra(),$time:ga(),properties:{id:t}};return fetch(`${n}/event/`,{method:"POST",body:JSON.stringify(r),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationRead(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"read",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationUnRead(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"unread",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}markNotificationArchive(t){const{apiUrl:n}=pn.getState();return fetch(`${n}/notification/${t}/action`,{method:"POST",body:JSON.stringify({action:"archive",distinct_id:this.config.distinctId,subscriber_id:this.config.subscriberId}),headers:{Authorization:`${this.config.workspaceKey}:`,"Content-Type":"application/json"}})}}let h9=class{constructor(t){this.config=void 0,this.config=t}_overallFirstApiCall(){const t=st.getState();for(let n in t.stores)if(t.stores[n].isFirstCall===!1)return!1;return!0}async fetchNotifications(){var t,n;const r=this.config.client,i=st.getState(),a=pn.getState(),s=i.activeStoreId;if(!s||!((t=i.stores)!=null&&t[s]))return;const o=i.stores[s],l=o.isFirstCall,u=i.initialFetchTime||Date.now(),c=(n=this.config.stores)==null?void 0:n.find(d=>d.storeId===s);try{if(!r||!i.hasNext)return;l?(st.setState({initialLoading:!0}),this._overallFirstApiCall()&&this.getNotificationsCount()):i.pageNumber>1&&st.setState({fetchMoreLoading:!0}),this.config.emitter.emit("sync_notif_store");const f=await(await r.getNotifications(c,i.pageNumber,a.pageSize,u)).json();let p;l||!l&&i.pageNumber===1?p=f.results:p=[...o.notifications,...f.results],i.stores[s].notifications=p,i.stores[s].isFirstCall=!1,st.setState({stores:i.stores,pageNumber:i.pageNumber+1,hasNext:f.meta.current_page<f.meta.total_pages,initialFetchTime:u,initialLoading:!1,fetchMoreLoading:!1}),this.config.emitter.emit("sync_notif_store"),this.config._startExipryCheck()}catch(d){console.log("SUPRSEND: error getting latest notifications",d),st.setState({initialLoading:!1,fetchMoreLoading:!1}),this.config.emitter.emit("sync_notif_store")}}async getNotificationsCount(){const t=this.config.client;if(t)try{const r=await(await t.getNotificationsCount()).json();st.setState(i=>{for(let a in i.stores){const s=i.stores[a];s.unseenCount=r[a]||0}return{unseenCount:r.ss_bell_count,stores:Mn({},i.stores)}}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error getting notifications count",n)}}async markClicked(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&(!l.interacted_on||!l.seen_on)){if(!r)return;try{l.interacted_on?l.seen_on||r.markNotificationRead(t):r.markNotificationClicked(t);const c=ga();if(l.interacted_on=c,!l.seen_on)for(let d in i==null?void 0:i.stores){var u;const f=i.stores[d];(u=f.notifications)==null||u.forEach(p=>{p.n_id===l.n_id&&(p.seen_on=c,p.interacted_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification clicked",c)}}}async markAllSeen(){const t=this.config.client;try{if(!t)return;t.markBellClicked(),st.setState({unseenCount:0}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error marking all notifications seen",n)}}async markAllRead(){const t=this.config.client;try{if(!t)return;t.markAllRead();const n=st.getState(),r=ga();for(let i in n.stores){const a=n.stores[i];a.notifications.forEach(s=>{s.seen_on||(s.seen_on=r)}),a.unseenCount=0}st.setState({stores:n.stores}),this.config.emitter.emit("sync_notif_store")}catch(n){console.log("SUPRSEND: error marking all notifications read",n)}}async markRead(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&!l.seen_on){if(!r)return;try{r.markNotificationRead(t);const c=ga();if(!l.seen_on)for(let d in i==null?void 0:i.stores){var u;const f=i.stores[d];(u=f.notifications)==null||u.forEach(p=>{p.n_id===l.n_id&&(p.seen_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification read",c)}}}async markUnRead(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const l=i.stores[a].notifications.find(c=>c.n_id===t);if(l&&l.seen_on){if(!r)return;try{if(r.markNotificationUnRead(t),l.seen_on)for(let c in i==null?void 0:i.stores){var u;const d=i.stores[c];(u=d.notifications)==null||u.forEach(f=>{f.n_id===l.n_id&&(f.seen_on=void 0,d.unseenCount>=0&&(d.unseenCount+=1))})}st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(c){console.log("SUPRSEND: error marking notification read",c)}}}markArchived(t){var n;const r=this.config.client,i=st.getState(),a=i.activeStoreId;if(!a||!((n=i.stores)!=null&&n[a]))return;const o=(i==null?void 0:i.stores)[a],l=o.notifications.find(u=>u.n_id===t);if(l&&!l.archived){if(!r)return;try{r.markNotificationArchive(t),o.notifications=o.notifications.filter(u=>u.n_id!==t),!l.seen_on&&o.unseenCount>0&&(o.unseenCount-=1),st.setState(Mn({},i)),this.config.emitter.emit("sync_notif_store")}catch(u){console.log("SUPRSEND: error marking notification archived",u)}}}get stores(){return this.config.stores}get data(){const t=st.getState(),n=t.activeStoreId,r=this.stores;if(n)return{unseenCount:t.unseenCount,activeStoreId:t.activeStoreId,stores:t.stores,hasStores:r?(r==null?void 0:r.length)>0:!1,hasNext:t.hasNext,initialLoading:t.initialLoading,fetchMoreLoading:t.fetchMoreLoading}}};class $F{constructor(t,n){this.workspaceKey="",this.tenantId=void 0,this.stores=void 0,this.distinctId=void 0,this.subscriberId=void 0,this._client=void 0,this._expiryTimerId=void 0,this.feed=new h9(this),this.emitter=FF(),this._validateConfig(t),this._setConfigStoreState((n==null?void 0:n.host)||{}),this.tenantId=(n==null?void 0:n.tenantID)||"default",this._validateStore(n==null?void 0:n.stores),this._validatePageSize(n==null?void 0:n.pageSize),this._initializeStoreState()}_validateConfig(t){if(t)this.workspaceKey=t;else throw new BF("workspaceKey missing")}_validateStore(t){if(!t||!Array.isArray(t))return;const n=[];t.forEach(r=>{if(!r.storeId){console.log("SuprSendInbox: storeId is mandatory if stores are used");return}const i=r==null?void 0:r.query;let a,s=[],o=[],l;typeof(i==null?void 0:i.read)=="boolean"&&(a=i.read),typeof(i==null?void 0:i.archived)=="boolean"&&(l=i.archived),typeof(i==null?void 0:i.tags)=="string"?s=[i.tags]:Array.isArray(i==null?void 0:i.tags)&&(s=i==null?void 0:i.tags.filter(u=>typeof u=="string")),typeof(i==null?void 0:i.categories)=="string"?o=[i.categories]:Array.isArray(i==null?void 0:i.categories)&&(o=i==null?void 0:i.categories.filter(u=>typeof u=="string")),n.push({storeId:r.storeId,label:r.label||r.storeId,query:{archived:l,read:a,tags:s,categories:o}})}),this.stores=n}_validatePageSize(t){if(t&&typeof t=="number"){const r=t<=50?t:50;pn.setState({pageSize:r})}}_setConfigStoreState(t){t&&(t!=null&&t.socketHost&&pn.setState({socketUrl:t.socketHost}),t!=null&&t.apiHost&&pn.setState({apiUrl:t.apiHost}),t!=null&&t.collectorHost&&pn.setState({collectorApiUrl:t.collectorHost}))}_initializeStoreState(){const t="default_store",n={notifications:[],unseenCount:0,isFirstCall:!0};if(this.stores&&Array.isArray(this.stores)&&this.stores.length>0){const r={};this.stores.map(i=>{r[i.storeId]=Mn({},n)}),st.setState({stores:r,activeStoreId:this.stores[0].storeId})}else st.setState({stores:{[t]:Mn({},n)},activeStoreId:t});setTimeout(()=>{this.emitter.emit("sync_notif_store")},0)}_startExipryCheck(){var t=this;this._expiryTimerId||(this._expiryTimerId=setInterval(async function(){const r=st.getState().stores;let i=!1;for(let a in r){let s=r[a].notifications;s=s.filter(o=>(o.expiry?Date.now()>o.expiry:!1)?(i=!0,!1):!0),r[a].notifications=s}i&&(st.setState({stores:r}),await t.feed.getNotificationsCount(),t.emitter.emit("sync_notif_store"))},3e4))}get client(){return this.distinctId&&this.subscriberId&&(this._client||(this._client=new LF(this))),this._client}identifyUser(t,n){this.distinctId=t,this.subscriberId=n}changeActiveStore(t){var n;const r=st.getState(),i={};if(r.activeStoreId!==t&&(n=r.stores)!=null&&n[t]){for(let a in r.stores){const s=r.stores[a],o=s.notifications.slice(0,20);i[a]={notifications:o,unseenCount:s.unseenCount,isFirstCall:s.isFirstCall}}st.setState({activeStoreId:t,stores:i,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null}),this.client&&this.feed.fetchNotifications()}}resetUser(){var t;st.setState({unseenCount:0,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null}),this._initializeStoreState(),(t=this._client)==null||t.socket.disconnect(),this.distinctId=void 0,this.subscriberId=void 0,this._client=void 0,clearInterval(this._expiryTimerId),this._expiryTimerId=void 0,this.feed=new h9(this)}}var p9=function(t){return t.reduce(function(n,r){var i=r[0],a=r[1];return n[i]=a,n},{})},m9=typeof window<"u"&&window.document&&window.document.createElement?rn.useLayoutEffect:rn.useEffect,Sn="top",sr="bottom",or="right",kn="left",om="auto",yl=[Sn,sr,or,kn],Os="start",ll="end",jF="clippingParents",KT="viewport",so="popper",HF="reference",g9=yl.reduce(function(e,t){return e.concat([t+"-"+Os,t+"-"+ll])},[]),GT=[].concat(yl,[om]).reduce(function(e,t){return e.concat([t,t+"-"+Os,t+"-"+ll])},[]),UF="beforeRead",zF="read",qF="afterRead",WF="beforeMain",VF="main",KF="afterMain",GF="beforeWrite",YF="write",ZF="afterWrite",QF=[UF,zF,qF,WF,VF,KF,GF,YF,ZF];function Vr(e){return e?(e.nodeName||"").toLowerCase():null}function Un(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Sa(e){var t=Un(e).Element;return e instanceof t||e instanceof Element}function rr(e){var t=Un(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lm(e){if(typeof ShadowRoot>"u")return!1;var t=Un(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function XF(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},a=t.elements[n];!rr(a)||!Vr(a)||(Object.assign(a.style,r),Object.keys(i).forEach(function(s){var o=i[s];o===!1?a.removeAttribute(s):a.setAttribute(s,o===!0?"":o)}))})}function JF(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],a=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),o=s.reduce(function(l,u){return l[u]="",l},{});!rr(i)||!Vr(i)||(Object.assign(i.style,o),Object.keys(a).forEach(function(l){i.removeAttribute(l)}))})}}const eB={name:"applyStyles",enabled:!0,phase:"write",fn:XF,effect:JF,requires:["computeStyles"]};function $r(e){return e.split("-")[0]}var Ta=Math.max,kc=Math.min,Ns=Math.round;function Oh(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function YT(){return!/^((?!chrome|android).)*safari/i.test(Oh())}function Is(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&rr(e)&&(i=e.offsetWidth>0&&Ns(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Ns(r.height)/e.offsetHeight||1);var s=Sa(e)?Un(e):window,o=s.visualViewport,l=!YT()&&n,u=(r.left+(l&&o?o.offsetLeft:0))/i,c=(r.top+(l&&o?o.offsetTop:0))/a,d=r.width/i,f=r.height/a;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function um(e){var t=Is(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function ZT(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lm(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hi(e){return Un(e).getComputedStyle(e)}function tB(e){return["table","td","th"].indexOf(Vr(e))>=0}function Qi(e){return((Sa(e)?e.ownerDocument:e.document)||window.document).documentElement}function r1(e){return Vr(e)==="html"?e:e.assignedSlot||e.parentNode||(lm(e)?e.host:null)||Qi(e)}function v9(e){return!rr(e)||hi(e).position==="fixed"?null:e.offsetParent}function nB(e){var t=/firefox/i.test(Oh()),n=/Trident/i.test(Oh());if(n&&rr(e)){var r=hi(e);if(r.position==="fixed")return null}var i=r1(e);for(lm(i)&&(i=i.host);rr(i)&&["html","body"].indexOf(Vr(i))<0;){var a=hi(i);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return i;i=i.parentNode}return null}function bl(e){for(var t=Un(e),n=v9(e);n&&tB(n)&&hi(n).position==="static";)n=v9(n);return n&&(Vr(n)==="html"||Vr(n)==="body"&&hi(n).position==="static")?t:n||nB(e)||t}function cm(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function $o(e,t,n){return Ta(e,kc(t,n))}function rB(e,t,n){var r=$o(e,t,n);return r>n?n:r}function QT(){return{top:0,right:0,bottom:0,left:0}}function XT(e){return Object.assign({},QT(),e)}function JT(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var iB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,XT(typeof t!="number"?t:JT(t,yl))};function aB(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,o=$r(n.placement),l=cm(o),u=[kn,or].indexOf(o)>=0,c=u?"height":"width";if(!(!a||!s)){var d=iB(i.padding,n),f=um(a),p=l==="y"?Sn:kn,g=l==="y"?sr:or,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],E=s[l]-n.rects.reference[l],v=bl(a),b=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,T=m/2-E/2,_=d[p],w=b-f[c]-d[g],A=b/2-f[c]/2+T,S=$o(_,A,w),B=l;n.modifiersData[r]=(t={},t[B]=S,t.centerOffset=S-A,t)}}function sB(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||ZT(t.elements.popper,i)&&(t.elements.arrow=i))}const oB={name:"arrow",enabled:!0,phase:"main",fn:aB,effect:sB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ps(e){return e.split("-")[1]}var lB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uB(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Ns(n*i)/i||0,y:Ns(r*i)/i||0}}function E9(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,o=e.position,l=e.gpuAcceleration,u=e.adaptive,c=e.roundOffsets,d=e.isFixed,f=s.x,p=f===void 0?0:f,g=s.y,m=g===void 0?0:g,E=typeof c=="function"?c({x:p,y:m}):{x:p,y:m};p=E.x,m=E.y;var v=s.hasOwnProperty("x"),b=s.hasOwnProperty("y"),T=kn,_=Sn,w=window;if(u){var A=bl(n),S="clientHeight",B="clientWidth";if(A===Un(n)&&(A=Qi(n),hi(A).position!=="static"&&o==="absolute"&&(S="scrollHeight",B="scrollWidth")),A=A,i===Sn||(i===kn||i===or)&&a===ll){_=sr;var F=d&&A===w&&w.visualViewport?w.visualViewport.height:A[S];m-=F-r.height,m*=l?1:-1}if(i===kn||(i===Sn||i===sr)&&a===ll){T=or;var L=d&&A===w&&w.visualViewport?w.visualViewport.width:A[B];p-=L-r.width,p*=l?1:-1}}var R=Object.assign({position:o},u&&lB),N=c===!0?uB({x:p,y:m},Un(n)):{x:p,y:m};if(p=N.x,m=N.y,l){var k;return Object.assign({},R,(k={},k[_]=b?"0":"",k[T]=v?"0":"",k.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",k))}return Object.assign({},R,(t={},t[_]=b?m+"px":"",t[T]=v?p+"px":"",t.transform="",t))}function cB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,a=n.adaptive,s=a===void 0?!0:a,o=n.roundOffsets,l=o===void 0?!0:o,u={placement:$r(t.placement),variation:Ps(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,E9(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,E9(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const dB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:cB,data:{}};var tu={passive:!0};function fB(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0?!0:i,s=r.resize,o=s===void 0?!0:s,l=Un(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&u.forEach(function(c){c.addEventListener("scroll",n.update,tu)}),o&&l.addEventListener("resize",n.update,tu),function(){a&&u.forEach(function(c){c.removeEventListener("scroll",n.update,tu)}),o&&l.removeEventListener("resize",n.update,tu)}}const hB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:fB,data:{}};var pB={left:"right",right:"left",bottom:"top",top:"bottom"};function Ju(e){return e.replace(/left|right|bottom|top/g,function(t){return pB[t]})}var mB={start:"end",end:"start"};function y9(e){return e.replace(/start|end/g,function(t){return mB[t]})}function dm(e){var t=Un(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fm(e){return Is(Qi(e)).left+dm(e).scrollLeft}function gB(e,t){var n=Un(e),r=Qi(e),i=n.visualViewport,a=r.clientWidth,s=r.clientHeight,o=0,l=0;if(i){a=i.width,s=i.height;var u=YT();(u||!u&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:a,height:s,x:o+fm(e),y:l}}function vB(e){var t,n=Qi(e),r=dm(e),i=(t=e.ownerDocument)==null?void 0:t.body,a=Ta(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ta(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),o=-r.scrollLeft+fm(e),l=-r.scrollTop;return hi(i||n).direction==="rtl"&&(o+=Ta(n.clientWidth,i?i.clientWidth:0)-a),{width:a,height:s,x:o,y:l}}function hm(e){var t=hi(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function e8(e){return["html","body","#document"].indexOf(Vr(e))>=0?e.ownerDocument.body:rr(e)&&hm(e)?e:e8(r1(e))}function jo(e,t){var n;t===void 0&&(t=[]);var r=e8(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),a=Un(r),s=i?[a].concat(a.visualViewport||[],hm(r)?r:[]):r,o=t.concat(s);return i?o:o.concat(jo(r1(s)))}function Nh(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function EB(e,t){var n=Is(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function b9(e,t,n){return t===KT?Nh(gB(e,n)):Sa(t)?EB(t,n):Nh(vB(Qi(e)))}function yB(e){var t=jo(r1(e)),n=["absolute","fixed"].indexOf(hi(e).position)>=0,r=n&&rr(e)?bl(e):e;return Sa(r)?t.filter(function(i){return Sa(i)&&ZT(i,r)&&Vr(i)!=="body"}):[]}function bB(e,t,n,r){var i=t==="clippingParents"?yB(e):[].concat(t),a=[].concat(i,[n]),s=a[0],o=a.reduce(function(l,u){var c=b9(e,u,r);return l.top=Ta(c.top,l.top),l.right=kc(c.right,l.right),l.bottom=kc(c.bottom,l.bottom),l.left=Ta(c.left,l.left),l},b9(e,s,r));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function t8(e){var t=e.reference,n=e.element,r=e.placement,i=r?$r(r):null,a=r?Ps(r):null,s=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2,l;switch(i){case Sn:l={x:s,y:t.y-n.height};break;case sr:l={x:s,y:t.y+t.height};break;case or:l={x:t.x+t.width,y:o};break;case kn:l={x:t.x-n.width,y:o};break;default:l={x:t.x,y:t.y}}var u=i?cm(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(a){case Os:l[u]=l[u]-(t[c]/2-n[c]/2);break;case ll:l[u]=l[u]+(t[c]/2-n[c]/2);break}}return l}function ul(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,s=a===void 0?e.strategy:a,o=n.boundary,l=o===void 0?jF:o,u=n.rootBoundary,c=u===void 0?KT:u,d=n.elementContext,f=d===void 0?so:d,p=n.altBoundary,g=p===void 0?!1:p,m=n.padding,E=m===void 0?0:m,v=XT(typeof E!="number"?E:JT(E,yl)),b=f===so?HF:so,T=e.rects.popper,_=e.elements[g?b:f],w=bB(Sa(_)?_:_.contextElement||Qi(e.elements.popper),l,c,s),A=Is(e.elements.reference),S=t8({reference:A,element:T,strategy:"absolute",placement:i}),B=Nh(Object.assign({},T,S)),F=f===so?B:A,L={top:w.top-F.top+v.top,bottom:F.bottom-w.bottom+v.bottom,left:w.left-F.left+v.left,right:F.right-w.right+v.right},R=e.modifiersData.offset;if(f===so&&R){var N=R[i];Object.keys(L).forEach(function(k){var I=[or,sr].indexOf(k)>=0?1:-1,j=[Sn,sr].indexOf(k)>=0?"y":"x";L[k]+=N[j]*I})}return L}function TB(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,s=n.padding,o=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?GT:l,c=Ps(r),d=c?o?g9:g9.filter(function(g){return Ps(g)===c}):yl,f=d.filter(function(g){return u.indexOf(g)>=0});f.length===0&&(f=d);var p=f.reduce(function(g,m){return g[m]=ul(e,{placement:m,boundary:i,rootBoundary:a,padding:s})[$r(m)],g},{});return Object.keys(p).sort(function(g,m){return p[g]-p[m]})}function _B(e){if($r(e)===om)return[];var t=Ju(e);return[y9(e),t,y9(t)]}function CB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0?!0:i,s=n.altAxis,o=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,g=p===void 0?!0:p,m=n.allowedAutoPlacements,E=t.options.placement,v=$r(E),b=v===E,T=l||(b||!g?[Ju(E)]:_B(E)),_=[E].concat(T).reduce(function(H,q){return H.concat($r(q)===om?TB(t,{placement:q,boundary:c,rootBoundary:d,padding:u,flipVariations:g,allowedAutoPlacements:m}):q)},[]),w=t.rects.reference,A=t.rects.popper,S=new Map,B=!0,F=_[0],L=0;L<_.length;L++){var R=_[L],N=$r(R),k=Ps(R)===Os,I=[Sn,sr].indexOf(N)>=0,j=I?"width":"height",z=ul(t,{placement:R,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),P=I?k?or:kn:k?sr:Sn;w[j]>A[j]&&(P=Ju(P));var ae=Ju(P),X=[];if(a&&X.push(z[N]<=0),o&&X.push(z[P]<=0,z[ae]<=0),X.every(function(H){return H})){F=R,B=!1;break}S.set(R,X)}if(B)for(var O=g?3:1,C=function(q){var U=_.find(function($){var oe=S.get($);if(oe)return oe.slice(0,q).every(function(Z){return Z})});if(U)return F=U,"break"},Y=O;Y>0;Y--){var M=C(Y);if(M==="break")break}t.placement!==F&&(t.modifiersData[r]._skip=!0,t.placement=F,t.reset=!0)}}const xB={name:"flip",enabled:!0,phase:"main",fn:CB,requiresIfExists:["offset"],data:{_skip:!1}};function T9(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function _9(e){return[Sn,or,sr,kn].some(function(t){return e[t]>=0})}function wB(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,s=ul(t,{elementContext:"reference"}),o=ul(t,{altBoundary:!0}),l=T9(s,r),u=T9(o,i,a),c=_9(l),d=_9(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const AB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:wB};function SB(e,t,n){var r=$r(e),i=[kn,Sn].indexOf(r)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=a[0],o=a[1];return s=s||0,o=(o||0)*i,[kn,or].indexOf(r)>=0?{x:o,y:s}:{x:s,y:o}}function kB(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,s=GT.reduce(function(c,d){return c[d]=SB(d,t.rects,a),c},{}),o=s[t.placement],l=o.x,u=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=s}const DB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:kB};function OB(e){var t=e.state,n=e.name;t.modifiersData[n]=t8({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const NB={name:"popperOffsets",enabled:!0,phase:"read",fn:OB,data:{}};function IB(e){return e==="x"?"y":"x"}function PB(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0?!0:i,s=n.altAxis,o=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,g=n.tetherOffset,m=g===void 0?0:g,E=ul(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),v=$r(t.placement),b=Ps(t.placement),T=!b,_=cm(v),w=IB(_),A=t.modifiersData.popperOffsets,S=t.rects.reference,B=t.rects.popper,F=typeof m=="function"?m(Object.assign({},t.rects,{placement:t.placement})):m,L=typeof F=="number"?{mainAxis:F,altAxis:F}:Object.assign({mainAxis:0,altAxis:0},F),R=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,N={x:0,y:0};if(A){if(a){var k,I=_==="y"?Sn:kn,j=_==="y"?sr:or,z=_==="y"?"height":"width",P=A[_],ae=P+E[I],X=P-E[j],O=p?-B[z]/2:0,C=b===Os?S[z]:B[z],Y=b===Os?-B[z]:-S[z],M=t.elements.arrow,H=p&&M?um(M):{width:0,height:0},q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:QT(),U=q[I],$=q[j],oe=$o(0,S[z],H[z]),Z=T?S[z]/2-O-oe-U-L.mainAxis:C-oe-U-L.mainAxis,ne=T?-S[z]/2+O+oe+$+L.mainAxis:Y+oe+$+L.mainAxis,se=t.elements.arrow&&bl(t.elements.arrow),ee=se?_==="y"?se.clientTop||0:se.clientLeft||0:0,xe=(k=R==null?void 0:R[_])!=null?k:0,ke=P+Z-xe-ee,be=P+ne-xe,ie=$o(p?kc(ae,ke):ae,P,p?Ta(X,be):X);A[_]=ie,N[_]=ie-P}if(o){var me,we=_==="x"?Sn:kn,Ie=_==="x"?sr:or,Xe=A[w],tt=w==="y"?"height":"width",qe=Xe+E[we],Ke=Xe-E[Ie],Fe=[Sn,kn].indexOf(v)!==-1,te=(me=R==null?void 0:R[w])!=null?me:0,pe=Fe?qe:Xe-S[tt]-B[tt]-te+L.altAxis,De=Fe?Xe+S[tt]+B[tt]-te-L.altAxis:Ke,ge=p&&Fe?rB(pe,Xe,De):$o(p?pe:qe,Xe,p?De:Ke);A[w]=ge,N[w]=ge-Xe}t.modifiersData[r]=N}}const RB={name:"preventOverflow",enabled:!0,phase:"main",fn:PB,requiresIfExists:["offset"]};function FB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function BB(e){return e===Un(e)||!rr(e)?dm(e):FB(e)}function MB(e){var t=e.getBoundingClientRect(),n=Ns(t.width)/e.offsetWidth||1,r=Ns(t.height)/e.offsetHeight||1;return n!==1||r!==1}function LB(e,t,n){n===void 0&&(n=!1);var r=rr(t),i=rr(t)&&MB(t),a=Qi(t),s=Is(e,i,n),o={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Vr(t)!=="body"||hm(a))&&(o=BB(t)),rr(t)?(l=Is(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):a&&(l.x=fm(a))),{x:s.left+o.scrollLeft-l.x,y:s.top+o.scrollTop-l.y,width:s.width,height:s.height}}function $B(e){var t=new Map,n=new Set,r=[];e.forEach(function(a){t.set(a.name,a)});function i(a){n.add(a.name);var s=[].concat(a.requires||[],a.requiresIfExists||[]);s.forEach(function(o){if(!n.has(o)){var l=t.get(o);l&&i(l)}}),r.push(a)}return e.forEach(function(a){n.has(a.name)||i(a)}),r}function jB(e){var t=$B(e);return QF.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function HB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function UB(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var C9={placement:"bottom",modifiers:[],strategy:"absolute"};function x9(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function zB(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?C9:i;return function(o,l,u){u===void 0&&(u=a);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},C9,a),modifiersData:{},elements:{reference:o,popper:l},attributes:{},styles:{}},d=[],f=!1,p={state:c,setOptions:function(v){var b=typeof v=="function"?v(c.options):v;m(),c.options=Object.assign({},a,c.options,b),c.scrollParents={reference:Sa(o)?jo(o):o.contextElement?jo(o.contextElement):[],popper:jo(l)};var T=jB(UB([].concat(r,c.options.modifiers)));return c.orderedModifiers=T.filter(function(_){return _.enabled}),g(),p.update()},forceUpdate:function(){if(!f){var v=c.elements,b=v.reference,T=v.popper;if(x9(b,T)){c.rects={reference:LB(b,bl(T),c.options.strategy==="fixed"),popper:um(T)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(L){return c.modifiersData[L.name]=Object.assign({},L.data)});for(var _=0;_<c.orderedModifiers.length;_++){if(c.reset===!0){c.reset=!1,_=-1;continue}var w=c.orderedModifiers[_],A=w.fn,S=w.options,B=S===void 0?{}:S,F=w.name;typeof A=="function"&&(c=A({state:c,options:B,name:F,instance:p})||c)}}}},update:HB(function(){return new Promise(function(E){p.forceUpdate(),E(c)})}),destroy:function(){m(),f=!0}};if(!x9(o,l))return p;p.setOptions(u).then(function(E){!f&&u.onFirstUpdate&&u.onFirstUpdate(E)});function g(){c.orderedModifiers.forEach(function(E){var v=E.name,b=E.options,T=b===void 0?{}:b,_=E.effect;if(typeof _=="function"){var w=_({state:c,name:v,instance:p,options:T}),A=function(){};d.push(w||A)}})}function m(){d.forEach(function(E){return E()}),d=[]}return p}}var qB=[hB,NB,dB,eB,DB,xB,RB,oB,AB],WB=zB({defaultModifiers:qB}),VB=typeof Element<"u",KB=typeof Map=="function",GB=typeof Set=="function",YB=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ec(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ec(e[r],t[r]))return!1;return!0}var a;if(KB&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(r=a.next()).done;)if(!t.has(r.value[0]))return!1;for(a=e.entries();!(r=a.next()).done;)if(!ec(r.value[1],t.get(r.value[0])))return!1;return!0}if(GB&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(r=a.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(YB&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(VB&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!ec(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var ZB=function(t,n){try{return ec(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const QB=Tr(ZB);var XB=[],JB=function(t,n,r){r===void 0&&(r={});var i=rn.useRef(null),a={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||XB},s=rn.useState({styles:{popper:{position:a.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=s[0],l=s[1],u=rn.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(p){var g=p.state,m=Object.keys(g.elements);R3.flushSync(function(){l({styles:p9(m.map(function(E){return[E,g.styles[E]||{}]})),attributes:p9(m.map(function(E){return[E,g.attributes[E]]}))})})},requires:["computeStyles"]}},[]),c=rn.useMemo(function(){var f={onFirstUpdate:a.onFirstUpdate,placement:a.placement,strategy:a.strategy,modifiers:[].concat(a.modifiers,[u,{name:"applyStyles",enabled:!1}])};return QB(i.current,f)?i.current||f:(i.current=f,f)},[a.onFirstUpdate,a.placement,a.strategy,a.modifiers,u]),d=rn.useRef();return m9(function(){d.current&&d.current.setOptions(c)},[c]),m9(function(){if(!(t==null||n==null)){var f=r.createPopper||WB,p=f(t,n,c);return d.current=p,function(){p.destroy(),d.current=null}}},[t,n,r.createPopper]),{state:d.current?d.current.state:null,styles:o.styles,attributes:o.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}};function Ih(){return Ih=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ih.apply(this,arguments)}function n8(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var eM=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,tM=n8(function(e){return eM.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),nM=!1;function rM(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function iM(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var aM=function(){function e(n){var r=this;this._insertTag=function(i){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(i,a),r.tags.push(i)},this.isSpeedy=n.speedy===void 0?!nM:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(iM(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=rM(i);try{a.insertRule(r,a.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var i;return(i=r.parentNode)==null?void 0:i.removeChild(r)}),this.tags=[],this.ctr=0},e}(),sn="-ms-",Dc="-moz-",pt="-webkit-",r8="comm",pm="rule",mm="decl",sM="@import",i8="@keyframes",oM="@layer",lM=Math.abs,i1=String.fromCharCode,uM=Object.assign;function cM(e,t){return nn(e,0)^45?(((t<<2^nn(e,0))<<2^nn(e,1))<<2^nn(e,2))<<2^nn(e,3):0}function a8(e){return e.trim()}function dM(e,t){return(e=t.exec(e))?e[0]:e}function mt(e,t,n){return e.replace(t,n)}function Ph(e,t){return e.indexOf(t)}function nn(e,t){return e.charCodeAt(t)|0}function cl(e,t,n){return e.slice(t,n)}function Nr(e){return e.length}function gm(e){return e.length}function nu(e,t){return t.push(e),e}function fM(e,t){return e.map(t).join("")}var a1=1,Rs=1,s8=0,On=0,qt=0,Us="";function s1(e,t,n,r,i,a,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:a1,column:Rs,length:s,return:""}}function oo(e,t){return uM(s1("",null,null,"",null,null,0),e,{length:-e.length},t)}function hM(){return qt}function pM(){return qt=On>0?nn(Us,--On):0,Rs--,qt===10&&(Rs=1,a1--),qt}function $n(){return qt=On<s8?nn(Us,On++):0,Rs++,qt===10&&(Rs=1,a1++),qt}function jr(){return nn(Us,On)}function tc(){return On}function Tl(e,t){return cl(Us,e,t)}function dl(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function o8(e){return a1=Rs=1,s8=Nr(Us=e),On=0,[]}function l8(e){return Us="",e}function nc(e){return a8(Tl(On-1,Rh(e===91?e+2:e===40?e+1:e)))}function mM(e){for(;(qt=jr())&&qt<33;)$n();return dl(e)>2||dl(qt)>3?"":" "}function gM(e,t){for(;--t&&$n()&&!(qt<48||qt>102||qt>57&&qt<65||qt>70&&qt<97););return Tl(e,tc()+(t<6&&jr()==32&&$n()==32))}function Rh(e){for(;$n();)switch(qt){case e:return On;case 34:case 39:e!==34&&e!==39&&Rh(qt);break;case 40:e===41&&Rh(e);break;case 92:$n();break}return On}function vM(e,t){for(;$n()&&e+qt!==47+10;)if(e+qt===42+42&&jr()===47)break;return"/*"+Tl(t,On-1)+"*"+i1(e===47?e:$n())}function EM(e){for(;!dl(jr());)$n();return Tl(e,On)}function yM(e){return l8(rc("",null,null,null,[""],e=o8(e),0,[0],e))}function rc(e,t,n,r,i,a,s,o,l){for(var u=0,c=0,d=s,f=0,p=0,g=0,m=1,E=1,v=1,b=0,T="",_=i,w=a,A=r,S=T;E;)switch(g=b,b=$n()){case 40:if(g!=108&&nn(S,d-1)==58){Ph(S+=mt(nc(b),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:S+=nc(b);break;case 9:case 10:case 13:case 32:S+=mM(g);break;case 92:S+=gM(tc()-1,7);continue;case 47:switch(jr()){case 42:case 47:nu(bM(vM($n(),tc()),t,n),l);break;default:S+="/"}break;case 123*m:o[u++]=Nr(S)*v;case 125*m:case 59:case 0:switch(b){case 0:case 125:E=0;case 59+c:v==-1&&(S=mt(S,/\f/g,"")),p>0&&Nr(S)-d&&nu(p>32?A9(S+";",r,n,d-1):A9(mt(S," ","")+";",r,n,d-2),l);break;case 59:S+=";";default:if(nu(A=w9(S,t,n,u,c,i,o,T,_=[],w=[],d),a),b===123)if(c===0)rc(S,t,A,A,_,a,d,o,w);else switch(f===99&&nn(S,3)===110?100:f){case 100:case 108:case 109:case 115:rc(e,A,A,r&&nu(w9(e,A,A,0,0,i,o,T,i,_=[],d),w),i,w,d,o,r?_:w);break;default:rc(S,A,A,A,[""],w,0,o,w)}}u=c=p=0,m=v=1,T=S="",d=s;break;case 58:d=1+Nr(S),p=g;default:if(m<1){if(b==123)--m;else if(b==125&&m++==0&&pM()==125)continue}switch(S+=i1(b),b*m){case 38:v=c>0?1:(S+="\f",-1);break;case 44:o[u++]=(Nr(S)-1)*v,v=1;break;case 64:jr()===45&&(S+=nc($n())),f=jr(),c=d=Nr(T=S+=EM(tc())),b++;break;case 45:g===45&&Nr(S)==2&&(m=0)}}return a}function w9(e,t,n,r,i,a,s,o,l,u,c){for(var d=i-1,f=i===0?a:[""],p=gm(f),g=0,m=0,E=0;g<r;++g)for(var v=0,b=cl(e,d+1,d=lM(m=s[g])),T=e;v<p;++v)(T=a8(m>0?f[v]+" "+b:mt(b,/&\f/g,f[v])))&&(l[E++]=T);return s1(e,t,n,i===0?pm:o,l,u,c)}function bM(e,t,n){return s1(e,t,n,r8,i1(hM()),cl(e,2,-2),0)}function A9(e,t,n,r){return s1(e,t,n,mm,cl(e,0,r),cl(e,r+1,-1),r)}function ms(e,t){for(var n="",r=gm(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function TM(e,t,n,r){switch(e.type){case oM:if(e.children.length)break;case sM:case mm:return e.return=e.return||e.value;case r8:return"";case i8:return e.return=e.value+"{"+ms(e.children,r)+"}";case pm:e.value=e.props.join(",")}return Nr(n=ms(e.children,r))?e.return=e.value+"{"+n+"}":""}function _M(e){var t=gm(e);return function(n,r,i,a){for(var s="",o=0;o<t;o++)s+=e[o](n,r,i,a)||"";return s}}function CM(e){return function(t){t.root||(t=t.return)&&e(t)}}var xM=function(t,n,r){for(var i=0,a=0;i=a,a=jr(),i===38&&a===12&&(n[r]=1),!dl(a);)$n();return Tl(t,On)},wM=function(t,n){var r=-1,i=44;do switch(dl(i)){case 0:i===38&&jr()===12&&(n[r]=1),t[r]+=xM(On-1,n,r);break;case 2:t[r]+=nc(i);break;case 4:if(i===44){t[++r]=jr()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=i1(i)}while(i=$n());return t},AM=function(t,n){return l8(wM(o8(t),n))},S9=new WeakMap,SM=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,i=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!S9.get(r))&&!i){S9.set(t,!0);for(var a=[],s=AM(n,a),o=r.props,l=0,u=0;l<s.length;l++)for(var c=0;c<o.length;c++,u++)t.props[u]=a[l]?s[l].replace(/&\f/g,o[c]):o[c]+" "+s[l]}}},kM=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function u8(e,t){switch(cM(e,t)){case 5103:return pt+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return pt+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return pt+e+Dc+e+sn+e+e;case 6828:case 4268:return pt+e+sn+e+e;case 6165:return pt+e+sn+"flex-"+e+e;case 5187:return pt+e+mt(e,/(\w+).+(:[^]+)/,pt+"box-$1$2"+sn+"flex-$1$2")+e;case 5443:return pt+e+sn+"flex-item-"+mt(e,/flex-|-self/,"")+e;case 4675:return pt+e+sn+"flex-line-pack"+mt(e,/align-content|flex-|-self/,"")+e;case 5548:return pt+e+sn+mt(e,"shrink","negative")+e;case 5292:return pt+e+sn+mt(e,"basis","preferred-size")+e;case 6060:return pt+"box-"+mt(e,"-grow","")+pt+e+sn+mt(e,"grow","positive")+e;case 4554:return pt+mt(e,/([^-])(transform)/g,"$1"+pt+"$2")+e;case 6187:return mt(mt(mt(e,/(zoom-|grab)/,pt+"$1"),/(image-set)/,pt+"$1"),e,"")+e;case 5495:case 3959:return mt(e,/(image-set\([^]*)/,pt+"$1$`$1");case 4968:return mt(mt(e,/(.+:)(flex-)?(.*)/,pt+"box-pack:$3"+sn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+pt+e+e;case 4095:case 3583:case 4068:case 2532:return mt(e,/(.+)-inline(.+)/,pt+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Nr(e)-1-t>6)switch(nn(e,t+1)){case 109:if(nn(e,t+4)!==45)break;case 102:return mt(e,/(.+:)(.+)-([^]+)/,"$1"+pt+"$2-$3$1"+Dc+(nn(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ph(e,"stretch")?u8(mt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(nn(e,t+1)!==115)break;case 6444:switch(nn(e,Nr(e)-3-(~Ph(e,"!important")&&10))){case 107:return mt(e,":",":"+pt)+e;case 101:return mt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+pt+(nn(e,14)===45?"inline-":"")+"box$3$1"+pt+"$2$3$1"+sn+"$2box$3")+e}break;case 5936:switch(nn(e,t+11)){case 114:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return pt+e+sn+mt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return pt+e+sn+e+e}return e}var DM=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case mm:t.return=u8(t.value,t.length);break;case i8:return ms([oo(t,{value:mt(t.value,"@","@"+pt)})],i);case pm:if(t.length)return fM(t.props,function(a){switch(dM(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ms([oo(t,{props:[mt(a,/:(read-\w+)/,":"+Dc+"$1")]})],i);case"::placeholder":return ms([oo(t,{props:[mt(a,/:(plac\w+)/,":"+pt+"input-$1")]}),oo(t,{props:[mt(a,/:(plac\w+)/,":"+Dc+"$1")]}),oo(t,{props:[mt(a,/:(plac\w+)/,sn+"input-$1")]})],i)}return""})}},OM=[DM],NM=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var E=m.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||OM,a={},s,o=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var E=m.getAttribute("data-emotion").split(" "),v=1;v<E.length;v++)a[E[v]]=!0;o.push(m)});var l,u=[SM,kM];{var c,d=[TM,CM(function(m){c.insert(m)})],f=_M(u.concat(i,d)),p=function(E){return ms(yM(E),f)};l=function(E,v,b,T){c=b,p(E?E+"{"+v.styles+"}":v.styles),T&&(g.inserted[v.name]=!0)}}var g={key:n,sheet:new aM({key:n,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:l};return g.sheet.hydrate(o),g},c8=fp(),IM={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},PM={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},d8={};d8[c8.ForwardRef]=IM;d8[c8.Memo]=PM;var RM=!0;function FM(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(r+=i+" ")}),r}var f8=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||RM===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},BM=function(t,n,r){f8(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var a=n;do t.insert(n===a?"."+i:"",a,t.sheet,!0),a=a.next;while(a!==void 0)}};function MM(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var LM={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$M=!1,jM=/[A-Z]|^ms/g,HM=/_EMO_([^_]+?)_([^]*?)_EMO_/g,h8=function(t){return t.charCodeAt(1)===45},k9=function(t){return t!=null&&typeof t!="boolean"},Pd=n8(function(e){return h8(e)?e:e.replace(jM,"-$&").toLowerCase()}),D9=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(HM,function(r,i,a){return Ir={name:i,styles:a,next:Ir},i})}return LM[t]!==1&&!h8(t)&&typeof n=="number"&&n!==0?n+"px":n},UM="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function fl(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return Ir={name:i.name,styles:i.styles,next:Ir},i.name;var a=n;if(a.styles!==void 0){var s=a.next;if(s!==void 0)for(;s!==void 0;)Ir={name:s.name,styles:s.styles,next:Ir},s=s.next;var o=a.styles+";";return o}return zM(e,t,n)}case"function":{if(e!==void 0){var l=Ir,u=n(e);return Ir=l,fl(e,t,u)}break}}var c=n;if(t==null)return c;var d=t[c];return d!==void 0?d:c}function zM(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=fl(e,t,n[i])+";";else for(var a in n){var s=n[a];if(typeof s!="object"){var o=s;t!=null&&t[o]!==void 0?r+=a+"{"+t[o]+"}":k9(o)&&(r+=Pd(a)+":"+D9(a,o)+";")}else{if(a==="NO_COMPONENT_SELECTOR"&&$M)throw new Error(UM);if(Array.isArray(s)&&typeof s[0]=="string"&&(t==null||t[s[0]]===void 0))for(var l=0;l<s.length;l++)k9(s[l])&&(r+=Pd(a)+":"+D9(a,s[l])+";");else{var u=fl(e,t,s);switch(a){case"animation":case"animationName":{r+=Pd(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}}return r}var O9=/label:\s*([^\s;{]+)\s*(;|$)/g,Ir;function p8(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,i="";Ir=void 0;var a=e[0];if(a==null||a.raw===void 0)r=!1,i+=fl(n,t,a);else{var s=a;i+=s[0]}for(var o=1;o<e.length;o++)if(i+=fl(n,t,e[o]),r){var l=a;i+=l[o]}O9.lastIndex=0;for(var u="",c;(c=O9.exec(i))!==null;)u+="-"+c[1];var d=MM(i)+u;return{name:d,styles:i,next:Ir}}var qM=function(t){return t()},WM=rn["useInsertionEffect"]?rn["useInsertionEffect"]:!1,VM=WM||qM,m8=rn.createContext(typeof HTMLElement<"u"?NM({key:"css"}):null);m8.Provider;var KM=function(t){return y.forwardRef(function(n,r){var i=y.useContext(m8);return t(n,i,r)})},GM=rn.createContext({});function YM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p8(t)}var ZM=function(){var t=YM.apply(void 0,arguments),n="animation-"+t.name;return{name:n,styles:"@keyframes "+n+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}},QM=tM,XM=function(t){return t!=="theme"},N9=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?QM:XM},I9=function(t,n,r){var i;if(n){var a=n.shouldForwardProp;i=t.__emotion_forwardProp&&a?function(s){return t.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},JM=!1,eL=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return f8(n,r,i),VM(function(){return BM(n,r,i)}),null},tL=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,a,s;n!==void 0&&(a=n.label,s=n.target);var o=I9(t,n,r),l=o||N9(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(a!==void 0&&d.push("label:"+a+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,p=1;p<f;p++)d.push(c[p],c[0][p])}var g=KM(function(m,E,v){var b=u&&m.as||i,T="",_=[],w=m;if(m.theme==null){w={};for(var A in m)w[A]=m[A];w.theme=rn.useContext(GM)}typeof m.className=="string"?T=FM(E.registered,_,m.className):m.className!=null&&(T=m.className+" ");var S=p8(d.concat(_),E.registered,w);T+=E.key+"-"+S.name,s!==void 0&&(T+=" "+s);var B=u&&o===void 0?N9(b):l,F={};for(var L in m)u&&L==="as"||B(L)&&(F[L]=m[L]);return F.className=T,v&&(F.ref=v),rn.createElement(rn.Fragment,null,rn.createElement(eL,{cache:E,serialized:S,isStringTag:typeof b=="string"}),rn.createElement(b,F))});return g.displayName=a!==void 0?a:"Styled("+(typeof i=="string"?i:i.displayName||i.name||"Component")+")",g.defaultProps=t.defaultProps,g.__emotion_real=g,g.__emotion_base=i,g.__emotion_styles=d,g.__emotion_forwardProp=o,Object.defineProperty(g,"toString",{value:function(){return s===void 0&&JM?"NO_COMPONENT_SELECTOR":"."+s}}),g.withComponent=function(m,E){return e(m,Ih({},n,E,{shouldForwardProp:I9(g,E,!0)})).apply(void 0,d)},g}},nL=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],Pe=tL.bind();nL.forEach(function(e){Pe[e]=Pe(e)});var za={}.hasOwnProperty,g8=rL;function rL(e){return!e||typeof e!="object"?"":za.call(e,"position")||za.call(e,"type")?P9(e.position):za.call(e,"start")||za.call(e,"end")?P9(e):za.call(e,"line")||za.call(e,"column")?Fh(e):""}function Fh(e){return(!e||typeof e!="object")&&(e={}),R9(e.line)+":"+R9(e.column)}function P9(e){return(!e||typeof e!="object")&&(e={}),Fh(e.start)+"-"+Fh(e.end)}function R9(e){return e&&typeof e=="number"?e:1}var iL=g8,aL=vm;function v8(){}v8.prototype=Error.prototype;vm.prototype=new v8;var Xi=vm.prototype;Xi.file="";Xi.name="";Xi.reason="";Xi.message="";Xi.stack="";Xi.fatal=null;Xi.column=null;Xi.line=null;function vm(e,t,n){var r,i,a;typeof t=="string"&&(n=t,t=null),r=sL(n),i=iL(t)||"1:1",a={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(a=t,t=t.start):a.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=i,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=a,this.source=r[0],this.ruleId=r[1]}function sL(e){var t=[null,null],n;return typeof e=="string"&&(n=e.indexOf(":"),n===-1?t[1]=e:(t[0]=e.slice(0,n),t[1]=e.slice(n+1))),t}var zs={};zs.basename=oL;zs.dirname=lL;zs.extname=uL;zs.join=cL;zs.sep="/";function oL(e,t){var n=0,r=-1,i,a,s,o;if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');if(_l(e),i=e.length,t===void 0||!t.length||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";for(a=-1,o=t.length-1;i--;)if(e.charCodeAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.charCodeAt(i)===t.charCodeAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function lL(e){var t,n,r;if(_l(e),!e.length)return".";for(t=-1,r=e.length;--r;)if(e.charCodeAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.charCodeAt(0)===47?"/":".":t===1&&e.charCodeAt(0)===47?"//":e.slice(0,t)}function uL(e){var t=-1,n=0,r=-1,i=0,a,s,o;for(_l(e),o=e.length;o--;){if(s=e.charCodeAt(o),s===47){if(a){n=o+1;break}continue}r<0&&(a=!0,r=o+1),s===46?t<0?t=o:i!==1&&(i=1):t>-1&&(i=-1)}return t<0||r<0||i===0||i===1&&t===r-1&&t===n+1?"":e.slice(t,r)}function cL(){for(var e=-1,t;++e<arguments.length;)_l(arguments[e]),arguments[e]&&(t=t===void 0?arguments[e]:t+"/"+arguments[e]);return t===void 0?".":dL(t)}function dL(e){var t,n;return _l(e),t=e.charCodeAt(0)===47,n=fL(e,!t),!n.length&&!t&&(n="."),n.length&&e.charCodeAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function fL(e,t){for(var n="",r=0,i=-1,a=0,s=-1,o,l;++s<=e.length;){if(s<e.length)o=e.charCodeAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(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("/")),i=s,a=0;continue}}else if(n.length){n="",r=0,i=s,a=0;continue}}t&&(n=n.length?n+"/..":"..",r=2)}else n.length?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function _l(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var E8={};E8.cwd=hL;function hL(){return"/"}/*!
167
167
  * Determine if an object is a Buffer
168
168
  *
169
169
  * @author Feross Aboukhadijeh <https://feross.org>