@apolitical/component-library 3.3.4 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -34,7 +34,7 @@ Please explain why you're reporting this post. Reasons could include: inappropri
|
|
|
34
34
|
|
|
35
35
|
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progress_tracker_steps:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},si={...tt,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},ii={...tt,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},oi={...tt,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},ci=Object.freeze(Object.defineProperty({__proto__:null,en:tt,es:si,fr:ii,pt:oi},Symbol.toStringTag,{value:"Module"})),tn=(t,e=tt)=>t in e,je=(t,e,n,r,s={})=>{let i="";return tn(`${e}_${n}`)?i=t({id:`${e}_${n}`},s):i=t({id:e},{[r]:n,...s}),i},li=(t,e,n)=>{if(!t||t===0)return"0";e||(e=0),n||(n=["k","m","b","t"]);let r=t.toString();e=Math.pow(10,e);for(let s=n.length-1;s>=0;s--){const i=Math.pow(10,(s+1)*3);if(i<=t){t=Math.round(t*e/i)/e,t===1e3&&s<n.length-1&&(t=1,s++),r=`${t}${n[s]}`;break}}return r},It=(t,e)=>h.Children.map(t,n=>Object.is(n,null)?n:h.cloneElement(n,{...e})),ka=(t=0)=>{setTimeout(()=>{const e=document.querySelector(".splash-screen");e&&e.remove(),window.prerenderReady=!0},t)},ui=t=>t.replace(/\s+/g,"").length>0,qn=t=>{const e=t.length>8,n=/[0-9]/.test(t)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(t),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(t);return{isValid:e&&n&&r,matchingRules:{isMoreThanEightCharacters:e,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}},re=({variant:t="primary",size:e="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:s=!1,element:i="button",onClick:o=!1,className:c="",disabled:f=!1,screenreaderText:l=!1,children:u=!1,...d})=>{const p=et(typeof e=="object");if(typeof e=="object"&&typeof p=="number"){const _=Object.assign({},e),b=ga(Object.keys(_));e=va(p,b,_)}const v=[];typeof e=="string"&&v.push(e),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const x={...d,className:C(t,c,v,{"no-text":!u,disabled:f,button:s}),onClick:_=>{(!s||s[0]==="#")&&o&&(_.preventDefault(),_.stopPropagation()),o&&o(_)},disabled:typeof f=="object"&&"isClickable"in f?!f.isClickable:f};return s&&(i="a",x.href=s),h.createElement(i,x,u||(l?a.jsx(he,{showOnFocus:!1,children:l}):null))},nt=({buttons:t,className:e="",...n})=>{const r=t.length>1?"ul":"p",s=t.map((i,o)=>r==="p"?a.jsx(re,{...i},o):a.jsx("li",{children:a.jsx(re,{...i})},o));return h.createElement(r,{className:C("button-wrapper",e),...n,children:s})};const Ee=({className:t="",maxWidth:e=!1})=>{const n=e?{"--max-width":`${e/16}rem`}:{};return a.jsx("hr",{className:C(t,{"has-max-width":e}),style:n})},Sr={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},di=({aspect:t,range:e,sizes:n})=>{const{range:r,sizes:s}=t?Sr[t]:Sr.fallback;return{range:e&&e.length>0?e:r,sizes:n||s}},fi=({format:t,height:e,query:n,width:r})=>{let s=`w=${r}&h=${e}`;return s=t?`${s}&fm=${t}`:s,s=n?`${s}&${n}`:s,s},gn=({format:t,range:e,url:n,query:r})=>e.map(({height:s,width:i})=>`${n}?${fi({format:t,height:s,query:r,width:i})} ${i}w`).join(", ");const rt=({image:t,className:e,testId:n})=>{const{description:r,height:s,type:i,query:o,url:c,width:f,loading:l,decoding:u,fetchPriority:d}=t,{range:m,sizes:p}=di(t),v=gn({format:"avif",query:o,range:m,url:c}),x=gn({format:"webp",query:o,range:m,url:c}),_=gn({format:"",query:o,range:m,url:c});return a.jsxs("picture",{className:e,children:[i!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:v,sizes:p,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:x,sizes:p,"data-testid":"source"}),a.jsx("img",{srcSet:_,sizes:p,src:c,alt:r,loading:l||"lazy",decoding:u||"async",fetchpriority:d||"auto",width:f,height:s,"data-testid":n||"image"})]})};const mi=({image:t,className:e,testId:n})=>a.jsx("div",{className:`image-container ${e}`,"data-testid":n||"image-container",children:t&&a.jsx(rt,{image:{...t},className:"image"})}),We=({href:t,children:e,fallbackElement:n,className:r="",onClick:s,gtmContext:i,gtmType:o,...c})=>{if(t){const f={...c};return s&&(f.onClick=s),i&&(f["data-gtm-event-context"]=i),o&&(f["data-gtm-event-type"]=o),a.jsx("a",{href:t,className:C("gtm-trackable",r),...f,children:e})}return n?h.createElement(n,{children:e,className:r,...c}):a.jsx(a.Fragment,{children:e})};const pi=({currentStep:t=1,steps:e=1})=>a.jsxs(a.Fragment,{children:[a.jsx(he,{children:a.jsx(O.FormattedMessage,{id:"progress_tracker_steps",values:{currentStep:t,total:e}})}),a.jsx("div",{className:"progress-tracker",children:a.jsx("div",{className:"dots-wrapper",children:new Array(e).fill("").map((n,r)=>{const s=r+1;return a.jsxs("div",{className:"dot-wrapper",children:[a.jsx("div",{className:C("dot",{active:s===t,completed:s<t}),"data-testid":"progress-dot"}),a.jsx("div",{className:C("line",{active:s<t})})]},r)})})})]});const hi=({elementId:t,offset:e=20})=>{const n=O.useIntl(),r=()=>{const s=document.getElementById(t);if(!s)return;const i=document.getElementById("header");i&&window.scrollTo({top:s.offsetTop-i.clientHeight-e})};return a.jsx(re,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})},Cr=300,Nr="ease-in-out";class gi{constructor(e){this.el=e,this.summary=e.querySelector("summary"),this.content=e.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",e=>this.onClick(e))}onClick(e){e.preventDefault(),e.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const e=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[e,n]},{duration:Cr,easing:Nr}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const e=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[e,n]},{duration:Cr,easing:Nr}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(e){this.el.open=e,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const nn=({label:t=!1,className:e="",children:n,shouldAnimate:r=!1})=>{const s=O.useIntl(),i=h.useRef(null);return h.useEffect(()=>{let o;return r&&(o=new gi(i.current)),()=>{r&&o&&o.cleanUp()}},[]),a.jsxs("details",{ref:i,className:C("collapsible-section",e,{"should-animate":r}),children:[a.jsx("summary",{children:t||s.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})},$r={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},vi=t=>{let e=t;return Object.keys($r).includes(t)&&(e=$r[t]),`url(${Fe}icons/${e}.svg)`};const Mr={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub"},ja=({contentType:t,customIcon:e,customLabel:n,className:r=""})=>{const s=O.useIntl(),i=e?{"--custom-icon":vi(e)}:{},o=tn(`contentTypeLabel_${t}`)?s.formatMessage({id:`contentTypeLabel_${t}`}):!1;return!n&&!o?null:a.jsx("small",{className:C("content-type-label text-small",t in Mr?Mr[t]:t,r,{"has-custom-icon":e}),style:i,"data-testid":"content-type-label",children:n||o})};const Te=({variant:t="primary",icon:e,styling:n={},className:r="",children:s,...i})=>{const{showHighlight:o=!1,background:c="default"}=n,f=e?{"--icon":`url(${Fe}icons/${e}.svg)`}:{};return a.jsx("div",{className:C("highlighted-text-box",t,r,{"has-icon":e,"show-highlight":o,[c]:c!=="default"}),style:f,...i,children:s})};const De=({variant:t="empty",text:e=!1,button:n=!1,className:r=""})=>{let s=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,o=et(i);if(i&&typeof n=="object"&&typeof o=="number"){const d=Object.assign({},n.breakpoints),m=ga(Object.keys(d));s=va(o,m,d)}const{breakpoints:c,text:f="",component:l,...u}=n;return a.jsx(Te,{variant:"subtle",className:C("empty-state-box",t,r),children:a.jsxs(a.Fragment,{children:[e&&typeof e=="string"?a.jsx(Pe,{options:{forceBlock:!0},children:e}):e,s&&typeof n=="object"&&(l||a.jsx(re,{...u,variant:n.variant?n.variant:"secondary",children:f}))]})})};const Un=({children:t,...e})=>a.jsx("p",{...e,children:t}),Ta={q:Un,blockquote:Un};for(let t=1;t<=6;t++)Ta[`h${t}`]={component:Un,props:{className:"title"}};const Ea=({type:t="default",className:e="",heading:n=!1,children:r})=>a.jsxs("div",{className:C("helper-text-box text-small",t,e),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(Pe,{options:{wrapper:h.Fragment,forceBlock:!0,overrides:Ta},children:r}):a.jsx("p",{children:r})]});const bi=({className:t="",show:e=!1,hide:n=!1,text:r,children:s})=>{const i=O.useIntl(),o=h.useRef(null),[c,f]=h.useState(""),[l,u]=h.useState("closed");h.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",d),()=>{p.removeEventListener("transitionend",d)}},[]),h.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
|
|
36
36
|
`);f(p.length<3?`${r.substring(0,400)}...`:p.slice(0,3).join(`
|
|
37
|
-
`))},[r]),h.useEffect(()=>{l==="ready-to-close"&&u("closing")},[l]);const d=({propertyName:p})=>{p==="max-height"&&u(v=>v==="opening"?"open":v==="closing"?"closed":v)};if(!r)return null;const m=["opening","open"].includes(l);return a.jsxs(Te,{variant:"subtle",className:C("hide-show-text-box",t),children:[a.jsxs("div",{ref:o,className:C("content",l),children:[a.jsx(Pe,{options:{forceBlock:!0},children:l==="closed"?c:r}),l!=="closed"&&s]}),a.jsx("p",{className:"cta",children:a.jsx(re,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:C({"rotate-180":m}),onClick:()=>{u(m?"ready-to-close":"opening")},children:m?n||i.formatMessage({id:"hideShowTextBox_hide"}):e||i.formatMessage({id:"hideShowTextBox_show"})})})]})};const yi=({element:t="ul",layout:e="vertical",variant:n="default",items:r=[],styling:s={},className:i=""})=>{const{hasBorder:o=!1,zebraStriping:c=!1}=s;return h.createElement(t,{className:C("icon-bulleted-list text-medium",n,i,{"has-border":o,"has-zebra-stripes":c,[e]:t!=="dl"}),children:r.map((f,l)=>{const u={wrapper:h.Fragment,forceInline:!0},d={"--icon":`url(${Fe}icons/${f.icon}.svg)`};return t==="dl"?a.jsxs(h.Fragment,{children:[a.jsx("dt",{style:d,children:a.jsx(Pe,{options:u,children:f.dt||""})},`dt-${l}`),a.jsx("dd",{children:typeof f.text=="string"?a.jsx(Pe,{options:u,children:f.text}):f.text},`dd-${l}`)]},`dl-${l}`):a.jsx("li",{style:d,children:typeof f.text=="string"?a.jsx(Pe,{options:u,children:f.text}):f.text},l)})})},ve=()=>h.Fragment,_i=({children:t})=>a.jsx(Te,{variant:"secondary",children:t}),xi=({children:t})=>typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{className:"center",children:t}):a.jsx("div",{className:"center",children:t}),wi=["span","strong","h1","h2","h3","h4","h5","h6","p"],ki=({children:t})=>{const e=O.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of h.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number"))if(h.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of h.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&h.isValidElement(o)){const c=o.type;if(wi.includes(c)){for(n=o.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const s=n?n.toString():"";return a.jsx(nn,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},ji=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(Te,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(Te,{variant:"primary",children:t});case"pink-textbox":return a.jsx(Te,{variant:"tertiary",children:t});case"content":return typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{children:t}):t;default:return a.jsx("div",{...e,children:t})}return a.jsx("div",{...e,children:t})},Ti=t=>{const e=O.useIntl(),n=Date.now().toString();let r="default";const s=t.src;return s.includes("youtube")||s.includes("vimeo")?r="video":s.includes("riddle")||s.includes("sli.do")?r="poll":s.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(he,{children:a.jsx("a",{href:`#content-after-iframe-${n}`,children:e.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),a.jsx("iframe",{...t,title:e.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},Pr=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},Ei=({children:t,...e})=>{let n={...e};e.href&&(e.href.includes("http:")||e.href.includes("https:"))&&!e.target&&(n.target="_blank");let r=t,s=!1;for(const i of h.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number")&&h.isValidElement(i)){const o=i.type;if(["button","center","span","strong"].includes(o)&&i.props&&i.props.children&&i.props.children[0])for((o==="button"||Pr(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!h.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Pr(r)==="button"&&(s=!0);else break}return s?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(re,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},Sa=({children:t})=>a.jsx("span",{children:t});const Si={default:{a:Ei,CollapsibleSection:nn,TextBox:Te,CaseStudy:_i,style:ve,details:ki,div:ji,iframe:Ti,center:xi},"text-only":{h1:ve,h2:ve,h3:ve,h4:ve,h5:ve,h6:ve,style:ve,details:ve,div:ve,TextBox:ve,CollapsibleSection:ve,CaseStudy:ve,blockquote:ve,iframe:ve,button:ve}},vt=({className:t="",options:e={},children:n,overrideType:r="default",styling:s={}})=>{const{highlightTitles:i=!1}=s;n=n.replace(/^<br\/?>/,"");const o={wrapper:h.Fragment,forceBlock:!0,overrides:Si[r]};return a.jsx("div",{className:C("markdown-text",t,{"highlight-titles":i}),children:a.jsx(Pe,{options:{...o,...e},children:n})})};const Ca=({maxWidth:t=!1,title:e,subtitle:n,children:r,className:s=""})=>{const i=t?{"--max-width":`${t/16}rem`}:{};return a.jsxs("section",{className:C("page-heading",s),children:[a.jsxs("div",{className:C("content",{"has-max-width":t}),style:i,children:[e&&e.text&&h.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&h.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const bt=({size:t="medium",variant:e="default",className:n="",children:r,...s})=>a.jsx("span",{className:C("pill",t,e,n),...s,children:r});const yt=({element:t="p",children:e=null,className:n="",...r})=>h.createElement(t,{...r,className:C("status-banner text-small",n),"aria-live":"assertive"},e);const Ci=({author:t,authorCite:e,content:n})=>a.jsxs("blockquote",{className:"testimonial-block",children:[a.jsx(Pe,{className:"testimonial",children:n}),t&&a.jsx("p",{className:"author text-small",children:t}),e&&a.jsx("p",{className:"author-cite text-small",children:a.jsx("cite",{children:e})})]}),Ni=h.memo(Ci);const $i=({items:t=[],selector:e="",className:n=""})=>{const r=O.useIntl(),[s,i]=h.useState(t);return h.useEffect(()=>{if(t.length)return;let o="";Array(6).fill(0).forEach((l,u)=>{o+=`${u>0?", ":""}${e} h${u+1}`});const f=Array.from(document.querySelectorAll(o)).filter(l=>l.id).map(l=>({id:l.id,text:l.textContent||""}));i(f)},[]),s&&s.length>0&&a.jsxs(Te,{variant:"subtle",className:C("table-of-contents",n),children:[a.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),a.jsx("nav",{children:a.jsx("ul",{children:s.map(({id:o,text:c})=>a.jsx("li",{children:a.jsx("a",{href:`#${o}`,children:c})},o))})})]})};const rn=({time:t,rangeTime:e,prependedText:n,appendedText:r,className:s=""})=>{const i=O.useIntl(),o="timeToComplete_";if(!t||typeof t!="number")return null;const c=u=>{const d=u/60,m=Math.floor(d),p=(d-m)*60,v=Math.round(p),x=`${i.formatMessage({id:`${o}hours`},{time:m})}${m>0&&v>0?", ":""}${i.formatMessage({id:`${o}minutes`},{time:v})}`;return{text:`${m>0?`${i.formatMessage({id:`${o}hours_short`},{time:m})} `:""}${v>0?i.formatMessage({id:`${o}minutes_short`},{time:v}):""}`,ariaText:x}};let{text:f,ariaText:l}=c(t);if(e){const{text:u,ariaText:d}=c(t+e);f=i.formatMessage({id:`${o}range`},{early:f,late:u}),l=i.formatMessage({id:`${o}range_aria`},{early:l,late:d})}return n&&(l=`${n} ${l}`,f=`${n} ${f}`),r&&(l=`${l} ${r}`,f=`${f} ${r}`),a.jsx("span",{className:C("time-to-complete",s),"aria-label":l,children:f})};let ot=!1;const Na=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=O.useIntl(),s=h.useRef(null),[i,o]=h.useState("hidden");h.useEffect(()=>{const f=s.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(ot!==!1&&clearTimeout(ot),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Qe(()=>{ot!==!1&&clearTimeout(ot);let f="open";t?o("opening"):(o("closing"),f="hidden"),ot=setTimeout(()=>{o(f)},300)},[t]),a.jsx("aside",{ref:s,className:C("tooltip text-medium",i,{loading:e}),hidden:i==="hidden",children:e?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const Mi=({className:t="",image:e,...n})=>e?(typeof e=="string"&&(e={width:1080,height:200,type:"image/png",url:e}),e.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],e.query="fit=thumb&f=center",a.jsx(rt,{...n,className:C("banner",t),image:{...e,aspect:"banner"}})):null;const Ae=({children:t,className:e="",styling:n={},...r})=>{const{background:s="default"}=n;return a.jsx("section",{className:C("full-width-section",e,{[s]:s!=="default"}),...r,children:t})};const Pi=({text:t,buttons:e,className:n=""})=>{const r=[];return e.forEach(s=>{r.push({href:s.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":s.eventContext||"Download",target:"_blank",children:s.text})}),a.jsx(Ae,{className:C("download-section",n),children:a.jsxs(a.Fragment,{children:[h.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(nt,{buttons:r})]})})};function $a({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const Ri=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:s,setShowModal:i})=>{const{formatMessage:o}=O.useIntl();return a.jsxs("div",{className:C("edit-section-placeholder",{"has-icon":!!t}),style:xa(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),s&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>$a({href:r,setShowModal:i}),children:n||o({id:"edit_section_placeholder_cta"})})]})},Fi=({children:t,className:e="",formProps:n,href:r,title:s,modalTitle:i,placeholder:o,showDivider:c=!0})=>{const[f,l]=h.useState(!1),u=typeof r=="string"||!!n,d=()=>l(!1);return a.jsxs("section",{className:C("edit-section",e),children:[n&&a.jsx(wt,{title:i||`Edit ${s}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:d},className:C("edit-section-modal"),children:a.jsx(xt,{...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 m=>{var p,v;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((v=n==null?void 0:n.functions)==null?void 0:v.onSuccess(m)),l(!1)},onCancel:d}})}),a.jsxs("div",{className:"edit-section-header",children:[a.jsx("h2",{className:"edit-section-header-title",children:s}),u&&a.jsx(re,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>$a({href:r,setShowModal:l}),children:"Edit"})]}),t||a.jsx(Ri,{...o,href:r,setShowModal:l,showEditButton:u}),c&&a.jsx(Ee,{})]})};const Oi=({title:t=!1,logos:e=[],styling:n={},className:r=""})=>{const s=e.length;if(s===0)return null;const i={element:typeof t=="object"?t.element:"h2",text:typeof t=="string"?t:typeof t=="object"?t.text:"",className:typeof t=="object"?t.className:""},{wrapLogos:o=!1,align:c="center",display:f="block"}=n;return a.jsxs("div",{className:C("logos",r,`align-${c}`,{[f]:f!=="block","wrap-logos":o}),children:[t&&h.createElement(i.element,{className:C("title",i.className)},i.text),a.jsx("ul",{className:C({"two-col":s===2||s===4,"three-col":s===5||s<=10&&s%3===0}),children:e.map(({logo:l,nameOfBusiness:u,link:d=!1,description:m=!1},p)=>{if(!l||!l.url)return null;const v=a.jsx("img",{src:l.url,width:l.width||"auto",height:l.height||"auto",alt:u});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:d?a.jsx("a",{href:d,target:"_blank",rel:"nofollow noreferrer noopener",children:v}):v}),m&&a.jsx("small",{children:m})]},window.btoa(`${l.url}_${p}`))})})]})};const Di=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ai=({className:t="",content:e,image:n,variant:r="default",spacing:s="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const f=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},u={};return f.forEach(d=>{if(!e[d]){u[d]=!1;return}if(!i[d]){if(typeof e[d]=="object"){u[d]=e[d];const{text:m,element:p}=e[d];if(p&&Di.includes(p.toLowerCase()))return;u[d]={text:m,element:l[d]};return}u[d]={text:e[d],element:l[d]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=d=>{d.preventDefault(),d.stopPropagation();const m=document.getElementById(o.link.substring(1));m&&m.scrollIntoView({behavior:"smooth"})}),a.jsx(Ae,{className:C("banner-section",r,s,t,{"has-image":n,"has-extra-spacing":s==="normal"&&u.eyebrow&&u.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[f.map(d=>{if(u[d]&&typeof u[d]=="object"){const{text:m,element:p=""}=u[d];return d==="text"?a.jsx(vt,{overrideType:"text-only",className:"text",children:m},d):h.createElement(p,{key:d,className:d},m)}return null}),c,o&&o.text&&o.link&&a.jsx(re,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(rt,{image:{...n,aspect:"banner"}})]})})},Ii=h.memo(Ai);const Li=({image:t,variant:e="default",children:n,className:r=""})=>{const s={};return t&&(s["--image"]=`url(${t})`),a.jsx(Ae,{className:C("custom-content-banner",e,r,{"has-image":t}),style:s,children:a.jsx("div",{className:"content-slim",children:n})})};const Bi=({alignImage:t="left",className:e,content:n,image:r})=>{const s=()=>typeof n=="string"?a.jsx(Pe,{children:n}):n;return a.jsxs(Ae,{className:C("highlight-section",e),children:[r&&a.jsx("div",{className:C("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(rt,{image:r})}),a.jsx("div",{className:C("highlight-container highlight-content-wrapper",{"no-image":!r}),children:a.jsx("div",{className:C("highlight-content",{"highlight-content-right":t==="left"}),children:s()})})]})},qi=h.memo(Bi);const Ui=({variant:t="primary",button:e=null,title:n,text:r,gtmContext:s})=>!n&&!r?null:a.jsxs("aside",{className:C("marketing-block",t),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),e&&a.jsx(re,{variant:"secondary",size:"medium",href:e.link,className:"gtm-trackable","data-gtm-event-context":s,"data-gtm-event-type":"learn-more-click",children:e.text})]}),Ma=({showDevTools:t=!0,children:e})=>{const n=new me.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(me.QueryClientProvider,{client:n,children:[e,t&&a.jsx(Zs.ReactQueryDevtools,{initialIsOpen:!1})]})};var Wi=h.createContext({client:At});function zi(t){var e=t.children,n=t.client,r=t.apiKey,s=t.options,i=h.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&s&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(At.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),At.init(r,s)),At)},[n,r]);return h.createElement(Wi.Provider,{value:{client:i}},e)}const Pa=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(zi,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:e.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!e.id}},children:t}):a.jsx(a.Fragment,{children:t}),Ra=({children:t,locale:e,messages:n})=>{const r=e||"en",s={...ci[r],...n||{}};return a.jsx(O.IntlProvider,{locale:r,messages:s,children:t})},Gn=h.createContext({}),Lt={en:"English",es:"Español",fr:"Français",pt:"Português"},Se=h.createContext({isLoading:!0});function an(){return h.useContext(Se)}const Fa=({children:t,user:e})=>a.jsx(Se.Provider,{value:e,children:t}),Zi=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[s,i]=h.useState({isLoading:!0}),o=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[c,f]=h.useState(o),l=u=>{localStorage.setItem("language",u),f(u)};return h.useEffect(()=>{t().then(u=>{i({...u,isLoading:!1}),ka(5e3)}).catch(()=>i({isLoading:!1}))},[]),a.jsx(Gn.Provider,{value:{language:c,updateLanguage:l},children:a.jsx(Ra,{locale:c,messages:n==null?void 0:n.messages,children:a.jsx(Vn.CookiesProvider,{children:a.jsx(Fa,{user:s,children:a.jsx(Ma,{showDevTools:r,children:a.jsx(Pa,{user:s,children:e})})})})})})};const Hi=({styling:t={},progress:e=0,text:n=!1,className:r=""})=>{const s=O.useIntl(),{showText:i=!1,layout:o="bar",size:c="default",color:f="default"}=t,l=e>75?100:e>50?75:e>25?50:e>5?25:0,u={"--progress":`${e}%`};return a.jsx("span",{className:C(`progress-bar section-${l}`,o,r,{[c]:c!=="default",[f!=="default"?f:""]:f!=="default"}),style:u,children:h.createElement(i?"span":he,{className:i?"text":"",children:n||s.formatMessage({id:"progressBar"},{number:e})})})},Qn=h.memo(Hi);const vn="loadingBlock_",Vi=({progress:t=0,steps:e=!1,className:n=""})=>{const r=O.useIntl();e||(e={0:{text:r.formatMessage({id:`${vn}loading`})},75:{text:r.formatMessage({id:`${vn}almostDone`})},100:{text:r.formatMessage({id:`${vn}complete`})}});let s=null;const i=Object.keys(e);for(let c=0;c<i.length&&!(t<parseInt(i[c]));c++)s=i[c];const o=s&&e[s].icon?{"--icon":`url(${Fe}icons/${e[s].icon}.svg)`}:{};return a.jsxs(Te,{className:C("loading-block",n,{"has-icon":s&&e[s].icon}),variant:"subtle",style:o,children:[s&&a.jsx("span",{className:"step",children:e[s].text}),a.jsx(Qn,{progress:t})]})},Yi=h.memo(Vi);const we=({element:t="div",className:e="",...n})=>a.jsx(en,{element:t,className:C("loading-placeholder",e),...n});const Wn={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Oa=(t,e)=>t in Wn?a.jsx("div",{className:t,children:Wn[t].map((n,r)=>Oa(n,r))},e):a.jsx(we,{className:t},e),Jn=({layout:t="overview-page",...e})=>a.jsx("div",{className:C("loading-state",t),...e,children:Wn[t].map((n,r)=>Oa(n,r))}),Da=t=>{const e=t&&t.toUpperCase().split(" ");return Array.isArray(e)&&e.length>1&&e[0]!==""?e[1]===""?e[0][0]:e[0][0]+e[e.length-1][0]:t?t.substr(0,1):""},Et=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Ki=t=>{const e=Math.ceil(26/Et.length),n=Da(t).toLowerCase();if(n==="")return Et[0];const r=n.charCodeAt(0)-96;for(let s=0;s<Et.length;s++)if(r<=e*(s+1))return Et[s]};const Rr=256,Ie=({className:t="",src:e="",name:n,alt:r,width:s=Rr,height:i=Rr,...o})=>{const[c,f]=h.useState(!1),l=h.useRef(null);h.useEffect(()=>{const d=l.current;if(!d)return;const m=d.getContext("2d");if(!m)return;const p=s,v=i;typeof window<"u"&&window.devicePixelRatio&&(d.width=p*window.devicePixelRatio,d.height=v*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Ki(n),m.fillRect(0,0,p,v),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Da(n),p/2,v/1.6)},[n]);let u=!1;return e&&e!==""&&!c&&(e.includes("http")||e.includes("//"))&&(u=!0),a.jsx("figure",{className:C("profile-picture",t,{error:c}),...o,children:u?a.jsx("img",{src:e,alt:r||n,onError:()=>{f(!0)},width:s,height:i}):a.jsx("canvas",{ref:l})})},Xn=t=>t==="apolitical"?{image:`${Fe}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${Fe}logos/member_community.svg`}:{name:t.name,role:t.jobTitle||"",organisation:t.organization||"",country:t.location&&t.location.country||"",url:`/profiles/${t.id}`,image:t.image&&t.image.thumbnail},Gi=({role:t="",organisation:e="",country:n="",maximumCharacters:r=80})=>{const s=t!=="",i=e!=="",o=n!=="";if(!s&&!i&&!o)return"";const c=`${t}${s&&i?` — ${e}`:e}`;let f=`${c}${(s||i)&&o?`, ${n}`:n}`;return f.length>r&&(f=c),f.length>r&&(f=Ge(f,r)),f};const sn=({element:t="div",member:e="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=O.useIntl(),c=Xn(e);c.name||(c.name=o.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:f,url:l,image:u}=c,d=Gi(c),m=n&&n.createdAt?Bn(n.createdAt):!1,p=n&&n.createdAt?Kn(n.createdAt):"";return h.createElement(t,{className:C("member text-medium",i),children:a.jsxs(We,{href:l,gtmType:s,gtmContext:r,onClick:v=>{v==null||v.stopPropagation()},children:[a.jsx(Ie,{name:f,src:u}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:f}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&m&&a.jsx("span",{className:"date",title:p,"aria-label":p,children:o.formatMessage({id:`dates_${m.path}`},{number:m.number})}),n.didEdit&&a.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),d&&a.jsx("small",{children:d})]})]})})};const Fr={small:24,medium:48},er=({element:t="div",contributors:{total:e,data:n}={total:void 0,data:[]},styling:{showText:r,size:s,showGap:i,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,multipleText:f,className:l="",...u})=>{const d=O.useIntl();return!n||n.length===0?null:h.createElement(t,{...u,className:C("contributors",l,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((m,p)=>{let v,x="";if(p<c){const{name:_="",image:b=""}=Xn(m);if(o)return a.jsx(we,{element:"li",className:"contributor"},p);v=a.jsx(Ie,{name:_,src:b,width:Fr[s||"medium"],height:Fr[s||"medium"]})}else if(p===c){const _=(e||n.length)-c;v=a.jsxs("small",{className:C({"large-number":_>99}),children:["+",li(_,0)]}),x="number-left"}return v?a.jsx("li",{className:C("contributor",x),children:v},p):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?d.formatMessage({id:`member_${n[0]}`}):Ge(n[0].name||"",20):f||null})]})})};const St="emailHelperTextBox_",Aa=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const s=O.useIntl(),[i,o]=h.useState({path:`${St}default`,type:"default",link:{},mail:{},error:""}),[c,f]=h.useState(!1),l=h.useCallback(p=>{p.preventDefault(),p.stopPropagation();const v=x=>{o({path:`${St}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>l(_),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:x})};if(typeof r!="function"){v(s.formatMessage({id:`${St}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(x=>{v(x.message)}).finally(()=>{f(!1)})},[e,n,r]);h.useEffect(()=>{let p=St,v="default",x={},_={};switch(t){case"gov":p+="autoApproved",v="success";break;case"nonGov":p+="unrecognisedEmail",v="error",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",v="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",v="error",x={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>l(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",v="error",x={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...i,path:p,type:v,link:x,mail:_})},[t]);const u={};return["link","mail"].forEach(p=>{u[p]=Object.keys(i[p]).length?v=>a.jsx("a",{...i[p],children:v}):v=>v}),a.jsx(Ea,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(we,{element:"span"}),a.jsx(we,{element:"span"})]}):s.formatMessage({id:`${i.path}_text`},{...u,strong:p=>a.jsx("strong",{children:p}),em:p=>a.jsx("em",{children:p}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:i.error})})},pt=({className:t="",element:e="input",id:n,inputRef:r,functions:s={onChange:()=>{}},name:i=n,placeholder:o,type:c="text",value:f,...l})=>{const u=h.useRef(),d=r||u;return h.createElement(e,{ref:d,...l,type:c,id:n,name:i,className:C(t,e,{"has-scrollbar":c==="textarea"&&d.current&&d.current.clientHeight<d.current.scrollHeight}),value:f,placeholder:o,...s,onChange:m=>{const p=m.target;s.onChange(p.value)}})};const He={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Qi=500,Ji=({value:t,placeholder:e,functions:n={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})}})=>{const{onChange:r=()=>{},onKeyInput:s=async()=>{}}=n,[{input:i,displayInput:o,debouncedInput:c},f]=h.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:l,activePredictionIndex:u,isPredictionSelected:d},m]=h.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=O.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),h.useEffect(()=>{const b=setTimeout(()=>{d||f(y=>({...y,debouncedInput:i}))},Qi);return()=>{clearTimeout(b)}},[i,d]),h.useEffect(()=>{c&&!d?(async()=>{try{const y=await s(c)||[];m(j=>({...j,predictions:y}))}catch(y){console.error("Error fetching predictions:",y),m(j=>({...j,predictions:[]}))}})():m(b=>({...b,predictions:[]}))},[c,d]),h.useEffect(()=>{u>=0&&l[u]&&f(b=>({...b,displayInput:l[u].description}))},[u,l]);const v=b=>{[He.DOWN,He.UP,He.ENTER].includes(b.key)&&(b.preventDefault(),b.key===He.DOWN&&u<l.length-1?m(y=>({...y,activePredictionIndex:u+1})):b.key===He.UP&&u>0?m(y=>({...y,activePredictionIndex:u-1})):b.key===He.ENTER&&u>-1&&(r(l[u].description),f(y=>({...y,input:l[u].description})),m(y=>({...y,predictions:[],isPredictionSelected:!0}))))},x=b=>{r(b.target.value),f(y=>({...y,input:b.target.value,displayInput:b.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},_=b=>{r(b.description),f(y=>({...y,input:b.description,displayInput:b.description})),m(y=>({...y,isPredictionSelected:!0,predictions:[]}))};return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:o,onChange:x,onKeyDown:v,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:l.map((b,y)=>a.jsx("li",{onClick:()=>_(b),onMouseEnter:()=>m(j=>({...j,activePredictionIndex:y})),className:C("predictions-list-item",{active:y===u}),children:b.description},y))})]})};const Ia=({className:t="",disabled:e,element:n="p",functions:r={onChange:()=>{}},id:s,inputRef:i,intlPath:o=!1,label:c,shownValue:f=!0,type:l="checkbox",value:u,...d})=>{const m=O.useIntl(),{onChange:p,...v}=r,x=()=>{e||p(u?null:f)},_=a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:i,id:s,name:s,type:l,value:f,checked:u,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),x())},readOnly:!0,disabled:e}),a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("label",{htmlFor:s,children:c||m.formatMessage({id:o?`${o}_${s}`:s})})]});return h.createElement(n,{onClick:b=>{const y=b.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),x())},className:C("checkbox-wrapper",t),...d,...v},_)};const Xi=h.memo(function({direction:e="down"}){return a.jsx(en,{className:C("rotating-chevron",`direction-${e}`)})});const eo=({className:t,options:e,initialValue:n,value:r,functions:s={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:o,multiSelect:c,multiSelectOptions:f,id:l})=>{const u=O.useIntl(),[d,m]=h.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[x,_]=h.useState(v);let b;Array.isArray(x)&&x.length===1&&typeof x[0]=="string"?b=e&&x?e.find(F=>F.id===x[0]):e?e[0]:{id:"",label:""}:Array.isArray(x)&&x.length===1&&typeof x[0]!="string"?b=x[0]:b={id:"",label:""},h.useEffect(()=>{_(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:j,...T}=s,w=F=>{if(c){let V=[];x!=null&&x.includes(F.id)?V=x.filter(R=>R!==F.id):V=[...x,F.id],_([...V]),y&&y([...V])}else _([F]),y&&y(F.id),m(!1)},L=F=>{if(F==="all"){const V=(e==null?void 0:e.map(R=>R.id))||[];_(V),y&&y(V)}else _([]),y&&y([])};return a.jsxs("div",{className:C("dropdown-wrapper",t),children:[a.jsxs("button",{className:"input","aria-expanded":d,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:F=>{F.preventDefault(),F.stopPropagation(),m(!d)},"data-testid":"dropdown-selector",...T,children:[c?`${o} · ${x.length}`:b.label,a.jsx(Xi,{direction:d?"up":"down"})]}),a.jsx("select",{defaultValue:b.id,onChange:F=>{F.preventDefault(),F.stopPropagation();const V=e&&e.find(R=>R.id===F.target.value);w(V)},hidden:!d,...T,children:e==null?void 0:e.map(F=>a.jsx("option",{value:F.id,children:F.label},F.id))}),a.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!d,children:[a.jsxs("div",{className:"dropdown-menu-list",children:[(f==null?void 0:f.topbar)&&a.jsxs("div",{className:"action-bar",children:[a.jsx("p",{children:`${x==null?void 0:x.length} selected`}),a.jsxs("ul",{children:[a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>L("all"),className:"gtm-trackable",children:u.formatMessage({id:"dropdown_menu_multiselect_all"})})}),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>L("none"),className:"gtm-trackable",children:u.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),a.jsx("ul",{children:e==null?void 0:e.map(F=>{const V=F.id===b.id||(x==null?void 0:x.includes(F))||(x==null?void 0:x.includes(F.id));return a.jsx("li",{"data-testid":"dropdown-options",children:a.jsxs("button",{className:C("gtm-trackable",{selected:V,"selected-single":V&&!c}),"data-gtm-event-type":`${F}-click`,"data-gtm-event-context":i,onClick:R=>{R.preventDefault(),R.stopPropagation(),w(F)},role:"menuitem","aria-current":V,"data-testid":V?"current-selection":"",children:[c&&a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("span",{className:C({"menu-option-label":c}),children:F.label})]})},F.id)})})]}),(f==null?void 0:f.submitSection)&&a.jsx("p",{className:"submit",children:a.jsx(re,{variant:"secondary",onClick:()=>{j&&j(x),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:x}})),m(!1)},children:u.formatMessage({id:"form_submit"})})})]})]})};const to=({className:t="",functions:e={onChange:()=>{}},intlPath:n=!1,id:r,label:s,multiSelect:i=!1,name:o,options:c,required:f,type:l="checkboxes",value:u,...d})=>{const m=O.useIntl(),p=i?u:[],v=u;return a.jsx("ul",{...d,className:C("options-wrapper",t),"data-testid":`ul-${r}`,children:c==null?void 0:c.map(({id:x,label:_=!1,value:b=x,disabled:y=!1})=>{const j=`${r}_${x}`,T=()=>{if(y)return;let w;if(i){const L=p==null?void 0:p.indexOf(b);Array.isArray(p)&&L>=0?(w=p,w.splice(L,1)):(!p||p.length===0?w=[]:w=p,w.push(b))}else w=v===b?void 0:b;e.onChange(w)};return a.jsx(Ia,{element:"li",id:j,type:l==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):v===b,functions:{...e,onChange:T},intlPath:n,label:_||m.formatMessage({id:n?`${n}_${x}`:x}),disabled:y},j)})})};const no=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const s=O.useIntl(),i=h.useRef(),o=t||i,[c,f]=h.useState(!1),[l,u]=h.useState(e),d=()=>{var m;f(!c),u(c?"password":"text"),(m=o.current)==null||m.focus()};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:C("show-password gtm-trackable",{"password-visible":c}),"data-gtm-event-context":n,"data-gtm-event-type":`${c?"hide":"show"}-password-click`,onClick:d,"aria-label":s.formatMessage({id:`showpassword_aria_${c?"hide":"show"}`}),children:s.formatMessage({id:`showpassword_${c?"hide":"show"}`})}),a.jsx(pt,{inputRef:o,type:l,...r})]})};const Ve={text:{component:pt},email:{component:pt},textarea:{component:pt,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ia},checkboxes:{component:to,props:{multiSelect:!0}},select:{component:eo},password:{component:no},autocomplete:{component:Ji}},ro=({id:t,intlPath:e=!1,className:n="",error:r,functions:s={onChange:()=>{}},limit:i=0,showRequiredLabels:o=!0,type:c,validation:f,value:l,...u})=>{const d=O.useIntl(),m=f&&f.some(({condition:T})=>T==="required"),p=(l==null?void 0:l.toString().length)||0,v=c&&Ve[c]&&Ve[c].component?Ve[c].component:pt,x={};c&&["checkboxes"].includes(c)?x.element="span":x.htmlFor=t;let _={...u,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:mt(s),value:l};i>0&&(_["data-character-limit"]=i,_.functions&&(_.functions.onChange=T=>{((T==null?void 0:T.toString().length)||0)>i&&(T=T==null?void 0:T.toString().slice(0,i)),s.onChange(T)})),c&&Ve[c]&&Ve[c].props&&(_={..._,...Ve[c].props}),c&&["checkboxes"].includes(c)&&(_.intlPath=`${e}_${t}`),r&&(_["aria-invalid"]=!0,_["aria-describedby"]=`error-${t}`);const b=u.label||d.formatMessage({id:e?`${e}_${t}`:t}),y=({...T})=>r?h.createElement(T.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...T},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(v,{..._,label:b,className:C("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const j=T=>h.createElement(T.element||"label",{...T,className:"checkboxes-label text-small","data-testid":`label-${t}`});return a.jsxs("dl",{className:C("field-wrapper text-medium",n),children:[a.jsx("dt",{children:a.jsxs(j,{...x,children:[b,m&&o&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("small",{children:["(",d.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),a.jsxs("dd",{children:[a.jsx(v,{..._}),i>0?a.jsxs("small",{className:C("character-limit",{"near-limit":p>=.99*i,"approaching-limit":p>=.9*i&&p<.99*i}),children:[a.jsx("span",{className:"hidden",children:d.formatMessage({id:"form_fieldWrapper_characterLimit"})}),p," / ",i]}):null]}),a.jsx(y,{})]})},ao=(t,e)=>{const{type:n,payload:r}=e,s=t.errors?mt(t.errors):{},i=t.values?mt(t.values):{};switch(n){case"toggleSubmitting":return{...t,isSubmitting:!t.isSubmitting};case"updateValue":if(r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...t,errors:s,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...t,errors:s,values:i};case"addError":return r!=null&&r.key&&!s[r==null?void 0:r.key]&&(s[r==null?void 0:r.key]=r==null?void 0:r.value),{...t,errors:s};case"removeError":return r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],{...t,errors:s};case"submitForm":{const{fields:o=[],dispatch:c=()=>{},onSuccess:f=()=>{},onFailure:l=()=>{},intl:u}=r,d=mt(Object.keys(s));for(const m of o)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:v="required",error:x=!1}=m.validation[p];let _=!1;if(typeof v=="function"){const b=v(i);b&&(_=x||b)}else{const b=i[m.id];switch(v){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(_){c({type:"addError",payload:{key:m.id,value:_}}),d.push(m.id);break}}return d.length===0?f(i):l(i,d),{...t,isSubmitting:!1}}case"formSubmitted":return{...t,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return t}};let bn=null;const xt=({fields:t,className:e="",id:n=t.length?`form__${t[0].id}`:"form",formRef:r,intlPath:s=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:{shouldShowCancelButton:c=!1,shouldReset:f=!0,showRequiredLabels:l=!0,showSuccessMessage:u=!1}={shouldShowCancelButton:!1,shouldReset:!0,showRequiredLabels:!0,showSuccessMessage:!1},gtm:d={context:"Form",event:"form-submit-click"},functions:{onSuccess:m=async()=>{},onCancel:p=()=>{},onCatch:v=()=>{},onFailure:x=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},..._})=>{const{customOnSubmit:b,hideButton:y,...j}=i,T=40,w=O.useIntl(),L={};t.length&&t.forEach(B=>{const H=B.id||B.name;H&&(L[H]=B.value||"")});const[F,V]=h.useReducer(ao,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:R,isSubmitting:A,formSubmitted:N,values:S}=F;h.useEffect(()=>{f&&N&&(bn=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[N]),h.useEffect(()=>()=>{bn&&clearTimeout(bn)},[]),h.useEffect(()=>{const B=H=>{V({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const k=h.useRef(null),$=r||k;if(!t.length)return null;i.text||(i.text=w.formatMessage({id:"form_submit"}));const z=[{...j,icon:N?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:B=>{var E;if(B.preventDefault(),B.stopPropagation(),A)return;let H=0;if((E=$==null?void 0:$.current)!=null&&E.id){const M=document.getElementById($.current.id);M&&(H=M.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(H=H-J.offsetHeight-T),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),V({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&V({type:"submitForm",payload:{fields:t,dispatch:V,intl:w}});return}V({type:"submitForm",payload:{fields:t,dispatch:V,onSuccess:async M=>{try{await m(M),V({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(Z){v(Z),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(M,Z)=>{x(M,Z),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:w}})},disabled:A||N||i.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:A||N?w.formatMessage({id:`form_${A?"submitting":"submitted"}`}):i.text}];return c&&z.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:A||N,onClick:p,children:o.text||w.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{..._,id:n,className:C("form",e),ref:$,children:[R!=null&&R.general?a.jsx(De,{variant:"error",text:w.formatMessage({id:"form_error_generalError"})}):null,(!A&&!N||b)&&t.map((B,H)=>{const{id:J=B.name||H,component:E,functions:M={onChange:()=>{}}}=B;if(E)return a.jsx(E,{...B.props||{}},`component-${J}-${H}`);const Z=S?S[J]:"";return a.jsx(ro,{intlPath:s,...B,showRequiredLabels:l,value:Z,error:R==null?void 0:R[J],functions:{...M,onChange:W=>{V({type:"updateValue",payload:{key:J,value:W}}),M.onChange(W&&W.toString(),V)}}},J)}),y?null:(A||N)&&b?b:a.jsx(nt,{className:C("cta",{center:A||N,submitted:N}),buttons:z})]}),u&&N&&a.jsx(yt,{className:"success",children:typeof u=="string"?u:w.formatMessage({id:"form_success"})})]})};const Ct="passwordRules_",La="isMoreThanEightCharacters",Ba="includesNumberAndSymbol",qa="includesLowerAndUppercase",so={[La]:"8Characters",[Ba]:"numberSymbol",[qa]:"lowercaseUppercase"},io=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=O.useIntl();return a.jsxs("aside",{className:C("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${Ct}intro`})}),a.jsx("ul",{children:[La,Ba,qa].map(r=>a.jsxs("li",{className:C({matches:t[r]}),children:[a.jsxs(he,{children:[n.formatMessage({id:`${Ct}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${Ct}rule_${so[r]}`})}),!t[r]&&a.jsxs(he,{element:"strong",children:[" ",n.formatMessage({id:`${Ct}notMet`})]})]},`rule-${r}`))})]})},Ua=h.memo(io);const oo=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=O.useIntl(),[f,l]=h.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const b=await n();l(y=>({...y,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){l(y=>({...y,setUp:!0,disabled:!0})),s(b)}};if(h.useEffect(()=>{o&&!f.setUp&&u()},[o]),!o)return a.jsx(we,{className:"rating-placeholder"});const{id:d,rating:m,disabled:p}=f,v="ratings_",x={text:c.formatMessage({id:`${v}text`}),low:c.formatMessage({id:`${v}low`}),high:c.formatMessage({id:`${v}high`}),success:c.formatMessage({id:`${v}success`}),...t},_=async b=>{if(!(!d||p))try{l(y=>({...y,rating:b,disabled:!0})),await r({id:d,value:b})}catch(y){l(j=>({...j,rating:null})),s(y)}finally{l(y=>({...y,disabled:!1}))}};return a.jsxs("div",{className:C("rating",i),children:[a.jsx("span",{className:"label",children:x[m?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(e).keys()).map(b=>{const y=b+1;return a.jsx("li",{className:C({selected:m&&y<=m}),children:a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:`star${!m||y>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${v}stars`},{number:y,total:e})}${y===1||y===e?` - ${x[y===1?"low":"high"]}`:""}`,onClick:j=>{j.preventDefault(),j.stopPropagation(),_(y)},disabled:p})},`rating-${y}`)})})]})};const co=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:s=()=>{}},isDisabled:i=!1,className:o=""})=>{const[c,f]=h.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);h.useEffect(()=>{r&&f(r)},[r]);const l=u=>{i||(f(u),s(u))};return a.jsxs("div",{className:C("toggle",o),onClick:u=>{u.preventDefault(),u.stopPropagation(),l(c===n[0].value?n[1].value:n[0].value)},children:[a.jsx("p",{children:e}),a.jsx("ul",{className:C("toggle-options",{disabled:i,on:c===n[1].value}),children:n.map(u=>{const d=`${t}-${u.value}`;return a.jsxs("li",{className:"hidden",children:[a.jsx("input",{type:"radio",id:d,name:t,value:u.value,checked:c===u.value,onChange:()=>l(u.value),disabled:i}),a.jsx("label",{htmlFor:d,children:u.label})]},d)})})]})};function lo({className:t="",userId:e,userName:n,src:r,setUserImage:s,uploadImage:i}){const[o,c]=h.useState(!1),[f,l]=h.useState(!1),u=h.useRef(null),d=async m=>{c(!0),l(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!e)throw c(!1),new Error("Image file or userID is missing");const v=await i({fileObject:p,userId:e});s(x=>({...x,image:{thumbnail:v.thumbnailURL,full:v.originalURL}}))}catch{l(!0)}finally{c(!1)}c(!1)};return a.jsxs("div",{className:C("profile-image-change-figure",t),children:[a.jsx(Ie,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(O.FormattedMessage,{id:"profile_image_change_error"})}),a.jsx("input",{id:"file",type:"file",accept:"image/*",ref:u,onChange:d,hidden:!0,"data-testid":"file-input"}),a.jsx(re,{onClick:()=>u.current&&u.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:o,children:a.jsx(O.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Wa=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:s="contact-form-submit-click"}=t||{};return a.jsx(xt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:s},functions:{onSuccess:e,onFailure:n}})};const za=({title:t,label:e,ctaMessage:n,titleColor:r,labelColor:s,backgroundColor:i,onClose:o,reportError:c,sendInvites:f,initialFormStatus:l="NOT_SUBMITTED"})=>{const[u,d]=h.useState([]),[m,p]=h.useState(!0),[v,x]=h.useState(l),{formatMessage:_}=O.useIntl(),b=async T=>{T.preventDefault();try{await f(u),d([]),x("SUCCESS")}catch(w){x("ERROR"),c(w)}},y=T=>{T.preventDefault(),x("NOT_SUBMITTED"),p(!0),d([])},j=T=>{T.preventDefault(),o(),x("CLOSED")};return v==="CLOSED"?null:v==="ERROR"||v==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:v==="SUCCESS"?a.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),a.jsx(Ee,{}),a.jsx("div",{className:"footer",children:v==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:_({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:j,children:_({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:_({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:i},onSubmit:b,className:C("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:t}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:s},children:e}),a.jsx(Hs.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:u,onChange:T=>{d(T),p(!T.length)},autoFocus:!1,getLabel:(T,w,L)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:T}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(w),p(!u.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},w)})]}),a.jsx(Ee,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})},Bt=t=>t.map(e=>({condition:e})),xe={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},uo=({functions:t,...e})=>{const{formatMessage:n}=O.useIntl(),[r,s]=h.useState(null),[i,o]=h.useState(!1),[c,f]=h.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),l=p=>p[xe.NEW_PASSWORD]!==p[xe.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,u=p=>!qn(p[xe.NEW_PASSWORD]).isValid,d=[{"data-testid":xe.NEW_PASSWORD,id:xe.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Bt(["required",u]),functions:{onChange:p=>f(qn(p).matchingRules),onFocus:()=>o(!0),onBlur:()=>o(!1)}},{"data-testid":xe.CONFIRMED_PASSWORD,id:xe.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Bt(["required",l])}];e.isPasswordChange&&d.unshift({"data-testid":xe.CURRENT_PASSWORD,id:xe.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Bt(["required"])}),i&&d.push({component:Ua,props:{matchingRules:c}});const m={id:xe.FORM_ID,fields:d,functions:{...t,onSuccess:async p=>(t.createPassword(p),t.onSuccess&&t.onSuccess(p)),onCatch:p=>s(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(xe.NEW_PASSWORD)||v.includes(xe.CONFIRMED_PASSWORD))&&o(!0)}},meta:{shouldReset:!0},...e};return a.jsxs(a.Fragment,{children:[a.jsx(xt,{...m}),r&&a.jsx(De,{variant:"error",text:r})]})};const Za=({id:t="search",className:e="",handleToggle:n=!1,defaultValue:r="",gtmContext:s="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},f=O.useIntl(),l=h.useRef(null);Qe(()=>{!n||c||!o||l.current&&l.current.focus()},[o]);const u=d=>{d.preventDefault(),d.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return a.jsx("form",{onSubmit:u,className:C("search-form gtm-trackable",e),"data-gtm-event-context":s,"data-gtm-event-type":i,children:a.jsx("fieldset",{id:`${t}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(he,{element:"label",htmlFor:t,children:f.formatMessage({id:"search_label"})}),a.jsx("input",{ref:l,type:"search",id:t,name:t,defaultValue:r,placeholder:f.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&u(d)}}),a.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:a.jsx(he,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:u,children:a.jsx(he,{children:f.formatMessage({id:"search_cta"})})})]})})})},Or=async({ref:t,validateEmail:e,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(!t.current.validity.valid||!r.test(t.current.value))return n([{type:"validFields.email",value:!1}]);const s=t.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},i);try{o=await e(s),o===void 0&&(o=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:s,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:c=!1,autoApproved:f=!1,exists:l}=o;let u="";return c?u=f?"gov":"nonGov":l.registration?l.engagement&&!l.user?u=l.auth?"verify":"pending":u="exists":l.auth&&(u="exists"),n([{type:"shouldManuallyApprove",value:!f},{type:"emailDetails",value:{email:s,boxType:u,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(s)}},{type:"validFields.email",value:!0}])},fo=t=>{const e={};for(const n of t.entries())e[n[0]]=n[1];return{name:e.full_name,email:e.email_address.toString().toLowerCase().trim(),jobTitle:e.job_title,organization:e.organization,bioLink:e.url,optIn:!0,expectation:e.expectation,page:window.location.pathname,"g-recaptcha-response":e["g-recaptcha-response"]}},mo=async({refs:t,dataToSubmit:e,createAccount:n,onSuccess:r,dispatch:s,state:i})=>{if(!t.form||!t.form.current)throw new Error("No refs.form");if(!t.form.current.checkValidity()){t.hiddenValidation&&t.hiddenValidation.current&&t.hiddenValidation.current.click();return}const o=fo(new FormData(t.form.current)),c=Object.assign(o,e);await n(c),localStorage.setItem("email",o.email),r&&r({...o,...i.values}),s([{type:"showSuccessMessage",value:!0}])},po=({shouldShow:t,functions:{validateEmail:e,resendVerificationCode:n},refs:r,state:s,dispatch:i,dataToSubmit:o,intl:c})=>{const{emailDetails:f}=s,l=(d,m)=>{d.current&&s.validFields[m]!==d.current.validity.valid&&i([{type:`validFields.${m}`,value:d.current.validity.valid}])},u=[{id:"full_name",type:"text",inputRef:r.name,placeholder:c.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>l(r.name,"name"),onFocus:()=>i([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:r.email,placeholder:c.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Or({ref:r.email,validateEmail:e,dispatch:i})},onChange:(d,m)=>{m&&m({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>i([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Aa,props:{email:f.email,type:f.boxType,resendVerificationCode:n}}];return s.shouldManuallyApprove&&(u.push({id:"job_title",type:"text",inputRef:r.jobTitle,placeholder:c.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>l(r.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:r.organisation,placeholder:c.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{l(r.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),t.url&&u.push({id:"url",type:"text",label:c.formatMessage({id:"signup_url"},{small:d=>a.jsx("small",{children:d})}),placeholder:c.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),t.expectation&&u.push({id:"expectation",className:"expectation",type:"text",label:c.formatMessage({id:"signup_expectation"},{small:d=>a.jsx("small",{className:"notes text-small",children:d})}),placeholder:c.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),u.push({id:"terms",className:"text-small",type:"checkbox",inputRef:r.tc,label:c.formatMessage({id:"signup_terms"},{terms:d=>a.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:d}),privacy:d=>a.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:d})}),shownValue:"accepted",functions:{onChange:d=>{if(!d)return;const m=[];["name","email"].forEach(p=>{s.validFields[p]!==r[p].current.validity.valid&&(m.push({type:`validFields.${p}`,value:r[p].current.validity.valid}),p==="email"&&Or({ref:r.email,validateEmail:e,dispatch:i}))}),m.length&&i(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),u};const ho=({className:t=""})=>a.jsxs("div",{className:C("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(O.FormattedMessage,{id:"signup_success_title"})}),a.jsx(O.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const go={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},vo=({className:t="",functions:e={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:n={title:!0,expectation:!1,url:!0,logInButton:!0,successMessage:!0},submitButton:r,dataToSubmit:s={ref:"sign-up-form"},...i})=>{const o=O.useIntl(),[c,f]=h.useReducer(Yn,go),{validFields:l,emailDetails:u,shouldManuallyApprove:d,showSuccessMessage:m,showError:p}=c,[v,x]=Vn.useCookies(["signup-this-session","functional-cookie-consent"]),_={form:h.createRef(),name:h.createRef(),email:h.createRef(),jobTitle:h.createRef(),organisation:h.createRef(),tc:h.createRef(),hiddenValidation:h.createRef()};h.useEffect(()=>{d===!0&&_.jobTitle.current&&_.jobTitle.current.focus()},[d]),h.useEffect(()=>{(i.showSuccessMessage||v["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[v]),h.useEffect(()=>{if(m&&v["functional-cookie-consent"]){const j={path:"/",maxAge:3600};i.showSuccessMessage||x("signup-this-session","true",j)}},[m]);const b=h.useMemo(()=>po({shouldShow:n,functions:e,refs:_,state:c,dispatch:f,dataToSubmit:s,intl:o}),[s,e,o,_,n,c]),y=d?!Object.values(l).every(j=>j===!0):!l.name||!l.email||["exists","pending","verify"].includes(u.boxType);return n.successMessage&&m?a.jsx(ho,{className:t}):a.jsxs("fieldset",{className:C("signup-form-fieldset",t),"data-testid":"signup-form",children:[n.title&&a.jsx("p",{className:"signup-title",children:a.jsx(O.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(De,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(xt,{className:"signup-form",formRef:_.form,id:"sign-up-form",fields:b,intlPath:"signup",button:{variant:"primary",size:"medium",text:r||o.formatMessage({id:"signup_button_join"}),disabled:y?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},meta:{shouldReset:!1,showRequiredLabels:!1},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{mo({refs:_,dataToSubmit:s,createAccount:e.createAccount,onSuccess:e.onSuccess,dispatch:f,state:c})},onCatch:j=>{e.handleError(j),f([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),a.jsx("button",{className:"validation-button",ref:_.hiddenValidation}),n.logInButton&&a.jsx(re,{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",children:o.formatMessage({id:"signup_button_login"})})]})};var zn={exports:{}},Nt={exports:{}},ce={};/** @license React v16.13.1
|
|
37
|
+
`))},[r]),h.useEffect(()=>{l==="ready-to-close"&&u("closing")},[l]);const d=({propertyName:p})=>{p==="max-height"&&u(v=>v==="opening"?"open":v==="closing"?"closed":v)};if(!r)return null;const m=["opening","open"].includes(l);return a.jsxs(Te,{variant:"subtle",className:C("hide-show-text-box",t),children:[a.jsxs("div",{ref:o,className:C("content",l),children:[a.jsx(Pe,{options:{forceBlock:!0},children:l==="closed"?c:r}),l!=="closed"&&s]}),a.jsx("p",{className:"cta",children:a.jsx(re,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:C({"rotate-180":m}),onClick:()=>{u(m?"ready-to-close":"opening")},children:m?n||i.formatMessage({id:"hideShowTextBox_hide"}):e||i.formatMessage({id:"hideShowTextBox_show"})})})]})};const yi=({element:t="ul",layout:e="vertical",variant:n="default",items:r=[],styling:s={},className:i=""})=>{const{hasBorder:o=!1,zebraStriping:c=!1}=s;return h.createElement(t,{className:C("icon-bulleted-list text-medium",n,i,{"has-border":o,"has-zebra-stripes":c,[e]:t!=="dl"}),children:r.map((f,l)=>{const u={wrapper:h.Fragment,forceInline:!0},d={"--icon":`url(${Fe}icons/${f.icon}.svg)`};return t==="dl"?a.jsxs(h.Fragment,{children:[a.jsx("dt",{style:d,children:a.jsx(Pe,{options:u,children:f.dt||""})},`dt-${l}`),a.jsx("dd",{children:typeof f.text=="string"?a.jsx(Pe,{options:u,children:f.text}):f.text},`dd-${l}`)]},`dl-${l}`):a.jsx("li",{style:d,children:typeof f.text=="string"?a.jsx(Pe,{options:u,children:f.text}):f.text},l)})})},ve=()=>h.Fragment,_i=({children:t})=>a.jsx(Te,{variant:"secondary",children:t}),xi=({children:t})=>typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{className:"center",children:t}):a.jsx("div",{className:"center",children:t}),wi=["span","strong","h1","h2","h3","h4","h5","h6","p"],ki=({children:t})=>{const e=O.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of h.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number"))if(h.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of h.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&h.isValidElement(o)){const c=o.type;if(wi.includes(c)){for(n=o.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const s=n?n.toString():"";return a.jsx(nn,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},ji=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(Te,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(Te,{variant:"primary",children:t});case"pink-textbox":return a.jsx(Te,{variant:"tertiary",children:t});case"content":return typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{children:t}):t;default:return a.jsx("div",{...e,children:t})}return a.jsx("div",{...e,children:t})},Ti=t=>{const e=O.useIntl(),n=Date.now().toString();let r="default";const s=t.src;return s.includes("youtube")||s.includes("vimeo")?r="video":s.includes("riddle")||s.includes("sli.do")?r="poll":s.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(he,{children:a.jsx("a",{href:`#content-after-iframe-${n}`,children:e.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),a.jsx("iframe",{...t,title:e.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},Pr=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},Ei=({children:t,...e})=>{let n={...e};e.href&&(e.href.includes("http:")||e.href.includes("https:"))&&!e.target&&(n.target="_blank");let r=t,s=!1;for(const i of h.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number")&&h.isValidElement(i)){const o=i.type;if(["button","center","span","strong"].includes(o)&&i.props&&i.props.children&&i.props.children[0])for((o==="button"||Pr(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!h.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Pr(r)==="button"&&(s=!0);else break}return s?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(re,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},Sa=({children:t})=>a.jsx("span",{children:t});const Si={default:{a:Ei,CollapsibleSection:nn,TextBox:Te,CaseStudy:_i,style:ve,details:ki,div:ji,iframe:Ti,center:xi},"text-only":{h1:ve,h2:ve,h3:ve,h4:ve,h5:ve,h6:ve,style:ve,details:ve,div:ve,TextBox:ve,CollapsibleSection:ve,CaseStudy:ve,blockquote:ve,iframe:ve,button:ve}},vt=({className:t="",options:e={},children:n,overrideType:r="default",styling:s={}})=>{const{highlightTitles:i=!1}=s;n=n.replace(/^<br\/?>/,"");const o={wrapper:h.Fragment,forceBlock:!0,overrides:Si[r]};return a.jsx("div",{className:C("markdown-text",t,{"highlight-titles":i}),children:a.jsx(Pe,{options:{...o,...e},children:n})})};const Ca=({maxWidth:t=!1,title:e,subtitle:n,children:r,className:s=""})=>{const i=t?{"--max-width":`${t/16}rem`}:{};return a.jsxs("section",{className:C("page-heading",s),children:[a.jsxs("div",{className:C("content",{"has-max-width":t}),style:i,children:[e&&e.text&&h.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&h.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const bt=({size:t="medium",variant:e="default",className:n="",children:r,...s})=>a.jsx("span",{className:C("pill",t,e,n),...s,children:r});const yt=({element:t="p",children:e=null,className:n="",...r})=>h.createElement(t,{...r,className:C("status-banner text-small",n),"aria-live":"assertive"},e);const Ci=({author:t,authorCite:e,content:n})=>a.jsxs("blockquote",{className:"testimonial-block",children:[a.jsx(Pe,{className:"testimonial",children:n}),t&&a.jsx("p",{className:"author text-small",children:t}),e&&a.jsx("p",{className:"author-cite text-small",children:a.jsx("cite",{children:e})})]}),Ni=h.memo(Ci);const $i=({items:t=[],selector:e="",className:n=""})=>{const r=O.useIntl(),[s,i]=h.useState(t);return h.useEffect(()=>{if(t.length)return;let o="";Array(6).fill(0).forEach((l,u)=>{o+=`${u>0?", ":""}${e} h${u+1}`});const f=Array.from(document.querySelectorAll(o)).filter(l=>l.id).map(l=>({id:l.id,text:l.textContent||""}));i(f)},[]),s&&s.length>0&&a.jsxs(Te,{variant:"subtle",className:C("table-of-contents",n),children:[a.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),a.jsx("nav",{children:a.jsx("ul",{children:s.map(({id:o,text:c})=>a.jsx("li",{children:a.jsx("a",{href:`#${o}`,children:c})},o))})})]})};const rn=({time:t,rangeTime:e,prependedText:n,appendedText:r,className:s=""})=>{const i=O.useIntl(),o="timeToComplete_";if(!t||typeof t!="number")return null;const c=u=>{const d=u/60,m=Math.floor(d),p=(d-m)*60,v=Math.round(p),x=`${i.formatMessage({id:`${o}hours`},{time:m})}${m>0&&v>0?", ":""}${i.formatMessage({id:`${o}minutes`},{time:v})}`;return{text:`${m>0?`${i.formatMessage({id:`${o}hours_short`},{time:m})} `:""}${v>0?i.formatMessage({id:`${o}minutes_short`},{time:v}):""}`,ariaText:x}};let{text:f,ariaText:l}=c(t);if(e){const{text:u,ariaText:d}=c(t+e);f=i.formatMessage({id:`${o}range`},{early:f,late:u}),l=i.formatMessage({id:`${o}range_aria`},{early:l,late:d})}return n&&(l=`${n} ${l}`,f=`${n} ${f}`),r&&(l=`${l} ${r}`,f=`${f} ${r}`),a.jsx("span",{className:C("time-to-complete",s),"aria-label":l,children:f})};let ot=!1;const Na=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=O.useIntl(),s=h.useRef(null),[i,o]=h.useState("hidden");h.useEffect(()=>{const f=s.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(ot!==!1&&clearTimeout(ot),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Qe(()=>{ot!==!1&&clearTimeout(ot);let f="open";t?o("opening"):(o("closing"),f="hidden"),ot=setTimeout(()=>{o(f)},300)},[t]),a.jsx("aside",{ref:s,className:C("tooltip text-medium",i,{loading:e}),hidden:i==="hidden",children:e?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const Mi=({className:t="",image:e,...n})=>e?(typeof e=="string"&&(e={width:1080,height:200,type:"image/png",url:e}),e.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],e.query="fit=thumb&f=center",a.jsx(rt,{...n,className:C("banner",t),image:{...e,aspect:"banner"}})):null;const Ae=({children:t,className:e="",styling:n={},...r})=>{const{background:s="default"}=n;return a.jsx("section",{className:C("full-width-section",e,{[s]:s!=="default"}),...r,children:t})};const Pi=({text:t,buttons:e,className:n=""})=>{const r=[];return e.forEach(s=>{r.push({href:s.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":s.eventContext||"Download",target:"_blank",children:s.text})}),a.jsx(Ae,{className:C("download-section",n),children:a.jsxs(a.Fragment,{children:[h.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(nt,{buttons:r})]})})};function $a({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const Ri=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:s,setShowModal:i})=>{const{formatMessage:o}=O.useIntl();return a.jsxs("div",{className:C("edit-section-placeholder",{"has-icon":!!t}),style:xa(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),s&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>$a({href:r,setShowModal:i}),children:n||o({id:"edit_section_placeholder_cta"})})]})},Fi=({children:t,className:e="",formProps:n,href:r,title:s,modalTitle:i,placeholder:o,showDivider:c=!0})=>{const[f,l]=h.useState(!1),u=typeof r=="string"||!!n,d=()=>l(!1);return a.jsxs("section",{className:C("edit-section",e),children:[n&&a.jsx(wt,{title:i||`Edit ${s}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:d},className:C("edit-section-modal"),children:a.jsx(xt,{...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 m=>{var p,v;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((v=n==null?void 0:n.functions)==null?void 0:v.onSuccess(m)),l(!1)},onCancel:d}})}),a.jsxs("div",{className:"edit-section-header",children:[a.jsx("h2",{className:"edit-section-header-title",children:s}),u&&a.jsx(re,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>$a({href:r,setShowModal:l}),children:"Edit"})]}),t||a.jsx(Ri,{...o,href:r,setShowModal:l,showEditButton:u}),c&&a.jsx(Ee,{})]})};const Oi=({title:t=!1,logos:e=[],styling:n={},className:r=""})=>{const s=e.length;if(s===0)return null;const i={element:typeof t=="object"?t.element:"h2",text:typeof t=="string"?t:typeof t=="object"?t.text:"",className:typeof t=="object"?t.className:""},{wrapLogos:o=!1,align:c="center",display:f="block"}=n;return a.jsxs("div",{className:C("logos",r,`align-${c}`,{[f]:f!=="block","wrap-logos":o}),children:[t&&h.createElement(i.element,{className:C("title",i.className)},i.text),a.jsx("ul",{className:C({"two-col":s===2||s===4,"three-col":s===5||s<=10&&s%3===0}),children:e.map(({logo:l,nameOfBusiness:u,link:d=!1,description:m=!1},p)=>{if(!l||!l.url)return null;const v=a.jsx("img",{src:l.url,width:l.width||"auto",height:l.height||"auto",alt:u});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:d?a.jsx("a",{href:d,target:"_blank",rel:"nofollow noreferrer noopener",children:v}):v}),m&&a.jsx("small",{children:m})]},window.btoa(`${l.url}_${p}`))})})]})};const Di=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ai=({className:t="",content:e,image:n,variant:r="default",spacing:s="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const f=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},u={};return f.forEach(d=>{if(!e[d]){u[d]=!1;return}if(!i[d]){if(typeof e[d]=="object"){u[d]=e[d];const{text:m,element:p}=e[d];if(p&&Di.includes(p.toLowerCase()))return;u[d]={text:m,element:l[d]};return}u[d]={text:e[d],element:l[d]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=d=>{d.preventDefault(),d.stopPropagation();const m=document.getElementById(o.link.substring(1));m&&m.scrollIntoView({behavior:"smooth"})}),a.jsx(Ae,{className:C("banner-section",r,s,t,{"has-image":n,"has-extra-spacing":s==="normal"&&u.eyebrow&&u.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[f.map(d=>{if(u[d]&&typeof u[d]=="object"){const{text:m,element:p=""}=u[d];return d==="text"?a.jsx(vt,{overrideType:"text-only",className:"text",children:m},d):h.createElement(p,{key:d,className:d},m)}return null}),c,o&&o.text&&o.link&&a.jsx(re,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(rt,{image:{...n,aspect:"banner"}})]})})},Ii=h.memo(Ai);const Li=({image:t,variant:e="default",children:n,className:r=""})=>{const s={};return t&&(s["--image"]=`url(${t})`),a.jsx(Ae,{className:C("custom-content-banner",e,r,{"has-image":t}),style:s,children:a.jsx("div",{className:"content-slim",children:n})})};const Bi=({alignImage:t="left",className:e,content:n,image:r})=>{const s=()=>typeof n=="string"?a.jsx(Pe,{children:n}):n;return a.jsxs(Ae,{className:C("highlight-section",e),children:[r&&a.jsx("div",{className:C("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(rt,{image:r})}),a.jsx("div",{className:C("highlight-container highlight-content-wrapper",{"no-image":!r}),children:a.jsx("div",{className:C("highlight-content",{"highlight-content-right":t==="left"}),children:s()})})]})},qi=h.memo(Bi);const Ui=({variant:t="primary",button:e=null,title:n,text:r,gtmContext:s})=>!n&&!r?null:a.jsxs("aside",{className:C("marketing-block",t),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),e&&a.jsx(re,{variant:"secondary",size:"medium",href:e.link,className:"gtm-trackable","data-gtm-event-context":s,"data-gtm-event-type":"learn-more-click",children:e.text})]}),Ma=({showDevTools:t=!0,children:e})=>{const n=new me.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(me.QueryClientProvider,{client:n,children:[e,t&&a.jsx(Zs.ReactQueryDevtools,{initialIsOpen:!1})]})};var Wi=h.createContext({client:At});function zi(t){var e=t.children,n=t.client,r=t.apiKey,s=t.options,i=h.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&s&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(At.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),At.init(r,s)),At)},[n,r]);return h.createElement(Wi.Provider,{value:{client:i}},e)}const Pa=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(zi,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:e.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!e.id}},children:t}):a.jsx(a.Fragment,{children:t}),Ra=({children:t,locale:e,messages:n})=>{const r=e||"en",s={...ci[r],...n||{}};return a.jsx(O.IntlProvider,{locale:r,messages:s,children:t})},Gn=h.createContext({}),Lt={en:"English",es:"Español",fr:"Français",pt:"Português"},Se=h.createContext({isLoading:!0});function an(){return h.useContext(Se)}const Fa=({children:t,user:e})=>a.jsx(Se.Provider,{value:e,children:t}),Zi=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[s,i]=h.useState({isLoading:!0}),o=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[c,f]=h.useState(o),l=u=>{localStorage.setItem("language",u),f(u)};return h.useEffect(()=>{t().then(u=>{i({...u,isLoading:!1}),ka(5e3)}).catch(()=>i({isLoading:!1}))},[]),a.jsx(Gn.Provider,{value:{language:c,updateLanguage:l},children:a.jsx(Ra,{locale:c,messages:n==null?void 0:n.messages,children:a.jsx(Vn.CookiesProvider,{children:a.jsx(Fa,{user:s,children:a.jsx(Ma,{showDevTools:r,children:a.jsx(Pa,{user:s,children:e})})})})})})};const Hi=({styling:t={},progress:e=0,text:n=!1,className:r=""})=>{const s=O.useIntl(),{showText:i=!1,layout:o="bar",size:c="default",color:f="default"}=t,l=e>75?100:e>50?75:e>25?50:e>5?25:0,u={"--progress":`${e}%`};return a.jsx("span",{className:C(`progress-bar section-${l}`,o,r,{[c]:c!=="default",[f!=="default"?f:""]:f!=="default"}),style:u,children:h.createElement(i?"span":he,{className:i?"text":"",children:n||s.formatMessage({id:"progressBar"},{number:e})})})},Qn=h.memo(Hi);const vn="loadingBlock_",Vi=({progress:t=0,steps:e=!1,className:n=""})=>{const r=O.useIntl();e||(e={0:{text:r.formatMessage({id:`${vn}loading`})},75:{text:r.formatMessage({id:`${vn}almostDone`})},100:{text:r.formatMessage({id:`${vn}complete`})}});let s=null;const i=Object.keys(e);for(let c=0;c<i.length&&!(t<parseInt(i[c]));c++)s=i[c];const o=s&&e[s].icon?{"--icon":`url(${Fe}icons/${e[s].icon}.svg)`}:{};return a.jsxs(Te,{className:C("loading-block",n,{"has-icon":s&&e[s].icon}),variant:"subtle",style:o,children:[s&&a.jsx("span",{className:"step",children:e[s].text}),a.jsx(Qn,{progress:t})]})},Yi=h.memo(Vi);const we=({element:t="div",className:e="",...n})=>a.jsx(en,{element:t,className:C("loading-placeholder",e),...n});const Wn={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Oa=(t,e)=>t in Wn?a.jsx("div",{className:t,children:Wn[t].map((n,r)=>Oa(n,r))},e):a.jsx(we,{className:t},e),Jn=({layout:t="overview-page",...e})=>a.jsx("div",{className:C("loading-state",t),...e,children:Wn[t].map((n,r)=>Oa(n,r))}),Da=t=>{const e=t&&t.toUpperCase().trim().split(" ");return Array.isArray(e)&&e.length>1&&e[0]!==""?e[1]===""?e[0][0]:e[0][0]+e[e.length-1][0]:t?t.substr(0,1):""},Et=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Ki=t=>{const e=Math.ceil(26/Et.length),n=Da(t).toLowerCase();if(n==="")return Et[0];const r=n.charCodeAt(0)-96;for(let s=0;s<Et.length;s++)if(r<=e*(s+1))return Et[s]};const Rr=256,Ie=({className:t="",src:e="",name:n,alt:r,width:s=Rr,height:i=Rr,...o})=>{const[c,f]=h.useState(!1),l=h.useRef(null);h.useEffect(()=>{const d=l.current;if(!d)return;const m=d.getContext("2d");if(!m)return;const p=s,v=i;typeof window<"u"&&window.devicePixelRatio&&(d.width=p*window.devicePixelRatio,d.height=v*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Ki(n),m.fillRect(0,0,p,v),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Da(n),p/2,v/1.6)},[n]);let u=!1;return e&&e!==""&&!c&&(e.includes("http")||e.includes("//"))&&(u=!0),a.jsx("figure",{className:C("profile-picture",t,{error:c}),...o,children:u?a.jsx("img",{src:e,alt:r||n,onError:()=>{f(!0)},width:s,height:i}):a.jsx("canvas",{ref:l})})},Xn=t=>t==="apolitical"?{image:`${Fe}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${Fe}logos/member_community.svg`}:{name:t.name,role:t.jobTitle||"",organisation:t.organization||"",country:t.location&&t.location.country||"",url:`/profiles/${t.id}`,image:t.image&&t.image.thumbnail},Gi=({role:t="",organisation:e="",country:n="",maximumCharacters:r=80})=>{const s=t!=="",i=e!=="",o=n!=="";if(!s&&!i&&!o)return"";const c=`${t}${s&&i?` — ${e}`:e}`;let f=`${c}${(s||i)&&o?`, ${n}`:n}`;return f.length>r&&(f=c),f.length>r&&(f=Ge(f,r)),f};const sn=({element:t="div",member:e="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=O.useIntl(),c=Xn(e);c.name||(c.name=o.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:f,url:l,image:u}=c,d=Gi(c),m=n&&n.createdAt?Bn(n.createdAt):!1,p=n&&n.createdAt?Kn(n.createdAt):"";return h.createElement(t,{className:C("member text-medium",i),children:a.jsxs(We,{href:l,gtmType:s,gtmContext:r,onClick:v=>{v==null||v.stopPropagation()},children:[a.jsx(Ie,{name:f,src:u}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:f}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&m&&a.jsx("span",{className:"date",title:p,"aria-label":p,children:o.formatMessage({id:`dates_${m.path}`},{number:m.number})}),n.didEdit&&a.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),d&&a.jsx("small",{children:d})]})]})})};const Fr={small:24,medium:48},er=({element:t="div",contributors:{total:e,data:n}={total:void 0,data:[]},styling:{showText:r,size:s,showGap:i,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,multipleText:f,className:l="",...u})=>{const d=O.useIntl();return!n||n.length===0?null:h.createElement(t,{...u,className:C("contributors",l,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((m,p)=>{let v,x="";if(p<c){const{name:_="",image:b=""}=Xn(m);if(o)return a.jsx(we,{element:"li",className:"contributor"},p);v=a.jsx(Ie,{name:_,src:b,width:Fr[s||"medium"],height:Fr[s||"medium"]})}else if(p===c){const _=(e||n.length)-c;v=a.jsxs("small",{className:C({"large-number":_>99}),children:["+",li(_,0)]}),x="number-left"}return v?a.jsx("li",{className:C("contributor",x),children:v},p):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?d.formatMessage({id:`member_${n[0]}`}):Ge(n[0].name||"",20):f||null})]})})};const St="emailHelperTextBox_",Aa=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const s=O.useIntl(),[i,o]=h.useState({path:`${St}default`,type:"default",link:{},mail:{},error:""}),[c,f]=h.useState(!1),l=h.useCallback(p=>{p.preventDefault(),p.stopPropagation();const v=x=>{o({path:`${St}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>l(_),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:x})};if(typeof r!="function"){v(s.formatMessage({id:`${St}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(x=>{v(x.message)}).finally(()=>{f(!1)})},[e,n,r]);h.useEffect(()=>{let p=St,v="default",x={},_={};switch(t){case"gov":p+="autoApproved",v="success";break;case"nonGov":p+="unrecognisedEmail",v="error",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",v="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",v="error",x={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>l(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",v="error",x={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...i,path:p,type:v,link:x,mail:_})},[t]);const u={};return["link","mail"].forEach(p=>{u[p]=Object.keys(i[p]).length?v=>a.jsx("a",{...i[p],children:v}):v=>v}),a.jsx(Ea,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(we,{element:"span"}),a.jsx(we,{element:"span"})]}):s.formatMessage({id:`${i.path}_text`},{...u,strong:p=>a.jsx("strong",{children:p}),em:p=>a.jsx("em",{children:p}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:i.error})})},pt=({className:t="",element:e="input",id:n,inputRef:r,functions:s={onChange:()=>{}},name:i=n,placeholder:o,type:c="text",value:f,...l})=>{const u=h.useRef(),d=r||u;return h.createElement(e,{ref:d,...l,type:c,id:n,name:i,className:C(t,e,{"has-scrollbar":c==="textarea"&&d.current&&d.current.clientHeight<d.current.scrollHeight}),value:f,placeholder:o,...s,onChange:m=>{const p=m.target;s.onChange(p.value)}})};const He={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Qi=500,Ji=({value:t,placeholder:e,functions:n={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})}})=>{const{onChange:r=()=>{},onKeyInput:s=async()=>{}}=n,[{input:i,displayInput:o,debouncedInput:c},f]=h.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:l,activePredictionIndex:u,isPredictionSelected:d},m]=h.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=O.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),h.useEffect(()=>{const b=setTimeout(()=>{d||f(y=>({...y,debouncedInput:i}))},Qi);return()=>{clearTimeout(b)}},[i,d]),h.useEffect(()=>{c&&!d?(async()=>{try{const y=await s(c)||[];m(j=>({...j,predictions:y}))}catch(y){console.error("Error fetching predictions:",y),m(j=>({...j,predictions:[]}))}})():m(b=>({...b,predictions:[]}))},[c,d]),h.useEffect(()=>{u>=0&&l[u]&&f(b=>({...b,displayInput:l[u].description}))},[u,l]);const v=b=>{[He.DOWN,He.UP,He.ENTER].includes(b.key)&&(b.preventDefault(),b.key===He.DOWN&&u<l.length-1?m(y=>({...y,activePredictionIndex:u+1})):b.key===He.UP&&u>0?m(y=>({...y,activePredictionIndex:u-1})):b.key===He.ENTER&&u>-1&&(r(l[u].description),f(y=>({...y,input:l[u].description})),m(y=>({...y,predictions:[],isPredictionSelected:!0}))))},x=b=>{r(b.target.value),f(y=>({...y,input:b.target.value,displayInput:b.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},_=b=>{r(b.description),f(y=>({...y,input:b.description,displayInput:b.description})),m(y=>({...y,isPredictionSelected:!0,predictions:[]}))};return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:o,onChange:x,onKeyDown:v,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:l.map((b,y)=>a.jsx("li",{onClick:()=>_(b),onMouseEnter:()=>m(j=>({...j,activePredictionIndex:y})),className:C("predictions-list-item",{active:y===u}),children:b.description},y))})]})};const Ia=({className:t="",disabled:e,element:n="p",functions:r={onChange:()=>{}},id:s,inputRef:i,intlPath:o=!1,label:c,shownValue:f=!0,type:l="checkbox",value:u,...d})=>{const m=O.useIntl(),{onChange:p,...v}=r,x=()=>{e||p(u?null:f)},_=a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:i,id:s,name:s,type:l,value:f,checked:u,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),x())},readOnly:!0,disabled:e}),a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("label",{htmlFor:s,children:c||m.formatMessage({id:o?`${o}_${s}`:s})})]});return h.createElement(n,{onClick:b=>{const y=b.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),x())},className:C("checkbox-wrapper",t),...d,...v},_)};const Xi=h.memo(function({direction:e="down"}){return a.jsx(en,{className:C("rotating-chevron",`direction-${e}`)})});const eo=({className:t,options:e,initialValue:n,value:r,functions:s={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:o,multiSelect:c,multiSelectOptions:f,id:l})=>{const u=O.useIntl(),[d,m]=h.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[x,_]=h.useState(v);let b;Array.isArray(x)&&x.length===1&&typeof x[0]=="string"?b=e&&x?e.find(F=>F.id===x[0]):e?e[0]:{id:"",label:""}:Array.isArray(x)&&x.length===1&&typeof x[0]!="string"?b=x[0]:b={id:"",label:""},h.useEffect(()=>{_(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:j,...T}=s,w=F=>{if(c){let V=[];x!=null&&x.includes(F.id)?V=x.filter(R=>R!==F.id):V=[...x,F.id],_([...V]),y&&y([...V])}else _([F]),y&&y(F.id),m(!1)},L=F=>{if(F==="all"){const V=(e==null?void 0:e.map(R=>R.id))||[];_(V),y&&y(V)}else _([]),y&&y([])};return a.jsxs("div",{className:C("dropdown-wrapper",t),children:[a.jsxs("button",{className:"input","aria-expanded":d,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:F=>{F.preventDefault(),F.stopPropagation(),m(!d)},"data-testid":"dropdown-selector",...T,children:[c?`${o} · ${x.length}`:b.label,a.jsx(Xi,{direction:d?"up":"down"})]}),a.jsx("select",{defaultValue:b.id,onChange:F=>{F.preventDefault(),F.stopPropagation();const V=e&&e.find(R=>R.id===F.target.value);w(V)},hidden:!d,...T,children:e==null?void 0:e.map(F=>a.jsx("option",{value:F.id,children:F.label},F.id))}),a.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!d,children:[a.jsxs("div",{className:"dropdown-menu-list",children:[(f==null?void 0:f.topbar)&&a.jsxs("div",{className:"action-bar",children:[a.jsx("p",{children:`${x==null?void 0:x.length} selected`}),a.jsxs("ul",{children:[a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>L("all"),className:"gtm-trackable",children:u.formatMessage({id:"dropdown_menu_multiselect_all"})})}),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>L("none"),className:"gtm-trackable",children:u.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),a.jsx("ul",{children:e==null?void 0:e.map(F=>{const V=F.id===b.id||(x==null?void 0:x.includes(F))||(x==null?void 0:x.includes(F.id));return a.jsx("li",{"data-testid":"dropdown-options",children:a.jsxs("button",{className:C("gtm-trackable",{selected:V,"selected-single":V&&!c}),"data-gtm-event-type":`${F}-click`,"data-gtm-event-context":i,onClick:R=>{R.preventDefault(),R.stopPropagation(),w(F)},role:"menuitem","aria-current":V,"data-testid":V?"current-selection":"",children:[c&&a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("span",{className:C({"menu-option-label":c}),children:F.label})]})},F.id)})})]}),(f==null?void 0:f.submitSection)&&a.jsx("p",{className:"submit",children:a.jsx(re,{variant:"secondary",onClick:()=>{j&&j(x),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:x}})),m(!1)},children:u.formatMessage({id:"form_submit"})})})]})]})};const to=({className:t="",functions:e={onChange:()=>{}},intlPath:n=!1,id:r,label:s,multiSelect:i=!1,name:o,options:c,required:f,type:l="checkboxes",value:u,...d})=>{const m=O.useIntl(),p=i?u:[],v=u;return a.jsx("ul",{...d,className:C("options-wrapper",t),"data-testid":`ul-${r}`,children:c==null?void 0:c.map(({id:x,label:_=!1,value:b=x,disabled:y=!1})=>{const j=`${r}_${x}`,T=()=>{if(y)return;let w;if(i){const L=p==null?void 0:p.indexOf(b);Array.isArray(p)&&L>=0?(w=p,w.splice(L,1)):(!p||p.length===0?w=[]:w=p,w.push(b))}else w=v===b?void 0:b;e.onChange(w)};return a.jsx(Ia,{element:"li",id:j,type:l==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):v===b,functions:{...e,onChange:T},intlPath:n,label:_||m.formatMessage({id:n?`${n}_${x}`:x}),disabled:y},j)})})};const no=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const s=O.useIntl(),i=h.useRef(),o=t||i,[c,f]=h.useState(!1),[l,u]=h.useState(e),d=()=>{var m;f(!c),u(c?"password":"text"),(m=o.current)==null||m.focus()};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:C("show-password gtm-trackable",{"password-visible":c}),"data-gtm-event-context":n,"data-gtm-event-type":`${c?"hide":"show"}-password-click`,onClick:d,"aria-label":s.formatMessage({id:`showpassword_aria_${c?"hide":"show"}`}),children:s.formatMessage({id:`showpassword_${c?"hide":"show"}`})}),a.jsx(pt,{inputRef:o,type:l,...r})]})};const Ve={text:{component:pt},email:{component:pt},textarea:{component:pt,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ia},checkboxes:{component:to,props:{multiSelect:!0}},select:{component:eo},password:{component:no},autocomplete:{component:Ji}},ro=({id:t,intlPath:e=!1,className:n="",error:r,functions:s={onChange:()=>{}},limit:i=0,showRequiredLabels:o=!0,type:c,validation:f,value:l,...u})=>{const d=O.useIntl(),m=f&&f.some(({condition:T})=>T==="required"),p=(l==null?void 0:l.toString().length)||0,v=c&&Ve[c]&&Ve[c].component?Ve[c].component:pt,x={};c&&["checkboxes"].includes(c)?x.element="span":x.htmlFor=t;let _={...u,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:mt(s),value:l};i>0&&(_["data-character-limit"]=i,_.functions&&(_.functions.onChange=T=>{((T==null?void 0:T.toString().length)||0)>i&&(T=T==null?void 0:T.toString().slice(0,i)),s.onChange(T)})),c&&Ve[c]&&Ve[c].props&&(_={..._,...Ve[c].props}),c&&["checkboxes"].includes(c)&&(_.intlPath=`${e}_${t}`),r&&(_["aria-invalid"]=!0,_["aria-describedby"]=`error-${t}`);const b=u.label||d.formatMessage({id:e?`${e}_${t}`:t}),y=({...T})=>r?h.createElement(T.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...T},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(v,{..._,label:b,className:C("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const j=T=>h.createElement(T.element||"label",{...T,className:"checkboxes-label text-small","data-testid":`label-${t}`});return a.jsxs("dl",{className:C("field-wrapper text-medium",n),children:[a.jsx("dt",{children:a.jsxs(j,{...x,children:[b,m&&o&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("small",{children:["(",d.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),a.jsxs("dd",{children:[a.jsx(v,{..._}),i>0?a.jsxs("small",{className:C("character-limit",{"near-limit":p>=.99*i,"approaching-limit":p>=.9*i&&p<.99*i}),children:[a.jsx("span",{className:"hidden",children:d.formatMessage({id:"form_fieldWrapper_characterLimit"})}),p," / ",i]}):null]}),a.jsx(y,{})]})},ao=(t,e)=>{const{type:n,payload:r}=e,s=t.errors?mt(t.errors):{},i=t.values?mt(t.values):{};switch(n){case"toggleSubmitting":return{...t,isSubmitting:!t.isSubmitting};case"updateValue":if(r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...t,errors:s,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...t,errors:s,values:i};case"addError":return r!=null&&r.key&&!s[r==null?void 0:r.key]&&(s[r==null?void 0:r.key]=r==null?void 0:r.value),{...t,errors:s};case"removeError":return r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],{...t,errors:s};case"submitForm":{const{fields:o=[],dispatch:c=()=>{},onSuccess:f=()=>{},onFailure:l=()=>{},intl:u}=r,d=mt(Object.keys(s));for(const m of o)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:v="required",error:x=!1}=m.validation[p];let _=!1;if(typeof v=="function"){const b=v(i);b&&(_=x||b)}else{const b=i[m.id];switch(v){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(_=x||(u==null?void 0:u.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(_){c({type:"addError",payload:{key:m.id,value:_}}),d.push(m.id);break}}return d.length===0?f(i):l(i,d),{...t,isSubmitting:!1}}case"formSubmitted":return{...t,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return t}};let bn=null;const xt=({fields:t,className:e="",id:n=t.length?`form__${t[0].id}`:"form",formRef:r,intlPath:s=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:{shouldShowCancelButton:c=!1,shouldReset:f=!0,showRequiredLabels:l=!0,showSuccessMessage:u=!1}={shouldShowCancelButton:!1,shouldReset:!0,showRequiredLabels:!0,showSuccessMessage:!1},gtm:d={context:"Form",event:"form-submit-click"},functions:{onSuccess:m=async()=>{},onCancel:p=()=>{},onCatch:v=()=>{},onFailure:x=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},..._})=>{const{customOnSubmit:b,hideButton:y,...j}=i,T=40,w=O.useIntl(),L={};t.length&&t.forEach(B=>{const H=B.id||B.name;H&&(L[H]=B.value||"")});const[F,V]=h.useReducer(ao,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:R,isSubmitting:A,formSubmitted:N,values:S}=F;h.useEffect(()=>{f&&N&&(bn=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[N]),h.useEffect(()=>()=>{bn&&clearTimeout(bn)},[]),h.useEffect(()=>{const B=H=>{V({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const k=h.useRef(null),$=r||k;if(!t.length)return null;i.text||(i.text=w.formatMessage({id:"form_submit"}));const z=[{...j,icon:N?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:B=>{var E;if(B.preventDefault(),B.stopPropagation(),A)return;let H=0;if((E=$==null?void 0:$.current)!=null&&E.id){const M=document.getElementById($.current.id);M&&(H=M.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(H=H-J.offsetHeight-T),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),V({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&V({type:"submitForm",payload:{fields:t,dispatch:V,intl:w}});return}V({type:"submitForm",payload:{fields:t,dispatch:V,onSuccess:async M=>{try{await m(M),V({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(Z){v(Z),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(M,Z)=>{x(M,Z),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:w}})},disabled:A||N||i.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:A||N?w.formatMessage({id:`form_${A?"submitting":"submitted"}`}):i.text}];return c&&z.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:A||N,onClick:p,children:o.text||w.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{..._,id:n,className:C("form",e),ref:$,children:[R!=null&&R.general?a.jsx(De,{variant:"error",text:w.formatMessage({id:"form_error_generalError"})}):null,(!A&&!N||b)&&t.map((B,H)=>{const{id:J=B.name||H,component:E,functions:M={onChange:()=>{}}}=B;if(E)return a.jsx(E,{...B.props||{}},`component-${J}-${H}`);const Z=S?S[J]:"";return a.jsx(ro,{intlPath:s,...B,showRequiredLabels:l,value:Z,error:R==null?void 0:R[J],functions:{...M,onChange:W=>{V({type:"updateValue",payload:{key:J,value:W}}),M.onChange(W&&W.toString(),V)}}},J)}),y?null:(A||N)&&b?b:a.jsx(nt,{className:C("cta",{center:A||N,submitted:N}),buttons:z})]}),u&&N&&a.jsx(yt,{className:"success",children:typeof u=="string"?u:w.formatMessage({id:"form_success"})})]})};const Ct="passwordRules_",La="isMoreThanEightCharacters",Ba="includesNumberAndSymbol",qa="includesLowerAndUppercase",so={[La]:"8Characters",[Ba]:"numberSymbol",[qa]:"lowercaseUppercase"},io=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=O.useIntl();return a.jsxs("aside",{className:C("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${Ct}intro`})}),a.jsx("ul",{children:[La,Ba,qa].map(r=>a.jsxs("li",{className:C({matches:t[r]}),children:[a.jsxs(he,{children:[n.formatMessage({id:`${Ct}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${Ct}rule_${so[r]}`})}),!t[r]&&a.jsxs(he,{element:"strong",children:[" ",n.formatMessage({id:`${Ct}notMet`})]})]},`rule-${r}`))})]})},Ua=h.memo(io);const oo=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=O.useIntl(),[f,l]=h.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const b=await n();l(y=>({...y,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){l(y=>({...y,setUp:!0,disabled:!0})),s(b)}};if(h.useEffect(()=>{o&&!f.setUp&&u()},[o]),!o)return a.jsx(we,{className:"rating-placeholder"});const{id:d,rating:m,disabled:p}=f,v="ratings_",x={text:c.formatMessage({id:`${v}text`}),low:c.formatMessage({id:`${v}low`}),high:c.formatMessage({id:`${v}high`}),success:c.formatMessage({id:`${v}success`}),...t},_=async b=>{if(!(!d||p))try{l(y=>({...y,rating:b,disabled:!0})),await r({id:d,value:b})}catch(y){l(j=>({...j,rating:null})),s(y)}finally{l(y=>({...y,disabled:!1}))}};return a.jsxs("div",{className:C("rating",i),children:[a.jsx("span",{className:"label",children:x[m?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(e).keys()).map(b=>{const y=b+1;return a.jsx("li",{className:C({selected:m&&y<=m}),children:a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:`star${!m||y>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${v}stars`},{number:y,total:e})}${y===1||y===e?` - ${x[y===1?"low":"high"]}`:""}`,onClick:j=>{j.preventDefault(),j.stopPropagation(),_(y)},disabled:p})},`rating-${y}`)})})]})};const co=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:s=()=>{}},isDisabled:i=!1,className:o=""})=>{const[c,f]=h.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);h.useEffect(()=>{r&&f(r)},[r]);const l=u=>{i||(f(u),s(u))};return a.jsxs("div",{className:C("toggle",o),onClick:u=>{u.preventDefault(),u.stopPropagation(),l(c===n[0].value?n[1].value:n[0].value)},children:[a.jsx("p",{children:e}),a.jsx("ul",{className:C("toggle-options",{disabled:i,on:c===n[1].value}),children:n.map(u=>{const d=`${t}-${u.value}`;return a.jsxs("li",{className:"hidden",children:[a.jsx("input",{type:"radio",id:d,name:t,value:u.value,checked:c===u.value,onChange:()=>l(u.value),disabled:i}),a.jsx("label",{htmlFor:d,children:u.label})]},d)})})]})};function lo({className:t="",userId:e,userName:n,src:r,setUserImage:s,uploadImage:i}){const[o,c]=h.useState(!1),[f,l]=h.useState(!1),u=h.useRef(null),d=async m=>{c(!0),l(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!e)throw c(!1),new Error("Image file or userID is missing");const v=await i({fileObject:p,userId:e});s(x=>({...x,image:{thumbnail:v.thumbnailURL,full:v.originalURL}}))}catch{l(!0)}finally{c(!1)}c(!1)};return a.jsxs("div",{className:C("profile-image-change-figure",t),children:[a.jsx(Ie,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(O.FormattedMessage,{id:"profile_image_change_error"})}),a.jsx("input",{id:"file",type:"file",accept:"image/*",ref:u,onChange:d,hidden:!0,"data-testid":"file-input"}),a.jsx(re,{onClick:()=>u.current&&u.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:o,children:a.jsx(O.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Wa=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:s="contact-form-submit-click"}=t||{};return a.jsx(xt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:s},functions:{onSuccess:e,onFailure:n}})};const za=({title:t,label:e,ctaMessage:n,titleColor:r,labelColor:s,backgroundColor:i,onClose:o,reportError:c,sendInvites:f,initialFormStatus:l="NOT_SUBMITTED"})=>{const[u,d]=h.useState([]),[m,p]=h.useState(!0),[v,x]=h.useState(l),{formatMessage:_}=O.useIntl(),b=async T=>{T.preventDefault();try{await f(u),d([]),x("SUCCESS")}catch(w){x("ERROR"),c(w)}},y=T=>{T.preventDefault(),x("NOT_SUBMITTED"),p(!0),d([])},j=T=>{T.preventDefault(),o(),x("CLOSED")};return v==="CLOSED"?null:v==="ERROR"||v==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:v==="SUCCESS"?a.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),a.jsx(Ee,{}),a.jsx("div",{className:"footer",children:v==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:_({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:j,children:_({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:_({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:i},onSubmit:b,className:C("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:t}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:s},children:e}),a.jsx(Hs.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:u,onChange:T=>{d(T),p(!T.length)},autoFocus:!1,getLabel:(T,w,L)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:T}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(w),p(!u.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},w)})]}),a.jsx(Ee,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})},Bt=t=>t.map(e=>({condition:e})),xe={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},uo=({functions:t,...e})=>{const{formatMessage:n}=O.useIntl(),[r,s]=h.useState(null),[i,o]=h.useState(!1),[c,f]=h.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),l=p=>p[xe.NEW_PASSWORD]!==p[xe.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,u=p=>!qn(p[xe.NEW_PASSWORD]).isValid,d=[{"data-testid":xe.NEW_PASSWORD,id:xe.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Bt(["required",u]),functions:{onChange:p=>f(qn(p).matchingRules),onFocus:()=>o(!0),onBlur:()=>o(!1)}},{"data-testid":xe.CONFIRMED_PASSWORD,id:xe.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Bt(["required",l])}];e.isPasswordChange&&d.unshift({"data-testid":xe.CURRENT_PASSWORD,id:xe.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Bt(["required"])}),i&&d.push({component:Ua,props:{matchingRules:c}});const m={id:xe.FORM_ID,fields:d,functions:{...t,onSuccess:async p=>(t.createPassword(p),t.onSuccess&&t.onSuccess(p)),onCatch:p=>s(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(xe.NEW_PASSWORD)||v.includes(xe.CONFIRMED_PASSWORD))&&o(!0)}},meta:{shouldReset:!0},...e};return a.jsxs(a.Fragment,{children:[a.jsx(xt,{...m}),r&&a.jsx(De,{variant:"error",text:r})]})};const Za=({id:t="search",className:e="",handleToggle:n=!1,defaultValue:r="",gtmContext:s="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},f=O.useIntl(),l=h.useRef(null);Qe(()=>{!n||c||!o||l.current&&l.current.focus()},[o]);const u=d=>{d.preventDefault(),d.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return a.jsx("form",{onSubmit:u,className:C("search-form gtm-trackable",e),"data-gtm-event-context":s,"data-gtm-event-type":i,children:a.jsx("fieldset",{id:`${t}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(he,{element:"label",htmlFor:t,children:f.formatMessage({id:"search_label"})}),a.jsx("input",{ref:l,type:"search",id:t,name:t,defaultValue:r,placeholder:f.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&u(d)}}),a.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:a.jsx(he,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:u,children:a.jsx(he,{children:f.formatMessage({id:"search_cta"})})})]})})})},Or=async({ref:t,validateEmail:e,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(!t.current.validity.valid||!r.test(t.current.value))return n([{type:"validFields.email",value:!1}]);const s=t.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},i);try{o=await e(s),o===void 0&&(o=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:s,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:c=!1,autoApproved:f=!1,exists:l}=o;let u="";return c?u=f?"gov":"nonGov":l.registration?l.engagement&&!l.user?u=l.auth?"verify":"pending":u="exists":l.auth&&(u="exists"),n([{type:"shouldManuallyApprove",value:!f},{type:"emailDetails",value:{email:s,boxType:u,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(s)}},{type:"validFields.email",value:!0}])},fo=t=>{const e={};for(const n of t.entries())e[n[0]]=n[1];return{name:e.full_name,email:e.email_address.toString().toLowerCase().trim(),jobTitle:e.job_title,organization:e.organization,bioLink:e.url,optIn:!0,expectation:e.expectation,page:window.location.pathname,"g-recaptcha-response":e["g-recaptcha-response"]}},mo=async({refs:t,dataToSubmit:e,createAccount:n,onSuccess:r,dispatch:s,state:i})=>{if(!t.form||!t.form.current)throw new Error("No refs.form");if(!t.form.current.checkValidity()){t.hiddenValidation&&t.hiddenValidation.current&&t.hiddenValidation.current.click();return}const o=fo(new FormData(t.form.current)),c=Object.assign(o,e);await n(c),localStorage.setItem("email",o.email),r&&r({...o,...i.values}),s([{type:"showSuccessMessage",value:!0}])},po=({shouldShow:t,functions:{validateEmail:e,resendVerificationCode:n},refs:r,state:s,dispatch:i,dataToSubmit:o,intl:c})=>{const{emailDetails:f}=s,l=(d,m)=>{d.current&&s.validFields[m]!==d.current.validity.valid&&i([{type:`validFields.${m}`,value:d.current.validity.valid}])},u=[{id:"full_name",type:"text",inputRef:r.name,placeholder:c.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>l(r.name,"name"),onFocus:()=>i([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:r.email,placeholder:c.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Or({ref:r.email,validateEmail:e,dispatch:i})},onChange:(d,m)=>{m&&m({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>i([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Aa,props:{email:f.email,type:f.boxType,resendVerificationCode:n}}];return s.shouldManuallyApprove&&(u.push({id:"job_title",type:"text",inputRef:r.jobTitle,placeholder:c.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>l(r.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:r.organisation,placeholder:c.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{l(r.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),t.url&&u.push({id:"url",type:"text",label:c.formatMessage({id:"signup_url"},{small:d=>a.jsx("small",{children:d})}),placeholder:c.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),t.expectation&&u.push({id:"expectation",className:"expectation",type:"text",label:c.formatMessage({id:"signup_expectation"},{small:d=>a.jsx("small",{className:"notes text-small",children:d})}),placeholder:c.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),u.push({id:"terms",className:"text-small",type:"checkbox",inputRef:r.tc,label:c.formatMessage({id:"signup_terms"},{terms:d=>a.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:d}),privacy:d=>a.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:d})}),shownValue:"accepted",functions:{onChange:d=>{if(!d)return;const m=[];["name","email"].forEach(p=>{s.validFields[p]!==r[p].current.validity.valid&&(m.push({type:`validFields.${p}`,value:r[p].current.validity.valid}),p==="email"&&Or({ref:r.email,validateEmail:e,dispatch:i}))}),m.length&&i(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),u};const ho=({className:t=""})=>a.jsxs("div",{className:C("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(O.FormattedMessage,{id:"signup_success_title"})}),a.jsx(O.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const go={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},vo=({className:t="",functions:e={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:n={title:!0,expectation:!1,url:!0,logInButton:!0,successMessage:!0},submitButton:r,dataToSubmit:s={ref:"sign-up-form"},...i})=>{const o=O.useIntl(),[c,f]=h.useReducer(Yn,go),{validFields:l,emailDetails:u,shouldManuallyApprove:d,showSuccessMessage:m,showError:p}=c,[v,x]=Vn.useCookies(["signup-this-session","functional-cookie-consent"]),_={form:h.createRef(),name:h.createRef(),email:h.createRef(),jobTitle:h.createRef(),organisation:h.createRef(),tc:h.createRef(),hiddenValidation:h.createRef()};h.useEffect(()=>{d===!0&&_.jobTitle.current&&_.jobTitle.current.focus()},[d]),h.useEffect(()=>{(i.showSuccessMessage||v["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[v]),h.useEffect(()=>{if(m&&v["functional-cookie-consent"]){const j={path:"/",maxAge:3600};i.showSuccessMessage||x("signup-this-session","true",j)}},[m]);const b=h.useMemo(()=>po({shouldShow:n,functions:e,refs:_,state:c,dispatch:f,dataToSubmit:s,intl:o}),[s,e,o,_,n,c]),y=d?!Object.values(l).every(j=>j===!0):!l.name||!l.email||["exists","pending","verify"].includes(u.boxType);return n.successMessage&&m?a.jsx(ho,{className:t}):a.jsxs("fieldset",{className:C("signup-form-fieldset",t),"data-testid":"signup-form",children:[n.title&&a.jsx("p",{className:"signup-title",children:a.jsx(O.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(De,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(xt,{className:"signup-form",formRef:_.form,id:"sign-up-form",fields:b,intlPath:"signup",button:{variant:"primary",size:"medium",text:r||o.formatMessage({id:"signup_button_join"}),disabled:y?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},meta:{shouldReset:!1,showRequiredLabels:!1},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{mo({refs:_,dataToSubmit:s,createAccount:e.createAccount,onSuccess:e.onSuccess,dispatch:f,state:c})},onCatch:j=>{e.handleError(j),f([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),a.jsx("button",{className:"validation-button",ref:_.hiddenValidation}),n.logInButton&&a.jsx(re,{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",children:o.formatMessage({id:"signup_button_login"})})]})};var zn={exports:{}},Nt={exports:{}},ce={};/** @license React v16.13.1
|
|
38
38
|
* react-is.production.min.js
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/index.mjs
CHANGED
|
@@ -2793,7 +2793,7 @@ const zn = {
|
|
|
2793
2793
|
"course-lesson-page": ["breadcrumb", "course-navigation", "text-page"],
|
|
2794
2794
|
"course-lesson-quiz": ["text-page", "quiz-box"]
|
|
2795
2795
|
}, xa = (t, e) => t in zn ? /* @__PURE__ */ a.jsx("div", { className: t, children: zn[t].map((n, r) => xa(n, r)) }, e) : /* @__PURE__ */ a.jsx(Se, { className: t }, e), wa = ({ layout: t = "overview-page", ...e }) => /* @__PURE__ */ a.jsx("div", { className: S("loading-state", t), ...e, children: zn[t].map((n, r) => xa(n, r)) }), ja = (t) => {
|
|
2796
|
-
const e = t && t.toUpperCase().split(" ");
|
|
2796
|
+
const e = t && t.toUpperCase().trim().split(" ");
|
|
2797
2797
|
return Array.isArray(e) && e.length > 1 && e[0] !== "" ? e[1] === "" ? e[0][0] : e[0][0] + e[e.length - 1][0] : t ? t.substr(0, 1) : "";
|
|
2798
2798
|
}, Et = ["#5AB6A3", "#A2D7AF", "#806056", "#3962B3"], Ri = (t) => {
|
|
2799
2799
|
const e = Math.ceil(26 / Et.length), n = ja(t).toLowerCase();
|