@apolitical/component-library 10.5.2 → 10.5.3

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.
@@ -9,6 +9,8 @@ export interface IShouldShowProps {
9
9
  export interface IOnSuccessProps {
10
10
  jobTitle: string;
11
11
  organization: string;
12
+ /** Whether the address needs a human to vet it before an account exists. */
13
+ shouldManuallyApprove: boolean;
12
14
  }
13
15
  interface ISignupForm {
14
16
  className?: string;
package/index.js CHANGED
@@ -137,7 +137,7 @@ ${m}${d?"1.":"-"} ${u}${f?`
137
137
 
138
138
  `.substring(0,i);return n+a+r}function xR(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var wR={isHistory(e){return Zt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||$i.isOperationList(e.redos[0].operations))&&(e.undos.length===0||$i.isOperationList(e.undos[0].operations))}},kd=new WeakMap,Dd=new WeakMap,ds={isHistoryEditor(e){return wR.isHistory(e.history)&&I.isEditor(e)},isMerging(e){return Dd.get(e)},isSaving(e){return kd.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=ds.isMerging(e);Dd.set(e,!1),t(),Dd.set(e,n)},withoutSaving(e,t){var n=ds.isSaving(e);kd.set(e,!1),t(),kd.set(e,n)}},AR=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&&oe.setSelection(t,a.selectionBefore),ds.withoutSaving(t,()=>{I.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];ds.withoutSaving(t,()=>{I.withoutNormalizing(t,()=>{var s=a.operations.map($i.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&oe.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=ds.isSaving(t),c=ds.isMerging(t);if(u==null&&(u=kR(r)),u){if(c==null&&(o==null?c=!1:i.length!==0?c=!0:c=SR(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},SR=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&V.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&V.equals(e.path,t.path)),kR=(e,t)=>e.type!=="set_selection";const DR=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===ne.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 OR=RR,NR=/^(?:\w+:)?\/\/(\S+)$/,IR=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,PR=/^[^\s\.]+\.\S{2,}$/;function RR(e){if(typeof e!="string")return!1;var t=e.match(NR);if(!t)return!1;var n=t[1];return n?!!(IR.test(n)||PR.test(n)):!1}const FR=gr(OR),BR=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[ne.link].includes(s.type)||i(a)},e.insertText=a=>{a&&FR(a)?up(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},MR=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===ne.mention?!0:n(a),e.isVoid=a=>a.type===ne.mention?!0:r(a),e.markableVoid=a=>a.type===ne.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},LR=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===ne.link&&he.string(r).trim()===""){oe.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const hp=({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=le.useIntl(),d=Ix();typeof s>"u"&&(s=!0);const{isInOverlay:f=!1}=i||{},{listMembers:m,clickMentionFallback:g,onChange:p=()=>{},onChangeData:y=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:T=()=>{},reportError:_=H=>{console.error(H)}}=a||{},C=[{type:ne.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const w={editorKey:null,originalValue:t||"",initialValue:t?null:C,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[x,S]=E.useReducer(Ms,w),{editorKey:N,originalValue:B,initialValue:$,stringValue:F,lastAnchor:L,lastKey:O,hasInteracted:P,hasLoaded:M,enrichedUrl:U,mentionPopover:D}=x,X=async H=>{const z=await v(H);z.url&&S([{type:"enrichedUrl",value:z}])},Z=`rte-${e}`,k=E.useCallback(H=>h.jsx(Ew,{...H}),[]),b=E.useCallback(H=>h.jsx(bw,{...H}),[]),q=E.useMemo(()=>DR(BR(MR(LR(AR(sN(uD())),_),_),Z,_),_),[]),R=H=>{if(!q||H!==Z)return;const z=I.end(q,[]);oe.select(q,z),ue.focus(q)};E.useEffect(()=>{const H=z=>{var Q;const Y=z,re=((Q=Y==null?void 0:Y.detail)==null?void 0:Q.id)||null;re&&R(re)};return window.addEventListener("focusEditor",H),()=>{window.removeEventListener("focusEditor",H)}},[]),E.useEffect(()=>{if(q.children.length>0&&!M){if(S([{type:"hasLoaded",value:!0}]),!s)return;R(Z)}},[q.children.length,$]),E.useEffect(()=>{B&&(async()=>{let z=Kn(B);if(z.endsWith("<br/>")&&(z=z.slice(0,-5)),z.includes("<")){ml.prototype.escape=re=>re;const Y=new ml;Y.addRule("br",{filter:["br"],replacement:re=>re+`
139
139
 
140
- `}),z=Y.turndown(z)}o&&o.mentions&&(z=await kb({text:z,template:`[${Oh}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),FP(z,Y=>{const re=[{type:"initialValue",value:Y},{type:"editorKey",value:B.toString()}];o!=null&&o.link&&(re.push({type:"enrichedUrl",value:o.link}),o.link.url&&X(o.link.url)),S(re),setTimeout(()=>{S([{type:"stringValue",value:E9(q)}])},150)})})()},[B]),E.useEffect(()=>{if(U===void 0&&q){const z=LP(q);z&&X(z)}const H=z=>{var Q;const Y=z,re=((Q=Y==null?void 0:Y.detail)==null?void 0:Q.url)||null;re&&U&&U.url===re&&S([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",H),()=>{window.removeEventListener("linkRemoved",H)}},[U]),E.useEffect(()=>{if(t){wa.lastIndex=0;const H=t.match(wa);H&&H.length===1&&H[0].length===t.length&&!P&&S([{type:"originalValue",value:t}])}t!==""||!q||Ec(B,t)&&!P||(I.withoutNormalizing(q,()=>{oe.delete(q,{at:{anchor:I.start(q,[]),focus:I.end(q,[])}}),oe.deselect(q),q.children.length!==0&&oe.unwrapNodes(q,{at:[0]}),oe.insertNodes(q,C,{at:[0]})}),S([{type:"initialValue",value:C},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),E.useEffect(()=>{y({link:U})},[U]),E.useEffect(()=>{F===""&&U&&S([{type:"enrichedUrl",value:void 0}])},[F]);const j=il(()=>{jP({editor:q,isShowing:D.show,numberOfUsers:D.numberOfUsers,listMembers:m,dispatch:S})},100);return $?h.jsx("div",{id:Z,className:"rich-text-editor input text-medium",children:h.jsxs(yi.Provider,{value:{...x,id:Z,isInOverlay:f,dispatch:S,onMention:T,reportError:_},children:[h.jsxs(iN,{editor:q,initialValue:$,onChange:H=>{if(q.operations.some(Y=>Y.type!=="set_selection")){let Y=UP(H);Y==="<br>"&&(Y=""),p(Y,U),S([{type:"stringValue",value:E9(q)}]),P||S([{type:"hasInteracted",value:!0}]),j(),d&&console.log({serialized:Y,json:H})}},...u,children:[h.jsx(YO,{className:"editor",renderElement:k,renderLeaf:b,placeholder:n||c.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async H=>{const z=U!==!1,Y=H.clipboardData.getData("text");if((Q=>{try{return new URL(Q),!0}catch{return!1}})(Y)){let Q=Y;if(Y){const{full:G}=gm(Y);Q=G}if(Y&&v&&!z){const G=await v(Q);G.url&&S([{type:"enrichedUrl",value:G}])}}},onKeyDown:H=>{if(H.key==="Enter"){D.show&&(H.preventDefault(),H.stopPropagation(),LT(q,D,S,Z));const{selection:z}=q;if(z){const Y=ie.isCollapsed(z),[re,Q]=I.node(q,z,{depth:1});let G=re,se=G.type;const ae=G.children[0];if(se===ne.h3){H.preventDefault(),H.stopPropagation();const be=I.start(q,Q),Ce=I.end(q,Q),Pe=Ge.equals(z.anchor,be),je=Ge.equals(z.anchor,Ce);if(Pe)oe.insertNodes(q,C,{at:Q});else if(je)oe.insertNodes(q,C,{at:V.next(Q)}),oe.select(q,I.end(q,V.next(Q)));else{const Fe=z.anchor,[,Be]=I.parent(q,z);oe.splitNodes(q,{at:Fe}),oe.setNodes(q,{type:ne.paragraph},{at:V.next(Be)})}return}if(ae&&[ne.ol,ne.ul].includes(ae.type)&&(G=ae,se=ae.type),G&&_e.isElement(G)&&se!==ne.paragraph){if(se===ne.blockquote&&!H.shiftKey){H.stopPropagation(),H.preventDefault(),oe.insertNodes(q,C);return}if(Y){const[be,Ce]=I.parent(q,z,{edge:"end"}),je=be.type;if([ne.ul,ne.ol].includes(se))if(H.stopPropagation(),H.preventDefault(),je===ne.li&&O==="Enter"){be.children.length===1&&"text"in be.children[0]&&be.children[0].text===""&&oe.removeNodes(q,{at:Ce}),oe.insertNodes(q,C,{at:V.next(Q)}),oe.select(q,I.end(q,V.next(Q)));return}else{const[Fe,Be]=BP(q,ne.li),Xe={type:ne.li,children:[{text:""}]};oe.insertNodes(q,Xe,{at:V.next(Be)}),oe.select(q,I.end(q,V.next(Be)))}}}}}else if(H.key==="Escape"){if(D.show){H.preventDefault(),H.stopPropagation(),S([{type:"mentionPopover",value:{...D,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(H.key)&&D.show){H.preventDefault(),H.stopPropagation();const{selectedUser:z,possibleUsers:Y}=D;let re=H.key==="ArrowUp"?z-1:z+1;re<0&&(re=Y.length-1),re>=Y.length+1&&(re=0),S([{type:"mentionPopover",value:{...D,selectedUser:re}}])}S([{type:"lastKey",value:H.key}]),$P(H,q,S,_)},onBlur:()=>{q.selection&&S([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(L){if(!V.isPath(L.path)||!he.has(q,L.path))return;const H=he.get(q,L.path);let z=0;if(xe.isText(H)?z=H.text.length:H.children&&(z=H.children.length),L.offset>z)return;try{oe.select(q,{anchor:L,focus:L})}catch(Y){const re=Y.message;_(`Error focusing editor: ${re}`)}}}}),U?h.jsx(pp,{data:U,variant:"condensed",onClick:()=>{S([{type:"enrichedUrl",value:!1}]);const H=new CustomEvent("ariaLive",{detail:{message:c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(H)},"aria-label":c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):h.jsx(h.Fragment,{}),h.jsx(JP,{styling:l==null?void 0:l.toolbar}),m?h.jsx(zP,{onFallbackClick:g}):h.jsx(h.Fragment,{})]},N),h.jsx($m,{id:`character-limit-${e}`,limit:r,valueLength:i1(F)})]})}):h.jsx(h.Fragment,{})};const JT=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=E.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);E.useEffect(()=>{r&&l(r)},[r]);const u=c=>{a||(l(c),i(c))};return h.jsxs("div",{className:te("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:te("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 e_({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=le.useIntl(),l="profileImageChange_",[u,c]=E.useState(r),[d,f]=E.useState(!1),[m,g]=E.useState(!1),p=E.useRef(null),y=async C=>{f(!0),g(!1);try{const w=C.target.files&&C.target.files[0];if(!w||!t)throw f(!1),new Error("Image file or userID is missing");const x=await i({fileObject:w,userId:t}),S={thumbnail:x.thumbnailURL,full:x.originalURL};c(S),s(S)}catch{g(!0)}finally{f(!1)}f(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:T=o.formatMessage({id:`${l}cta_change`}),uploading:_=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return h.jsxs("div",{className:te("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"}),m&&h.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),h.jsx("input",{id:"file",type:"file",accept:"image/*",ref:p,onChange:y,hidden:!0,"data-testid":"file-input"}),h.jsx(Ie,{onClick:()=>p.current&&p.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?_:u?T:v})]})}const t_=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return h.jsx(vr,{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 $R=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=le.useIntl();return h.jsx(mx.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(Ie,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},n_=({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:m})=>{const[g,p]=E.useState([]),[y,v]=E.useState(!0),[T,_]=E.useState(c),{formatMessage:C}=le.useIntl(),w=async N=>{try{await u(g,N.message),p([]),_("SUCCESS")}catch(B){_("ERROR"),l(B)}},x=N=>{N.preventDefault(),_("NOT_SUBMITTED"),v(!0),p([])},S=N=>{N.preventDefault(),o(),_("CLOSED")};return T==="CLOSED"?null:T==="ERROR"||T==="SUCCESS"&&!(m!=null&&m.shouldHideDoneButtonOnSubmit)?h.jsxs("div",{className:"invite-form-wrapper",children:[h.jsx("div",{className:"content centred",children:T==="SUCCESS"?h.jsx("h2",{className:"success-title",children:C({id:"inviteForm_success"})}):h.jsxs("h2",{className:"error-title",children:[" ",C({id:"inviteForm_error"})]})}),h.jsx(pr,{}),h.jsx("div",{className:"footer",children:T==="SUCCESS"?h.jsxs(h.Fragment,{children:[h.jsx(Ie,{variant:"secondary",onClick:x,children:C({id:"inviteForm_ctaSendMoreInvites"})}),h.jsx(Ie,{onClick:S,children:C({id:"inviteForm_ctaDone"})})]}):h.jsx(Ie,{onClick:x,children:C({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(vr,{id:"invite-form",fields:[{component:$R,props:{emails:g,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:C({id:"inviteForm_message_label"}),placeholder:n||C({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:y},gtm:d,meta:m,secondaryActionButton:f})]})},rc=e=>e.map(t=>({condition:t}));const Mn={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},jR=({functions:e,...t})=>{const{formatMessage:n}=le.useIntl(),[r,i]=E.useState(null),[a,s]=E.useState(!1),[o,l]=E.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Mn.NEW_PASSWORD]!==m[Mn.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!oh(m[Mn.NEW_PASSWORD]).isValid,d=[{"data-testid":Mn.NEW_PASSWORD,id:Mn.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:rc(["required",c]),functions:{onChange:m=>l(oh(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Mn.CONFIRMED_PASSWORD,id:Mn.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:rc(["required",u])}];t.isPasswordChange&&d.unshift({"data-testid":Mn.CURRENT_PASSWORD,id:Mn.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:rc(["required"])}),a&&d.push({component:k4,props:{matchingRules:o}});const f={id:Mn.FORM_ID,fields:d,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>i(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Mn.NEW_PASSWORD)||g.includes(Mn.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return h.jsxs(h.Fragment,{children:[h.jsx(vr,{...f}),r&&h.jsx(Lr,{variant:"error",text:r})]})};const r_=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var N;const s=le.useIntl(),o="profileForm_",l=E.useContext(Ft),[u,c]=E.useState(l.image),[d,f]=E.useState(!1),{uploadImage:m=()=>{},onSuccess:g=async B=>{},onCancel:p=()=>{},onFailure:y=()=>{}}=n,{buildLocation:v,isValidPlace:T,predictPlaces:_}=t.useMaps(),{context:C="ProfileForm",event:w="profile-form-submit-click"}=i||{},x=[{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:(N=l.location)==null?void 0:N.en,validation:[{condition:"required"},{condition:({location:B})=>B&&!d?!1:!T(B),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{d||f(!0)},onKeyInput:_}}],S=[{component:e_,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,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"}]},...x,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:pr}];return h.jsx(vr,{id:"profile-details-form",fields:e?x:S,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:C,event:w},functions:{onSuccess:async B=>{try{const $={...B,image:u||null,location:d?await v(B==null?void 0:B.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(F=>({...F,...$})),await g($)}catch{y()}},onCancel:p,onFailure:y},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})},HR=()=>{const e=le.useIntl(),[t,n]=E.useState(0);return E.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(Yb,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function UR({coverImage:e,setShowImagePicker:t}){return e&&e.url?h.jsx(Lr,{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(Ie,{variant:"tertiary",onClick:()=>t(!0),children:h.jsx(le.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):h.jsx(Lr,{button:{component:h.jsx(Ie,{variant:"secondary",onClick:()=>t(!0),children:h.jsx(le.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var i_=(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))(i_||{});let Od=null;const Bt="publishArticleForm_",A9={},S9=10,zR=({id:e="publish-article-form",values:t=A9,setShowImagePicker:n,functions:r,meta:i,gtm:a,isEditMode:s=!1})=>{var F;const o=le.useIntl(),l=E.useContext(Ft),{create:u,edit:c,onSuccess:d=()=>{},onFailure:f=()=>{}}=r||{},{isInOverlay:m=!1}=i||{},[g,p]=E.useState(!1),[y,v]=E.useState(t.body||""),[T,_]=E.useState(!1),[C,w]=E.useState("");E.useEffect(()=>{Ec(t,A9)||sl(t.body)&&t.body!==y&&t.body!==void 0&&v(t.body)},[t.body]);const x=()=>{!l||!l.id?_(o.formatMessage({id:`${Bt}error_loggedOut`})):T&&_(!1)},S=L=>({condition:O=>{const P=O[L];return!P||typeof P!="string"?!0:P.length<S9},error:o.formatMessage({id:`${Bt}error_underMinLength`},{length:S9})}),N=!!y&&sl(y),B=()=>h.jsxs(h.Fragment,{children:[h.jsx(pr,{}),h.jsx("p",{className:"text-medium",children:o.formatMessage({id:`${Bt}disclaimer`})})]}),$=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:o.formatMessage({id:`${Bt}title_label`}),placeholder:o.formatMessage({id:`${Bt}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:x},validation:[{condition:"required"},S("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:o.formatMessage({id:`${Bt}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:o.formatMessage({id:`${Bt}subtitle_placeholder`}),functions:{onChange:x},validation:[{condition:"required"},S("subtitle")]},{component:Fc,props:{formID:e,label:{visible:o.formatMessage({id:`${Bt}body_label`})},showLabel:!0}},{component:hp,props:{id:`${e}-input`,value:y,placeholder:o.formatMessage({id:`${Bt}body_placeholder`}),meta:{isInOverlay:m},autoFocus:!1,functions:{onChange:L=>{v(L),x()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!T,"aria-errormessage":"error-message"}},{id:"tags",label:o.formatMessage({id:`${Bt}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(i_).map(L=>({id:L,label:o.formatMessage({id:`${Bt}_tags_${L}`})})),value:t.tags||[],multipleOptions:{limit:3},validation:[{condition:"required",error:o.formatMessage({id:`${Bt}tags_error_required`})},{condition:L=>{var O;return((O=L==null?void 0:L.tags)==null?void 0:O.length)>3},error:o.formatMessage({id:`${Bt}tags_error_over_three`})}]},{component:Fc,props:{formID:e,label:{visible:o.formatMessage({id:`${Bt}cover_image_label`})},showLabel:!0}},{component:UR,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return g?$.push({component:pr}):$.push({component:B}),h.jsxs("section",{className:"publish-article-form",children:[h.jsx(vr,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async L=>{if(!l||!l.id||!N)return;Od&&clearTimeout(Od),p(!0);const O={...L,body:y,coverImage:t.coverImage};try{s&&c?await c(O):u&&await u(O),Od=setTimeout(()=>{w(o.formatMessage({id:`${Bt}aria_success${s?"_edit":""}`})),d(O)},500)}catch{_(o.formatMessage({id:`${Bt}error`})),w(""),f()}},onFailure:f},fields:$,intlPath:Bt,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||!N||!((F=t==null?void 0:t.coverImage)!=null&&F.url),text:{default:o.formatMessage({id:`${Bt}cta_submit${s?"_edit":""}`}),submitting:o.formatMessage({id:`${Bt}cta_submitting${s?"_edit":""}`}),submitted:o.formatMessage({id:`${Bt}cta_submitted${s?"_edit":""}`})},customOnSubmit:T?h.jsx(h.Fragment,{}):h.jsx(HR,{})},gtm:a}),T&&h.jsx(ws,{id:"error-message",className:"error",children:typeof T=="string"&&T.includes(" ")?T:o.formatMessage({id:`${Bt}error`})}),C&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,children:C})]})};var Un,qR=Un={_regexEscape:/([\.\*\+\^\$\[\]\\\(\)\|\{\}\,\-\:\?])/g,_regexParseLocale:/^([a-zA-Z]*)([_\-a-zA-Z]*)$/,_escapeRegExpPattern:function(e){return typeof e!="string"?e:e.replace(Un._regexEscape,"\\$1")},_toLowerCase:function(e,t){return typeof e!="string"?t&&e:e.toLowerCase()},_toUpperCase:function(e,t){return typeof e!="string"?t&&e:e.toUpperCase()},_trim:function(e,t,n){var r=[],i,a=function(l){r.push("^"+l+"+|"+l+"+$")};if(typeof t=="boolean"&&(n=t,t=null),typeof e!="string")return n&&e;if(Array.isArray(t)&&t.map(function(l){var u=Un._escapeRegExpPattern(l);a(u)}),typeof t=="string"){var s=Un._escapeRegExpPattern(t);a(s)}t||a("\\s");var o="("+r.join("|")+")";for(i=new RegExp(o,"g");e.match(i);)e=e.replace(i,"");return e},_parseLocale:function(e){var t=Un._regexParseLocale.exec(e),n,r,i;if(!(!e||!t))return t[2]=Un._trim(t[2],["-","_"]),r=Un._toLowerCase(t[1]),i=Un._toUpperCase(t[2])||i,n={lang:r,countryCode:i},n},isRtlLang:function(e){var t=Un._parseLocale(e);if(t)return Un._BIDI_RTL_LANGS.indexOf(t.lang)>=0},getLangDir:function(e){return Un.isRtlLang(e)?"rtl":"ltr"}};Object.defineProperty(Un,"_BIDI_RTL_LANGS",{value:["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","prs","ps","sd","ug","ur","yi"],writable:!1,enumerable:!0,configurable:!1});var WR=qR,k9=WR,VR={isRtlLang:k9.isRtlLang,getLangDir:k9.getLangDir};const a_=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission",onSearchClick:s})=>{const{searchIsOpen:o=!0,isDesktopVersion:l=!1}=n||{},u=le.useIntl(),c=E.useRef(null),d=VR.getLangDir(u.locale)||"ltr";xs(()=>{!n||l||!o||c.current&&c.current.focus()},[o]);const f=m=>{if(m.preventDefault(),m.stopPropagation(),!c.current||!c.current.value||c.current.value.length<1)return;const g=encodeURIComponent(c.current.value);window.location.href=`/?searchQuery=${g}`};return s?h.jsx("button",{type:"button",className:te("search toggle-search-button search-modal-trigger",t),onClick:m=>{m.preventDefault(),m.stopPropagation(),s()},"aria-label":u.formatMessage({id:"search_label"})}):h.jsx("form",{onSubmit:f,className:te("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&&!l?!o:!1,children:h.jsxs("p",{children:[h.jsx(ot,{element:"label",htmlFor:e,children:u.formatMessage({id:"search_label"})}),h.jsx("input",{ref:c,type:"search",id:e,name:e,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&f(m)}}),h.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),c.current&&c.current.value&&(c.current.value="")},children:h.jsx(ot,{children:u.formatMessage({id:"search_clear"})})}),h.jsx("button",{className:`search ${d}`,onClick:f,children:h.jsx(ot,{children:u.formatMessage({id:"search_cta"})})})]})})})},D9=async({ref:e,readAccount: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=Jc("ref"),s={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},s);try{o=await t(i,a),o===void 0&&(o=s)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:l=!1,autoApproved:u=!1,exists:c}=o;let d="";return l?d=u?"gov":"nonGov":c.registration?c.engagement&&!c.user?d=c.auth?"verify":"pending":d="exists":c.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!u},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},KR=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"]}},GR=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=KR(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),sessionStorage.setItem(mm.SESSION_STORAGE.EMAIL,s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},YR=({shouldShow:e,placeholders:t,labels:n,functions:{readAccount:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,d=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.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:()=>{D9({ref:a.email,readAccount:r,dispatch:o})},onChange:(m,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:_4,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:m=>h.jsx("small",{children:m})}),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:m=>h.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>h.jsx("a",{href:"/pages/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>h.jsx("a",{href:"/pages/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(p=>{s.validFields[p]!==a[p].current.validity.valid&&(g.push({type:`validFields.${p}`,value:a[p].current.validity.valid}),p==="email"&&D9({ref:a.email,readAccount:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const ZR=({className:e=""})=>h.jsxs("div",{className:te("success-message",e),"data-testid":"success-message",children:[h.jsx("p",{className:"success-title",children:h.jsx(le.FormattedMessage,{id:"signup_success_title"})}),h.jsx(le.FormattedMessage,{id:"signup_success_text",values:{p:t=>h.jsx("p",{children:t})}})]});const QR={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},XR=({className:e="",labels:t={},placeholders:n={},functions:r={readAccount:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=le.useIntl(),u=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname+window.location.search}`,{title:c=!0,expectation:d=!1,url:f=!0,logInButton:m=!0,successMessage:g=!0}=i,p={title:c,expectation:d,url:f,logInButton:m,successMessage:g},[y,v]=E.useReducer(Ms,QR),{validFields:T,emailDetails:_,shouldManuallyApprove:C,shouldDisableButton:w,showSuccessMessage:x,showError:S}=y,[N,B]=hm.useCookies(["signup-this-session","functional-cookie-consent"]),$={form:E.createRef(),name:E.createRef(),email:E.createRef(),jobTitle:E.createRef(),organisation:E.createRef(),tc:E.createRef(),hiddenValidation:E.createRef()};E.useEffect(()=>{C===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[C]),E.useEffect(()=>{N["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[N]),E.useEffect(()=>{x&&N["functional-cookie-consent"]&&B("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const F=E.useMemo(()=>YR({placeholders:n,labels:t,shouldShow:p,functions:r,refs:$,state:y,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,$,p,y]),L=w?!0:C?!Object.values(T).every(O=>O===!0):!T.name||!T.email||["exists","pending","verify"].includes(_.boxType);return p.successMessage&&x?h.jsx(ZR,{className:e}):h.jsxs("fieldset",{className:te("signup-form-fieldset",e),"data-testid":"signup-form",children:[p.title&&h.jsx("p",{className:"signup-title",children:h.jsx(le.FormattedMessage,{id:"signup_title"})}),S&&h.jsx(Lr,{variant:"error",text:l.formatMessage({id:"signup_error"})}),h.jsx(vr,{className:"signup-form",formRef:$.form,id:"sign-up-form",fields:F,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:L?{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:p.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await GR({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:y})},onCatch:O=>{r.handleError(O),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),h.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};function JR({parentId:e,isMember:t,formFunctions:n,leave:r,join:i,meta:a}){const s=le.useIntl();return h.jsx(P0,{form:{content:{type:ze.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 eF({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=le.useIntl(),a=()=>{n(r),t()};return h.jsx(Al,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function tF({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ft.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=wg({reply:L6(o),user:a});return Ss(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l)=>{const u=wg({reply:o,user:a});r.setQueryData(i,c=>Ss(u,c,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Bm(u.id,"reply")},0)}});return s}function nF({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ft.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=_n(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function rF({replies:e,user:t,replyType:n,currentLocale:r}){return!e||!(t!=null&&t.id)?[]:e.map(({id:i,own_children:a,latest_children:s,children_counts:o,data:l,created_at:u,parent:c,...d})=>{var x,S,N,B,$,F,L,O,P,M,U,D,X;const f=(((x=a==null?void 0:a.like)==null?void 0:x.length)||0)>0,m=(((S=s==null?void 0:s.like)==null?void 0:S.length)||0)>0,g=f?(N=a==null?void 0:a.like)==null?void 0:N.find(Z=>{var k;return((k=Z==null?void 0:Z.user)==null?void 0:k.id)===(t==null?void 0:t.id)}):!1,p=typeof g=="object"?(g==null?void 0:g.id)??"":"",y=m?(B=s==null?void 0:s.like)==null?void 0:B.map(Z=>{var k,b,q;return{id:(k=Z==null?void 0:Z.user)==null?void 0:k.id,name:(q=(b=Z==null?void 0:Z.user)==null?void 0:b.data)==null?void 0:q.name}}):!1,v=(O=(L=(F=($=l==null?void 0:l.payload)==null?void 0:$.data)==null?void 0:F.translations)==null?void 0:L[r])==null?void 0:O.body,T=(M=(P=l==null?void 0:l.payload)==null?void 0:P.data)==null?void 0:M.original,_=!!v,C=(T==null?void 0:T.locale)===r,w=v||(T==null?void 0:T.body);return{user:d==null?void 0:d.user,body:n===Rt.Courses?y4({payload:(U=l==null?void 0:l.payload)==null?void 0:U.data,currentLocale:r,originalLocale:l==null?void 0:l.locale}):w||"",locale:l==null?void 0:l.locale,createdAt:u,data:{...iF(l),translationInfo:{hasTranslation:_,isOriginalPost:C,currentBody:w,currentLocale:r,originalBody:T==null?void 0:T.body,originalLocale:T==null?void 0:T.locale}},likeId:p,liked:m,likes:(o==null?void 0:o.like)||0,peopleWhoLiked:y,replyId:i,parent:c,userLiked:!!g,payloadId:(D=l==null?void 0:l.payload)==null?void 0:D.id,payloadCollection:(X=l==null?void 0:l.payload)==null?void 0:X.collection}})}function iF(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 mp({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s,type:o=Rt.Communities}){const l=ft.useQueryClient(),u=t1(),c=Pa(),d={queryClient:l,queryKey:s},f={mutationHandlers:{error:Nm(d),mutate:Im(d)},user:u,...d},m=tF({...f,mutationFn:e}),g=nF({...f,mutationFn:t}),p=aF({...f,mutationFn:n}),y=oF({...f,mutationFn:i}),v=lF({...f,mutationFn:a}),{replies:T,..._}=sF({queryKey:s,queryFn:r});return{replies:rF({replies:T,user:u,replyType:o,currentLocale:c}),mutations:{create:m,edit:g,remove:y,like:p,unlike:v},user:u,..._}}function aF({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ft.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=_n(s,o);return l&&Ag({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=_n(o,l);u&&Ag({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function sF({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=ft.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Fm(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function oF({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ft.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>g4(i,a)),onError:n});return r}function lF({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ft.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=_n(a,s);return o&&$6({reply:o,user:r}),s}),onError:n});return i}const uF=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o},type:l=Rt.Communities})=>{const u=le.useIntl(),c=3,{replies:d,fetchNextPage:f,hasNextPage:m,isLoading:g,mutations:{create:p,edit:y,like:v,remove:T,unlike:_}}=mp({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:x=>a.list({...x,reactionId:i})},type:l});vm([g]);const[C,w]=E.useState(!0);return h.jsxs(h.Fragment,{children:[(d==null?void 0:d.length)>=c&&h.jsx(Ie,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>w(!C),children:u.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&h.jsx(ax,{loadMore:{isLoading:g,hasNextPage:m,loadNextPage:()=>f()},form:{parentId:r,content:{type:ze.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(x,{body:S})=>p({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:x,likes:S,data:N,body:B,createdAt:$,userLiked:F,peopleWhoLiked:L,parent:O,user:P,likeId:M})=>h.jsx(jl,{isCommunity:!0,content:{id:x,type:ze.Reply,body:B,createdAt:$,slugs:{question:`${t}/${r}`,answer:e,reply:O},slug:"",author:Cl(P),userLiked:F,likes:S,peopleWhoLiked:l===Rt.Courses?!1:L,data:N},forceHide:{shareLink:l===Rt.Courses},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>T({replyId:x}),updateContent:(U,{body:D})=>y({replyId:x,content:D})},likes:{createLike:()=>v({replyId:x}),deleteLike:()=>_({replyId:x,reactionId:M}),listLikes:U=>o.list({replyId:x,...U})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:nn.Communities,area:r||""},{scope:nn.Platform,area:"all"}]},disableMentions:l===Rt.Courses,basePath:t,parentId:r},x)):null})]})};function cF({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s,type:o=Rt.Communities}){const{body:l,data:u,likeId:c,likes:d,peopleWhoLiked:f,replyId:m,createdAt:g,user:p,userLiked:y}=s,{edit:v,like:T,remove:_,unlike:C}=e.mutations;return h.jsx(tx,{children:h.jsx(jl,{isCommunity:!0,content:{id:m,type:ze.Reply,body:l,createdAt:g,slugs:{question:`${n}/${a}`,answer:t,reply:m},slug:m,author:Cl(p),userLiked:y,likes:d,peopleWhoLiked:o===Rt.Courses?!1:f,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:m}),updateContent:(w,{body:x})=>v({replyId:m,content:x})},likes:{createLike:()=>T({replyId:m}),deleteLike:()=>C({replyId:m,reactionId:c}),listLikes:w=>e.likes.list({replyId:m,...w})},comments:{},form:e.form},forceHide:{shareLink:o===Rt.Courses},badges:{showBadges:!0,scopes:[{scope:nn.Communities,area:a||""},{scope:nn.Platform,area:"all"}]},translation:{isTranslatable:!0,onTranslate:async({payloadId:w,payloadCollection:x})=>({body:"Translated body"})},disableMentions:o===Rt.Courses,children:h.jsx(uF,{basePath:n,parentId:a,activityId:t,replyId:m,isMember:i,functions:e,type:o}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},m)},m)}const au="ALL",s_=({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=Rt.Communities,repliesFilters:m})=>{const g=le.useIntl(),p=Pa(),{fetchNextPage:y,hasNextPage:v,isLoading:T,replies:_,mutations:{create:C,remove:w,edit:x,like:S,unlike:N}}=mp({queryKey:[t,n,e,"replies"],queryFns:u,type:f}),[B,$]=E.useState(f===Rt.Courses&&p||au),[F,L]=E.useState([]),O=E.useMemo(()=>_,[JSON.stringify(_)]);E.useEffect(()=>{if(!O)return;const D=!B||B===au||f!==Rt.Courses?O:O.filter(X=>X.locale===B);L(D)},[O,B]);const[P,M]=E.useState(null);vm([T]),Mm();const U={create:(D,X)=>{const{body:Z}=X;C({activityId:e,content:Z})},...a};return h.jsxs("section",{className:"replies-feed",children:[h.jsx(ix,{type:"comment",responses:r,isLoading:T}),d?h.jsxs(h.Fragment,{children:[h.jsx(JR,{parentId:n,isMember:i,join:s,leave:o,formFunctions:U,meta:{isAutoFocused:f===Rt.Courses||!1}}),f===Rt.Courses&&(m==null?void 0:m.isEnabled)&&h.jsxs("section",{className:"replies-feed-language-switcher",style:{display:"flex"},children:[h.jsx(vr,{id:"replies-feed-language-switcher",fields:[{id:"language",label:!1,type:"select",initialValue:B,options:[{id:au,label:g.formatMessage({id:"activitySection_language_switcher_all_languages_option"})},...(m==null?void 0:m.options)||[]],functions:{onChange:D=>$(D)}}],functions:{},button:{hideButton:!0}}),h.jsx(Ie,{icon:"info-inside-circle",variant:"tertiary",className:"language-switcher-info-button",tooltip:g.formatMessage({id:"activitySection_language_switcher_info"}),forceTooltip:!0,children:h.jsx(ot,{children:g.formatMessage({id:"activitySection_language_switcher_info"})})})]}),F==null?void 0:F.map((D,X)=>h.jsx(cF,{activityId:e,basePath:t,focus:P===X,formFns:{form:a,likes:l,reactions:u,mutations:{remove:w,edit:x,like:S,unlike:N}},isMember:i,parentId:n,reply:D,type:f},D.replyId)),T?h.jsx(h.Fragment,{children:" "}):h.jsx(eF,{hasNextPage:v,fetchNextPage:y,setFocusReplyIndex:M,totalReplies:_.length})]}):h.jsx(In,{children:h.jsx(le.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),h.jsx(R0,{form:c})]})};function dF({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=ft.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:c=>(c==null?void 0:c.next)||null}),l=Fm(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function fF({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=dF({queryKey:t,queryFn:e});return{likes:n,...r}}function o_({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=fF({queryKey:[e,t,n,"likes"],queryFns:i.likes});E.useEffect(()=>{l()},[l]);const u=a.map(({user:c})=>c).map(c=>c?Cl(c):void 0).filter(c=>c&&typeof c!="string");return h.jsx("section",{className:"likes-feed",children:h.jsx(Q3,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const l_=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=le.useIntl();return h.jsx(vi,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:te("profile-modal in-portal",i,{open:e}),maxWidth:600,children:h.jsx(o_,{...a,likeCount:r??0,functions:{likes:n}})})},hF=Object.freeze(Object.defineProperty({__proto__:null,default:l_},Symbol.toStringTag,{value:"Module"})),mF={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 pF=3e3,u_=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=le.useIntl(),r="discussion_share_copy_link",[i,a]=E.useState({isOpen:!1,isCopied:!1});return h.jsxs("li",{className:"share-link-wrapper",children:[h.jsx(ms,{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})},pF)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),h.jsx(pi,{className:te({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"top",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const ra="discussion_",c_=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,edit:s,shareLink:o,moreMenu:l})=>{const u=le.useIntl(),c=[];return l&&l.reportData&&c.push({text:u.formatMessage({id:`${ra}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:communities@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${ra}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${ra}report_body`},{contentType:n||"",contentSlug:l&&l.reportData&&l.contentSlug||"",contentUrl:l&&l.reportData&&l.reportData.contentUrl||""}))}`,icon:"flag"}),h.jsxs("ul",{className:te("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?h.jsx(E4,{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(ms,{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:`${ra}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${ra}comments${i.count===null?"_loading":""}`},{count:i.count})})}):h.jsx(h.Fragment,{}),a?h.jsx("li",{children:h.jsx(ms,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${ra}reply`})})}):h.jsx(h.Fragment,{}),s?h.jsx("li",{className:"edit-button-item",children:h.jsx(ms,{styling:{muted:!0},onClick:s.onClick,icon:{icon:"pencil-paper"},"data-testid":"edit",children:u.formatMessage({id:`${ra}action_edit`})})}):h.jsx(h.Fragment,{}),o?h.jsx(u_,{url:o.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):h.jsx(h.Fragment,{}),l?h.jsx(Mc,{element:"li",id:`more-${l.contentSlug}`,options:[...l.options||[],...c]}):h.jsx(h.Fragment,{})]})};const gF=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=le.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(ot,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),h.jsx("ul",{className:te("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(ot,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),h.jsx(Ki,{href:s?void 0:a,...l,children:rl(i,t)})]},`${mi(i)}_${o}`)})})]})};const pp=({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:te("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 d_=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",styling:o,gtm:l})=>{const u=le.useIntl(),{muted:c,large:d}=o||{},f=n?[{id:"all",text:typeof n!="boolean"&&n.text||u.formatMessage({id:"filters_all"})},...e]:e,[m,g]=E.useState(n?["all"]:t.length?t.map(T=>T.id):[]),[p,y]=E.useState(0),v=(T,_)=>{let C=[];m.includes(T)&&!a?C=m.filter(w=>w!==T):T==="all"?C=["all"]:r?C=[...m.filter(w=>w!=="all"),T]:C=[T],g(w=>(i&&typeof i=="function"&&i({current:C,previous:w}),C)),_&&typeof _=="function"&&_()};return h.jsx("ul",{className:te("filters",s),children:f.map(({id:T,text:_,disabled:C=!1,callback:w=()=>{},content:x},S)=>{let N={tabIndex:p===S?0:-1};return C&&(N={disabled:!0,"aria-label":u.formatMessage({id:"filters_disabled"},{name:_})}),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)||`${_.toLowerCase().replace(" ","-")}-click`,className:te(T,{selected:m.includes(T),large:d,muted:c}),onClick:B=>{B.preventDefault(),B.stopPropagation(),v(T,w)},onKeyDown:B=>{var O,P;let $=S+1,F,L;switch(B.code){case"Enter":case"Space":B.preventDefault(),B.stopPropagation(),v(T,w);break;case"ArrowLeft":case"ArrowRight":B.preventDefault(),B.stopPropagation(),B.code==="ArrowLeft"?($=S-1,$<0&&($=f.length-1)):$>=f.length&&($=0),y($),F=B.currentTarget.closest("li"),L=(O=F==null?void 0:F.parentElement)==null?void 0:O.children[$],(P=L==null?void 0:L.querySelector("button"))==null||P.focus();break}},"aria-selected":m.includes(T),...N,children:x||_})},T)})})},vF=(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 su="languageSwitcher_",yF=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=le.useIntl(),{updateLanguage:c=()=>{}}=E.useContext(Tm),[d,f]=E.useState(e);if(E.useEffect(()=>{e!==d&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),p=d!==e;return h.jsxs("div",{className:te("language-switcher text-small",s,l),children:[h.jsxs("nav",{children:[s!=="short"&&h.jsx("p",{children:o||u.formatMessage({id:`${su}label`})}),h.jsx("ul",{children:g.map(y=>{var C;if(!Cs.ALL_LOCALES.includes(y))return null;const v=(C=r[y])==null?void 0:C.post_name,T=Cs.ALL_LOCALES_WITH_LABELS.filter(w=>w.value===y)[0].title;let _={className:y};if(d===y)_["aria-label"]=u.formatMessage({id:`${su}selected`},{language:T});else{const w=vF(y,v,a);_={..._,href:typeof w=="string"?w:w.url,onClick:x=>{f(y),c(y),typeof i<"u"&&(x.preventDefault(),x.stopPropagation(),i(y,typeof w=="string"?w:w.urlForRouter))}}}return h.jsx("li",{children:h.jsx(Ki,{..._,fallbackElement:"span",children:T})},y)})}),s!=="short"&&!p&&h.jsx("p",{children:u.formatMessage({id:`${su}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!p&&!t&&!n&&h.jsx("small",{children:u.formatMessage({id:`${su}disclaimer`},{email:Fo.support,link:y=>{const v=`mailto:${y}`;return h.jsx("a",{href:v,children:y})}})})]})};const Nd=le.createIntl({locale:"en",messages:zt}),Al=({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:Nd.formatMessage({id:"loadMore_button"}),endOfFeed:Nd.formatMessage({id:"loadMore_endOfFeed"}),error:Nd.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,d]=E.useState(""),f=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?d(g.message):d("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:h.jsx("footer",{className:te("load-more",l),children:!c&&e?h.jsx(Ie,{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 gp=({variant:e="default",version:t="default",className:n="",...r})=>h.jsx("p",{className:"logo-wrapper",children:h.jsx("a",{href:"/",className:te("logo",e,t,n),...r,children:h.jsx(ot,{children:h.jsx(le.FormattedMessage,{id:"apolitical"})})})});let ou=!1;const Mc=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=le.useIntl(),a=E.useRef(null),[s,o]=E.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return E.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),E.createElement(e,{ref:a,className:te("more-menu text-medium",r),children:h.jsxs(h.Fragment,{children:[h.jsx(Ie,{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,...m},g)=>{const p={...m,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ou&&(clearTimeout(ou),ou=!1)},onBlur:()=>{ou=setTimeout(()=>{o(!1)},100)}};return u&&(p.href=u),h.jsx("li",{className:"more-menu-list-item",children:h.jsx(Ie,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...p,children:d})},`${mi(d)}_${g}`)})})]})})},EF=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const bF=E.lazy(()=>Promise.resolve().then(()=>F7)),TF=[{key:"homepage",href:"/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/courses/"},{key:"articles",href:"/articles/"},{key:"communities",href:"/communities/"}],f_=({activeLink:e,profile:t})=>{const n=le.useIntl(),r=E.useContext(Ft),i=r&&typeof r.id=="string";return h.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[TF.map(({key:a,href:s})=>{const o=EF(s,e),l={};return o&&(l["aria-current"]="page"),h.jsx("li",{className:te(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(bF,{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"})]})},io=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,_F=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${io(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(`${io(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(`${io(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
140
+ `}),z=Y.turndown(z)}o&&o.mentions&&(z=await kb({text:z,template:`[${Oh}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),FP(z,Y=>{const re=[{type:"initialValue",value:Y},{type:"editorKey",value:B.toString()}];o!=null&&o.link&&(re.push({type:"enrichedUrl",value:o.link}),o.link.url&&X(o.link.url)),S(re),setTimeout(()=>{S([{type:"stringValue",value:E9(q)}])},150)})})()},[B]),E.useEffect(()=>{if(U===void 0&&q){const z=LP(q);z&&X(z)}const H=z=>{var Q;const Y=z,re=((Q=Y==null?void 0:Y.detail)==null?void 0:Q.url)||null;re&&U&&U.url===re&&S([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",H),()=>{window.removeEventListener("linkRemoved",H)}},[U]),E.useEffect(()=>{if(t){wa.lastIndex=0;const H=t.match(wa);H&&H.length===1&&H[0].length===t.length&&!P&&S([{type:"originalValue",value:t}])}t!==""||!q||Ec(B,t)&&!P||(I.withoutNormalizing(q,()=>{oe.delete(q,{at:{anchor:I.start(q,[]),focus:I.end(q,[])}}),oe.deselect(q),q.children.length!==0&&oe.unwrapNodes(q,{at:[0]}),oe.insertNodes(q,C,{at:[0]})}),S([{type:"initialValue",value:C},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),E.useEffect(()=>{y({link:U})},[U]),E.useEffect(()=>{F===""&&U&&S([{type:"enrichedUrl",value:void 0}])},[F]);const j=il(()=>{jP({editor:q,isShowing:D.show,numberOfUsers:D.numberOfUsers,listMembers:m,dispatch:S})},100);return $?h.jsx("div",{id:Z,className:"rich-text-editor input text-medium",children:h.jsxs(yi.Provider,{value:{...x,id:Z,isInOverlay:f,dispatch:S,onMention:T,reportError:_},children:[h.jsxs(iN,{editor:q,initialValue:$,onChange:H=>{if(q.operations.some(Y=>Y.type!=="set_selection")){let Y=UP(H);Y==="<br>"&&(Y=""),p(Y,U),S([{type:"stringValue",value:E9(q)}]),P||S([{type:"hasInteracted",value:!0}]),j(),d&&console.log({serialized:Y,json:H})}},...u,children:[h.jsx(YO,{className:"editor",renderElement:k,renderLeaf:b,placeholder:n||c.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async H=>{const z=U!==!1,Y=H.clipboardData.getData("text");if((Q=>{try{return new URL(Q),!0}catch{return!1}})(Y)){let Q=Y;if(Y){const{full:G}=gm(Y);Q=G}if(Y&&v&&!z){const G=await v(Q);G.url&&S([{type:"enrichedUrl",value:G}])}}},onKeyDown:H=>{if(H.key==="Enter"){D.show&&(H.preventDefault(),H.stopPropagation(),LT(q,D,S,Z));const{selection:z}=q;if(z){const Y=ie.isCollapsed(z),[re,Q]=I.node(q,z,{depth:1});let G=re,se=G.type;const ae=G.children[0];if(se===ne.h3){H.preventDefault(),H.stopPropagation();const be=I.start(q,Q),Ce=I.end(q,Q),Pe=Ge.equals(z.anchor,be),je=Ge.equals(z.anchor,Ce);if(Pe)oe.insertNodes(q,C,{at:Q});else if(je)oe.insertNodes(q,C,{at:V.next(Q)}),oe.select(q,I.end(q,V.next(Q)));else{const Fe=z.anchor,[,Be]=I.parent(q,z);oe.splitNodes(q,{at:Fe}),oe.setNodes(q,{type:ne.paragraph},{at:V.next(Be)})}return}if(ae&&[ne.ol,ne.ul].includes(ae.type)&&(G=ae,se=ae.type),G&&_e.isElement(G)&&se!==ne.paragraph){if(se===ne.blockquote&&!H.shiftKey){H.stopPropagation(),H.preventDefault(),oe.insertNodes(q,C);return}if(Y){const[be,Ce]=I.parent(q,z,{edge:"end"}),je=be.type;if([ne.ul,ne.ol].includes(se))if(H.stopPropagation(),H.preventDefault(),je===ne.li&&O==="Enter"){be.children.length===1&&"text"in be.children[0]&&be.children[0].text===""&&oe.removeNodes(q,{at:Ce}),oe.insertNodes(q,C,{at:V.next(Q)}),oe.select(q,I.end(q,V.next(Q)));return}else{const[Fe,Be]=BP(q,ne.li),Xe={type:ne.li,children:[{text:""}]};oe.insertNodes(q,Xe,{at:V.next(Be)}),oe.select(q,I.end(q,V.next(Be)))}}}}}else if(H.key==="Escape"){if(D.show){H.preventDefault(),H.stopPropagation(),S([{type:"mentionPopover",value:{...D,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(H.key)&&D.show){H.preventDefault(),H.stopPropagation();const{selectedUser:z,possibleUsers:Y}=D;let re=H.key==="ArrowUp"?z-1:z+1;re<0&&(re=Y.length-1),re>=Y.length+1&&(re=0),S([{type:"mentionPopover",value:{...D,selectedUser:re}}])}S([{type:"lastKey",value:H.key}]),$P(H,q,S,_)},onBlur:()=>{q.selection&&S([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(L){if(!V.isPath(L.path)||!he.has(q,L.path))return;const H=he.get(q,L.path);let z=0;if(xe.isText(H)?z=H.text.length:H.children&&(z=H.children.length),L.offset>z)return;try{oe.select(q,{anchor:L,focus:L})}catch(Y){const re=Y.message;_(`Error focusing editor: ${re}`)}}}}),U?h.jsx(pp,{data:U,variant:"condensed",onClick:()=>{S([{type:"enrichedUrl",value:!1}]);const H=new CustomEvent("ariaLive",{detail:{message:c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(H)},"aria-label":c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||c.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):h.jsx(h.Fragment,{}),h.jsx(JP,{styling:l==null?void 0:l.toolbar}),m?h.jsx(zP,{onFallbackClick:g}):h.jsx(h.Fragment,{})]},N),h.jsx($m,{id:`character-limit-${e}`,limit:r,valueLength:i1(F)})]})}):h.jsx(h.Fragment,{})};const JT=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=E.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);E.useEffect(()=>{r&&l(r)},[r]);const u=c=>{a||(l(c),i(c))};return h.jsxs("div",{className:te("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:te("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 e_({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=le.useIntl(),l="profileImageChange_",[u,c]=E.useState(r),[d,f]=E.useState(!1),[m,g]=E.useState(!1),p=E.useRef(null),y=async C=>{f(!0),g(!1);try{const w=C.target.files&&C.target.files[0];if(!w||!t)throw f(!1),new Error("Image file or userID is missing");const x=await i({fileObject:w,userId:t}),S={thumbnail:x.thumbnailURL,full:x.originalURL};c(S),s(S)}catch{g(!0)}finally{f(!1)}f(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:T=o.formatMessage({id:`${l}cta_change`}),uploading:_=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return h.jsxs("div",{className:te("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"}),m&&h.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),h.jsx("input",{id:"file",type:"file",accept:"image/*",ref:p,onChange:y,hidden:!0,"data-testid":"file-input"}),h.jsx(Ie,{onClick:()=>p.current&&p.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?_:u?T:v})]})}const t_=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return h.jsx(vr,{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 $R=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=le.useIntl();return h.jsx(mx.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(Ie,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},n_=({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:m})=>{const[g,p]=E.useState([]),[y,v]=E.useState(!0),[T,_]=E.useState(c),{formatMessage:C}=le.useIntl(),w=async N=>{try{await u(g,N.message),p([]),_("SUCCESS")}catch(B){_("ERROR"),l(B)}},x=N=>{N.preventDefault(),_("NOT_SUBMITTED"),v(!0),p([])},S=N=>{N.preventDefault(),o(),_("CLOSED")};return T==="CLOSED"?null:T==="ERROR"||T==="SUCCESS"&&!(m!=null&&m.shouldHideDoneButtonOnSubmit)?h.jsxs("div",{className:"invite-form-wrapper",children:[h.jsx("div",{className:"content centred",children:T==="SUCCESS"?h.jsx("h2",{className:"success-title",children:C({id:"inviteForm_success"})}):h.jsxs("h2",{className:"error-title",children:[" ",C({id:"inviteForm_error"})]})}),h.jsx(pr,{}),h.jsx("div",{className:"footer",children:T==="SUCCESS"?h.jsxs(h.Fragment,{children:[h.jsx(Ie,{variant:"secondary",onClick:x,children:C({id:"inviteForm_ctaSendMoreInvites"})}),h.jsx(Ie,{onClick:S,children:C({id:"inviteForm_ctaDone"})})]}):h.jsx(Ie,{onClick:x,children:C({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(vr,{id:"invite-form",fields:[{component:$R,props:{emails:g,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:C({id:"inviteForm_message_label"}),placeholder:n||C({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:w},button:{text:r,size:"medium",disabled:y},gtm:d,meta:m,secondaryActionButton:f})]})},rc=e=>e.map(t=>({condition:t}));const Mn={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},jR=({functions:e,...t})=>{const{formatMessage:n}=le.useIntl(),[r,i]=E.useState(null),[a,s]=E.useState(!1),[o,l]=E.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Mn.NEW_PASSWORD]!==m[Mn.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!oh(m[Mn.NEW_PASSWORD]).isValid,d=[{"data-testid":Mn.NEW_PASSWORD,id:Mn.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:rc(["required",c]),functions:{onChange:m=>l(oh(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Mn.CONFIRMED_PASSWORD,id:Mn.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:rc(["required",u])}];t.isPasswordChange&&d.unshift({"data-testid":Mn.CURRENT_PASSWORD,id:Mn.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:rc(["required"])}),a&&d.push({component:k4,props:{matchingRules:o}});const f={id:Mn.FORM_ID,fields:d,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>i(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Mn.NEW_PASSWORD)||g.includes(Mn.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return h.jsxs(h.Fragment,{children:[h.jsx(vr,{...f}),r&&h.jsx(Lr,{variant:"error",text:r})]})};const r_=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var N;const s=le.useIntl(),o="profileForm_",l=E.useContext(Ft),[u,c]=E.useState(l.image),[d,f]=E.useState(!1),{uploadImage:m=()=>{},onSuccess:g=async B=>{},onCancel:p=()=>{},onFailure:y=()=>{}}=n,{buildLocation:v,isValidPlace:T,predictPlaces:_}=t.useMaps(),{context:C="ProfileForm",event:w="profile-form-submit-click"}=i||{},x=[{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:(N=l.location)==null?void 0:N.en,validation:[{condition:"required"},{condition:({location:B})=>B&&!d?!1:!T(B),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{d||f(!0)},onKeyInput:_}}],S=[{component:e_,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,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"}]},...x,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:pr}];return h.jsx(vr,{id:"profile-details-form",fields:e?x:S,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:C,event:w},functions:{onSuccess:async B=>{try{const $={...B,image:u||null,location:d?await v(B==null?void 0:B.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(F=>({...F,...$})),await g($)}catch{y()}},onCancel:p,onFailure:y},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})},HR=()=>{const e=le.useIntl(),[t,n]=E.useState(0);return E.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(Yb,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function UR({coverImage:e,setShowImagePicker:t}){return e&&e.url?h.jsx(Lr,{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(Ie,{variant:"tertiary",onClick:()=>t(!0),children:h.jsx(le.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):h.jsx(Lr,{button:{component:h.jsx(Ie,{variant:"secondary",onClick:()=>t(!0),children:h.jsx(le.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var i_=(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))(i_||{});let Od=null;const Bt="publishArticleForm_",A9={},S9=10,zR=({id:e="publish-article-form",values:t=A9,setShowImagePicker:n,functions:r,meta:i,gtm:a,isEditMode:s=!1})=>{var F;const o=le.useIntl(),l=E.useContext(Ft),{create:u,edit:c,onSuccess:d=()=>{},onFailure:f=()=>{}}=r||{},{isInOverlay:m=!1}=i||{},[g,p]=E.useState(!1),[y,v]=E.useState(t.body||""),[T,_]=E.useState(!1),[C,w]=E.useState("");E.useEffect(()=>{Ec(t,A9)||sl(t.body)&&t.body!==y&&t.body!==void 0&&v(t.body)},[t.body]);const x=()=>{!l||!l.id?_(o.formatMessage({id:`${Bt}error_loggedOut`})):T&&_(!1)},S=L=>({condition:O=>{const P=O[L];return!P||typeof P!="string"?!0:P.length<S9},error:o.formatMessage({id:`${Bt}error_underMinLength`},{length:S9})}),N=!!y&&sl(y),B=()=>h.jsxs(h.Fragment,{children:[h.jsx(pr,{}),h.jsx("p",{className:"text-medium",children:o.formatMessage({id:`${Bt}disclaimer`})})]}),$=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:o.formatMessage({id:`${Bt}title_label`}),placeholder:o.formatMessage({id:`${Bt}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:x},validation:[{condition:"required"},S("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:o.formatMessage({id:`${Bt}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:o.formatMessage({id:`${Bt}subtitle_placeholder`}),functions:{onChange:x},validation:[{condition:"required"},S("subtitle")]},{component:Fc,props:{formID:e,label:{visible:o.formatMessage({id:`${Bt}body_label`})},showLabel:!0}},{component:hp,props:{id:`${e}-input`,value:y,placeholder:o.formatMessage({id:`${Bt}body_placeholder`}),meta:{isInOverlay:m},autoFocus:!1,functions:{onChange:L=>{v(L),x()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!T,"aria-errormessage":"error-message"}},{id:"tags",label:o.formatMessage({id:`${Bt}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(i_).map(L=>({id:L,label:o.formatMessage({id:`${Bt}_tags_${L}`})})),value:t.tags||[],multipleOptions:{limit:3},validation:[{condition:"required",error:o.formatMessage({id:`${Bt}tags_error_required`})},{condition:L=>{var O;return((O=L==null?void 0:L.tags)==null?void 0:O.length)>3},error:o.formatMessage({id:`${Bt}tags_error_over_three`})}]},{component:Fc,props:{formID:e,label:{visible:o.formatMessage({id:`${Bt}cover_image_label`})},showLabel:!0}},{component:UR,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return g?$.push({component:pr}):$.push({component:B}),h.jsxs("section",{className:"publish-article-form",children:[h.jsx(vr,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async L=>{if(!l||!l.id||!N)return;Od&&clearTimeout(Od),p(!0);const O={...L,body:y,coverImage:t.coverImage};try{s&&c?await c(O):u&&await u(O),Od=setTimeout(()=>{w(o.formatMessage({id:`${Bt}aria_success${s?"_edit":""}`})),d(O)},500)}catch{_(o.formatMessage({id:`${Bt}error`})),w(""),f()}},onFailure:f},fields:$,intlPath:Bt,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||!N||!((F=t==null?void 0:t.coverImage)!=null&&F.url),text:{default:o.formatMessage({id:`${Bt}cta_submit${s?"_edit":""}`}),submitting:o.formatMessage({id:`${Bt}cta_submitting${s?"_edit":""}`}),submitted:o.formatMessage({id:`${Bt}cta_submitted${s?"_edit":""}`})},customOnSubmit:T?h.jsx(h.Fragment,{}):h.jsx(HR,{})},gtm:a}),T&&h.jsx(ws,{id:"error-message",className:"error",children:typeof T=="string"&&T.includes(" ")?T:o.formatMessage({id:`${Bt}error`})}),C&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,children:C})]})};var Un,qR=Un={_regexEscape:/([\.\*\+\^\$\[\]\\\(\)\|\{\}\,\-\:\?])/g,_regexParseLocale:/^([a-zA-Z]*)([_\-a-zA-Z]*)$/,_escapeRegExpPattern:function(e){return typeof e!="string"?e:e.replace(Un._regexEscape,"\\$1")},_toLowerCase:function(e,t){return typeof e!="string"?t&&e:e.toLowerCase()},_toUpperCase:function(e,t){return typeof e!="string"?t&&e:e.toUpperCase()},_trim:function(e,t,n){var r=[],i,a=function(l){r.push("^"+l+"+|"+l+"+$")};if(typeof t=="boolean"&&(n=t,t=null),typeof e!="string")return n&&e;if(Array.isArray(t)&&t.map(function(l){var u=Un._escapeRegExpPattern(l);a(u)}),typeof t=="string"){var s=Un._escapeRegExpPattern(t);a(s)}t||a("\\s");var o="("+r.join("|")+")";for(i=new RegExp(o,"g");e.match(i);)e=e.replace(i,"");return e},_parseLocale:function(e){var t=Un._regexParseLocale.exec(e),n,r,i;if(!(!e||!t))return t[2]=Un._trim(t[2],["-","_"]),r=Un._toLowerCase(t[1]),i=Un._toUpperCase(t[2])||i,n={lang:r,countryCode:i},n},isRtlLang:function(e){var t=Un._parseLocale(e);if(t)return Un._BIDI_RTL_LANGS.indexOf(t.lang)>=0},getLangDir:function(e){return Un.isRtlLang(e)?"rtl":"ltr"}};Object.defineProperty(Un,"_BIDI_RTL_LANGS",{value:["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","prs","ps","sd","ug","ur","yi"],writable:!1,enumerable:!0,configurable:!1});var WR=qR,k9=WR,VR={isRtlLang:k9.isRtlLang,getLangDir:k9.getLangDir};const a_=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission",onSearchClick:s})=>{const{searchIsOpen:o=!0,isDesktopVersion:l=!1}=n||{},u=le.useIntl(),c=E.useRef(null),d=VR.getLangDir(u.locale)||"ltr";xs(()=>{!n||l||!o||c.current&&c.current.focus()},[o]);const f=m=>{if(m.preventDefault(),m.stopPropagation(),!c.current||!c.current.value||c.current.value.length<1)return;const g=encodeURIComponent(c.current.value);window.location.href=`/?searchQuery=${g}`};return s?h.jsx("button",{type:"button",className:te("search toggle-search-button search-modal-trigger",t),onClick:m=>{m.preventDefault(),m.stopPropagation(),s()},"aria-label":u.formatMessage({id:"search_label"})}):h.jsx("form",{onSubmit:f,className:te("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&&!l?!o:!1,children:h.jsxs("p",{children:[h.jsx(ot,{element:"label",htmlFor:e,children:u.formatMessage({id:"search_label"})}),h.jsx("input",{ref:c,type:"search",id:e,name:e,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&f(m)}}),h.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),c.current&&c.current.value&&(c.current.value="")},children:h.jsx(ot,{children:u.formatMessage({id:"search_clear"})})}),h.jsx("button",{className:`search ${d}`,onClick:f,children:h.jsx(ot,{children:u.formatMessage({id:"search_cta"})})})]})})})},D9=async({ref:e,readAccount: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=Jc("ref"),s={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},s);try{o=await t(i,a),o===void 0&&(o=s)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:l=!1,autoApproved:u=!1,exists:c}=o;let d="";return l?d=u?"gov":"nonGov":c.registration?c.engagement&&!c.user?d=c.auth?"verify":"pending":d="exists":c.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!u},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},KR=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"]}},GR=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=KR(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),sessionStorage.setItem(mm.SESSION_STORAGE.EMAIL,s.email),r&&r({...s,shouldManuallyApprove:a.shouldManuallyApprove}),i([{type:"showSuccessMessage",value:!0}])},YR=({shouldShow:e,placeholders:t,labels:n,functions:{readAccount:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,d=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.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:()=>{D9({ref:a.email,readAccount:r,dispatch:o})},onChange:(m,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:_4,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:m=>h.jsx("small",{children:m})}),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:m=>h.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>h.jsx("a",{href:"/pages/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>h.jsx("a",{href:"/pages/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(p=>{s.validFields[p]!==a[p].current.validity.valid&&(g.push({type:`validFields.${p}`,value:a[p].current.validity.valid}),p==="email"&&D9({ref:a.email,readAccount:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const ZR=({className:e=""})=>h.jsxs("div",{className:te("success-message",e),"data-testid":"success-message",children:[h.jsx("p",{className:"success-title",children:h.jsx(le.FormattedMessage,{id:"signup_success_title"})}),h.jsx(le.FormattedMessage,{id:"signup_success_text",values:{p:t=>h.jsx("p",{children:t})}})]});const QR={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},XR=({className:e="",labels:t={},placeholders:n={},functions:r={readAccount:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=le.useIntl(),u=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname+window.location.search}`,{title:c=!0,expectation:d=!1,url:f=!0,logInButton:m=!0,successMessage:g=!0}=i,p={title:c,expectation:d,url:f,logInButton:m,successMessage:g},[y,v]=E.useReducer(Ms,QR),{validFields:T,emailDetails:_,shouldManuallyApprove:C,shouldDisableButton:w,showSuccessMessage:x,showError:S}=y,[N,B]=hm.useCookies(["signup-this-session","functional-cookie-consent"]),$={form:E.createRef(),name:E.createRef(),email:E.createRef(),jobTitle:E.createRef(),organisation:E.createRef(),tc:E.createRef(),hiddenValidation:E.createRef()};E.useEffect(()=>{C===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[C]),E.useEffect(()=>{N["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[N]),E.useEffect(()=>{x&&N["functional-cookie-consent"]&&B("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const F=E.useMemo(()=>YR({placeholders:n,labels:t,shouldShow:p,functions:r,refs:$,state:y,dispatch:v,dataToSubmit:s,intl:l}),[s,r,l,$,p,y]),L=w?!0:C?!Object.values(T).every(O=>O===!0):!T.name||!T.email||["exists","pending","verify"].includes(_.boxType);return p.successMessage&&x?h.jsx(ZR,{className:e}):h.jsxs("fieldset",{className:te("signup-form-fieldset",e),"data-testid":"signup-form",children:[p.title&&h.jsx("p",{className:"signup-title",children:h.jsx(le.FormattedMessage,{id:"signup_title"})}),S&&h.jsx(Lr,{variant:"error",text:l.formatMessage({id:"signup_error"})}),h.jsx(vr,{className:"signup-form",formRef:$.form,id:"sign-up-form",fields:F,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:L?{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:p.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await GR({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:y})},onCatch:O=>{r.handleError(O),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),h.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};function JR({parentId:e,isMember:t,formFunctions:n,leave:r,join:i,meta:a}){const s=le.useIntl();return h.jsx(P0,{form:{content:{type:ze.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 eF({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=le.useIntl(),a=()=>{n(r),t()};return h.jsx(Al,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function tF({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ft.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=wg({reply:L6(o),user:a});return Ss(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l)=>{const u=wg({reply:o,user:a});r.setQueryData(i,c=>Ss(u,c,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Bm(u.id,"reply")},0)}});return s}function nF({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ft.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=_n(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function rF({replies:e,user:t,replyType:n,currentLocale:r}){return!e||!(t!=null&&t.id)?[]:e.map(({id:i,own_children:a,latest_children:s,children_counts:o,data:l,created_at:u,parent:c,...d})=>{var x,S,N,B,$,F,L,O,P,M,U,D,X;const f=(((x=a==null?void 0:a.like)==null?void 0:x.length)||0)>0,m=(((S=s==null?void 0:s.like)==null?void 0:S.length)||0)>0,g=f?(N=a==null?void 0:a.like)==null?void 0:N.find(Z=>{var k;return((k=Z==null?void 0:Z.user)==null?void 0:k.id)===(t==null?void 0:t.id)}):!1,p=typeof g=="object"?(g==null?void 0:g.id)??"":"",y=m?(B=s==null?void 0:s.like)==null?void 0:B.map(Z=>{var k,b,q;return{id:(k=Z==null?void 0:Z.user)==null?void 0:k.id,name:(q=(b=Z==null?void 0:Z.user)==null?void 0:b.data)==null?void 0:q.name}}):!1,v=(O=(L=(F=($=l==null?void 0:l.payload)==null?void 0:$.data)==null?void 0:F.translations)==null?void 0:L[r])==null?void 0:O.body,T=(M=(P=l==null?void 0:l.payload)==null?void 0:P.data)==null?void 0:M.original,_=!!v,C=(T==null?void 0:T.locale)===r,w=v||(T==null?void 0:T.body);return{user:d==null?void 0:d.user,body:n===Rt.Courses?y4({payload:(U=l==null?void 0:l.payload)==null?void 0:U.data,currentLocale:r,originalLocale:l==null?void 0:l.locale}):w||"",locale:l==null?void 0:l.locale,createdAt:u,data:{...iF(l),translationInfo:{hasTranslation:_,isOriginalPost:C,currentBody:w,currentLocale:r,originalBody:T==null?void 0:T.body,originalLocale:T==null?void 0:T.locale}},likeId:p,liked:m,likes:(o==null?void 0:o.like)||0,peopleWhoLiked:y,replyId:i,parent:c,userLiked:!!g,payloadId:(D=l==null?void 0:l.payload)==null?void 0:D.id,payloadCollection:(X=l==null?void 0:l.payload)==null?void 0:X.collection}})}function iF(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 mp({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s,type:o=Rt.Communities}){const l=ft.useQueryClient(),u=t1(),c=Pa(),d={queryClient:l,queryKey:s},f={mutationHandlers:{error:Nm(d),mutate:Im(d)},user:u,...d},m=tF({...f,mutationFn:e}),g=nF({...f,mutationFn:t}),p=aF({...f,mutationFn:n}),y=oF({...f,mutationFn:i}),v=lF({...f,mutationFn:a}),{replies:T,..._}=sF({queryKey:s,queryFn:r});return{replies:rF({replies:T,user:u,replyType:o,currentLocale:c}),mutations:{create:m,edit:g,remove:y,like:p,unlike:v},user:u,..._}}function aF({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ft.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=_n(s,o);return l&&Ag({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=_n(o,l);u&&Ag({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function sF({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=ft.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Fm(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function oF({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ft.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>g4(i,a)),onError:n});return r}function lF({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ft.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=_n(a,s);return o&&$6({reply:o,user:r}),s}),onError:n});return i}const uF=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o},type:l=Rt.Communities})=>{const u=le.useIntl(),c=3,{replies:d,fetchNextPage:f,hasNextPage:m,isLoading:g,mutations:{create:p,edit:y,like:v,remove:T,unlike:_}}=mp({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:x=>a.list({...x,reactionId:i})},type:l});vm([g]);const[C,w]=E.useState(!0);return h.jsxs(h.Fragment,{children:[(d==null?void 0:d.length)>=c&&h.jsx(Ie,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>w(!C),children:u.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&h.jsx(ax,{loadMore:{isLoading:g,hasNextPage:m,loadNextPage:()=>f()},form:{parentId:r,content:{type:ze.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(x,{body:S})=>p({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:x,likes:S,data:N,body:B,createdAt:$,userLiked:F,peopleWhoLiked:L,parent:O,user:P,likeId:M})=>h.jsx(jl,{isCommunity:!0,content:{id:x,type:ze.Reply,body:B,createdAt:$,slugs:{question:`${t}/${r}`,answer:e,reply:O},slug:"",author:Cl(P),userLiked:F,likes:S,peopleWhoLiked:l===Rt.Courses?!1:L,data:N},forceHide:{shareLink:l===Rt.Courses},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>T({replyId:x}),updateContent:(U,{body:D})=>y({replyId:x,content:D})},likes:{createLike:()=>v({replyId:x}),deleteLike:()=>_({replyId:x,reactionId:M}),listLikes:U=>o.list({replyId:x,...U})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:nn.Communities,area:r||""},{scope:nn.Platform,area:"all"}]},disableMentions:l===Rt.Courses,basePath:t,parentId:r},x)):null})]})};function cF({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s,type:o=Rt.Communities}){const{body:l,data:u,likeId:c,likes:d,peopleWhoLiked:f,replyId:m,createdAt:g,user:p,userLiked:y}=s,{edit:v,like:T,remove:_,unlike:C}=e.mutations;return h.jsx(tx,{children:h.jsx(jl,{isCommunity:!0,content:{id:m,type:ze.Reply,body:l,createdAt:g,slugs:{question:`${n}/${a}`,answer:t,reply:m},slug:m,author:Cl(p),userLiked:y,likes:d,peopleWhoLiked:o===Rt.Courses?!1:f,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:m}),updateContent:(w,{body:x})=>v({replyId:m,content:x})},likes:{createLike:()=>T({replyId:m}),deleteLike:()=>C({replyId:m,reactionId:c}),listLikes:w=>e.likes.list({replyId:m,...w})},comments:{},form:e.form},forceHide:{shareLink:o===Rt.Courses},badges:{showBadges:!0,scopes:[{scope:nn.Communities,area:a||""},{scope:nn.Platform,area:"all"}]},translation:{isTranslatable:!0,onTranslate:async({payloadId:w,payloadCollection:x})=>({body:"Translated body"})},disableMentions:o===Rt.Courses,children:h.jsx(uF,{basePath:n,parentId:a,activityId:t,replyId:m,isMember:i,functions:e,type:o}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},m)},m)}const au="ALL",s_=({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=Rt.Communities,repliesFilters:m})=>{const g=le.useIntl(),p=Pa(),{fetchNextPage:y,hasNextPage:v,isLoading:T,replies:_,mutations:{create:C,remove:w,edit:x,like:S,unlike:N}}=mp({queryKey:[t,n,e,"replies"],queryFns:u,type:f}),[B,$]=E.useState(f===Rt.Courses&&p||au),[F,L]=E.useState([]),O=E.useMemo(()=>_,[JSON.stringify(_)]);E.useEffect(()=>{if(!O)return;const D=!B||B===au||f!==Rt.Courses?O:O.filter(X=>X.locale===B);L(D)},[O,B]);const[P,M]=E.useState(null);vm([T]),Mm();const U={create:(D,X)=>{const{body:Z}=X;C({activityId:e,content:Z})},...a};return h.jsxs("section",{className:"replies-feed",children:[h.jsx(ix,{type:"comment",responses:r,isLoading:T}),d?h.jsxs(h.Fragment,{children:[h.jsx(JR,{parentId:n,isMember:i,join:s,leave:o,formFunctions:U,meta:{isAutoFocused:f===Rt.Courses||!1}}),f===Rt.Courses&&(m==null?void 0:m.isEnabled)&&h.jsxs("section",{className:"replies-feed-language-switcher",style:{display:"flex"},children:[h.jsx(vr,{id:"replies-feed-language-switcher",fields:[{id:"language",label:!1,type:"select",initialValue:B,options:[{id:au,label:g.formatMessage({id:"activitySection_language_switcher_all_languages_option"})},...(m==null?void 0:m.options)||[]],functions:{onChange:D=>$(D)}}],functions:{},button:{hideButton:!0}}),h.jsx(Ie,{icon:"info-inside-circle",variant:"tertiary",className:"language-switcher-info-button",tooltip:g.formatMessage({id:"activitySection_language_switcher_info"}),forceTooltip:!0,children:h.jsx(ot,{children:g.formatMessage({id:"activitySection_language_switcher_info"})})})]}),F==null?void 0:F.map((D,X)=>h.jsx(cF,{activityId:e,basePath:t,focus:P===X,formFns:{form:a,likes:l,reactions:u,mutations:{remove:w,edit:x,like:S,unlike:N}},isMember:i,parentId:n,reply:D,type:f},D.replyId)),T?h.jsx(h.Fragment,{children:" "}):h.jsx(eF,{hasNextPage:v,fetchNextPage:y,setFocusReplyIndex:M,totalReplies:_.length})]}):h.jsx(In,{children:h.jsx(le.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),h.jsx(R0,{form:c})]})};function dF({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=ft.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:c=>(c==null?void 0:c.next)||null}),l=Fm(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function fF({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=dF({queryKey:t,queryFn:e});return{likes:n,...r}}function o_({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=fF({queryKey:[e,t,n,"likes"],queryFns:i.likes});E.useEffect(()=>{l()},[l]);const u=a.map(({user:c})=>c).map(c=>c?Cl(c):void 0).filter(c=>c&&typeof c!="string");return h.jsx("section",{className:"likes-feed",children:h.jsx(Q3,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const l_=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=le.useIntl();return h.jsx(vi,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:te("profile-modal in-portal",i,{open:e}),maxWidth:600,children:h.jsx(o_,{...a,likeCount:r??0,functions:{likes:n}})})},hF=Object.freeze(Object.defineProperty({__proto__:null,default:l_},Symbol.toStringTag,{value:"Module"})),mF={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 pF=3e3,u_=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=le.useIntl(),r="discussion_share_copy_link",[i,a]=E.useState({isOpen:!1,isCopied:!1});return h.jsxs("li",{className:"share-link-wrapper",children:[h.jsx(ms,{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})},pF)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),h.jsx(pi,{className:te({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"top",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const ra="discussion_",c_=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,edit:s,shareLink:o,moreMenu:l})=>{const u=le.useIntl(),c=[];return l&&l.reportData&&c.push({text:u.formatMessage({id:`${ra}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:communities@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${ra}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${ra}report_body`},{contentType:n||"",contentSlug:l&&l.reportData&&l.contentSlug||"",contentUrl:l&&l.reportData&&l.reportData.contentUrl||""}))}`,icon:"flag"}),h.jsxs("ul",{className:te("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?h.jsx(E4,{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(ms,{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:`${ra}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${ra}comments${i.count===null?"_loading":""}`},{count:i.count})})}):h.jsx(h.Fragment,{}),a?h.jsx("li",{children:h.jsx(ms,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${ra}reply`})})}):h.jsx(h.Fragment,{}),s?h.jsx("li",{className:"edit-button-item",children:h.jsx(ms,{styling:{muted:!0},onClick:s.onClick,icon:{icon:"pencil-paper"},"data-testid":"edit",children:u.formatMessage({id:`${ra}action_edit`})})}):h.jsx(h.Fragment,{}),o?h.jsx(u_,{url:o.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):h.jsx(h.Fragment,{}),l?h.jsx(Mc,{element:"li",id:`more-${l.contentSlug}`,options:[...l.options||[],...c]}):h.jsx(h.Fragment,{})]})};const gF=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=le.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(ot,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),h.jsx("ul",{className:te("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(ot,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),h.jsx(Ki,{href:s?void 0:a,...l,children:rl(i,t)})]},`${mi(i)}_${o}`)})})]})};const pp=({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:te("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 d_=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",styling:o,gtm:l})=>{const u=le.useIntl(),{muted:c,large:d}=o||{},f=n?[{id:"all",text:typeof n!="boolean"&&n.text||u.formatMessage({id:"filters_all"})},...e]:e,[m,g]=E.useState(n?["all"]:t.length?t.map(T=>T.id):[]),[p,y]=E.useState(0),v=(T,_)=>{let C=[];m.includes(T)&&!a?C=m.filter(w=>w!==T):T==="all"?C=["all"]:r?C=[...m.filter(w=>w!=="all"),T]:C=[T],g(w=>(i&&typeof i=="function"&&i({current:C,previous:w}),C)),_&&typeof _=="function"&&_()};return h.jsx("ul",{className:te("filters",s),children:f.map(({id:T,text:_,disabled:C=!1,callback:w=()=>{},content:x},S)=>{let N={tabIndex:p===S?0:-1};return C&&(N={disabled:!0,"aria-label":u.formatMessage({id:"filters_disabled"},{name:_})}),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)||`${_.toLowerCase().replace(" ","-")}-click`,className:te(T,{selected:m.includes(T),large:d,muted:c}),onClick:B=>{B.preventDefault(),B.stopPropagation(),v(T,w)},onKeyDown:B=>{var O,P;let $=S+1,F,L;switch(B.code){case"Enter":case"Space":B.preventDefault(),B.stopPropagation(),v(T,w);break;case"ArrowLeft":case"ArrowRight":B.preventDefault(),B.stopPropagation(),B.code==="ArrowLeft"?($=S-1,$<0&&($=f.length-1)):$>=f.length&&($=0),y($),F=B.currentTarget.closest("li"),L=(O=F==null?void 0:F.parentElement)==null?void 0:O.children[$],(P=L==null?void 0:L.querySelector("button"))==null||P.focus();break}},"aria-selected":m.includes(T),...N,children:x||_})},T)})})},vF=(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 su="languageSwitcher_",yF=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=le.useIntl(),{updateLanguage:c=()=>{}}=E.useContext(Tm),[d,f]=E.useState(e);if(E.useEffect(()=>{e!==d&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),p=d!==e;return h.jsxs("div",{className:te("language-switcher text-small",s,l),children:[h.jsxs("nav",{children:[s!=="short"&&h.jsx("p",{children:o||u.formatMessage({id:`${su}label`})}),h.jsx("ul",{children:g.map(y=>{var C;if(!Cs.ALL_LOCALES.includes(y))return null;const v=(C=r[y])==null?void 0:C.post_name,T=Cs.ALL_LOCALES_WITH_LABELS.filter(w=>w.value===y)[0].title;let _={className:y};if(d===y)_["aria-label"]=u.formatMessage({id:`${su}selected`},{language:T});else{const w=vF(y,v,a);_={..._,href:typeof w=="string"?w:w.url,onClick:x=>{f(y),c(y),typeof i<"u"&&(x.preventDefault(),x.stopPropagation(),i(y,typeof w=="string"?w:w.urlForRouter))}}}return h.jsx("li",{children:h.jsx(Ki,{..._,fallbackElement:"span",children:T})},y)})}),s!=="short"&&!p&&h.jsx("p",{children:u.formatMessage({id:`${su}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!p&&!t&&!n&&h.jsx("small",{children:u.formatMessage({id:`${su}disclaimer`},{email:Fo.support,link:y=>{const v=`mailto:${y}`;return h.jsx("a",{href:v,children:y})}})})]})};const Nd=le.createIntl({locale:"en",messages:zt}),Al=({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:Nd.formatMessage({id:"loadMore_button"}),endOfFeed:Nd.formatMessage({id:"loadMore_endOfFeed"}),error:Nd.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,d]=E.useState(""),f=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?d(g.message):d("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:h.jsx("footer",{className:te("load-more",l),children:!c&&e?h.jsx(Ie,{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 gp=({variant:e="default",version:t="default",className:n="",...r})=>h.jsx("p",{className:"logo-wrapper",children:h.jsx("a",{href:"/",className:te("logo",e,t,n),...r,children:h.jsx(ot,{children:h.jsx(le.FormattedMessage,{id:"apolitical"})})})});let ou=!1;const Mc=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=le.useIntl(),a=E.useRef(null),[s,o]=E.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return E.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),E.createElement(e,{ref:a,className:te("more-menu text-medium",r),children:h.jsxs(h.Fragment,{children:[h.jsx(Ie,{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,...m},g)=>{const p={...m,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ou&&(clearTimeout(ou),ou=!1)},onBlur:()=>{ou=setTimeout(()=>{o(!1)},100)}};return u&&(p.href=u),h.jsx("li",{className:"more-menu-list-item",children:h.jsx(Ie,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...p,children:d})},`${mi(d)}_${g}`)})})]})})},EF=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const bF=E.lazy(()=>Promise.resolve().then(()=>F7)),TF=[{key:"homepage",href:"/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/courses/"},{key:"articles",href:"/articles/"},{key:"communities",href:"/communities/"}],f_=({activeLink:e,profile:t})=>{const n=le.useIntl(),r=E.useContext(Ft),i=r&&typeof r.id=="string";return h.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[TF.map(({key:a,href:s})=>{const o=EF(s,e),l={};return o&&(l["aria-current"]="page"),h.jsx("li",{className:te(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(bF,{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"})]})},io=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,_F=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${io(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(`${io(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(`${io(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
141
141
 
142
142
  ${io(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:io(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const CF="shareLinks_",xF=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=le.useIntl(),l=_F({title:e,link:t,referrer:n});return h.jsxs("aside",{className:te("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:m})=>{if(typeof f=="function"&&!f())return null;const g={};return m&&(g.onClick=p=>m(p,d)),h.jsx("li",{children:h.jsx(Ie,{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:`${CF}link_${u}`}),...g})},u)})})]})};const wF=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(p,y,v)=>(p||(p=`panel-${mi(y)}-${v}`),p),i=Wi(!0)||0;let a=e.findIndex(p=>p.current===!0);if(a<0&&(a=0),window.location.hash){const p=window.location.hash.replace("#","");if(e.find(v=>v.id===p)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===p){a=v;break}}}const[s,o]=E.useState((g=e[a])!=null&&g.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=E.useState(""),c=(p,y)=>{switch(p.key){case"ArrowLeft":case"ArrowRight":{p.preventDefault();let v=y;p.key==="ArrowLeft"?y>0?v=y-1:v=e.length-1:p.key==="ArrowRight"&&(y<e.length-1?v=y+1:v=0);const T=r(e[v].id,e[v].text,v),_=document.getElementById(`tab-${T}`);_==null||_.focus(),u(T);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},d=p=>{let y=!1;return p.target==="min-width"&&i>=p.value&&(y=!0),p.target==="max-width"&&i<=p.value&&(y=!0),y};E.useEffect(()=>{if(e[a].hasCarousel){const p=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(p)}},[s]);const f=[],m=[];return e.forEach(({id:p,text:y,content:v,href:T,hasCarousel:_,breakpoint:C},w)=>{if(C&&!d(C))return;p=r(p,y,w);const x=s===p,S={};T||(S["aria-controls"]=p,S.onClick=N=>{N.preventDefault(),N.stopPropagation(),o(p),!n&&window.history.replaceState(null,"",`#${p}`)},m.push(h.jsx("section",{id:p,hidden:!x,role:"tabpanel","aria-labelledby":`tab-${p}`,"aria-live":x?"assertive":"off",children:typeof v=="string"?h.jsx("p",{children:v}):v},`section-${p}`))),f.push(h.jsx("li",{"data-testid":"navigation-tab",children:h.jsx("a",{href:T||`#${p}`,id:`tab-${p}`,"aria-controls":p,className:te({selected:x}),role:"tab",tabIndex:x?0:-1,"aria-selected":x,onKeyDown:N=>c(N,w),...S,children:y})},`tab-${p}`))}),h.jsxs("div",{className:te("tabs-wrapper",t),children:[h.jsx("ul",{className:"tabs",role:"tablist",children:f}),h.jsx("div",{className:"tab-content",children:m})]})};const AF={"2-1":901,"1-3":769,"1-1":769},h_=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=Wi(!0);let s=i;if(E.Children.count(i)===1){const o=E.Children.toArray(i)[0];E.isValidElement(o)&&o.props&&(s=o.props.children)}return h.jsx("section",{className:te("columns",`layout-${e}`,r,{"has-containers":n}),children:E.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<AF[e]?null:o)})};const Zi=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return h.jsx("section",{className:te("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const SF=({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:te("download-section",n),styling:{background:"dark"},children:h.jsxs("div",{className:"content-default",children:[E.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),h.jsx(Ls,{buttons:r})]})})};const Lh="editSection_";function m_({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const kF=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=le.useIntl();return h.jsxs(In,{variant:"muted",icon:e,children:[h.jsx("p",{children:t||s({id:`${Lh}placeholder_description`})}),i&&h.jsx("p",{children:h.jsx(Ie,{href:r,variant:"secondary",size:"small",onClick:()=>m_({href:r,setShowModal:a}),children:n||s({id:`${Lh}placeholder_cta`})})})]})},DF=({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}=le.useIntl(),[d,f]=E.useState(!1),m=()=>f(!1),g=!!n||!!r,p=typeof i=="string"||g;let y;return r&&(y=E.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),h.jsxs("section",{className:te("edit-section",t),children:[g&&h.jsx(vi,{title:o||`Edit ${a}`,isOpen:d,showDivider:!1,showIcon:!1,functions:{onClose:m},className:te("edit-section-modal"),children:y||(n?h.jsx(vr,{...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 T,_;(T=n==null?void 0:n.functions)!=null&&T.onSuccess&&await((_=n==null?void 0:n.functions)==null?void 0:_.onSuccess(v)),f(!1)},onCancel:m}}):h.jsx(h.Fragment,{}))}),h.jsxs("div",{className:te("edit-section-header",{"no-title":!s}),children:[s&&h.jsx("h2",{className:"edit-section-header-title",children:a}),p&&h.jsx(Ie,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>m_({href:i,setShowModal:f}),children:c({id:`${Lh}edit`})})]}),e||h.jsx(kF,{...l,href:i,setShowModal:f,showEditButton:p}),u&&h.jsx(pr,{})]})};const OF=({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:te("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&E.createElement(s.element,{className:te("title",s.className)},s.text),t&&h.jsx("p",{children:t}),h.jsx("ul",{className:te({"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:m=!1},g)=>{if(!c||!c.url)return null;const p=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:p}):p}),m&&h.jsx("small",{children:m})]},`${c.url}_${g}`)})})]})};let Id;const Pd="contactFooter_",NF=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=E.useRef(null),[r,i]=E.useState(0),[a,s]=E.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(Id),Id=setTimeout(()=>{o(),s(!1)},500))};return E.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Id),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(le.FormattedMessage,{id:`${Pd}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(le.FormattedMessage,{id:`${Pd}text`})}),h.jsx(Ki,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:h.jsx(le.FormattedMessage,{id:`${Pd}email`})})]}),h.jsx(t_,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},IF=({activeLink:e,profile:t,...n})=>h.jsx(Zi,{children:h.jsx(h_,{layout:"1-3",children:h.jsxs(h.Fragment,{children:[h.jsx(f_,{activeLink:e,profile:t}),h.jsx(Wb,{...n})]})})});const Rd="cookieBanner_",Fd=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Bd=new Date(Date.now()+12*30*24*60*60*1e3),p_=()=>{const e=le.useIntl(),[t,n,r]=hm.useCookies(Fd),[i,a]=E.useState(!t["apol-cookie-banner"]),s=()=>{Fd.forEach(c=>{n(c,!0,{path:"/",expires:Bd,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Bd}),Fd.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Bd});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:`${Rd}buttons_${c.id}`})})}),h.jsxs("section",{id:"cookie-banner","aria-labelledby":"cookie-banner-title","aria-describedby":"cookie-banner-desc","aria-live":"polite","aria-modal":"true",className:"text-medium",children:[h.jsx("h6",{id:"cookie-banner-title","aria-label":"Cookies and your privacy",children:e.formatMessage({id:`${Rd}title`})}),h.jsx("p",{id:"cookie-banner-desc",children:e.formatMessage({id:`${Rd}text`})}),h.jsx(Ls,{buttons:u})]})},si={platform:{order:["events","courses","articles","communities","aiCampus","climateCampus"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/courses/",gtmType:"courses-click"},articles:{href:"/articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"},aiCampus:{href:"/pages/government-ai-campus",gtmType:"ai-campus-click"},climateCampus:{href:"/pages/government-energy-climate-campus",gtmType:"climate-campus-click"}},community:{order:["post","join","guidelines"],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:["agl","news","insights","story","team","careers","partner"],agl:{href:"https://aglintelligence.com",gtmType:"agl-click"},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"},child:"legal"},legal:{order:["trust","privacy","terms","cookie","accessibility","ai"],privacy:{href:"/pages/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"/pages/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"},trust:{href:"/pages/trust-at-apolitical",gtmType:"trust-at-apolitical-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Fo["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fo["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:{href:"https://help.apolitical.co",linkText:"Help Centre",gtmType:"help-centre-click"},business:{email:Fo.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 vs="footer_",qo="SiteFooter",PF=({group:e,keyName:t})=>{const i=le.useIntl().formatMessage({id:`${vs}${e}_${t}_address`}).split("{br}");return h.jsx("address",{children:i.map((a,s)=>h.jsxs(E.Fragment,{children:[a,s<i.length-1&&h.jsx("br",{})]},s))})},O9=({group:e})=>{const t=si[e].order||[];let n=!1;return"text"in si[e]&&(n=si[e].text),h.jsxs(E.Fragment,{children:[h.jsx("p",{className:"pre-title",children:h.jsx(le.FormattedMessage,{id:`${vs}${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}=si[e][r],s={};return(["legal"].includes(e)||i.startsWith("http"))&&(s.target="_blank",s.rel="noopener"),h.jsx("li",{children:h.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":qo,"data-gtm-event-type":a,...s,children:h.jsx(le.FormattedMessage,{id:`${vs}${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(E.Fragment,{children:[h.jsx("dt",{children:h.jsx(le.FormattedMessage,{id:`${vs}${e}_${r}`})}),h.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&h.jsx(PF,{group:e,keyName:r}),typeof n!="boolean"&&n[r].email&&h.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":qo,"data-gtm-event-type":n[r].gtmType,children:n[r].email}),typeof n!="boolean"&&n[r].href&&h.jsx("a",{href:n[r].href,target:"_blank",rel:"noopener",className:"gtm-trackable","data-gtm-event-context":qo,"data-gtm-event-type":n[r].gtmType,children:n[r].linkText||n[r].href})]})]},`dl-${e}-${r}`))})]},e)},vp=()=>h.jsx("div",{id:"footer",children:h.jsxs("div",{className:"wrapper",children:[h.jsx(Qc,{element:"hr"}),h.jsx(gp,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":qo,"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(O9,{group:e}),Object.keys(si[e]).includes("child")&&h.jsx(O9,{group:si[e].child})]},e))}),h.jsx("hr",{}),h.jsxs("div",{className:"sub-footer",children:[h.jsx("ul",{children:Array.isArray(si.social.order)&&si.social.order.map(e=>{const t=si.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":qo,"data-gtm-event-type":"social-click",children:h.jsx("span",{className:"hidden",children:h.jsx(le.FormattedMessage,{id:`${vs}social_${e}`})})})},e)})}),h.jsx("small",{children:h.jsx(le.FormattedMessage,{id:`${vs}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),jr=Object.create(null);jr.open="0";jr.close="1";jr.ping="2";jr.pong="3";jr.message="4";jr.upgrade="5";jr.noop="6";const ic=Object.create(null);Object.keys(jr).forEach(e=>{ic[jr[e]]=e});const $h={type:"error",data:"parser error"},g_=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",v_=typeof ArrayBuffer=="function",y_=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,yp=({type:e,data:t},n,r)=>g_&&t instanceof Blob?n?r(t):N9(t,r):v_&&(t instanceof ArrayBuffer||y_(t))?n?r(t):N9(new Blob([t]),r):r(jr[e]+(t||"")),N9=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function I9(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Md;function RF(e,t){if(g_&&e.data instanceof Blob)return e.data.arrayBuffer().then(I9).then(t);if(v_&&(e.data instanceof ArrayBuffer||y_(e.data)))return t(I9(e.data));yp(e,!1,n=>{Md||(Md=new TextEncoder),t(Md.encode(n))})}const P9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<P9.length;e++)Oo[P9.charCodeAt(e)]=e;const FF=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=Oo[e.charCodeAt(r)],s=Oo[e.charCodeAt(r+1)],o=Oo[e.charCodeAt(r+2)],l=Oo[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},BF=typeof ArrayBuffer=="function",Ep=(e,t)=>{if(typeof e!="string")return{type:"message",data:E_(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:MF(e.substring(1),t)}:ic[n]?e.length>1?{type:ic[n],data:e.substring(1)}:{type:ic[n]}:$h},MF=(e,t)=>{if(BF){const n=FF(e);return E_(n,t)}else return{base64:!0,data:e}},E_=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},b_=String.fromCharCode(30),LF=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,s)=>{yp(a,!1,o=>{r[s]=o,++i===n&&t(r.join(b_))})})},$F=(e,t)=>{const n=e.split(b_),r=[];for(let i=0;i<n.length;i++){const a=Ep(n[i],t);if(r.push(a),a.type==="error")break}return r};function jF(){return new TransformStream({transform(e,t){RF(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 Ld;function lu(e){return e.reduce((t,n)=>t+n.length,0)}function uu(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 HF(e,t){Ld||(Ld=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(lu(n)<1)break;const l=uu(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(lu(n)<2)break;const l=uu(n,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(lu(n)<8)break;const l=uu(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($h);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(lu(n)<i)break;const l=uu(n,i);o.enqueue(Ep(a?l:Ld.decode(l),t)),r=0}if(i===0||i>e){o.enqueue($h);break}}}})}const T_=4;function $t(e){if(e)return UF(e)}function UF(e){for(var t in $t.prototype)e[t]=$t.prototype[t];return e}$t.prototype.on=$t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};$t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};$t.prototype.off=$t.prototype.removeListener=$t.prototype.removeAllListeners=$t.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};$t.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};$t.prototype.emitReserved=$t.prototype.emit;$t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};$t.prototype.hasListeners=function(e){return!!this.listeners(e).length};const f1=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Vn=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),zF="arraybuffer";function __(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const qF=Vn.setTimeout,WF=Vn.clearTimeout;function h1(e,t){t.useNativeTimers?(e.setTimeoutFn=qF.bind(Vn),e.clearTimeoutFn=WF.bind(Vn)):(e.setTimeoutFn=Vn.setTimeout.bind(Vn),e.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const VF=1.33;function KF(e){return typeof e=="string"?GF(e):Math.ceil((e.byteLength||e.size)*VF)}function GF(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 C_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function YF(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function ZF(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 QF extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class bp extends $t{constructor(t){super(),this.writable=!1,h1(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 QF(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=Ep(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=YF(t);return n.length?"?"+n:""}}class XF extends bp{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)};$F(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,LF(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]=C_()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let x_=!1;try{x_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const JF=x_;function eB(){}class tB extends XF{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 Rr extends $t{constructor(t,n,r){super(),this.createRequest=t,h1(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=__(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=Rr.requestsCount++,Rr.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=eB,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Rr.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()}}Rr.requestsCount=0;Rr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",R9);else if(typeof addEventListener=="function"){const e="onpagehide"in Vn?"pagehide":"unload";addEventListener(e,R9,!1)}}function R9(){for(let e in Rr.requests)Rr.requests.hasOwnProperty(e)&&Rr.requests[e].abort()}const nB=function(){const e=w_({xdomain:!1});return e&&e.responseType!==null}();class rB extends tB{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=nB&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Rr(w_,this.uri(),t)}}function w_(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||JF))return new XMLHttpRequest}catch{}if(!t)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const A_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class iB extends bp{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=A_?{}:__(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;yp(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}i&&f1(()=>{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]=C_()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const $d=Vn.WebSocket||Vn.MozWebSocket;class aB extends iB{createSocket(t,n,r){return A_?new $d(t,n,r):n?new $d(t,n):new $d(t)}doWrite(t,n){this.ws.send(n)}}class sB extends bp{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=HF(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=jF();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&&f1(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const oB={websocket:aB,webtransport:sB,polling:rB},lB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function jh(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=lB.exec(e||""),a={},s=14;for(;s--;)a[uB[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=cB(a,a.path),a.queryKey=dB(a,a.query),a}function cB(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 dB(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}const Hh=typeof addEventListener=="function"&&typeof removeEventListener=="function",ac=[];Hh&&addEventListener("offline",()=>{ac.forEach(e=>e())},!1);class Ui extends $t{constructor(t,n){if(super(),this.binaryType=zF,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=jh(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=jh(n.host).host);h1(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=ZF(this.opts.query)),Hh&&(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"})},ac.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=T_,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&&Ui.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",Ui.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+=KF(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,f1(()=>{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(Ui.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(),Hh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=ac.indexOf(this._offlineEventListener);r!==-1&&ac.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ui.protocol=T_;class fB extends Ui{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;Ui.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;Ui.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 hB=class extends fB{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=>oB[i]).filter(i=>!!i)),super(t,r)}};function mB(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=jh(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 pB=typeof ArrayBuffer=="function",gB=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,S_=Object.prototype.toString,vB=typeof Blob=="function"||typeof Blob<"u"&&S_.call(Blob)==="[object BlobConstructor]",yB=typeof File=="function"||typeof File<"u"&&S_.call(File)==="[object FileConstructor]";function Tp(e){return pB&&(e instanceof ArrayBuffer||gB(e))||vB&&e instanceof Blob||yB&&e instanceof File}function sc(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(sc(e[n]))return!0;return!1}if(Tp(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return sc(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&sc(e[n]))return!0;return!1}function EB(e){const t=[],n=e.data,r=e;return r.data=oc(n,t),r.attachments=t.length,{packet:r,buffers:t}}function oc(e,t,n){if(!e)return e;if(Tp(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let i=0;i<e.length;i++)r[i]=oc(e[i],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){if(e.toJSON&&typeof e.toJSON=="function"&&!n)return oc(e.toJSON(),t,!0);const r={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=oc(e[i],t));return r}return e}function bB(e,t){return e.data=Uh(e.data,t),delete e.attachments,e}function Uh(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]=Uh(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Uh(e[n],t));return e}const k_=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],TB=5;var Qe;(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"})(Qe||(Qe={}));class _B{constructor(t){this.replacer=t}encode(t){return(t.type===Qe.EVENT||t.type===Qe.ACK)&&sc(t)?this.encodeAsBinary({type:t.type===Qe.EVENT?Qe.BINARY_EVENT:Qe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Qe.BINARY_EVENT||t.type===Qe.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=EB(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class _p extends $t{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}: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===Qe.BINARY_EVENT;r||n.type===Qe.BINARY_ACK?(n.type=r?Qe.EVENT:Qe.ACK,this.reconstructor=new CB(n)):super.emitReserved("decoded",n)}else if(Tp(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(Qe[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Qe.BINARY_EVENT||r.type===Qe.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");const o=Number(s);if(!D_(o)||o<1)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=o}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(_p.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case Qe.CONNECT:return Lc(n);case Qe.DISCONNECT:return n===void 0;case Qe.CONNECT_ERROR:return typeof n=="string"||Lc(n);case Qe.EVENT:case Qe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&k_.indexOf(n[0])===-1);case Qe.ACK:case Qe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class CB{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=bB(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function xB(e){return typeof e=="string"}const D_=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function wB(e){return e===void 0||D_(e)}function Lc(e){return Object.prototype.toString.call(e)==="[object Object]"}function AB(e,t){switch(e){case Qe.CONNECT:return t===void 0||Lc(t);case Qe.DISCONNECT:return t===void 0;case Qe.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&k_.indexOf(t[0])===-1);case Qe.ACK:return Array.isArray(t);case Qe.CONNECT_ERROR:return typeof t=="string"||Lc(t);default:return!1}}function SB(e){return xB(e.nsp)&&wB(e.id)&&AB(e.type,e.data)}const kB=Object.freeze(Object.defineProperty({__proto__:null,Decoder:_p,Encoder:_B,get PacketType(){return Qe},isPacketValid:SB,protocol:TB},Symbol.toStringTag,{value:"Module"}));function fr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const DB=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class O_ extends $t{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=[fr(t,"open",this.onopen.bind(this)),fr(t,"packet",this.onpacket.bind(this)),fr(t,"error",this.onerror.bind(this)),fr(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(DB.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:Qe.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:Qe.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 Qe.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 Qe.EVENT:case Qe.BINARY_EVENT:this.onevent(t);break;case Qe.ACK:case Qe.BINARY_ACK:this.onack(t);break;case Qe.DISCONNECT:this.ondisconnect();break;case Qe.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:Qe.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:Qe.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 Us(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}Us.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};Us.prototype.reset=function(){this.attempts=0};Us.prototype.setMin=function(e){this.ms=e};Us.prototype.setMax=function(e){this.max=e};Us.prototype.setJitter=function(e){this.jitter=e};class zh extends $t{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,h1(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 Us({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||kB;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 hB(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=fr(n,"open",function(){r.onopen(),t&&t()}),a=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),t?t(o):this.maybeReconnectOnOpen()},s=fr(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(fr(t,"ping",this.onping.bind(this)),fr(t,"data",this.ondata.bind(this)),fr(t,"error",this.onerror.bind(this)),fr(t,"close",this.onclose.bind(this)),fr(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){f1(()=>{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 O_(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 lc(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=mB(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 zh(r,t):(ao[i]||(ao[i]=new zh(r,t)),l=ao[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(lc,{Manager:zh,Socket:O_,io:lc,connect:lc});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 m=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},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},N_=e=>e?F9(e):F9;function OB(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 Nn(){return Nn=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},Nn.apply(this,arguments)}class NB extends Error{constructor(t){super(t),this.name=void 0,this.name="SuprSendError"}}function Ea(){return Math.round(Date.now())}function ia(){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 ln=N_()(()=>({apiUrl:"https://inboxs.live",collectorApiUrl:"https://hub.suprsend.com",socketUrl:"https://betainbox.suprsend.com",pageSize:20})),IB={unseenCount:0,stores:{},activeStoreId:null,pageNumber:1,hasNext:!0,initialLoading:!1,fetchMoreLoading:!1,initialFetchTime:null},st=N_()(()=>IB);class PB{constructor(t){this.socket=void 0,this.config=void 0,this.config=t;const n=ln.getState();this.socket=lc(n.socketUrl,{transports:["websocket"],auth:{subscriber_id:this.config.subscriberId,distinct_id:this.config.distinctId,authorization:`${this.config.workspaceKey}:${ia()}`,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:Nn({},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:Nn({},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(m=>m.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(m=>m.n_id!==n.n_id)}else s.stores[o].notifications=d.notifications.map(m=>m.n_id===n.n_id?u.data:m);st.setState({stores:Nn({},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:Nn({},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=Ea();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,m=n==null||(a=n.query)==null?void 0:a.tags,g=n==null||(s=n.query)==null?void 0:s.categories,p=!d||o===d,y=!f||l===f;let v,T;return Array.isArray(m)&&m.length>0?m.forEach(_=>{u!=null&&u.includes(_)&&(v=!0)}):v=!0,Array.isArray(g)&&g.length>0?g.includes(c)&&(T=!0):T=!0,p&&v&&T&&y}_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}=ln.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}:${ia()}`}})}getNotifications(t,n,r=20,i){const{apiUrl:a}=ln.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}:${ia()}`}})}getNotificationDetails(t){const{apiUrl:n}=ln.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}:${ia()}`}})}markBellClicked(){const{apiUrl:t}=ln.getState(),n="/bell-clicked/",r=JSON.stringify({time:Ea(),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}:${ia()}`,"Content-Type":"application/json"}})}markAllRead(){const{apiUrl:t}=ln.getState(),n="/mark-all-read/",r=JSON.stringify({time:Ea(),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}:${ia()}`,"Content-Type":"application/json"}})}markNotificationClicked(t){const{collectorApiUrl:n}=ln.getState(),r={event:"$notification_clicked",env:this.config.workspaceKey,$insert_id:ia(),$time:Ea(),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}=ln.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}=ln.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}=ln.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 B9=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=ln.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 m;l||!l&&i.pageNumber===1?m=f.results:m=[...o.notifications,...f.results],i.stores[s].notifications=m,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:Nn({},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=Ea();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(m=>{m.n_id===l.n_id&&(m.seen_on=c,m.interacted_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Nn({},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=Ea();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=Ea();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(m=>{m.n_id===l.n_id&&(m.seen_on=c,f.unseenCount>0&&(f.unseenCount-=1))})}st.setState(Nn({},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(Nn({},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(Nn({},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 RB{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 B9(this),this.emitter=OB(),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 NB("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;ln.setState({pageSize:r})}}_setConfigStoreState(t){t&&(t!=null&&t.socketHost&&ln.setState({socketUrl:t.socketHost}),t!=null&&t.apiHost&&ln.setState({apiUrl:t.apiHost}),t!=null&&t.collectorHost&&ln.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]=Nn({},n)}),st.setState({stores:r,activeStoreId:this.stores[0].storeId})}else st.setState({stores:{[t]:Nn({},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 PB(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 B9(this)}}var M9=function(t){return t.reduce(function(n,r){var i=r[0],a=r[1];return n[i]=a,n},{})},L9=typeof window<"u"&&window.document&&window.document.createElement?Xt.useLayoutEffect:Xt.useEffect,bn="top",er="bottom",tr="right",Tn="left",Cp="auto",Sl=[bn,er,tr,Tn],Is="start",pl="end",FB="clippingParents",I_="viewport",so="popper",BB="reference",$9=Sl.reduce(function(e,t){return e.concat([t+"-"+Is,t+"-"+pl])},[]),P_=[].concat(Sl,[Cp]).reduce(function(e,t){return e.concat([t,t+"-"+Is,t+"-"+pl])},[]),MB="beforeRead",LB="read",$B="afterRead",jB="beforeMain",HB="main",UB="afterMain",zB="beforeWrite",qB="write",WB="afterWrite",VB=[MB,LB,$B,jB,HB,UB,zB,qB,WB];function Hr(e){return e?(e.nodeName||"").toLowerCase():null}function Bn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Na(e){var t=Bn(e).Element;return e instanceof t||e instanceof Element}function Qn(e){var t=Bn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function xp(e){if(typeof ShadowRoot>"u")return!1;var t=Bn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function KB(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];!Qn(a)||!Hr(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 GB(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},{});!Qn(i)||!Hr(i)||(Object.assign(i.style,o),Object.keys(a).forEach(function(l){i.removeAttribute(l)}))})}}const YB={name:"applyStyles",enabled:!0,phase:"write",fn:KB,effect:GB,requires:["computeStyles"]};function Fr(e){return e.split("-")[0]}var xa=Math.max,$c=Math.min,Ps=Math.round;function qh(){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 R_(){return!/^((?!chrome|android).)*safari/i.test(qh())}function Rs(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&Qn(e)&&(i=e.offsetWidth>0&&Ps(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Ps(r.height)/e.offsetHeight||1);var s=Na(e)?Bn(e):window,o=s.visualViewport,l=!R_()&&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 wp(e){var t=Rs(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 F_(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&xp(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function di(e){return Bn(e).getComputedStyle(e)}function ZB(e){return["table","td","th"].indexOf(Hr(e))>=0}function Qi(e){return((Na(e)?e.ownerDocument:e.document)||window.document).documentElement}function m1(e){return Hr(e)==="html"?e:e.assignedSlot||e.parentNode||(xp(e)?e.host:null)||Qi(e)}function j9(e){return!Qn(e)||di(e).position==="fixed"?null:e.offsetParent}function QB(e){var t=/firefox/i.test(qh()),n=/Trident/i.test(qh());if(n&&Qn(e)){var r=di(e);if(r.position==="fixed")return null}var i=m1(e);for(xp(i)&&(i=i.host);Qn(i)&&["html","body"].indexOf(Hr(i))<0;){var a=di(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 kl(e){for(var t=Bn(e),n=j9(e);n&&ZB(n)&&di(n).position==="static";)n=j9(n);return n&&(Hr(n)==="html"||Hr(n)==="body"&&di(n).position==="static")?t:n||QB(e)||t}function Ap(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Wo(e,t,n){return xa(e,$c(t,n))}function XB(e,t,n){var r=Wo(e,t,n);return r>n?n:r}function B_(){return{top:0,right:0,bottom:0,left:0}}function M_(e){return Object.assign({},B_(),e)}function L_(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var JB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,M_(typeof t!="number"?t:L_(t,Sl))};function eM(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,o=Fr(n.placement),l=Ap(o),u=[Tn,tr].indexOf(o)>=0,c=u?"height":"width";if(!(!a||!s)){var d=JB(i.padding,n),f=wp(a),m=l==="y"?bn:Tn,g=l==="y"?er:tr,p=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],y=s[l]-n.rects.reference[l],v=kl(a),T=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,_=p/2-y/2,C=d[m],w=T-f[c]-d[g],x=T/2-f[c]/2+_,S=Wo(C,x,w),N=l;n.modifiersData[r]=(t={},t[N]=S,t.centerOffset=S-x,t)}}function tM(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)||F_(t.elements.popper,i)&&(t.elements.arrow=i))}const nM={name:"arrow",enabled:!0,phase:"main",fn:eM,effect:tM,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Fs(e){return e.split("-")[1]}var rM={top:"auto",right:"auto",bottom:"auto",left:"auto"};function iM(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Ps(n*i)/i||0,y:Ps(r*i)/i||0}}function H9(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,m=f===void 0?0:f,g=s.y,p=g===void 0?0:g,y=typeof c=="function"?c({x:m,y:p}):{x:m,y:p};m=y.x,p=y.y;var v=s.hasOwnProperty("x"),T=s.hasOwnProperty("y"),_=Tn,C=bn,w=window;if(u){var x=kl(n),S="clientHeight",N="clientWidth";if(x===Bn(n)&&(x=Qi(n),di(x).position!=="static"&&o==="absolute"&&(S="scrollHeight",N="scrollWidth")),x=x,i===bn||(i===Tn||i===tr)&&a===pl){C=er;var B=d&&x===w&&w.visualViewport?w.visualViewport.height:x[S];p-=B-r.height,p*=l?1:-1}if(i===Tn||(i===bn||i===er)&&a===pl){_=tr;var $=d&&x===w&&w.visualViewport?w.visualViewport.width:x[N];m-=$-r.width,m*=l?1:-1}}var F=Object.assign({position:o},u&&rM),L=c===!0?iM({x:m,y:p},Bn(n)):{x:m,y:p};if(m=L.x,p=L.y,l){var O;return Object.assign({},F,(O={},O[C]=T?"0":"",O[_]=v?"0":"",O.transform=(w.devicePixelRatio||1)<=1?"translate("+m+"px, "+p+"px)":"translate3d("+m+"px, "+p+"px, 0)",O))}return Object.assign({},F,(t={},t[C]=T?p+"px":"",t[_]=v?m+"px":"",t.transform="",t))}function aM(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:Fr(t.placement),variation:Fs(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,H9(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,H9(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 sM={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:aM,data:{}};var cu={passive:!0};function oM(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=Bn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&u.forEach(function(c){c.addEventListener("scroll",n.update,cu)}),o&&l.addEventListener("resize",n.update,cu),function(){a&&u.forEach(function(c){c.removeEventListener("scroll",n.update,cu)}),o&&l.removeEventListener("resize",n.update,cu)}}const lM={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:oM,data:{}};var uM={left:"right",right:"left",bottom:"top",top:"bottom"};function uc(e){return e.replace(/left|right|bottom|top/g,function(t){return uM[t]})}var cM={start:"end",end:"start"};function U9(e){return e.replace(/start|end/g,function(t){return cM[t]})}function Sp(e){var t=Bn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function kp(e){return Rs(Qi(e)).left+Sp(e).scrollLeft}function dM(e,t){var n=Bn(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=R_();(u||!u&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:a,height:s,x:o+kp(e),y:l}}function fM(e){var t,n=Qi(e),r=Sp(e),i=(t=e.ownerDocument)==null?void 0:t.body,a=xa(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=xa(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),o=-r.scrollLeft+kp(e),l=-r.scrollTop;return di(i||n).direction==="rtl"&&(o+=xa(n.clientWidth,i?i.clientWidth:0)-a),{width:a,height:s,x:o,y:l}}function Dp(e){var t=di(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function $_(e){return["html","body","#document"].indexOf(Hr(e))>=0?e.ownerDocument.body:Qn(e)&&Dp(e)?e:$_(m1(e))}function Vo(e,t){var n;t===void 0&&(t=[]);var r=$_(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),a=Bn(r),s=i?[a].concat(a.visualViewport||[],Dp(r)?r:[]):r,o=t.concat(s);return i?o:o.concat(Vo(m1(s)))}function Wh(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function hM(e,t){var n=Rs(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 z9(e,t,n){return t===I_?Wh(dM(e,n)):Na(t)?hM(t,n):Wh(fM(Qi(e)))}function mM(e){var t=Vo(m1(e)),n=["absolute","fixed"].indexOf(di(e).position)>=0,r=n&&Qn(e)?kl(e):e;return Na(r)?t.filter(function(i){return Na(i)&&F_(i,r)&&Hr(i)!=="body"}):[]}function pM(e,t,n,r){var i=t==="clippingParents"?mM(e):[].concat(t),a=[].concat(i,[n]),s=a[0],o=a.reduce(function(l,u){var c=z9(e,u,r);return l.top=xa(c.top,l.top),l.right=$c(c.right,l.right),l.bottom=$c(c.bottom,l.bottom),l.left=xa(c.left,l.left),l},z9(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 j_(e){var t=e.reference,n=e.element,r=e.placement,i=r?Fr(r):null,a=r?Fs(r):null,s=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2,l;switch(i){case bn:l={x:s,y:t.y-n.height};break;case er:l={x:s,y:t.y+t.height};break;case tr:l={x:t.x+t.width,y:o};break;case Tn:l={x:t.x-n.width,y:o};break;default:l={x:t.x,y:t.y}}var u=i?Ap(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(a){case Is:l[u]=l[u]-(t[c]/2-n[c]/2);break;case pl:l[u]=l[u]+(t[c]/2-n[c]/2);break}}return l}function gl(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?FB:o,u=n.rootBoundary,c=u===void 0?I_:u,d=n.elementContext,f=d===void 0?so:d,m=n.altBoundary,g=m===void 0?!1:m,p=n.padding,y=p===void 0?0:p,v=M_(typeof y!="number"?y:L_(y,Sl)),T=f===so?BB:so,_=e.rects.popper,C=e.elements[g?T:f],w=pM(Na(C)?C:C.contextElement||Qi(e.elements.popper),l,c,s),x=Rs(e.elements.reference),S=j_({reference:x,element:_,strategy:"absolute",placement:i}),N=Wh(Object.assign({},_,S)),B=f===so?N:x,$={top:w.top-B.top+v.top,bottom:B.bottom-w.bottom+v.bottom,left:w.left-B.left+v.left,right:B.right-w.right+v.right},F=e.modifiersData.offset;if(f===so&&F){var L=F[i];Object.keys($).forEach(function(O){var P=[tr,er].indexOf(O)>=0?1:-1,M=[bn,er].indexOf(O)>=0?"y":"x";$[O]+=L[M]*P})}return $}function gM(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?P_:l,c=Fs(r),d=c?o?$9:$9.filter(function(g){return Fs(g)===c}):Sl,f=d.filter(function(g){return u.indexOf(g)>=0});f.length===0&&(f=d);var m=f.reduce(function(g,p){return g[p]=gl(e,{placement:p,boundary:i,rootBoundary:a,padding:s})[Fr(p)],g},{});return Object.keys(m).sort(function(g,p){return m[g]-m[p]})}function vM(e){if(Fr(e)===Cp)return[];var t=uc(e);return[U9(e),t,U9(t)]}function yM(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,m=n.flipVariations,g=m===void 0?!0:m,p=n.allowedAutoPlacements,y=t.options.placement,v=Fr(y),T=v===y,_=l||(T||!g?[uc(y)]:vM(y)),C=[y].concat(_).reduce(function(j,H){return j.concat(Fr(H)===Cp?gM(t,{placement:H,boundary:c,rootBoundary:d,padding:u,flipVariations:g,allowedAutoPlacements:p}):H)},[]),w=t.rects.reference,x=t.rects.popper,S=new Map,N=!0,B=C[0],$=0;$<C.length;$++){var F=C[$],L=Fr(F),O=Fs(F)===Is,P=[bn,er].indexOf(L)>=0,M=P?"width":"height",U=gl(t,{placement:F,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),D=P?O?tr:Tn:O?er:bn;w[M]>x[M]&&(D=uc(D));var X=uc(D),Z=[];if(a&&Z.push(U[L]<=0),o&&Z.push(U[D]<=0,U[X]<=0),Z.every(function(j){return j})){B=F,N=!1;break}S.set(F,Z)}if(N)for(var k=g?3:1,b=function(H){var z=C.find(function(Y){var re=S.get(Y);if(re)return re.slice(0,H).every(function(Q){return Q})});if(z)return B=z,"break"},q=k;q>0;q--){var R=b(q);if(R==="break")break}t.placement!==B&&(t.modifiersData[r]._skip=!0,t.placement=B,t.reset=!0)}}const EM={name:"flip",enabled:!0,phase:"main",fn:yM,requiresIfExists:["offset"],data:{_skip:!1}};function q9(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 W9(e){return[bn,tr,er,Tn].some(function(t){return e[t]>=0})}function bM(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,s=gl(t,{elementContext:"reference"}),o=gl(t,{altBoundary:!0}),l=q9(s,r),u=q9(o,i,a),c=W9(l),d=W9(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 TM={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:bM};function _M(e,t,n){var r=Fr(e),i=[Tn,bn].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,[Tn,tr].indexOf(r)>=0?{x:o,y:s}:{x:s,y:o}}function CM(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,s=P_.reduce(function(c,d){return c[d]=_M(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 xM={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:CM};function wM(e){var t=e.state,n=e.name;t.modifiersData[n]=j_({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const AM={name:"popperOffsets",enabled:!0,phase:"read",fn:wM,data:{}};function SM(e){return e==="x"?"y":"x"}function kM(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,m=f===void 0?!0:f,g=n.tetherOffset,p=g===void 0?0:g,y=gl(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),v=Fr(t.placement),T=Fs(t.placement),_=!T,C=Ap(v),w=SM(C),x=t.modifiersData.popperOffsets,S=t.rects.reference,N=t.rects.popper,B=typeof p=="function"?p(Object.assign({},t.rects,{placement:t.placement})):p,$=typeof B=="number"?{mainAxis:B,altAxis:B}:Object.assign({mainAxis:0,altAxis:0},B),F=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(x){if(a){var O,P=C==="y"?bn:Tn,M=C==="y"?er:tr,U=C==="y"?"height":"width",D=x[C],X=D+y[P],Z=D-y[M],k=m?-N[U]/2:0,b=T===Is?S[U]:N[U],q=T===Is?-N[U]:-S[U],R=t.elements.arrow,j=m&&R?wp(R):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:B_(),z=H[P],Y=H[M],re=Wo(0,S[U],j[U]),Q=_?S[U]/2-k-re-z-$.mainAxis:b-re-z-$.mainAxis,G=_?-S[U]/2+k+re+Y+$.mainAxis:q+re+Y+$.mainAxis,se=t.elements.arrow&&kl(t.elements.arrow),ae=se?C==="y"?se.clientTop||0:se.clientLeft||0:0,be=(O=F==null?void 0:F[C])!=null?O:0,Ce=D+Q-be-ae,Pe=D+G-be,je=Wo(m?$c(X,Ce):X,D,m?xa(Z,Pe):Z);x[C]=je,L[C]=je-D}if(o){var Fe,Be=C==="x"?bn:Tn,Xe=C==="x"?er:tr,nt=x[w],Je=w==="y"?"height":"width",me=nt+y[Be],de=nt-y[Xe],Te=[bn,Tn].indexOf(v)!==-1,ee=(Fe=F==null?void 0:F[w])!=null?Fe:0,fe=Te?me:nt-S[Je]-N[Je]-ee+$.altAxis,Ae=Te?nt+S[Je]+N[Je]-ee-$.altAxis:de,Se=m&&Te?XB(fe,nt,Ae):Wo(m?fe:me,nt,m?Ae:de);x[w]=Se,L[w]=Se-nt}t.modifiersData[r]=L}}const DM={name:"preventOverflow",enabled:!0,phase:"main",fn:kM,requiresIfExists:["offset"]};function OM(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function NM(e){return e===Bn(e)||!Qn(e)?Sp(e):OM(e)}function IM(e){var t=e.getBoundingClientRect(),n=Ps(t.width)/e.offsetWidth||1,r=Ps(t.height)/e.offsetHeight||1;return n!==1||r!==1}function PM(e,t,n){n===void 0&&(n=!1);var r=Qn(t),i=Qn(t)&&IM(t),a=Qi(t),s=Rs(e,i,n),o={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Hr(t)!=="body"||Dp(a))&&(o=NM(t)),Qn(t)?(l=Rs(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):a&&(l.x=kp(a))),{x:s.left+o.scrollLeft-l.x,y:s.top+o.scrollTop-l.y,width:s.width,height:s.height}}function RM(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 FM(e){var t=RM(e);return VB.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function BM(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function MM(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 V9={placement:"bottom",modifiers:[],strategy:"absolute"};function K9(){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 LM(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?V9:i;return function(o,l,u){u===void 0&&(u=a);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},V9,a),modifiersData:{},elements:{reference:o,popper:l},attributes:{},styles:{}},d=[],f=!1,m={state:c,setOptions:function(v){var T=typeof v=="function"?v(c.options):v;p(),c.options=Object.assign({},a,c.options,T),c.scrollParents={reference:Na(o)?Vo(o):o.contextElement?Vo(o.contextElement):[],popper:Vo(l)};var _=FM(MM([].concat(r,c.options.modifiers)));return c.orderedModifiers=_.filter(function(C){return C.enabled}),g(),m.update()},forceUpdate:function(){if(!f){var v=c.elements,T=v.reference,_=v.popper;if(K9(T,_)){c.rects={reference:PM(T,kl(_),c.options.strategy==="fixed"),popper:wp(_)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function($){return c.modifiersData[$.name]=Object.assign({},$.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var w=c.orderedModifiers[C],x=w.fn,S=w.options,N=S===void 0?{}:S,B=w.name;typeof x=="function"&&(c=x({state:c,options:N,name:B,instance:m})||c)}}}},update:BM(function(){return new Promise(function(y){m.forceUpdate(),y(c)})}),destroy:function(){p(),f=!0}};if(!K9(o,l))return m;m.setOptions(u).then(function(y){!f&&u.onFirstUpdate&&u.onFirstUpdate(y)});function g(){c.orderedModifiers.forEach(function(y){var v=y.name,T=y.options,_=T===void 0?{}:T,C=y.effect;if(typeof C=="function"){var w=C({state:c,name:v,instance:m,options:_}),x=function(){};d.push(w||x)}})}function p(){d.forEach(function(y){return y()}),d=[]}return m}}var $M=[lM,AM,sM,YB,xM,EM,DM,nM,TM],jM=LM({defaultModifiers:$M}),HM=typeof Element<"u",UM=typeof Map=="function",zM=typeof Set=="function",qM=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function cc(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(!cc(e[r],t[r]))return!1;return!0}var a;if(UM&&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(!cc(r.value[1],t.get(r.value[0])))return!1;return!0}if(zM&&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(qM&&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(HM&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!cc(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var WM=function(t,n){try{return cc(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 VM=gr(WM);var KM=[],GM=function(t,n,r){r===void 0&&(r={});var i=Xt.useRef(null),a={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||KM},s=Xt.useState({styles:{popper:{position:a.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=s[0],l=s[1],u=Xt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(m){var g=m.state,p=Object.keys(g.elements);px.flushSync(function(){l({styles:M9(p.map(function(y){return[y,g.styles[y]||{}]})),attributes:M9(p.map(function(y){return[y,g.attributes[y]]}))})})},requires:["computeStyles"]}},[]),c=Xt.useMemo(function(){var f={onFirstUpdate:a.onFirstUpdate,placement:a.placement,strategy:a.strategy,modifiers:[].concat(a.modifiers,[u,{name:"applyStyles",enabled:!1}])};return VM(i.current,f)?i.current||f:(i.current=f,f)},[a.onFirstUpdate,a.placement,a.strategy,a.modifiers,u]),d=Xt.useRef();return L9(function(){d.current&&d.current.setOptions(c)},[c]),L9(function(){if(!(t==null||n==null)){var f=r.createPopper||jM,m=f(t,n,c);return d.current=m,function(){m.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 Vh(){return Vh=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},Vh.apply(this,arguments)}function H_(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var YM=/^((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)-.*))$/,ZM=H_(function(e){return YM.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),QM=!1;function XM(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 JM(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 eL=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?!QM: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(JM(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=XM(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}(),en="-ms-",jc="-moz-",ut="-webkit-",U_="comm",Op="rule",Np="decl",tL="@import",z_="@keyframes",nL="@layer",rL=Math.abs,p1=String.fromCharCode,iL=Object.assign;function aL(e,t){return Qt(e,0)^45?(((t<<2^Qt(e,0))<<2^Qt(e,1))<<2^Qt(e,2))<<2^Qt(e,3):0}function q_(e){return e.trim()}function sL(e,t){return(e=t.exec(e))?e[0]:e}function ct(e,t,n){return e.replace(t,n)}function Kh(e,t){return e.indexOf(t)}function Qt(e,t){return e.charCodeAt(t)|0}function vl(e,t,n){return e.slice(t,n)}function Sr(e){return e.length}function Ip(e){return e.length}function du(e,t){return t.push(e),e}function oL(e,t){return e.map(t).join("")}var g1=1,Bs=1,W_=0,Cn=0,Lt=0,zs="";function v1(e,t,n,r,i,a,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:g1,column:Bs,length:s,return:""}}function oo(e,t){return iL(v1("",null,null,"",null,null,0),e,{length:-e.length},t)}function lL(){return Lt}function uL(){return Lt=Cn>0?Qt(zs,--Cn):0,Bs--,Lt===10&&(Bs=1,g1--),Lt}function Pn(){return Lt=Cn<W_?Qt(zs,Cn++):0,Bs++,Lt===10&&(Bs=1,g1++),Lt}function Br(){return Qt(zs,Cn)}function dc(){return Cn}function Dl(e,t){return vl(zs,e,t)}function yl(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 V_(e){return g1=Bs=1,W_=Sr(zs=e),Cn=0,[]}function K_(e){return zs="",e}function fc(e){return q_(Dl(Cn-1,Gh(e===91?e+2:e===40?e+1:e)))}function cL(e){for(;(Lt=Br())&&Lt<33;)Pn();return yl(e)>2||yl(Lt)>3?"":" "}function dL(e,t){for(;--t&&Pn()&&!(Lt<48||Lt>102||Lt>57&&Lt<65||Lt>70&&Lt<97););return Dl(e,dc()+(t<6&&Br()==32&&Pn()==32))}function Gh(e){for(;Pn();)switch(Lt){case e:return Cn;case 34:case 39:e!==34&&e!==39&&Gh(Lt);break;case 40:e===41&&Gh(e);break;case 92:Pn();break}return Cn}function fL(e,t){for(;Pn()&&e+Lt!==47+10;)if(e+Lt===42+42&&Br()===47)break;return"/*"+Dl(t,Cn-1)+"*"+p1(e===47?e:Pn())}function hL(e){for(;!yl(Br());)Pn();return Dl(e,Cn)}function mL(e){return K_(hc("",null,null,null,[""],e=V_(e),0,[0],e))}function hc(e,t,n,r,i,a,s,o,l){for(var u=0,c=0,d=s,f=0,m=0,g=0,p=1,y=1,v=1,T=0,_="",C=i,w=a,x=r,S=_;y;)switch(g=T,T=Pn()){case 40:if(g!=108&&Qt(S,d-1)==58){Kh(S+=ct(fc(T),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:S+=fc(T);break;case 9:case 10:case 13:case 32:S+=cL(g);break;case 92:S+=dL(dc()-1,7);continue;case 47:switch(Br()){case 42:case 47:du(pL(fL(Pn(),dc()),t,n),l);break;default:S+="/"}break;case 123*p:o[u++]=Sr(S)*v;case 125*p:case 59:case 0:switch(T){case 0:case 125:y=0;case 59+c:v==-1&&(S=ct(S,/\f/g,"")),m>0&&Sr(S)-d&&du(m>32?Y9(S+";",r,n,d-1):Y9(ct(S," ","")+";",r,n,d-2),l);break;case 59:S+=";";default:if(du(x=G9(S,t,n,u,c,i,o,_,C=[],w=[],d),a),T===123)if(c===0)hc(S,t,x,x,C,a,d,o,w);else switch(f===99&&Qt(S,3)===110?100:f){case 100:case 108:case 109:case 115:hc(e,x,x,r&&du(G9(e,x,x,0,0,i,o,_,i,C=[],d),w),i,w,d,o,r?C:w);break;default:hc(S,x,x,x,[""],w,0,o,w)}}u=c=m=0,p=v=1,_=S="",d=s;break;case 58:d=1+Sr(S),m=g;default:if(p<1){if(T==123)--p;else if(T==125&&p++==0&&uL()==125)continue}switch(S+=p1(T),T*p){case 38:v=c>0?1:(S+="\f",-1);break;case 44:o[u++]=(Sr(S)-1)*v,v=1;break;case 64:Br()===45&&(S+=fc(Pn())),f=Br(),c=d=Sr(_=S+=hL(dc())),T++;break;case 45:g===45&&Sr(S)==2&&(p=0)}}return a}function G9(e,t,n,r,i,a,s,o,l,u,c){for(var d=i-1,f=i===0?a:[""],m=Ip(f),g=0,p=0,y=0;g<r;++g)for(var v=0,T=vl(e,d+1,d=rL(p=s[g])),_=e;v<m;++v)(_=q_(p>0?f[v]+" "+T:ct(T,/&\f/g,f[v])))&&(l[y++]=_);return v1(e,t,n,i===0?Op:o,l,u,c)}function pL(e,t,n){return v1(e,t,n,U_,p1(lL()),vl(e,2,-2),0)}function Y9(e,t,n,r){return v1(e,t,n,Np,vl(e,0,r),vl(e,r+1,-1),r)}function ys(e,t){for(var n="",r=Ip(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function gL(e,t,n,r){switch(e.type){case nL:if(e.children.length)break;case tL:case Np:return e.return=e.return||e.value;case U_:return"";case z_:return e.return=e.value+"{"+ys(e.children,r)+"}";case Op:e.value=e.props.join(",")}return Sr(n=ys(e.children,r))?e.return=e.value+"{"+n+"}":""}function vL(e){var t=Ip(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 yL(e){return function(t){t.root||(t=t.return)&&e(t)}}var EL=function(t,n,r){for(var i=0,a=0;i=a,a=Br(),i===38&&a===12&&(n[r]=1),!yl(a);)Pn();return Dl(t,Cn)},bL=function(t,n){var r=-1,i=44;do switch(yl(i)){case 0:i===38&&Br()===12&&(n[r]=1),t[r]+=EL(Cn-1,n,r);break;case 2:t[r]+=fc(i);break;case 4:if(i===44){t[++r]=Br()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=p1(i)}while(i=Pn());return t},TL=function(t,n){return K_(bL(V_(t),n))},Z9=new WeakMap,_L=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&&!Z9.get(r))&&!i){Z9.set(t,!0);for(var a=[],s=TL(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]}}},CL=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function G_(e,t){switch(aL(e,t)){case 5103:return ut+"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 ut+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ut+e+jc+e+en+e+e;case 6828:case 4268:return ut+e+en+e+e;case 6165:return ut+e+en+"flex-"+e+e;case 5187:return ut+e+ct(e,/(\w+).+(:[^]+)/,ut+"box-$1$2"+en+"flex-$1$2")+e;case 5443:return ut+e+en+"flex-item-"+ct(e,/flex-|-self/,"")+e;case 4675:return ut+e+en+"flex-line-pack"+ct(e,/align-content|flex-|-self/,"")+e;case 5548:return ut+e+en+ct(e,"shrink","negative")+e;case 5292:return ut+e+en+ct(e,"basis","preferred-size")+e;case 6060:return ut+"box-"+ct(e,"-grow","")+ut+e+en+ct(e,"grow","positive")+e;case 4554:return ut+ct(e,/([^-])(transform)/g,"$1"+ut+"$2")+e;case 6187:return ct(ct(ct(e,/(zoom-|grab)/,ut+"$1"),/(image-set)/,ut+"$1"),e,"")+e;case 5495:case 3959:return ct(e,/(image-set\([^]*)/,ut+"$1$`$1");case 4968:return ct(ct(e,/(.+:)(flex-)?(.*)/,ut+"box-pack:$3"+en+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ut+e+e;case 4095:case 3583:case 4068:case 2532:return ct(e,/(.+)-inline(.+)/,ut+"$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(Sr(e)-1-t>6)switch(Qt(e,t+1)){case 109:if(Qt(e,t+4)!==45)break;case 102:return ct(e,/(.+:)(.+)-([^]+)/,"$1"+ut+"$2-$3$1"+jc+(Qt(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Kh(e,"stretch")?G_(ct(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Qt(e,t+1)!==115)break;case 6444:switch(Qt(e,Sr(e)-3-(~Kh(e,"!important")&&10))){case 107:return ct(e,":",":"+ut)+e;case 101:return ct(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ut+(Qt(e,14)===45?"inline-":"")+"box$3$1"+ut+"$2$3$1"+en+"$2box$3")+e}break;case 5936:switch(Qt(e,t+11)){case 114:return ut+e+en+ct(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ut+e+en+ct(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ut+e+en+ct(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ut+e+en+e+e}return e}var xL=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case Np:t.return=G_(t.value,t.length);break;case z_:return ys([oo(t,{value:ct(t.value,"@","@"+ut)})],i);case Op:if(t.length)return oL(t.props,function(a){switch(sL(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ys([oo(t,{props:[ct(a,/:(read-\w+)/,":"+jc+"$1")]})],i);case"::placeholder":return ys([oo(t,{props:[ct(a,/:(plac\w+)/,":"+ut+"input-$1")]}),oo(t,{props:[ct(a,/:(plac\w+)/,":"+jc+"$1")]}),oo(t,{props:[ct(a,/:(plac\w+)/,en+"input-$1")]})],i)}return""})}},wL=[xL],AL=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(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var i=t.stylisPlugins||wL,a={},s,o=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),v=1;v<y.length;v++)a[y[v]]=!0;o.push(p)});var l,u=[_L,CL];{var c,d=[gL,yL(function(p){c.insert(p)})],f=vL(u.concat(i,d)),m=function(y){return ys(mL(y),f)};l=function(y,v,T,_){c=T,m(y?y+"{"+v.styles+"}":v.styles),_&&(g.inserted[v.name]=!0)}}var g={key:n,sheet:new eL({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},Yh={exports:{}},ht={};/** @license React v16.13.1
143
143
  * react-is.production.min.js
package/index.mjs CHANGED
@@ -24381,7 +24381,7 @@ const LR = ({
24381
24381
  return;
24382
24382
  }
24383
24383
  const o = MR(new FormData(e.form.current)), s = Object.assign(o, t);
24384
- await n(s), sessionStorage.setItem(d4.SESSION_STORAGE.EMAIL, o.email), r && r({ ...o, ...a.values }), i([{ type: "showSuccessMessage", value: !0 }]);
24384
+ await n(s), sessionStorage.setItem(d4.SESSION_STORAGE.EMAIL, o.email), r && r({ ...o, shouldManuallyApprove: a.shouldManuallyApprove }), i([{ type: "showSuccessMessage", value: !0 }]);
24385
24385
  }, jR = ({
24386
24386
  shouldShow: e,
24387
24387
  placeholders: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "10.5.2",
3
+ "version": "10.5.3",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {