@apolitical/component-library 3.1.0-beta.1 → 3.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +273 -271
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/base/_text.scss +1 -1
- package/text/markdown-text/components/div/div.d.ts +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_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",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",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"},ei={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>"},ti={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"},ni={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>"},ri=Object.freeze(Object.defineProperty({__proto__:null,en:Wn,es:ei,fr:ti,pt:ni},Symbol.toStringTag,{value:"Module"})),Gt=(t,e=Wn)=>t in e,ke=(t,e,n,r,s={})=>{let i="";return Gt(`${e}_${n}`)?i=t({id:`${e}_${n}`},s):i=t({id:e},{[r]:n,...s}),i},ai=(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},Ot=(t,e)=>g.Children.map(t,n=>Object.is(n,null)?n:g.cloneElement(n,{...e})),ya=(t=0)=>{setTimeout(()=>{const e=document.querySelector(".splash-screen");e&&e.remove(),window.prerenderReady=!0},t)},si=t=>t.replace(/\s+/g,"").length>0,ii=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=Xe(typeof e=="object");if(typeof e=="object"&&typeof p=="number"){const x=Object.assign({},e),b=fa(Object.keys(x));e=ma(p,b,x)}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 _={...d,className:C(t,c,v,{"no-text":!u,disabled:f,button:s}),onClick:x=>{(!s||s[0]==="#")&&o&&(x.preventDefault(),x.stopPropagation()),o&&o(x)},disabled:typeof f=="object"&&"isClickable"in f?!f.isClickable:f};return s&&(i="a",_.href=s),g.createElement(i,_,u||(l?a.jsx(ge,{showOnFocus:!1,children:l}):null))},et=({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 g.createElement(r,{className:C("button-wrapper",e),...n,children:s})};const Te=({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})},kr={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"}},oi=({aspect:t,range:e,sizes:n})=>{const{range:r,sizes:s}=t?kr[t]:kr.fallback;return{range:e&&e.length>0?e:r,sizes:n||s}},ci=({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},fn=({format:t,range:e,url:n,query:r})=>e.map(({height:s,width:i})=>`${n}?${ci({format:t,height:s,query:r,width:i})} ${i}w`).join(", ");const tt=({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}=oi(t),v=fn({format:"avif",query:o,range:m,url:c}),_=fn({format:"webp",query:o,range:m,url:c}),x=fn({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:_,sizes:p,"data-testid":"source"}),a.jsx("img",{srcSet:x,sizes:p,src:c,alt:r,loading:l||"lazy",decoding:u||"async",fetchpriority:d||"auto",width:f,height:s,"data-testid":n||"image"})]})};const li=({image:t,className:e,testId:n})=>a.jsx("div",{className:`image-container ${e}`,"data-testid":n||"image-container",children:t&&a.jsx(tt,{image:{...t},className:"image"})}),qe=({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?g.createElement(n,{children:e,className:r,...c}):e};const ui=({elementId:t,offset:e=20})=>{const n=A.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"})})},jr=300,Tr="ease-in-out";class di{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))}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:jr,easing:Tr}),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:jr,easing:Tr}),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 Qt=({label:t=!1,className:e="",children:n,shouldAnimate:r=!1})=>{const s=A.useIntl(),i=g.useRef(null);return g.useEffect(()=>{r&&new di(i.current)},[]),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})]})},Er={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},fi=t=>{let e=t;return Object.keys(Er).includes(t)&&(e=Er[t]),`url(${Re}icons/${e}.svg)`};const Sr={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub"},_a=({contentType:t,customIcon:e,customLabel:n,className:r=""})=>{const s=A.useIntl(),i=e?{"--custom-icon":fi(e)}:{},o=Gt(`contentTypeLabel_${t}`)?s.formatMessage({id:`contentTypeLabel_${t}`}):!1;return!n&&!o?null:a.jsx("small",{className:C("content-type-label text-small",t in Sr?Sr[t]:t,r,{"has-custom-icon":e}),style:i,"data-testid":"content-type-label",children:n||o})};const je=({variant:t="primary",icon:e,styling:n={},className:r="",children:s,...i})=>{const{showHighlight:o=!1,background:c="default"}=n,f=e?{"--icon":`url(${Re}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 Ue=({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=Xe(i);if(i&&typeof n=="object"&&typeof o=="number"){const d=Object.assign({},n.breakpoints),m=fa(Object.keys(d));s=ma(o,m,d)}const{breakpoints:c,text:f="",component:l,...u}=n;return a.jsx(je,{variant:"subtle",className:C("empty-state-box",t,r),children:a.jsxs(a.Fragment,{children:[e&&typeof e=="string"?a.jsx(Me,{options:{forceBlock:!0},children:e}):e,s&&typeof n=="object"&&(l||a.jsx(re,{...u,variant:n.variant?n.variant:"secondary",children:f}))]})})};const In=({children:t,...e})=>a.jsx("p",{...e,children:t}),xa={q:In,blockquote:In};for(let t=1;t<=6;t++)xa[`h${t}`]={component:In,props:{className:"title"}};const wa=({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(Me,{options:{wrapper:g.Fragment,forceBlock:!0,overrides:xa},children:r}):a.jsx("p",{children:r})]});const mi=({className:t="",show:e=!1,hide:n=!1,text:r,children:s})=>{const i=A.useIntl(),o=g.useRef(null),[c,f]=g.useState(""),[l,u]=g.useState("closed");g.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",d),()=>{p.removeEventListener("transitionend",d)}},[]),g.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]),g.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(je,{variant:"subtle",className:C("hide-show-text-box",t),children:[a.jsxs("div",{ref:o,className:C("content",l),children:[a.jsx(Me,{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 pi=({element:t="ul",layout:e="vertical",variant:n="default",items:r=[],styling:s={},className:i=""})=>{const{hasBorder:o=!1,zebraStriping:c=!1}=s;return g.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:g.Fragment,forceInline:!0},d={"--icon":`url(${Re}icons/${f.icon}.svg)`};return t==="dl"?a.jsxs(g.Fragment,{children:[a.jsx("dt",{style:d,children:a.jsx(Me,{options:u,children:f.dt||""})},`dt-${l}`),a.jsx("dd",{children:typeof f.text=="string"?a.jsx(Me,{options:u,children:f.text}):f.text},`dd-${l}`)]},`dl-${l}`):a.jsx("li",{style:d,children:typeof f.text=="string"?a.jsx(Me,{options:u,children:f.text}):f.text},l)})})},ve=()=>g.Fragment,hi=({children:t})=>a.jsx(je,{variant:"secondary",children:t}),gi=["span","strong","h1","h2","h3","h4","h5","h6","p"],vi=({children:t})=>{const e=A.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number"))if(g.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of g.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&g.isValidElement(o)){const c=o.type;if(gi.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(Qt,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},bi=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(je,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(je,{variant:"primary",children:t});case"pink-textbox":return a.jsx(je,{variant:"tertiary",children:t});default:return a.jsx("div",{...e,children:t})}return a.jsx("div",{...e,children:t})},yi=t=>{const e=A.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(ge,{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})]})},Cr=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},_i=({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 g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number")&&g.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"||Cr(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!g.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Cr(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})},ka=({children:t})=>a.jsx("span",{children:t});const xi={default:{a:_i,CollapsibleSection:Qt,TextBox:je,CaseStudy:hi,style:ve,details:vi,div:bi,iframe:yi},"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}},ht=({className:t="",options:e={},children:n,overrideType:r="default",styling:s={}})=>{const{highlightTitles:i=!1}=s;n=n.replace(/^<br\/?>/,"");const o={wrapper:g.Fragment,forceBlock:!0,overrides:xi[r]};return a.jsx("div",{className:C("markdown-text",t,{"highlight-titles":i}),children:a.jsx(Me,{options:{...o,...e},children:n})})};const ja=({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&&g.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&g.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const gt=({size:t="medium",variant:e="default",className:n="",children:r,...s})=>a.jsx("span",{className:C("pill",t,e,n),...s,children:r});const vt=({element:t="p",children:e=null,className:n="",...r})=>g.createElement(t,{...r,className:C("status-banner text-small",n),"aria-live":"assertive"},e);const wi=({author:t,authorCite:e,content:n})=>a.jsxs("blockquote",{className:"testimonial-block",children:[a.jsx(Me,{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})})]}),ki=g.memo(wi);const ji=({items:t=[],selector:e="",className:n=""})=>{const r=A.useIntl(),[s,i]=g.useState(t);return g.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(je,{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 Jt=({time:t,rangeTime:e,prependedText:n,appendedText:r,className:s=""})=>{const i=A.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),_=`${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:_}};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 st=!1;const Ta=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=A.useIntl(),s=g.useRef(null),[i,o]=g.useState("hidden");g.useEffect(()=>{const f=s.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(st!==!1&&clearTimeout(st),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Ge(()=>{st!==!1&&clearTimeout(st);let f="open";t?o("opening"):(o("closing"),f="hidden"),st=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 Ti=({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(tt,{...n,className:C("banner",t),image:{...e,aspect:"banner"}})):null;const Oe=({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 Ei=({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(Oe,{className:C("download-section",n),children:a.jsxs(a.Fragment,{children:[g.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(et,{buttons:r})]})})};function Ea({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const Si=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:s,setShowModal:i})=>{const{formatMessage:o}=A.useIntl();return a.jsxs("div",{className:C("edit-section-placeholder",{"has-icon":!!t}),style:va(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),s&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>Ea({href:r,setShowModal:i}),children:n||o({id:"edit_section_placeholder_cta"})})]})},Ci=({children:t,className:e="",formProps:n,href:r,title:s,modalTitle:i,placeholder:o,showDivider:c=!0})=>{const[f,l]=g.useState(!1),u=typeof r=="string"||!!n,d=()=>l(!1);return a.jsxs("section",{className:C("edit-section",e),children:[n&&a.jsx(yt,{title:i||`Edit ${s}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:d},className:C("edit-section-modal"),children:a.jsx(tn,{...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:()=>Ea({href:r,setShowModal:l}),children:"Edit"})]}),t||a.jsx(Si,{...o,href:r,setShowModal:l,showEditButton:u}),c&&a.jsx(Te,{})]})};const $i=({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&&g.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 Ni=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Mi=({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&&Ni.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(Oe,{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(ht,{overrideType:"text-only",className:"text",children:m},d):g.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(tt,{image:{...n,aspect:"banner"}})]})})},Pi=g.memo(Mi);const Ri=({image:t,variant:e="default",children:n,className:r=""})=>{const s={};return t&&(s["--image"]=`url(${t})`),a.jsx(Oe,{className:C("custom-content-banner",e,r,{"has-image":t}),style:s,children:a.jsx("div",{className:"content-slim",children:n})})};const Fi=({alignImage:t="left",className:e,content:n,image:r})=>{const s=()=>typeof n=="string"?a.jsx(Me,{children:n}):n;return a.jsxs(Oe,{className:C("highlight-section",e),children:[r&&a.jsx("div",{className:C("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(tt,{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()})})]})},Oi=g.memo(Fi);const Ai=({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})]}),Sa=({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(Bs.ReactQueryDevtools,{initialIsOpen:!1})]})};var Di=g.createContext({client:Ft});function Ii(t){var e=t.children,n=t.client,r=t.apiKey,s=t.options,i=g.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&&(Ft.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ft.init(r,s)),Ft)},[n,r]);return g.createElement(Di.Provider,{value:{client:i}},e)}const Ca=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(Ii,{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}):t,$a=({children:t,locale:e,messages:n})=>{const r=e||"en",s={...ri[r],...n||{}};return a.jsx(A.IntlProvider,{locale:r,messages:s,children:t})},Ee=g.createContext({isLoading:!0});function Xt(){return g.useContext(Ee)}const Na=({children:t,user:e})=>a.jsx(Ee.Provider,{value:e,children:t}),Li=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[s,i]=g.useState({isLoading:!0});return g.useEffect(()=>{t().then(o=>{i({...o,isLoading:!1}),ya(5e3)}).catch(()=>i({isLoading:!1}))},[]),a.jsx($a,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(zn.CookiesProvider,{children:a.jsx(Na,{user:s,children:a.jsx(Sa,{showDevTools:r,children:a.jsx(Ca,{user:s,children:e})})})})})};const Bi=({styling:t={},progress:e=0,text:n=!1,className:r=""})=>{const s=A.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:g.createElement(i?"span":ge,{className:i?"text":"",children:n||s.formatMessage({id:"progressBar"},{number:e})})})},Vn=g.memo(Bi);const mn="loadingBlock_",qi=({progress:t=0,steps:e=!1,className:n=""})=>{const r=A.useIntl();e||(e={0:{text:r.formatMessage({id:`${mn}loading`})},75:{text:r.formatMessage({id:`${mn}almostDone`})},100:{text:r.formatMessage({id:`${mn}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(${Re}icons/${e[s].icon}.svg)`}:{};return a.jsxs(je,{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(Vn,{progress:t})]})},Ui=g.memo(qi);const xe=({element:t="div",className:e="",...n})=>a.jsx(Kt,{element:t,className:C("loading-placeholder",e),...n});const Ln={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"]},Ma=(t,e)=>t in Ln?a.jsx("div",{className:t,children:Ln[t].map((n,r)=>Ma(n,r))},e):a.jsx(xe,{className:t},e),Yn=({layout:t="overview-page",...e})=>a.jsx("div",{className:C("loading-state",t),...e,children:Ln[t].map((n,r)=>Ma(n,r))}),Pa=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):""},kt=["#5AB6A3","#A2D7AF","#806056","#3962B3"],zi=t=>{const e=Math.ceil(26/kt.length),n=Pa(t).toLowerCase();if(n==="")return kt[0];const r=n.charCodeAt(0)-96;for(let s=0;s<kt.length;s++)if(r<=e*(s+1))return kt[s]};const $r=256,Ae=({className:t="",src:e="",name:n,alt:r,width:s=$r,height:i=$r,...o})=>{const[c,f]=g.useState(!1),l=g.useRef(null);g.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=zi(n),m.fillRect(0,0,p,v),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Pa(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})})},Kn=t=>t==="apolitical"?{image:`${Re}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${Re}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},Zi=({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=Ke(f,r)),f};const en=({element:t="div",member:e="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=A.useIntl(),c=Kn(e);c.name||(c.name=o.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:f,url:l,image:u}=c,d=Zi(c),m=n&&n.createdAt?Dn(n.createdAt):!1,p=n&&n.createdAt?Hn(n.createdAt):"";return g.createElement(t,{className:C("member text-medium",i),children:a.jsxs(qe,{href:l,gtmType:s,gtmContext:r,onClick:v=>{v==null||v.stopPropagation()},children:[a.jsx(Ae,{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 Nr={small:24,medium:48},Gn=({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,className:f="",...l})=>{const u=A.useIntl();return!n||n.length===0?null:g.createElement(t,{...l,className:C("contributors",f,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((d,m)=>{let p,v="";if(m<c){const{name:_="",image:x=""}=Kn(d);if(o)return a.jsx(xe,{element:"li",className:"contributor"},m);p=a.jsx(Ae,{name:_,src:x,width:Nr[s||"medium"],height:Nr[s||"medium"]})}else if(m===c){const _=(e||n.length)-c;p=a.jsxs("small",{className:C({"large-number":_>99}),children:["+",ai(_,0)]}),v="number-left"}return p?a.jsx("li",{className:C("contributor",v),children:p},m):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?u.formatMessage({id:`member_${n[0]}`}):Ke(n[0].name||"",20):null})]})})};const jt="emailHelperTextBox_",Ra=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const s=A.useIntl(),[i,o]=g.useState({path:`${jt}default`,type:"default",link:{},mail:{},error:""}),[c,f]=g.useState(!1),l=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const v=_=>{o({path:`${jt}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>l(x),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:_})};if(typeof r!="function"){v(s.formatMessage({id:`${jt}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(_=>{v(_.message)}).finally(()=>{f(!1)})},[e,n,r]);g.useEffect(()=>{let p=jt,v="default",_={},x={};switch(t){case"gov":p+="autoApproved",v="success";break;case"nonGov":p+="unrecognisedEmail",v="error",_={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",x={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",_={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",_={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",_={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:_,mail:x})},[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(wa,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(xe,{element:"span"}),a.jsx(xe,{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})})},ft=({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=g.useRef(),d=r||u;return g.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"},Hi=500,Wi=({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]=g.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:l,activePredictionIndex:u,isPredictionSelected:d},m]=g.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=A.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),g.useEffect(()=>{const b=setTimeout(()=>{d||f(y=>({...y,debouncedInput:i}))},Hi);return()=>{clearTimeout(b)}},[i,d]),g.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]),g.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}))))},_=b=>{r(b.target.value),f(y=>({...y,input:b.target.value,displayInput:b.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},x=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:_,onKeyDown:v,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:l.map((b,y)=>a.jsx("li",{onClick:()=>x(b),onMouseEnter:()=>m(j=>({...j,activePredictionIndex:y})),className:C("predictions-list-item",{active:y===u}),children:b.description},y))})]})};const Fa=({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=A.useIntl(),{onChange:p,...v}=r,_=()=>{e||p(u?null:f)},x=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(),_())},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 g.createElement(n,{onClick:b=>{const y=b.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),_())},className:C("checkbox-wrapper",t),...d,...v},x)};const Vi=g.memo(function({direction:e="down"}){return a.jsx(Kt,{className:C("rotating-chevron",`direction-${e}`)})});const Yi=({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=A.useIntl(),[d,m]=g.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[_,x]=g.useState(v);let b;Array.isArray(_)&&_.length===1&&typeof _[0]=="string"?b=e&&_?e.find(F=>F.id===_[0]):e?e[0]:{id:"",label:""}:Array.isArray(_)&&_.length===1&&typeof _[0]!="string"?b=_[0]:b={id:"",label:""},g.useEffect(()=>{x(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:j,...E}=s,k=F=>{if(c){let V=[];_!=null&&_.includes(F.id)?V=_.filter(R=>R!==F.id):V=[..._,F.id],x([...V]),y&&y([...V])}else x([F]),y&&y(F.id),m(!1)},L=F=>{if(F==="all"){const V=(e==null?void 0:e.map(R=>R.id))||[];x(V),y&&y(V)}else x([]),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",...E,children:[c?`${o} · ${_.length}`:b.label,a.jsx(Vi,{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);k(V)},hidden:!d,...E,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:`${_==null?void 0:_.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||(_==null?void 0:_.includes(F))||(_==null?void 0:_.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(),k(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(_),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:_}})),m(!1)},children:u.formatMessage({id:"form_submit"})})})]})]})};const Ki=({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=A.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:_,label:x=!1,value:b=_,disabled:y=!1})=>{const j=`${r}_${_}`,E=()=>{if(y)return;let k;if(i){const L=p==null?void 0:p.indexOf(b);Array.isArray(p)&&L>=0?(k=p,k.splice(L,1)):(!p||p.length===0?k=[]:k=p,k.push(b))}else k=v===b?void 0:b;e.onChange(k)};return a.jsx(Fa,{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:E},intlPath:n,label:x||m.formatMessage({id:n?`${n}_${_}`:_}),disabled:y},j)})})};const Gi=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const s=A.useIntl(),i=g.useRef(),o=t||i,[c,f]=g.useState(!1),[l,u]=g.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(ft,{inputRef:o,type:l,...r})]})};const We={text:{component:ft},email:{component:ft},textarea:{component:ft,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Fa},checkboxes:{component:Ki,props:{multiSelect:!0}},select:{component:Yi},password:{component:Gi},autocomplete:{component:Wi}},Qi=({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=A.useIntl(),m=f&&f.some(({condition:E})=>E==="required"),p=(l==null?void 0:l.toString().length)||0,v=c&&We[c]&&We[c].component?We[c].component:ft,_={};c&&["checkboxes"].includes(c)?_.element="span":_.htmlFor=t;let x={...u,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:dt(s),value:l};i>0&&(x["data-character-limit"]=i,x.functions&&(x.functions.onChange=E=>{((E==null?void 0:E.toString().length)||0)>i&&(E=E==null?void 0:E.toString().slice(0,i)),s.onChange(E)})),c&&We[c]&&We[c].props&&(x={...x,...We[c].props}),c&&["checkboxes"].includes(c)&&(x.intlPath=`${e}_${t}`),r&&(x["aria-invalid"]=!0,x["aria-describedby"]=`error-${t}`);const b=u.label||d.formatMessage({id:e?`${e}_${t}`:t}),y=({...E})=>r?g.createElement(E.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(v,{...x,label:b,className:C("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const j=E=>g.createElement(E.element||"label",{...E,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,{..._,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,{...x}),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,{})]})},Ji=(t,e)=>{const{type:n,payload:r}=e,s=t.errors?dt(t.errors):{},i=t.values?dt(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=dt(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:_=!1}=m.validation[p];let x=!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(x){c({type:"addError",payload:{key:m.id,value:x}}),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 pn=null;const tn=({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:_=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...x})=>{const{customOnSubmit:b,hideButton:y,...j}=i,E=40,k=A.useIntl(),L={};t.length&&t.forEach(B=>{const W=B.id||B.name;W&&(L[W]=B.value||"")});const[F,V]=g.useReducer(Ji,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:R,isSubmitting:D,formSubmitted:$,values:S}=F;g.useEffect(()=>{f&&$&&(pn=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[$]),g.useEffect(()=>()=>{pn&&clearTimeout(pn)},[]),g.useEffect(()=>{const B=W=>{V({type:"updateValue",payload:{key:W.detail.id,value:W.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const w=g.useRef(null),N=r||w;if(!t.length)return null;i.text||(i.text=k.formatMessage({id:"form_submit"}));const Z=[{...j,icon:$?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:B=>{var T;if(B.preventDefault(),B.stopPropagation(),D)return;let W=0;if((T=N==null?void 0:N.current)!=null&&T.id){const M=document.getElementById(N.current.id);M&&(W=M.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(W=W-J.offsetHeight-E),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"}),V({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&V({type:"submitForm",payload:{fields:t,dispatch:V,intl:k}});return}V({type:"submitForm",payload:{fields:t,dispatch:V,onSuccess:async M=>{try{await m(M),V({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(H){v(H),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(M,H)=>{_(M,H),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:k}})},disabled:D||$||i.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:D||$?k.formatMessage({id:`form_${D?"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:D||$,onClick:p,children:o.text||k.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{...x,id:n,className:C("form",e),ref:N,children:[R!=null&&R.general?a.jsx(Ue,{variant:"error",text:k.formatMessage({id:"form_error_generalError"})}):null,(!D&&!$||b)&&t.map((B,W)=>{const{id:J=B.name||W,component:T,functions:M={onChange:()=>{}}}=B;if(T)return a.jsx(T,{...B.props||{}},`component-${J}-${W}`);const H=S?S[J]:"";return a.jsx(Qi,{intlPath:s,...B,showRequiredLabels:l,value:H,error:R==null?void 0:R[J],functions:{...M,onChange:z=>{V({type:"updateValue",payload:{key:J,value:z}}),M.onChange(z&&z.toString(),V)}}},J)}),y?null:(D||$)&&b?b:a.jsx(et,{className:C("cta",{center:D||$,submitted:$}),buttons:Z})]}),u&&$&&a.jsx(vt,{className:"success",children:typeof u=="string"?u:k.formatMessage({id:"form_success"})})]})};const Tt="passwordRules_",Oa="isMoreThanEightCharacters",Aa="includesNumberAndSymbol",Da="includesLowerAndUppercase",Xi={[Oa]:"8Characters",[Aa]:"numberSymbol",[Da]:"lowercaseUppercase"},eo=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=A.useIntl();return a.jsxs("aside",{className:C("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${Tt}intro`})}),a.jsx("ul",{children:[Oa,Aa,Da].map(r=>a.jsxs("li",{className:C({matches:t[r]}),children:[a.jsxs(ge,{children:[n.formatMessage({id:`${Tt}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${Tt}rule_${Xi[r]}`})}),!t[r]&&a.jsxs(ge,{element:"strong",children:[" ",n.formatMessage({id:`${Tt}notMet`})]})]},`rule-${r}`))})]})},to=g.memo(eo);const no=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=A.useIntl(),[f,l]=g.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(g.useEffect(()=>{o&&!f.setUp&&u()},[o]),!o)return a.jsx(xe,{className:"rating-placeholder"});const{id:d,rating:m,disabled:p}=f,v="ratings_",_={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},x=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:_[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?` - ${_[y===1?"low":"high"]}`:""}`,onClick:j=>{j.preventDefault(),j.stopPropagation(),x(y)},disabled:p})},`rating-${y}`)})})]})};const ro=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:s=()=>{}},isDisabled:i=!1,className:o=""})=>{const[c,f]=g.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);g.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 ao({className:t="",userId:e,userName:n,src:r,setUserImage:s,uploadImage:i}){const[o,c]=g.useState(!1),[f,l]=g.useState(!1),u=g.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(_=>({..._,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(Ae,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(A.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(A.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Ia=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:s="contact-form-submit-click"}=t||{};return a.jsx(tn,{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 La=({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]=g.useState([]),[m,p]=g.useState(!0),[v,_]=g.useState(l),{formatMessage:x}=A.useIntl(),b=async E=>{E.preventDefault();try{await f(u),d([]),_("SUCCESS")}catch(k){_("ERROR"),c(k)}},y=E=>{E.preventDefault(),_("NOT_SUBMITTED"),p(!0),d([])},j=E=>{E.preventDefault(),o(),_("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:x({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),a.jsx(Te,{}),a.jsx("div",{className:"footer",children:v==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:x({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:j,children:x({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:x({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(qs.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:u,onChange:E=>{d(E),p(!E.length)},autoFocus:!1,getLabel:(E,k,L)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:E}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(k),p(!u.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},k)})]}),a.jsx(Te,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})};const Ba=({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=A.useIntl(),l=g.useRef(null);Ge(()=>{!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(ge,{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(ge,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:u,children:a.jsx(ge,{children:f.formatMessage({id:"search_cta"})})})]})})})},Mr=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}])},so=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"]}},io=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=so(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}])},oo=({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:()=>{Mr({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:Ra,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"&&Mr({ref:r.email,validateEmail:e,dispatch:i}))}),m.length&&i(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),u};const co=({className:t=""})=>a.jsxs("div",{className:C("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(A.FormattedMessage,{id:"signup_success_title"})}),a.jsx(A.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const lo={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},uo=({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=A.useIntl(),[c,f]=g.useReducer(Zn,lo),{validFields:l,emailDetails:u,shouldManuallyApprove:d,showSuccessMessage:m,showError:p}=c,[v,_]=zn.useCookies(["signup-this-session","functional-cookie-consent"]),x={form:g.createRef(),name:g.createRef(),email:g.createRef(),jobTitle:g.createRef(),organisation:g.createRef(),tc:g.createRef(),hiddenValidation:g.createRef()};g.useEffect(()=>{d===!0&&x.jobTitle.current&&x.jobTitle.current.focus()},[d]),g.useEffect(()=>{(i.showSuccessMessage||v["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[v]),g.useEffect(()=>{if(m&&v["functional-cookie-consent"]){const j={path:"/",maxAge:3600};i.showSuccessMessage||_("signup-this-session","true",j)}},[m]);const b=g.useMemo(()=>oo({shouldShow:n,functions:e,refs:x,state:c,dispatch:f,dataToSubmit:s,intl:o}),[s,e,o,x,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(co,{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(A.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(Ue,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(tn,{className:"signup-form",formRef:x.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()=>{io({refs:x,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:x.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 Bn={exports:{}},Et={exports:{}},ce={};/** @license React v16.13.1
|
|
37
|
+
`))},[r]),g.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(je,{variant:"subtle",className:C("hide-show-text-box",t),children:[a.jsxs("div",{ref:o,className:C("content",l),children:[a.jsx(Me,{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 pi=({element:t="ul",layout:e="vertical",variant:n="default",items:r=[],styling:s={},className:i=""})=>{const{hasBorder:o=!1,zebraStriping:c=!1}=s;return g.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:g.Fragment,forceInline:!0},d={"--icon":`url(${Re}icons/${f.icon}.svg)`};return t==="dl"?a.jsxs(g.Fragment,{children:[a.jsx("dt",{style:d,children:a.jsx(Me,{options:u,children:f.dt||""})},`dt-${l}`),a.jsx("dd",{children:typeof f.text=="string"?a.jsx(Me,{options:u,children:f.text}):f.text},`dd-${l}`)]},`dl-${l}`):a.jsx("li",{style:d,children:typeof f.text=="string"?a.jsx(Me,{options:u,children:f.text}):f.text},l)})})},ve=()=>g.Fragment,hi=({children:t})=>a.jsx(je,{variant:"secondary",children:t}),gi=["span","strong","h1","h2","h3","h4","h5","h6","p"],vi=({children:t})=>{const e=A.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number"))if(g.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of g.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&g.isValidElement(o)){const c=o.type;if(gi.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(Qt,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},bi=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(je,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(je,{variant:"primary",children:t});case"pink-textbox":return a.jsx(je,{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})},yi=t=>{const e=A.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(ge,{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})]})},Cr=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},_i=({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 g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number")&&g.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"||Cr(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!g.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Cr(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})},ka=({children:t})=>a.jsx("span",{children:t});const xi={default:{a:_i,CollapsibleSection:Qt,TextBox:je,CaseStudy:hi,style:ve,details:vi,div:bi,iframe:yi},"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}},ht=({className:t="",options:e={},children:n,overrideType:r="default",styling:s={}})=>{const{highlightTitles:i=!1}=s;n=n.replace(/^<br\/?>/,"");const o={wrapper:g.Fragment,forceBlock:!0,overrides:xi[r]};return a.jsx("div",{className:C("markdown-text",t,{"highlight-titles":i}),children:a.jsx(Me,{options:{...o,...e},children:n})})};const ja=({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&&g.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&g.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const gt=({size:t="medium",variant:e="default",className:n="",children:r,...s})=>a.jsx("span",{className:C("pill",t,e,n),...s,children:r});const vt=({element:t="p",children:e=null,className:n="",...r})=>g.createElement(t,{...r,className:C("status-banner text-small",n),"aria-live":"assertive"},e);const wi=({author:t,authorCite:e,content:n})=>a.jsxs("blockquote",{className:"testimonial-block",children:[a.jsx(Me,{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})})]}),ki=g.memo(wi);const ji=({items:t=[],selector:e="",className:n=""})=>{const r=A.useIntl(),[s,i]=g.useState(t);return g.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(je,{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 Jt=({time:t,rangeTime:e,prependedText:n,appendedText:r,className:s=""})=>{const i=A.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),_=`${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:_}};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 st=!1;const Ta=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=A.useIntl(),s=g.useRef(null),[i,o]=g.useState("hidden");g.useEffect(()=>{const f=s.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(st!==!1&&clearTimeout(st),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Ge(()=>{st!==!1&&clearTimeout(st);let f="open";t?o("opening"):(o("closing"),f="hidden"),st=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 Ti=({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(tt,{...n,className:C("banner",t),image:{...e,aspect:"banner"}})):null;const Oe=({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 Ei=({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(Oe,{className:C("download-section",n),children:a.jsxs(a.Fragment,{children:[g.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(et,{buttons:r})]})})};function Ea({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const Si=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:s,setShowModal:i})=>{const{formatMessage:o}=A.useIntl();return a.jsxs("div",{className:C("edit-section-placeholder",{"has-icon":!!t}),style:va(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),s&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>Ea({href:r,setShowModal:i}),children:n||o({id:"edit_section_placeholder_cta"})})]})},Ci=({children:t,className:e="",formProps:n,href:r,title:s,modalTitle:i,placeholder:o,showDivider:c=!0})=>{const[f,l]=g.useState(!1),u=typeof r=="string"||!!n,d=()=>l(!1);return a.jsxs("section",{className:C("edit-section",e),children:[n&&a.jsx(yt,{title:i||`Edit ${s}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:d},className:C("edit-section-modal"),children:a.jsx(tn,{...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:()=>Ea({href:r,setShowModal:l}),children:"Edit"})]}),t||a.jsx(Si,{...o,href:r,setShowModal:l,showEditButton:u}),c&&a.jsx(Te,{})]})};const $i=({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&&g.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 Ni=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Mi=({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&&Ni.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(Oe,{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(ht,{overrideType:"text-only",className:"text",children:m},d):g.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(tt,{image:{...n,aspect:"banner"}})]})})},Pi=g.memo(Mi);const Ri=({image:t,variant:e="default",children:n,className:r=""})=>{const s={};return t&&(s["--image"]=`url(${t})`),a.jsx(Oe,{className:C("custom-content-banner",e,r,{"has-image":t}),style:s,children:a.jsx("div",{className:"content-slim",children:n})})};const Fi=({alignImage:t="left",className:e,content:n,image:r})=>{const s=()=>typeof n=="string"?a.jsx(Me,{children:n}):n;return a.jsxs(Oe,{className:C("highlight-section",e),children:[r&&a.jsx("div",{className:C("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(tt,{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()})})]})},Oi=g.memo(Fi);const Ai=({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})]}),Sa=({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(Bs.ReactQueryDevtools,{initialIsOpen:!1})]})};var Di=g.createContext({client:Ft});function Ii(t){var e=t.children,n=t.client,r=t.apiKey,s=t.options,i=g.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&&(Ft.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ft.init(r,s)),Ft)},[n,r]);return g.createElement(Di.Provider,{value:{client:i}},e)}const Ca=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(Ii,{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}):t,$a=({children:t,locale:e,messages:n})=>{const r=e||"en",s={...ri[r],...n||{}};return a.jsx(A.IntlProvider,{locale:r,messages:s,children:t})},Ee=g.createContext({isLoading:!0});function Xt(){return g.useContext(Ee)}const Na=({children:t,user:e})=>a.jsx(Ee.Provider,{value:e,children:t}),Li=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[s,i]=g.useState({isLoading:!0});return g.useEffect(()=>{t().then(o=>{i({...o,isLoading:!1}),ya(5e3)}).catch(()=>i({isLoading:!1}))},[]),a.jsx($a,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(zn.CookiesProvider,{children:a.jsx(Na,{user:s,children:a.jsx(Sa,{showDevTools:r,children:a.jsx(Ca,{user:s,children:e})})})})})};const Bi=({styling:t={},progress:e=0,text:n=!1,className:r=""})=>{const s=A.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:g.createElement(i?"span":ge,{className:i?"text":"",children:n||s.formatMessage({id:"progressBar"},{number:e})})})},Vn=g.memo(Bi);const mn="loadingBlock_",qi=({progress:t=0,steps:e=!1,className:n=""})=>{const r=A.useIntl();e||(e={0:{text:r.formatMessage({id:`${mn}loading`})},75:{text:r.formatMessage({id:`${mn}almostDone`})},100:{text:r.formatMessage({id:`${mn}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(${Re}icons/${e[s].icon}.svg)`}:{};return a.jsxs(je,{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(Vn,{progress:t})]})},Ui=g.memo(qi);const xe=({element:t="div",className:e="",...n})=>a.jsx(Kt,{element:t,className:C("loading-placeholder",e),...n});const Ln={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"]},Ma=(t,e)=>t in Ln?a.jsx("div",{className:t,children:Ln[t].map((n,r)=>Ma(n,r))},e):a.jsx(xe,{className:t},e),Yn=({layout:t="overview-page",...e})=>a.jsx("div",{className:C("loading-state",t),...e,children:Ln[t].map((n,r)=>Ma(n,r))}),Pa=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):""},kt=["#5AB6A3","#A2D7AF","#806056","#3962B3"],zi=t=>{const e=Math.ceil(26/kt.length),n=Pa(t).toLowerCase();if(n==="")return kt[0];const r=n.charCodeAt(0)-96;for(let s=0;s<kt.length;s++)if(r<=e*(s+1))return kt[s]};const $r=256,Ae=({className:t="",src:e="",name:n,alt:r,width:s=$r,height:i=$r,...o})=>{const[c,f]=g.useState(!1),l=g.useRef(null);g.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=zi(n),m.fillRect(0,0,p,v),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Pa(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})})},Kn=t=>t==="apolitical"?{image:`${Re}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${Re}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},Zi=({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=Ke(f,r)),f};const en=({element:t="div",member:e="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=A.useIntl(),c=Kn(e);c.name||(c.name=o.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:f,url:l,image:u}=c,d=Zi(c),m=n&&n.createdAt?Dn(n.createdAt):!1,p=n&&n.createdAt?Hn(n.createdAt):"";return g.createElement(t,{className:C("member text-medium",i),children:a.jsxs(qe,{href:l,gtmType:s,gtmContext:r,onClick:v=>{v==null||v.stopPropagation()},children:[a.jsx(Ae,{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 Nr={small:24,medium:48},Gn=({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,className:f="",...l})=>{const u=A.useIntl();return!n||n.length===0?null:g.createElement(t,{...l,className:C("contributors",f,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((d,m)=>{let p,v="";if(m<c){const{name:_="",image:x=""}=Kn(d);if(o)return a.jsx(xe,{element:"li",className:"contributor"},m);p=a.jsx(Ae,{name:_,src:x,width:Nr[s||"medium"],height:Nr[s||"medium"]})}else if(m===c){const _=(e||n.length)-c;p=a.jsxs("small",{className:C({"large-number":_>99}),children:["+",ai(_,0)]}),v="number-left"}return p?a.jsx("li",{className:C("contributor",v),children:p},m):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?u.formatMessage({id:`member_${n[0]}`}):Ke(n[0].name||"",20):null})]})})};const jt="emailHelperTextBox_",Ra=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const s=A.useIntl(),[i,o]=g.useState({path:`${jt}default`,type:"default",link:{},mail:{},error:""}),[c,f]=g.useState(!1),l=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const v=_=>{o({path:`${jt}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>l(x),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:_})};if(typeof r!="function"){v(s.formatMessage({id:`${jt}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(_=>{v(_.message)}).finally(()=>{f(!1)})},[e,n,r]);g.useEffect(()=>{let p=jt,v="default",_={},x={};switch(t){case"gov":p+="autoApproved",v="success";break;case"nonGov":p+="unrecognisedEmail",v="error",_={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",x={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",_={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",_={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",_={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:_,mail:x})},[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(wa,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(xe,{element:"span"}),a.jsx(xe,{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})})},ft=({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=g.useRef(),d=r||u;return g.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"},Hi=500,Wi=({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]=g.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:l,activePredictionIndex:u,isPredictionSelected:d},m]=g.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=A.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),g.useEffect(()=>{const b=setTimeout(()=>{d||f(y=>({...y,debouncedInput:i}))},Hi);return()=>{clearTimeout(b)}},[i,d]),g.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]),g.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}))))},_=b=>{r(b.target.value),f(y=>({...y,input:b.target.value,displayInput:b.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},x=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:_,onKeyDown:v,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:l.map((b,y)=>a.jsx("li",{onClick:()=>x(b),onMouseEnter:()=>m(j=>({...j,activePredictionIndex:y})),className:C("predictions-list-item",{active:y===u}),children:b.description},y))})]})};const Fa=({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=A.useIntl(),{onChange:p,...v}=r,_=()=>{e||p(u?null:f)},x=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(),_())},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 g.createElement(n,{onClick:b=>{const y=b.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),_())},className:C("checkbox-wrapper",t),...d,...v},x)};const Vi=g.memo(function({direction:e="down"}){return a.jsx(Kt,{className:C("rotating-chevron",`direction-${e}`)})});const Yi=({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=A.useIntl(),[d,m]=g.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[_,x]=g.useState(v);let b;Array.isArray(_)&&_.length===1&&typeof _[0]=="string"?b=e&&_?e.find(F=>F.id===_[0]):e?e[0]:{id:"",label:""}:Array.isArray(_)&&_.length===1&&typeof _[0]!="string"?b=_[0]:b={id:"",label:""},g.useEffect(()=>{x(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:j,...E}=s,k=F=>{if(c){let V=[];_!=null&&_.includes(F.id)?V=_.filter(R=>R!==F.id):V=[..._,F.id],x([...V]),y&&y([...V])}else x([F]),y&&y(F.id),m(!1)},L=F=>{if(F==="all"){const V=(e==null?void 0:e.map(R=>R.id))||[];x(V),y&&y(V)}else x([]),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",...E,children:[c?`${o} · ${_.length}`:b.label,a.jsx(Vi,{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);k(V)},hidden:!d,...E,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:`${_==null?void 0:_.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||(_==null?void 0:_.includes(F))||(_==null?void 0:_.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(),k(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(_),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:_}})),m(!1)},children:u.formatMessage({id:"form_submit"})})})]})]})};const Ki=({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=A.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:_,label:x=!1,value:b=_,disabled:y=!1})=>{const j=`${r}_${_}`,E=()=>{if(y)return;let k;if(i){const L=p==null?void 0:p.indexOf(b);Array.isArray(p)&&L>=0?(k=p,k.splice(L,1)):(!p||p.length===0?k=[]:k=p,k.push(b))}else k=v===b?void 0:b;e.onChange(k)};return a.jsx(Fa,{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:E},intlPath:n,label:x||m.formatMessage({id:n?`${n}_${_}`:_}),disabled:y},j)})})};const Gi=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const s=A.useIntl(),i=g.useRef(),o=t||i,[c,f]=g.useState(!1),[l,u]=g.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(ft,{inputRef:o,type:l,...r})]})};const We={text:{component:ft},email:{component:ft},textarea:{component:ft,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Fa},checkboxes:{component:Ki,props:{multiSelect:!0}},select:{component:Yi},password:{component:Gi},autocomplete:{component:Wi}},Qi=({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=A.useIntl(),m=f&&f.some(({condition:E})=>E==="required"),p=(l==null?void 0:l.toString().length)||0,v=c&&We[c]&&We[c].component?We[c].component:ft,_={};c&&["checkboxes"].includes(c)?_.element="span":_.htmlFor=t;let x={...u,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:dt(s),value:l};i>0&&(x["data-character-limit"]=i,x.functions&&(x.functions.onChange=E=>{((E==null?void 0:E.toString().length)||0)>i&&(E=E==null?void 0:E.toString().slice(0,i)),s.onChange(E)})),c&&We[c]&&We[c].props&&(x={...x,...We[c].props}),c&&["checkboxes"].includes(c)&&(x.intlPath=`${e}_${t}`),r&&(x["aria-invalid"]=!0,x["aria-describedby"]=`error-${t}`);const b=u.label||d.formatMessage({id:e?`${e}_${t}`:t}),y=({...E})=>r?g.createElement(E.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(v,{...x,label:b,className:C("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const j=E=>g.createElement(E.element||"label",{...E,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,{..._,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,{...x}),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,{})]})},Ji=(t,e)=>{const{type:n,payload:r}=e,s=t.errors?dt(t.errors):{},i=t.values?dt(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=dt(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:_=!1}=m.validation[p];let x=!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(x){c({type:"addError",payload:{key:m.id,value:x}}),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 pn=null;const tn=({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:_=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...x})=>{const{customOnSubmit:b,hideButton:y,...j}=i,E=40,k=A.useIntl(),L={};t.length&&t.forEach(B=>{const W=B.id||B.name;W&&(L[W]=B.value||"")});const[F,V]=g.useReducer(Ji,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:R,isSubmitting:D,formSubmitted:$,values:S}=F;g.useEffect(()=>{f&&$&&(pn=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[$]),g.useEffect(()=>()=>{pn&&clearTimeout(pn)},[]),g.useEffect(()=>{const B=W=>{V({type:"updateValue",payload:{key:W.detail.id,value:W.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",B),()=>{document.removeEventListener("dropdownMultiSelectSubmit",B)}},[]);const w=g.useRef(null),N=r||w;if(!t.length)return null;i.text||(i.text=k.formatMessage({id:"form_submit"}));const Z=[{...j,icon:$?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:B=>{var T;if(B.preventDefault(),B.stopPropagation(),D)return;let W=0;if((T=N==null?void 0:N.current)!=null&&T.id){const M=document.getElementById(N.current.id);M&&(W=M.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(W=W-J.offsetHeight-E),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"}),V({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&V({type:"submitForm",payload:{fields:t,dispatch:V,intl:k}});return}V({type:"submitForm",payload:{fields:t,dispatch:V,onSuccess:async M=>{try{await m(M),V({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(H){v(H),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(M,H)=>{_(M,H),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:k}})},disabled:D||$||i.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:D||$?k.formatMessage({id:`form_${D?"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:D||$,onClick:p,children:o.text||k.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{...x,id:n,className:C("form",e),ref:N,children:[R!=null&&R.general?a.jsx(Ue,{variant:"error",text:k.formatMessage({id:"form_error_generalError"})}):null,(!D&&!$||b)&&t.map((B,W)=>{const{id:J=B.name||W,component:T,functions:M={onChange:()=>{}}}=B;if(T)return a.jsx(T,{...B.props||{}},`component-${J}-${W}`);const H=S?S[J]:"";return a.jsx(Qi,{intlPath:s,...B,showRequiredLabels:l,value:H,error:R==null?void 0:R[J],functions:{...M,onChange:z=>{V({type:"updateValue",payload:{key:J,value:z}}),M.onChange(z&&z.toString(),V)}}},J)}),y?null:(D||$)&&b?b:a.jsx(et,{className:C("cta",{center:D||$,submitted:$}),buttons:Z})]}),u&&$&&a.jsx(vt,{className:"success",children:typeof u=="string"?u:k.formatMessage({id:"form_success"})})]})};const Tt="passwordRules_",Oa="isMoreThanEightCharacters",Aa="includesNumberAndSymbol",Da="includesLowerAndUppercase",Xi={[Oa]:"8Characters",[Aa]:"numberSymbol",[Da]:"lowercaseUppercase"},eo=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=A.useIntl();return a.jsxs("aside",{className:C("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${Tt}intro`})}),a.jsx("ul",{children:[Oa,Aa,Da].map(r=>a.jsxs("li",{className:C({matches:t[r]}),children:[a.jsxs(ge,{children:[n.formatMessage({id:`${Tt}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${Tt}rule_${Xi[r]}`})}),!t[r]&&a.jsxs(ge,{element:"strong",children:[" ",n.formatMessage({id:`${Tt}notMet`})]})]},`rule-${r}`))})]})},to=g.memo(eo);const no=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=A.useIntl(),[f,l]=g.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(g.useEffect(()=>{o&&!f.setUp&&u()},[o]),!o)return a.jsx(xe,{className:"rating-placeholder"});const{id:d,rating:m,disabled:p}=f,v="ratings_",_={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},x=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:_[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?` - ${_[y===1?"low":"high"]}`:""}`,onClick:j=>{j.preventDefault(),j.stopPropagation(),x(y)},disabled:p})},`rating-${y}`)})})]})};const ro=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:s=()=>{}},isDisabled:i=!1,className:o=""})=>{const[c,f]=g.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);g.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 ao({className:t="",userId:e,userName:n,src:r,setUserImage:s,uploadImage:i}){const[o,c]=g.useState(!1),[f,l]=g.useState(!1),u=g.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(_=>({..._,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(Ae,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(A.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(A.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Ia=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:s="contact-form-submit-click"}=t||{};return a.jsx(tn,{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 La=({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]=g.useState([]),[m,p]=g.useState(!0),[v,_]=g.useState(l),{formatMessage:x}=A.useIntl(),b=async E=>{E.preventDefault();try{await f(u),d([]),_("SUCCESS")}catch(k){_("ERROR"),c(k)}},y=E=>{E.preventDefault(),_("NOT_SUBMITTED"),p(!0),d([])},j=E=>{E.preventDefault(),o(),_("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:x({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),a.jsx(Te,{}),a.jsx("div",{className:"footer",children:v==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:x({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:j,children:x({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:x({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(qs.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:u,onChange:E=>{d(E),p(!E.length)},autoFocus:!1,getLabel:(E,k,L)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:E}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(k),p(!u.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},k)})]}),a.jsx(Te,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})};const Ba=({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=A.useIntl(),l=g.useRef(null);Ge(()=>{!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(ge,{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(ge,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:u,children:a.jsx(ge,{children:f.formatMessage({id:"search_cta"})})})]})})})},Mr=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}])},so=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"]}},io=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=so(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}])},oo=({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:()=>{Mr({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:Ra,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"&&Mr({ref:r.email,validateEmail:e,dispatch:i}))}),m.length&&i(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),u};const co=({className:t=""})=>a.jsxs("div",{className:C("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(A.FormattedMessage,{id:"signup_success_title"})}),a.jsx(A.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const lo={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},uo=({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=A.useIntl(),[c,f]=g.useReducer(Zn,lo),{validFields:l,emailDetails:u,shouldManuallyApprove:d,showSuccessMessage:m,showError:p}=c,[v,_]=zn.useCookies(["signup-this-session","functional-cookie-consent"]),x={form:g.createRef(),name:g.createRef(),email:g.createRef(),jobTitle:g.createRef(),organisation:g.createRef(),tc:g.createRef(),hiddenValidation:g.createRef()};g.useEffect(()=>{d===!0&&x.jobTitle.current&&x.jobTitle.current.focus()},[d]),g.useEffect(()=>{(i.showSuccessMessage||v["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[v]),g.useEffect(()=>{if(m&&v["functional-cookie-consent"]){const j={path:"/",maxAge:3600};i.showSuccessMessage||_("signup-this-session","true",j)}},[m]);const b=g.useMemo(()=>oo({shouldShow:n,functions:e,refs:x,state:c,dispatch:f,dataToSubmit:s,intl:o}),[s,e,o,x,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(co,{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(A.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(Ue,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(tn,{className:"signup-form",formRef:x.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()=>{io({refs:x,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:x.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 Bn={exports:{}},Et={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.
|