@apolitical/component-library 7.0.5 → 8.0.0-761-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +2 -2
  2. package/index.mjs +186 -186
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -63,7 +63,7 @@ Valid keys: `+JSON.stringify(Object.keys(D),null," "));var J=de(U,ne,j,N,O+"."+
63
63
 
64
64
  `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await kd({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Po=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),ov=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},uv=(e,t)=>e?typeof e=="string"?e:e[t]:"";const lv=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:d},profile:f,locale:h=_o})=>{const p=ie.useIntl(),[v,m]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,g]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),y={...a,...d},{activities:C,error:k,fetchNextPage:E,hasNextPage:_,isLoading:T,mutations:{create:L,edit:P,remove:z,like:M,unlike:A,pin:F,unpin:S,createPoll:I,createVote:H,removeVote:V,removePoll:ae}}=Xg({queryKey:[e,t,"activities",v],queryFns:y,filterOption:v[0]});x.useEffect(()=>{i&&g(b.concat(i==null?void 0:i.map(({slug:q,name:B})=>({id:q,text:B,type:"category"}))))},[i]);const[X,D]=x.useState(null),Q=()=>{D(C.length),E()};return hf(),k?c.jsx(Qt,{variant:"error",text:k.message}):c.jsxs("section",{className:"activities-feed",children:[c.jsx(mu,{isCard:!0,parentId:t,categories:i,form:{content:{type:yr.Post,slugs:{}},functions:{create:L,createPoll:I,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),c.jsx(Cf,{className:"activities-feed-filtering",options:b.map(({id:q,text:B})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${B}`,defaultMessage:B})})),defaultOptions:v.map(({id:q,text:B})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${B}`,defaultMessage:B})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:q,previous:B})=>{if(q[0]===B[0])return;m([b.find(O=>O.id===q[0])]);const j=b.find(O=>O.id===q[0]);if(!j)return;const N=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${j.text}`,defaultMessage:j.text})})}});document.dispatchEvent(N)},gtm:{context:"activitiesFeed_sorting"}}),C==null?void 0:C.map((q,B)=>{var ye,Ee,Ce,ze,We,He,Ke,Te,Oe;const{id:j,own_reactions:N,latest_reactions:O,reaction_counts:U,mentioned_users:ee,total_replies:W,additional_data:ne}=q,de=(((ye=O==null?void 0:O.like)==null?void 0:ye.length)||0)>0,J=(((Ee=N==null?void 0:N.like)==null?void 0:Ee.length)||0)>0,ve=J?N==null?void 0:N.like[0].id:"",me=de?(Ce=O==null?void 0:O.like)==null?void 0:Ce.map(we=>{var Y,se,be;return{id:(Y=we==null?void 0:we.user)==null?void 0:Y.id,name:(be=(se=we==null?void 0:we.user)==null?void 0:se.data)==null?void 0:be.name}}):!1;return c.jsx(x.Fragment,{children:c.jsx(ui,{content:{type:q.verb,title:q==null?void 0:q.title,body:q==null?void 0:q.content,createdAt:(q==null?void 0:q.time)||"",slugs:{question:`${e}/${t}`,answer:j},slug:j,author:xr(q==null?void 0:q.actor),userLiked:J,likes:(U==null?void 0:U.like)||0,comments:W||0,peopleWhoLiked:me,data:{mentions:ee,...ne||{}},pinned:(U==null?void 0:U.pin)&&(U==null?void 0:U.pin)>0||!1,categories:Po((q==null?void 0:q.categories)||[],i||[]),pollOptions:of(q,h),pollSettings:{showRemoveVote:(ze=q==null?void 0:q.settings)==null?void 0:ze.show_remove_vote,allowMultipleVotes:(We=q==null?void 0:q.settings)==null?void 0:We.allow_multiple_votes,deadlineAt:(He=q==null?void 0:q.settings)==null?void 0:He.deadline_at,hideParticipants:(Ke=q==null?void 0:q.settings)==null?void 0:Ke.hide_participants,numberOfWinners:(Te=q==null?void 0:q.settings)==null?void 0:Te.number_of_winners,resultsVisibility:(Oe=q==null?void 0:q.settings)==null?void 0:Oe.results_visibility}},links:{post:`${e}/${t}/${j}`,comments:`${e}/${t}/${j}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:j}),updateContent:(we,{body:Y})=>P({activityId:j,content:Y})},likes:{createLike:()=>M({activityId:j}),deleteLike:()=>A({activityId:j,reactionId:ve}),listLikes:we=>u.list({activityId:j,...we})},comments:{openComments:()=>null},pins:{createPin:()=>F({activityId:j}),deletePin:()=>S({activityId:j,reactionId:O==null?void 0:O.pin[0].id})},polls:{createVote:({reactionId:we})=>H({activityId:j,reactionId:we}),removeVote:({reactionId:we})=>V({activityId:j,reactionId:we}),removePoll:()=>ae({activityId:j})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:B===X,userHasOwnerPermissions:r,userHasPermissions:n,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t})},j)}),!T&&c.jsx(ii,{hasNextPage:_,loadNextPage:Q,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),C.length===0&&!T&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:v[0].type==="category"?c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ae,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(hu,{form:f})]})},cv={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function dv({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=ie.useIntl();return c.jsx(mu,{form:{content:{type:Be.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:a.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:a.formatMessage({id:"community_joinToPost"})}})}function fv({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=ie.useIntl(),a=()=>{n(r),t()};return c.jsx(ii,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function mv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ju({reply:$g(o),user:a});return cr(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Ju({reply:o,user:a});r.setQueryData(i,cr(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{To(d.id,"reply")},0)}});return s}function hv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=wt(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function pv({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:i,children_counts:a,data:s,created_at:o,parent:l,...u})=>{var m,b,g,y;const d=(((m=r==null?void 0:r.like)==null?void 0:m.length)||0)>0,f=(((b=i==null?void 0:i.like)==null?void 0:b.length)||0)>0,h=d?(g=r==null?void 0:r.like)==null?void 0:g.find(C=>{var k;return((k=C==null?void 0:C.user)==null?void 0:k.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",v=f?(y=i==null?void 0:i.like)==null?void 0:y.map(C=>{var k,E,_;return{id:(k=C==null?void 0:C.user)==null?void 0:k.id,name:(_=(E=C==null?void 0:C.user)==null?void 0:E.data)==null?void 0:_.name}}):!1;return{user:u==null?void 0:u.user,body:vv(s),createdAt:o,data:gv(s),likeId:p,liked:f,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!h}})}function gv(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function vv(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function gf({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=Re.useQueryClient(),l=ha(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:ko(u),mutate:Fo(u)},user:l,...u},f=mv({...d,mutationFn:e}),h=hv({...d,mutationFn:t}),p=bv({...d,mutationFn:n}),v=xv({...d,mutationFn:i}),m=wv({...d,mutationFn:a}),{replies:b,...g}=yv({queryKey:s,queryFn:r});return{replies:pv({replies:b,user:l}),mutations:{create:f,edit:h,remove:v,like:p,unlike:m},user:l,...g}}function bv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=wt(s,o);return l&&Xu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=wt(o,l);u&&Xu({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function yv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Bo(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function xv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>mf(i,a)),onError:n});return r}function wv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=wt(a,s);return o&&Lg({reply:o,user:r}),s}),onError:n});return i}const Cv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const l=ie.useIntl(),u=3,{replies:d,fetchNextPage:f,hasNextPage:h,isLoading:p,mutations:{create:v,edit:m,like:b,remove:g,unlike:y}}=gf({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:E=>a.list({...E,reactionId:i})}});fo([p]);const[C,k]=x.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ae,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!C),children:l.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&c.jsx(vh,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>f()},form:{parentId:r,content:{type:Be.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(E,{body:_})=>v({activityId:e,replyId:i,content:_}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:E,likes:_,data:T,body:L,createdAt:P,userLiked:z,peopleWhoLiked:M,parent:A,user:F,likeId:S})=>c.jsx(ui,{isCommunity:!0,content:{id:E,type:Be.Reply,body:L,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:A},slug:"",author:xr(F),userLiked:z,likes:_,peopleWhoLiked:M,data:T},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:E}),updateContent:(I,{body:H})=>m({replyId:E,content:H})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>y({replyId:E,reactionId:S}),listLikes:I=>o.list({replyId:E,...I})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:r||""},{scope:ut.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function Dv({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:l,likeId:u,likes:d,peopleWhoLiked:f,replyId:h,createdAt:p,user:v,userLiked:m}=s,{edit:b,like:g,remove:y,unlike:C}=e.mutations;return c.jsx(mh,{children:c.jsx(ui,{isCommunity:!0,content:{id:h,type:Be.Reply,body:o,createdAt:p,slugs:{question:`${n}/${a}`,answer:t,reply:h},slug:h,author:xr(v),userLiked:m,likes:d,peopleWhoLiked:f,data:l},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:h}),updateContent:(k,{body:E})=>b({replyId:h,content:E})},likes:{createLike:()=>g({replyId:h}),deleteLike:()=>C({replyId:h,reactionId:u}),listLikes:k=>e.likes.list({replyId:h,...k})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:a||""},{scope:ut.Platform,area:"all"}]},children:c.jsx(Cv,{basePath:n,parentId:a,activityId:t,replyId:h,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},h)},h)}const vf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:f})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:v,replies:m,mutations:{create:b,remove:g,edit:y,like:C,unlike:k}}=gf({queryKey:[t,n,e,"replies"],queryFns:u}),[E,_]=x.useState(null);fo([v]),hf();const T={create:(L,P)=>{const{body:z}=P;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(gh,{type:"comment",responses:r,isLoading:v}),f?c.jsxs(c.Fragment,{children:[c.jsx(dv,{parentId:n,isMember:i,join:s,leave:o,formFunctions:T}),m==null?void 0:m.map((L,P)=>c.jsx(Dv,{activityId:e,basePath:t,focus:E===P,formFns:{form:a,likes:l,reactions:u,mutations:{remove:g,edit:y,like:C,unlike:k}},isMember:i,parentId:n,reply:L},L.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(fv,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:_,totalReplies:m.length})]}):c.jsx(_t,{children:c.jsx(ie.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(hu,{form:d})]})};function Ev({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Bo(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function _v({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=Ev({queryKey:t,queryFn:e});return{likes:n,...r}}function bf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=_v({queryKey:[e,t,n,"likes"],queryFns:i.likes});x.useEffect(()=>{l()},[l]);const u=a.map(({user:d})=>d).map(d=>d?xr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(fh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const yf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=ie.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:K("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(bf,{...a,likeCount:r??0,functions:{likes:n}})})},kv=Object.freeze(Object.defineProperty({__proto__:null,default:yf},Symbol.toStringTag,{value:"Module"})),Fv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const Av=3e3,xf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[i,a]=x.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Zr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Av)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(Ln,{className:K({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Wn="discussion_",wf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const l=ie.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:K("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(pf,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Zr,{shortText:`${i.count??0}`,onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Wn}comments_screenReader`},{count:i.count}),children:l.formatMessage({id:`${Wn}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Zr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:l.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(xf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(Df,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const Bv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:K("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(Dn,{href:s?void 0:a,...l,children:sr(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const Oo=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{if(!n)return c.jsx(c.Fragment,{});let l=n.split("//");l.length>1?l=l[1]:l=l[0],l=l.split("/"),l=l[0];const{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:K("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:f=>{if(f.preventDefault(),f.stopPropagation(),a){a(f);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),i&&e!=="condensed"?c.jsx("p",{className:"text-small",children:i}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const Cf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",gtm:o})=>{const l=ie.useIntl(),u=n?[{id:"all",text:typeof n!="boolean"&&n.text||l.formatMessage({id:"filters_all"})},...e]:e,[d,f]=x.useState(n?["all"]:t.length?t.map(m=>m.id):[]),[h,p]=x.useState(0),v=(m,b)=>{let g=[];d.includes(m)&&!a?g=d.filter(y=>y!==m):m==="all"?g=["all"]:r?g=[...d.filter(y=>y!=="all"),m]:g=[m],f(y=>(i&&typeof i=="function"&&i({current:g,previous:y}),g)),b&&typeof b=="function"&&b()};return c.jsx("ul",{className:K("filters",s),children:u.map(({id:m,text:b,disabled:g=!1,callback:y=()=>{}},C)=>{let k={tabIndex:h===C?0:-1};return g&&(k={disabled:!0,"aria-label":l.formatMessage({id:"filters_disabled"},{name:b})}),c.jsx("li",{children:c.jsx("button",{"data-gtm-event-context":(o==null?void 0:o.context)||"filters","data-gtm-event-type":(o==null?void 0:o.type)||`${b.toLowerCase().replace(" ","-")}-click`,className:K(m,{selected:d.includes(m)}),onClick:E=>{E.preventDefault(),E.stopPropagation(),v(m,y)},onKeyDown:E=>{var P,z;let _=C+1,T,L;switch(E.code){case"Enter":case"Space":E.preventDefault(),E.stopPropagation(),v(m,y);break;case"ArrowLeft":case"ArrowRight":E.preventDefault(),E.stopPropagation(),E.code==="ArrowLeft"?(_=C-1,_<0&&(_=u.length-1)):_>=u.length&&(_=0),p(_),T=E.currentTarget.closest("li"),L=(P=T==null?void 0:T.parentElement)==null?void 0:P.children[_],(z=L==null?void 0:L.querySelector("button"))==null||z.focus();break}},"aria-selected":d.includes(m),...k,children:b})},m)})})},Tv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const gi="languageSwitcher_",Sv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=ie.useIntl(),{updateLanguage:d=()=>{}}=x.useContext(vo),[f,h]=x.useState(e);if(x.useEffect(()=>{e!==f&&h(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),m=f!==e;return c.jsxs("div",{className:K("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${gi}label`})}),c.jsx("ul",{children:v.map(b=>{var C;if(!Mi[b])return null;const g=(C=r[b])==null?void 0:C.post_name;let y={className:b};if(f===b)y["aria-label"]=u.formatMessage({id:`${gi}selected`},{language:Mi[b]});else{const k=Tv(b,g,a);y={...y,href:typeof k=="string"?k:k.url,onClick:E=>{h(b),d(b),typeof i<"u"&&(E.preventDefault(),E.stopPropagation(),i(b,typeof k=="string"?k:k.urlForRouter))}}}return c.jsx("li",{children:c.jsx(Dn,{...y,fallbackElement:"span",children:Mi[b]})},b)})}),s!=="short"&&!m&&c.jsx("p",{children:u.formatMessage({id:`${gi}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${gi}disclaimer`},{email:Qn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const Wa=ie.createIntl({locale:"en",messages:gr}),ii=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Wa.formatMessage({id:"loadMore_button"}),endOfFeed:Wa.formatMessage({id:"loadMore_endOfFeed"}),error:Wa.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,f]=x.useState(""),h=async p=>{if(!n)try{await t(p)}catch(v){v instanceof Error?f(v.message):f("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:K("load-more",l),children:!d&&e?c.jsx(Ae,{variant:r,size:i,styling:a,icon:s,onClick:h,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Mo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:K("logo",e,t,n),...r,children:c.jsx(Me,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let vi=!1;const Df=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=ie.useIntl(),a=x.useRef(null),[s,o]=x.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),x.createElement(e,{ref:a,className:K("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:f,icon:h,...p},v)=>{const m={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{vi&&(clearTimeout(vi),vi=!1)},onBlur:()=>{vi=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ae,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...m,children:f})},`${window.btoa(f)}_${v}`)})})]})})},jv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Pv=x.lazy(()=>Promise.resolve().then(()=>Sp)),Ov=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Ef=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=x.useContext(it),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ov.map(({key:a,href:s})=>{const o=jv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:K(a,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&c.jsx(Pv,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},Ar=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Mv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ar(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${Ar(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${Ar(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${Ar(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ar(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Nv="shareLinks_",Iv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ie.useIntl(),l=Mv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",i,a,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:f,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const v={};return p&&(v.onClick=m=>p(m,f)),c.jsx("li",{children:c.jsx(Ae,{size:i,variant:"tertiary",icon:{icon:d||u},href:f,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Nv}link_${u}`}),...v})},u)})})]})};const Rv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(m,b,g)=>(m||(m=`panel-${window.btoa(b)}-${g}`),m),i=wn(!0)||0;let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(g=>g.id===m)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===m){a=g;break}}}const[s,o]=x.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=x.useState(""),d=(m,b)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let g=b;m.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:m.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const y=r(e[g].id,e[g].text,g),C=document.getElementById(`tab-${y}`);C==null||C.focus(),u(y);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},f=m=>{let b=!1;return m.target==="min-width"&&i>=m.value&&(b=!0),m.target==="max-width"&&i<=m.value&&(b=!0),b};x.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(m)}},[s]);const h=[],p=[];return e.forEach(({id:m,text:b,content:g,href:y,hasCarousel:C,breakpoint:k},E)=>{if(k&&!f(k))return;m=r(m,b,E);const _=s===m,T={};y||(T["aria-controls"]=m,T.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(m),!n&&window.history.replaceState(null,"",`#${m}`)},p.push(c.jsx("section",{id:m,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${m}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:y||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:K({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:L=>d(L,E),...T,children:b})},`tab-${m}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const $v={"2-1":901,"1-3":769,"1-1":769},_f=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=wn(!0);let s=i;return x.Children.count(i)===1&&(s=x.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<$v[e]?null:o)})};const No=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ie.useIntl(),a="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Me,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},va=e=>(e==null?void 0:e.toString().length)||0,kf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{va(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const bi="emailHelperTextBox_",Ff=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ie.useIntl(),[s,o]=x.useState({path:`${bi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=x.useState(!1),d=x.useCallback(v=>{v.preventDefault(),v.stopPropagation();const m=b=>{o({path:`${bi}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof i!="function"){m(a.formatMessage({id:`${bi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{m(b.message)}).finally(()=>{u(!1)})},[n,r,i]);x.useEffect(()=>{let v=bi,m="default",b={},g={};switch(t){case"gov":v+="autoApproved",m="success";break;case"nonGov":v+="unrecognisedEmail",m="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",m="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",m="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>d(y),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",m="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:m,link:b,mail:g})},[t]);const f={};return["link","mail"].forEach(v=>{f[v]=Object.keys(s[v]).length?m=>c.jsx("a",{...s[v],children:m}):m=>m}),c.jsx(Sd,{id:e,type:s.type,heading:l?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...f,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,styling:f={},...h})=>{const p=x.useRef(),v=r||p,{autosizeToFit:m=!1}=f;md(m&&t==="textarea",v),x.useEffect(()=>{var g;u&&((g=v.current)==null||g.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email");const b={};return t==="input"&&(b.type=o),x.createElement(t,{ref:v,...h,...b,id:n,name:a,className:K(e,t,{autoresize:m}),value:l,placeholder:s,autoFocus:u,...i,onChange:g=>{const y=g.target;i.onChange(y.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Lv=500,zv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:l,displayInput:u,debouncedInput:d},f]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},m]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{v||f(E=>({...E,debouncedInput:l}))},Lv);return()=>{clearTimeout(k)}},[l,v]),x.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];m(_=>({..._,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),m(_=>({..._,predictions:[]}))}})():m(k=>({...k,predictions:[]}))},[d,v]),x.useEffect(()=>{p>=0&&h[p]&&f(k=>({...k,displayInput:h[p].description}))},[p,h]);const g=k=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Vn.DOWN&&p<h.length-1?m(E=>({...E,activePredictionIndex:p+1})):k.key===Vn.UP&&p>0?m(E=>({...E,activePredictionIndex:p-1})):k.key===Vn.ENTER&&p>-1&&(s(h[p].description),f(E=>({...E,input:h[p].description})),m(E=>({...E,predictions:[],isPredictionSelected:!0}))))},y=k=>{s(k.target.value),f(E=>({...E,input:k.target.value,displayInput:k.target.value})),m(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},C=k=>{s(k.description),f(E=>({...E,input:k.description,displayInput:k.description})),m(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:y,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((k,E)=>c.jsx("li",{onClick:()=>C(k),onMouseEnter:()=>m(_=>({..._,activePredictionIndex:E})),className:K("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Io=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:f=!1}={}}={},...h})=>{const p=ie.useIntl(),{onChange:v,...m}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:K("pretty-checkbox",{radio:u==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:y=>{(y.key==="Enter"||y.code==="Space")&&(y.preventDefault(),y.stopPropagation(),b())},tabIndex:d||!f?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return x.createElement(n,{onClick:y=>{const C=y.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(y.preventDefault(),y.stopPropagation(),b())},onKeyDown:f?y=>{var C,k,E;if(y.key!=="Tab")switch(y.code){case"Enter":case"Space":y.stopPropagation(),y.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":y.stopPropagation(),y.preventDefault();const _=y.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(y.key==="ArrowLeft"){const L=_==null?void 0:_.previousElementSibling;L?T=L:T=(C=_==null?void 0:_.parentElement)==null?void 0:C.lastElementChild}else T||(T=(k=_==null?void 0:_.parentElement)==null?void 0:k.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:K(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...m},g)};const qv=x.memo(function({direction:t="down"}){return c.jsx(da,{className:K("rotating-chevron",`direction-${t}`)})});const Uv=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ie.useIntl(),[f,h]=x.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[m,b]=x.useState(v);let g;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?g=t&&m?t.find(T=>T.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?g=m[0]:g={id:"",label:""},x.useEffect(()=>{b(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:C,...k}=i,E=T=>{if(o){let L=[];m!=null&&m.includes(T.id)?L=m.filter(P=>P!==T.id):L=[...m,T.id],b([...L]),y&&y([...L])}else b([T]),y&&y(T.id),h(!1)},_=T=>{if(T==="all"){const L=(t==null?void 0:t.map(P=>P.id))||[];b(L),y&&y(L)}else b([]),y&&y([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${m.length}`:g.label,c.jsx(qv,{direction:f?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const L=t&&t.find(P=>P.id===T.target.value);E(L)},hidden:!f,...k,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${m==null?void 0:m.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ae,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ae,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const L=T.id===g.id||(m==null?void 0:m.includes(T))||(m==null?void 0:m.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":L,"data-testid":L?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ae,{variant:"secondary",onClick:()=>{C&&C(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Or=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};let Va=null;const Wv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...f})=>{const h=ie.useIntl(),{showCount:p=!1,label:v,defaultInputs:m=1,maxInputs:b=100,hasButton:g=!1,allowDuplicateValues:y=!1}=o||{},[C,k]=x.useState(r?Array.isArray(r)?r:[r]:Array(m).fill("")),E=C.filter(z=>z!==""),_=()=>{if(!u)return;const z=Pt(u.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),M=[];C.map((F,S)=>{if(b&&S>=b)return;const I=Pt(l??[]);e&&(y||I.push({condition:H=>{var D;const V=H[e].toLowerCase(),ae=((D=H[`${e}-all`])==null?void 0:D.length)??0,X=new Set(H[`${e}-all`].map(Q=>Q.toLowerCase()));return X.has(V)&&X.size<ae},error:h==null?void 0:h.formatMessage({id:"form_error_multipleInputs_same"})}),I.forEach(H=>{const{condition:V,error:ae}=H;if(typeof V=="function")H.condition=X=>{var q;let D=(q=X==null?void 0:X[e])==null?void 0:q[S];D||(X[e]&&!Array.isArray(X[e])?D=X[e]:D="");const Q=Pt(X);return Q[e]=D,Q[`${e}-all`]=X[e],typeof V=="function"&&V(Q)?ae:!1};else{const X=V;H.condition=D=>{var q;let Q=(q=D==null?void 0:D[e])==null?void 0:q[S];switch(Q||(D[e]&&!Array.isArray(D[e])?Q=D[e]:Q=""),X){case"required":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ae||(H.error=ae||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Or(X,Q)?H.error:!1}}}),M.push({id:`${e}-${S}`,validation:I,value:F}))});const A={fieldsToValidate:z.concat(M)};u.multipleInputs.includes(e)&&(A.multipleInputs=u.multipleInputs.filter(F=>F!==e)),u.setFields(F=>({...F,...A}))};x.useEffect(()=>{_()},[C.length]),x.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&_()},[u==null?void 0:u.multipleInputs]);const T=()=>{(!b||C.length<b)&&k([...C,""])},L=z=>{const M=document.getElementById(`${e}-${z+1}`);M==null||M.focus()},P=(z,M)=>z.replace("{number}",M+1);return c.jsxs("fieldset",{className:K("multiple-inputs field-wrapper",{"has-button":g,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label text-small",children:[t,p?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":h.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:E.length,total:b}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:E.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((z,M)=>{if(b&&M>=b)return c.jsx(c.Fragment,{});let A=!1;t?A=c.jsx(Me,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:M+1})}):v&&(A=P(v,M));const F=`${e}-${M}`,S=M+1>m;return c.jsx(Af,{id:F,type:"text",label:A,value:z,placeholder:i?P(i,M):void 0,className:K({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{g||M!==C.length-1||T()},onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),Va&&clearTimeout(Va),M!==C.length-1?L(M):(T(),Va=setTimeout(()=>L(M),100)))},onChange:I=>{const H=C[M].toLowerCase(),V=Pt(C);V[M]=I,k(V),u==null||u.dispatch({type:"removeError",payload:{key:F}}),y||V.forEach((ae,X)=>{Kr(ae)&&X!==M&&ae.toLowerCase()===H&&(u==null||u.dispatch({type:"removeError",payload:{key:`${e}-${X}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(Ae,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const I=Pt(C);I.splice(M,1),k(I),u==null||u.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(I)}}):void 0,...f},F)}),g?c.jsx(Ae,{...g,onClick:T,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const nl=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:f,styling:{displayOptionsAsPills:h=!1}={},multipleOptions:p,...v})=>{const m=ie.useIntl(),b=a?d:[],g=d;return c.jsx("ul",{...v,className:K("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:y,label:C=!1,value:k=y,disabled:E=void 0})=>{const _=`${r}_${y}`;E===void 0&&(E=p!=null&&p.limit?b.length>=p.limit&&!b.includes(k):!1);const T=()=>{if(E)return;let L;if(a){const P=b==null?void 0:b.indexOf(k);Array.isArray(b)&&P>=0?(L=b,L.splice(P,1)):(!b||b.length===0?L=[]:L=b,L.push(k))}else L=g===k?void 0:k;t.onChange(L)};return c.jsx(Io,{element:"li",id:_,type:u==="checkboxes"?"checkbox":"radio",shownValue:k,value:a?b==null?void 0:b.includes(k):g===k,functions:{...t,onChange:T},intlPath:n,label:C||m.formatMessage({id:n?`${n}_${y}`:y}),disabled:E,accessibilityOptions:f,className:K({disabled:E})},_)})})};const Vv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ie.useIntl(),s=x.useRef(),o=e||s,[l,u]=x.useState(!1),[d,f]=x.useState(t),h=()=>{var p;u(!l),f(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Hn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Io},checkboxes:{component:nl,props:{multiSelect:!0}},radio:{component:nl,props:{multiSelect:!1}},select:{component:Uv},password:{component:Vv},autocomplete:{component:zv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Af=e=>{const t=ie.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:f,submitOnEnter:h,fieldData:p,siblings:v,...m}=e;if(u&&u==="multiple-inputs")return c.jsx(Wv,{...e});const b=d&&d.some(({condition:S})=>S==="required"),g=va(f),y=u&&Hn[u]&&Hn[u].component?Hn[u].component:Jn,C=u&&["checkboxes","radio"].includes(u),k=u&&["autocomplete"].includes(u),E=a&&`error-${n}`,_=`character-limit-${n}`,T={};C?T.element="legend":T.htmlFor=n;let L={...m,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Pt(s),value:f};const P=S=>{L["aria-describedby"]?L["aria-describedby"]+=` ${S}`:L["aria-describedby"]=S};if(o>0){const S=kf(o,s);P(`${_}-info`),L={...L,...S},S.functions&&typeof S.functions=="object"&&(L.functions={...L.functions,...S.functions})}u&&Hn[u]&&Hn[u].props&&(L={...L,...Hn[u].props}),C&&(L.intlPath=`${r}_${n}`),a&&(L["aria-invalid"]=!0,L["aria-errormessage"]=E,P(E));const z=m.label||t.formatMessage({id:r?`${r}_${n}`:n}),M=({...S})=>a?x.createElement(S.as||"p",{id:E,className:"error text-small",...S},a):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(y,{...L,label:z,className:K("field-wrapper",i)}),c.jsx(M,{as:"p"})]});const A={};C?T.className="legend-as-label text-small":A.className="field-label";const F=({element:S,...I})=>x.createElement(S||"label",{...I,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:x.createElement(C?"fieldset":"div",{className:K("field-wrapper text-small",i,`${u}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[m.label===!1?c.jsx(c.Fragment,{}):x.createElement(C?x.Fragment:"p",A,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),x.createElement(C||k?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(y,{...L}),c.jsx(No,{id:_,limit:o,valueLength:g}),v]})),c.jsx(M,{})]}))})},Hv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Pt(e.errors):{},a=e.values?Pt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,f=Pt(Object.keys(i));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:v="required",error:m=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=m||g)}else{const g=a[h.id],y=v;switch(y){case"required":Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:h.id,value:b}}),f.push(h.id);break}}return f.length===0?l(a):u(a,f),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Ha=null;const Xt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:f,...h})=>{const p=(t||[]).filter(W=>W.type==="multiple-inputs").map(W=>W.id),[v,m]=x.useState({fieldsToValidate:t,multipleInputs:p});x.useEffect(()=>{v.multipleInputs.length||m(W=>({...W,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:g,...y}=s,C=40,{shouldShowCancelButton:k=!1,shouldReset:E=!0,shouldHide:_=!0,showRequiredLabels:T=!0,showSuccessMessage:L=!1,shouldScrollOnSuccess:P=!0}=l||{},{onSuccess:z=async()=>{},onCancel:M=()=>{},onCatch:A=()=>{},onFailure:F=()=>{}}=f||{},S=ie.useIntl(),I={};t.length&&t.forEach(W=>{const ne=W.id||W.name;ne&&(I[ne]=W.value||"")});const[H,V]=x.useReducer(Hv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:ae,isSubmitting:X,formSubmitted:D,values:Q}=H;x.useEffect(()=>{E&&D&&(Ha=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[D]),x.useEffect(()=>()=>{Ha&&clearTimeout(Ha)},[]),x.useEffect(()=>{const W=ne=>{V({type:"updateValue",payload:{key:ne.detail.id,value:ne.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",W),()=>{document.removeEventListener("dropdownMultiSelectSubmit",W)}},[]);const q=x.useRef(null),B=i||q,j=Wr(()=>{if(!X){if(V({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&V({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:V,intl:S}});return}V({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:V,onSuccess:async W=>{P&&O();try{await z(W),V({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(ne){A(ne),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(W,ne)=>{O(),F(W,ne),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},100);if(!t.length)return null;const N={};s.children&&(N.default=s.children),y.text&&typeof y.text=="string"&&(N.default=y.text),["default","submitting","submitted"].forEach(W=>{y.text&&typeof y.text!="string"&&W in y.text?N[W]=y.text[W]:N[W]||(N[W]=S.formatMessage({id:`form_${W==="default"?"submit":W}`}))}),delete y.text;const O=()=>{var de;let W=0;if((de=B==null?void 0:B.current)!=null&&de.id){const J=document.getElementById(B.current.id);J&&(W=J.getBoundingClientRect().top+window.scrollY)}const ne=document.getElementById("header");ne&&(W=W-ne.offsetHeight-C),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"})},U=W=>{W.preventDefault(),W.stopPropagation(),!X&&j()},ee=[{...y,icon:D?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",y.className),onClick:U,disabled:X||D||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:N[X?"submitting":D?"submitted":"default"]}];return k&&ee.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:X||D,onClick:M,children:o.text||S.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[x.createElement(e,{...h,id:r,className:K("form",n),ref:B},c.jsxs(c.Fragment,{children:[ae!=null&&ae.general?c.jsx(Qt,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,u,(!_||!X&&!D||b)&&t.map((W,ne)=>{const{id:de=W.name||ne,component:J,functions:ve={onChange:()=>{}},submitOnEnter:me=!1}=W;if(J)return c.jsx(J,{...W.props||{}},`component-${de}-${ne}`);const ye=(Q==null?void 0:Q[de])||"",Ee={...ve,onChange:Ce=>{V({type:"updateValue",payload:{key:de,value:Ce}}),ve.onChange(Ce,V)}};return me&&(Ee.onKeyDown=Ce=>{Ce.key==="Enter"&&(Ce.stopPropagation(),Ce.preventDefault(),j()),ve.onKeyDown&&ve.onKeyDown(Ce)}),c.jsx(Af,{intlPath:a,...W,showRequiredLabels:T,value:ye,error:W.type==="multiple-inputs"?ae:ae==null?void 0:ae[de],functions:Ee,fieldData:{fields:v.fieldsToValidate,multipleInputs:v.multipleInputs,setFields:m,dispatch:V}},de)}),g?null:(X||D)&&b?b:c.jsx(vr,{className:K("cta",{center:X||D,submitted:D}),buttons:ee})]})),L&&D&&c.jsx(ur,{className:"success",children:typeof L=="string"?L:S.formatMessage({id:"form_success"})})]})};const yi="passwordRules_",Bf="isMoreThanEightCharacters",Tf="includesNumberAndSymbol",Sf="includesLowerAndUppercase",Kv={[Bf]:"8Characters",[Tf]:"numberSymbol",[Sf]:"lowercaseUppercase"},Zv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${yi}intro`})}),c.jsx("ul",{children:[Bf,Tf,Sf].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${yi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${yi}rule_${Kv[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${yi}notMet`})]})]},`rule-${r}`))})]})},jf=x.memo(Zv);const Yv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[l,u]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(y=>({...y,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(y=>({...y,setUp:!0,disabled:!0})),i(g)}};if(x.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:f,rating:h,disabled:p}=l,v="ratings_",m={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!f||p))try{u(y=>({...y,rating:g,disabled:!0})),await r({id:f,value:g})}catch(y){u(C=>({...C,rating:null})),i(y)}finally{u(y=>({...y,disabled:!1}))}};return c.jsxs("div",{className:K("rating",a),children:[c.jsx("span",{className:"label",children:m[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const y=g+1;return c.jsx("li",{className:K({selected:h&&y<=h}),children:c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:`star${!h||y>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:y,total:t})}${y===1||y===t?` - ${m[y===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(y)},disabled:p})},`rating-${y}`)})})]})},Gv={id:"",showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},cn=x.createContext(Gv),Qv={tabbableOption:"",setFocus:()=>{},openTooltip:null,dispatch:()=>{}},ai=x.createContext(Qv);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(Z||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Jv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Xv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),r[Z.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var eb=rb,Pf="֑-߿יִ-﷽ﹰ-ﻼ",Of="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",tb=new RegExp("^[^"+Of+"]*["+Pf+"]"),nb=new RegExp("^[^"+Pf+"]*["+Of+"]");function rb(e){return e=String(e||""),tb.test(e)?"rtl":nb.test(e)?"ltr":"neutral"}const Mf=$n(eb);function ib(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ro=ib,ab=typeof ci=="object"&&ci&&ci.Object===Object&&ci,sb=ab,ob=sb,ub=typeof self=="object"&&self&&self.Object===Object&&self,lb=ob||ub||Function("return this")(),Nf=lb,cb=Nf,db=function(){return cb.Date.now()},fb=db,mb=/\s/;function hb(e){for(var t=e.length;t--&&mb.test(e.charAt(t)););return t}var pb=hb,gb=pb,vb=/^\s+/;function bb(e){return e&&e.slice(0,gb(e)+1).replace(vb,"")}var yb=bb,xb=Nf,wb=xb.Symbol,If=wb,rl=If,Rf=Object.prototype,Cb=Rf.hasOwnProperty,Db=Rf.toString,Br=rl?rl.toStringTag:void 0;function Eb(e){var t=Cb.call(e,Br),n=e[Br];try{e[Br]=void 0;var r=!0}catch{}var i=Db.call(e);return r&&(t?e[Br]=n:delete e[Br]),i}var _b=Eb,kb=Object.prototype,Fb=kb.toString;function Ab(e){return Fb.call(e)}var Bb=Ab,il=If,Tb=_b,Sb=Bb,jb="[object Null]",Pb="[object Undefined]",al=il?il.toStringTag:void 0;function Ob(e){return e==null?e===void 0?Pb:jb:al&&al in Object(e)?Tb(e):Sb(e)}var Mb=Ob;function Nb(e){return e!=null&&typeof e=="object"}var Ib=Nb,Rb=Mb,$b=Ib,Lb="[object Symbol]";function zb(e){return typeof e=="symbol"||$b(e)&&Rb(e)==Lb}var qb=zb,Ub=yb,sl=Ro,Wb=qb,ol=0/0,Vb=/^[-+]0x[0-9a-f]+$/i,Hb=/^0b[01]+$/i,Kb=/^0o[0-7]+$/i,Zb=parseInt;function Yb(e){if(typeof e=="number")return e;if(Wb(e))return ol;if(sl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=sl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ub(e);var n=Hb.test(e);return n||Kb.test(e)?Zb(e.slice(2),n?2:8):Vb.test(e)?ol:+e}var Gb=Yb,Qb=Ro,Ka=fb,ul=Gb,Jb="Expected a function",Xb=Math.max,e0=Math.min;function t0(e,t,n){var r,i,a,s,o,l,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(Jb);t=ul(t)||0,Qb(n)&&(d=!!n.leading,f="maxWait"in n,a=f?Xb(ul(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(_){var T=r,L=i;return r=i=void 0,u=_,s=e.apply(L,T),s}function v(_){return u=_,o=setTimeout(g,t),d?p(_):s}function m(_){var T=_-l,L=_-u,P=t-T;return f?e0(P,a-L):P}function b(_){var T=_-l,L=_-u;return l===void 0||T>=t||T<0||f&&L>=a}function g(){var _=Ka();if(b(_))return y(_);o=setTimeout(g,m(_))}function y(_){return o=void 0,h&&r?p(_):(r=i=void 0,s)}function C(){o!==void 0&&clearTimeout(o),u=0,r=l=i=o=void 0}function k(){return o===void 0?s:y(Ka())}function E(){var _=Ka(),T=b(_);if(r=arguments,i=this,l=_,T){if(o===void 0)return v(l);if(f)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=C,E.flush=k,E}var $f=t0;const n0=$n($f);var r0=$f,i0=Ro,a0="Expected a function";function s0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(a0);return i0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),r0(e,t,{leading:r,maxWait:t,trailing:i})}var o0=s0;const u0=$n(o0),ll=e=>typeof e=="object"&&e!=null&&e.nodeType===1,cl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Za=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return cl(n.overflowY,t)||cl(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},xi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,l0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},dl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:H=>H!==u;if(!ll(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;ll(v)&&f(v);){if(v=l0(v),v===h){p.push(v);break}v!=null&&v===document.body&&Za(v)&&!Za(document.documentElement)||v!=null&&Za(v,d)&&p.push(v)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:g,scrollY:y}=window,{height:C,width:k,top:E,right:_,bottom:T,left:L}=e.getBoundingClientRect(),{top:P,right:z,bottom:M,left:A}=(H=>{const V=window.getComputedStyle(H);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-P:o==="end"?T+M:E+C/2-P+M,S=l==="center"?L+k/2-A+z:l==="end"?_+z:L-A;const I=[];for(let H=0;H<p.length;H++){const V=p[H],{height:ae,width:X,top:D,right:Q,bottom:q,left:B}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&L>=0&&T<=b&&_<=m&&E>=D&&T<=q&&L>=B&&_<=Q)return I;const j=getComputedStyle(V),N=parseInt(j.borderLeftWidth,10),O=parseInt(j.borderTopWidth,10),U=parseInt(j.borderRightWidth,10),ee=parseInt(j.borderBottomWidth,10);let W=0,ne=0;const de="offsetWidth"in V?V.offsetWidth-V.clientWidth-N-U:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-O-ee:0,ve="offsetWidth"in V?V.offsetWidth===0?0:X/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:ae/V.offsetHeight:0;if(h===V)W=o==="start"?F:o==="end"?F-b:o==="nearest"?xi(y,y+b,b,O,ee,y+F,y+F+C,C):F-b/2,ne=l==="start"?S:l==="center"?S-m/2:l==="end"?S-m:xi(g,g+m,m,N,U,g+S,g+S+k,k),W=Math.max(0,W+y),ne=Math.max(0,ne+g);else{W=o==="start"?F-D-O:o==="end"?F-q+ee+J:o==="nearest"?xi(D,q,ae,O,ee+J,F,F+C,C):F-(D+ae/2)+J/2,ne=l==="start"?S-B-N:l==="center"?S-(B+X/2)+de/2:l==="end"?S-Q+U+de:xi(B,Q,X,N,U+de,S,S+k,k);const{scrollLeft:ye,scrollTop:Ee}=V;W=me===0?0:Math.max(0,Math.min(Ee+W/me,V.scrollHeight-ae/me+J)),ne=ve===0?0:Math.max(0,Math.min(ye+ne/ve,V.scrollWidth-X/ve+de)),F+=Ee-W,S+=ye-ne}I.push({el:V,top:W,left:ne})}return I},c0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function d0(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(dl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of dl(e,c0(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${Ar(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ar(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Nv="shareLinks_",Iv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ie.useIntl(),l=Mv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",i,a,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:f,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const v={};return p&&(v.onClick=m=>p(m,f)),c.jsx("li",{children:c.jsx(Ae,{size:i,variant:"tertiary",icon:{icon:d||u},href:f,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Nv}link_${u}`}),...v})},u)})})]})};const Rv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(m,b,g)=>(m||(m=`panel-${window.btoa(b)}-${g}`),m),i=wn(!0)||0;let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(g=>g.id===m)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===m){a=g;break}}}const[s,o]=x.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=x.useState(""),d=(m,b)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let g=b;m.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:m.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const y=r(e[g].id,e[g].text,g),C=document.getElementById(`tab-${y}`);C==null||C.focus(),u(y);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},f=m=>{let b=!1;return m.target==="min-width"&&i>=m.value&&(b=!0),m.target==="max-width"&&i<=m.value&&(b=!0),b};x.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(m)}},[s]);const h=[],p=[];return e.forEach(({id:m,text:b,content:g,href:y,hasCarousel:C,breakpoint:k},E)=>{if(k&&!f(k))return;m=r(m,b,E);const _=s===m,T={};y||(T["aria-controls"]=m,T.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(m),!n&&window.history.replaceState(null,"",`#${m}`)},p.push(c.jsx("section",{id:m,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${m}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:y||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:K({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:L=>d(L,E),...T,children:b})},`tab-${m}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const $v={"2-1":901,"1-3":769,"1-1":769},_f=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=wn(!0);let s=i;return x.Children.count(i)===1&&(s=x.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<$v[e]?null:o)})};const No=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ie.useIntl(),a="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Me,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},va=e=>(e==null?void 0:e.toString().length)||0,kf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{va(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const bi="emailHelperTextBox_",Ff=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ie.useIntl(),[s,o]=x.useState({path:`${bi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=x.useState(!1),d=x.useCallback(v=>{v.preventDefault(),v.stopPropagation();const m=b=>{o({path:`${bi}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof i!="function"){m(a.formatMessage({id:`${bi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{m(b.message)}).finally(()=>{u(!1)})},[n,r,i]);x.useEffect(()=>{let v=bi,m="default",b={},g={};switch(t){case"gov":v+="autoApproved",m="success";break;case"nonGov":v+="unrecognisedEmail",m="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":v+="pendingApproval",m="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",m="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>d(y),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",m="error",b={href:"/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:v,type:m,link:b,mail:g})},[t]);const f={};return["link","mail"].forEach(v=>{f[v]=Object.keys(s[v]).length?m=>c.jsx("a",{...s[v],children:m}):m=>m}),c.jsx(Sd,{id:e,type:s.type,heading:l?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...f,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,styling:f={},...h})=>{const p=x.useRef(),v=r||p,{autosizeToFit:m=!1}=f;md(m&&t==="textarea",v),x.useEffect(()=>{var g;u&&((g=v.current)==null||g.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email");const b={};return t==="input"&&(b.type=o),x.createElement(t,{ref:v,...h,...b,id:n,name:a,className:K(e,t,{autoresize:m}),value:l,placeholder:s,autoFocus:u,...i,onChange:g=>{const y=g.target;i.onChange(y.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Lv=500,zv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:l,displayInput:u,debouncedInput:d},f]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},m]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{v||f(E=>({...E,debouncedInput:l}))},Lv);return()=>{clearTimeout(k)}},[l,v]),x.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];m(_=>({..._,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),m(_=>({..._,predictions:[]}))}})():m(k=>({...k,predictions:[]}))},[d,v]),x.useEffect(()=>{p>=0&&h[p]&&f(k=>({...k,displayInput:h[p].description}))},[p,h]);const g=k=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Vn.DOWN&&p<h.length-1?m(E=>({...E,activePredictionIndex:p+1})):k.key===Vn.UP&&p>0?m(E=>({...E,activePredictionIndex:p-1})):k.key===Vn.ENTER&&p>-1&&(s(h[p].description),f(E=>({...E,input:h[p].description})),m(E=>({...E,predictions:[],isPredictionSelected:!0}))))},y=k=>{s(k.target.value),f(E=>({...E,input:k.target.value,displayInput:k.target.value})),m(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},C=k=>{s(k.description),f(E=>({...E,input:k.description,displayInput:k.description})),m(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:y,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((k,E)=>c.jsx("li",{onClick:()=>C(k),onMouseEnter:()=>m(_=>({..._,activePredictionIndex:E})),className:K("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Io=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:f=!1}={}}={},...h})=>{const p=ie.useIntl(),{onChange:v,...m}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:K("pretty-checkbox",{radio:u==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:y=>{(y.key==="Enter"||y.code==="Space")&&(y.preventDefault(),y.stopPropagation(),b())},tabIndex:d||!f?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return x.createElement(n,{onClick:y=>{const C=y.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(y.preventDefault(),y.stopPropagation(),b())},onKeyDown:f?y=>{var C,k,E;if(y.key!=="Tab")switch(y.code){case"Enter":case"Space":y.stopPropagation(),y.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":y.stopPropagation(),y.preventDefault();const _=y.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(y.key==="ArrowLeft"){const L=_==null?void 0:_.previousElementSibling;L?T=L:T=(C=_==null?void 0:_.parentElement)==null?void 0:C.lastElementChild}else T||(T=(k=_==null?void 0:_.parentElement)==null?void 0:k.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:K(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...m},g)};const qv=x.memo(function({direction:t="down"}){return c.jsx(da,{className:K("rotating-chevron",`direction-${t}`)})});const Uv=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ie.useIntl(),[f,h]=x.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[m,b]=x.useState(v);let g;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?g=t&&m?t.find(T=>T.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?g=m[0]:g={id:"",label:""},x.useEffect(()=>{b(v)},[r,n]);const{onChange:y,onMultiSelectSubmit:C,...k}=i,E=T=>{if(o){let L=[];m!=null&&m.includes(T.id)?L=m.filter(P=>P!==T.id):L=[...m,T.id],b([...L]),y&&y([...L])}else b([T]),y&&y(T.id),h(!1)},_=T=>{if(T==="all"){const L=(t==null?void 0:t.map(P=>P.id))||[];b(L),y&&y(L)}else b([]),y&&y([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${m.length}`:g.label,c.jsx(qv,{direction:f?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const L=t&&t.find(P=>P.id===T.target.value);E(L)},hidden:!f,...k,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${m==null?void 0:m.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ae,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ae,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const L=T.id===g.id||(m==null?void 0:m.includes(T))||(m==null?void 0:m.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":L,"data-testid":L?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ae,{variant:"secondary",onClick:()=>{C&&C(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Or=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};let Va=null;const Wv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...f})=>{const h=ie.useIntl(),{showCount:p=!1,label:v,defaultInputs:m=1,maxInputs:b=100,hasButton:g=!1,allowDuplicateValues:y=!1}=o||{},[C,k]=x.useState(r?Array.isArray(r)?r:[r]:Array(m).fill("")),E=C.filter(z=>z!==""),_=()=>{if(!u)return;const z=Pt(u.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),M=[];C.map((F,S)=>{if(b&&S>=b)return;const I=Pt(l??[]);e&&(y||I.push({condition:H=>{var D;const V=H[e].toLowerCase(),ae=((D=H[`${e}-all`])==null?void 0:D.length)??0,X=new Set(H[`${e}-all`].map(Q=>Q.toLowerCase()));return X.has(V)&&X.size<ae},error:h==null?void 0:h.formatMessage({id:"form_error_multipleInputs_same"})}),I.forEach(H=>{const{condition:V,error:ae}=H;if(typeof V=="function")H.condition=X=>{var q;let D=(q=X==null?void 0:X[e])==null?void 0:q[S];D||(X[e]&&!Array.isArray(X[e])?D=X[e]:D="");const Q=Pt(X);return Q[e]=D,Q[`${e}-all`]=X[e],typeof V=="function"&&V(Q)?ae:!1};else{const X=V;H.condition=D=>{var q;let Q=(q=D==null?void 0:D[e])==null?void 0:q[S];switch(Q||(D[e]&&!Array.isArray(D[e])?Q=D[e]:Q=""),X){case"required":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ae||(H.error=ae||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Or(X,Q)?H.error:!1}}}),M.push({id:`${e}-${S}`,validation:I,value:F}))});const A={fieldsToValidate:z.concat(M)};u.multipleInputs.includes(e)&&(A.multipleInputs=u.multipleInputs.filter(F=>F!==e)),u.setFields(F=>({...F,...A}))};x.useEffect(()=>{_()},[C.length]),x.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&_()},[u==null?void 0:u.multipleInputs]);const T=()=>{(!b||C.length<b)&&k([...C,""])},L=z=>{const M=document.getElementById(`${e}-${z+1}`);M==null||M.focus()},P=(z,M)=>z.replace("{number}",M+1);return c.jsxs("fieldset",{className:K("multiple-inputs field-wrapper",{"has-button":g,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label text-small",children:[t,p?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":h.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:E.length,total:b}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:E.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((z,M)=>{if(b&&M>=b)return c.jsx(c.Fragment,{});let A=!1;t?A=c.jsx(Me,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:M+1})}):v&&(A=P(v,M));const F=`${e}-${M}`,S=M+1>m;return c.jsx(Af,{id:F,type:"text",label:A,value:z,placeholder:i?P(i,M):void 0,className:K({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{g||M!==C.length-1||T()},onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),Va&&clearTimeout(Va),M!==C.length-1?L(M):(T(),Va=setTimeout(()=>L(M),100)))},onChange:I=>{const H=C[M].toLowerCase(),V=Pt(C);V[M]=I,k(V),u==null||u.dispatch({type:"removeError",payload:{key:F}}),y||V.forEach((ae,X)=>{Kr(ae)&&X!==M&&ae.toLowerCase()===H&&(u==null||u.dispatch({type:"removeError",payload:{key:`${e}-${X}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(Ae,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const I=Pt(C);I.splice(M,1),k(I),u==null||u.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(I)}}):void 0,...f},F)}),g?c.jsx(Ae,{...g,onClick:T,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const nl=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:f,styling:{displayOptionsAsPills:h=!1}={},multipleOptions:p,...v})=>{const m=ie.useIntl(),b=a?d:[],g=d;return c.jsx("ul",{...v,className:K("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:y,label:C=!1,value:k=y,disabled:E=void 0})=>{const _=`${r}_${y}`;E===void 0&&(E=p!=null&&p.limit?b.length>=p.limit&&!b.includes(k):!1);const T=()=>{if(E)return;let L;if(a){const P=b==null?void 0:b.indexOf(k);Array.isArray(b)&&P>=0?(L=b,L.splice(P,1)):(!b||b.length===0?L=[]:L=b,L.push(k))}else L=g===k?void 0:k;t.onChange(L)};return c.jsx(Io,{element:"li",id:_,type:u==="checkboxes"?"checkbox":"radio",shownValue:k,value:a?b==null?void 0:b.includes(k):g===k,functions:{...t,onChange:T},intlPath:n,label:C||m.formatMessage({id:n?`${n}_${y}`:y}),disabled:E,accessibilityOptions:f,className:K({disabled:E})},_)})})};const Vv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ie.useIntl(),s=x.useRef(),o=e||s,[l,u]=x.useState(!1),[d,f]=x.useState(t),h=()=>{var p;u(!l),f(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Hn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Io},checkboxes:{component:nl,props:{multiSelect:!0}},radio:{component:nl,props:{multiSelect:!1}},select:{component:Uv},password:{component:Vv},autocomplete:{component:zv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Af=e=>{const t=ie.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:f,submitOnEnter:h,fieldData:p,siblings:v,...m}=e;if(u&&u==="multiple-inputs")return c.jsx(Wv,{...e});const b=d&&d.some(({condition:S})=>S==="required"),g=va(f),y=u&&Hn[u]&&Hn[u].component?Hn[u].component:Jn,C=u&&["checkboxes","radio"].includes(u),k=u&&["autocomplete"].includes(u),E=a&&`error-${n}`,_=`character-limit-${n}`,T={};C?T.element="legend":T.htmlFor=n;let L={...m,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Pt(s),value:f};const P=S=>{L["aria-describedby"]?L["aria-describedby"]+=` ${S}`:L["aria-describedby"]=S};if(o>0){const S=kf(o,s);P(`${_}-info`),L={...L,...S},S.functions&&typeof S.functions=="object"&&(L.functions={...L.functions,...S.functions})}u&&Hn[u]&&Hn[u].props&&(L={...L,...Hn[u].props}),C&&(L.intlPath=`${r}_${n}`),a&&(L["aria-invalid"]=!0,L["aria-errormessage"]=E,P(E));const z=m.label||t.formatMessage({id:r?`${r}_${n}`:n}),M=({...S})=>a?x.createElement(S.as||"p",{id:E,className:"error text-small",...S},a):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(y,{...L,label:z,className:K("field-wrapper",i)}),c.jsx(M,{as:"p"})]});const A={};C?T.className="legend-as-label text-small":A.className="field-label";const F=({element:S,...I})=>x.createElement(S||"label",{...I,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:x.createElement(C?"fieldset":"div",{className:K("field-wrapper text-small",i,`${u}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[m.label===!1?c.jsx(c.Fragment,{}):x.createElement(C?x.Fragment:"p",A,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),x.createElement(C||k?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(y,{...L}),c.jsx(No,{id:_,limit:o,valueLength:g}),v]})),c.jsx(M,{})]}))})},Hv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Pt(e.errors):{},a=e.values?Pt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,f=Pt(Object.keys(i));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:v="required",error:m=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=m||g)}else{const g=a[h.id],y=v;switch(y){case"required":Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Or(y,g)&&(b=m||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:h.id,value:b}}),f.push(h.id);break}}return f.length===0?l(a):u(a,f),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Ha=null;const Xt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:f,...h})=>{const p=(t||[]).filter(W=>W.type==="multiple-inputs").map(W=>W.id),[v,m]=x.useState({fieldsToValidate:t,multipleInputs:p});x.useEffect(()=>{v.multipleInputs.length||m(W=>({...W,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:g,...y}=s,C=40,{shouldShowCancelButton:k=!1,shouldReset:E=!0,shouldHide:_=!0,showRequiredLabels:T=!0,showSuccessMessage:L=!1,shouldScrollOnSuccess:P=!0}=l||{},{onSuccess:z=async()=>{},onCancel:M=()=>{},onCatch:A=()=>{},onFailure:F=()=>{}}=f||{},S=ie.useIntl(),I={};t.length&&t.forEach(W=>{const ne=W.id||W.name;ne&&(I[ne]=W.value||"")});const[H,V]=x.useReducer(Hv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:ae,isSubmitting:X,formSubmitted:D,values:Q}=H;x.useEffect(()=>{E&&D&&(Ha=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[D]),x.useEffect(()=>()=>{Ha&&clearTimeout(Ha)},[]),x.useEffect(()=>{const W=ne=>{V({type:"updateValue",payload:{key:ne.detail.id,value:ne.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",W),()=>{document.removeEventListener("dropdownMultiSelectSubmit",W)}},[]);const q=x.useRef(null),B=i||q,j=Wr(()=>{if(!X){if(V({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&V({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:V,intl:S}});return}V({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:V,onSuccess:async W=>{P&&O();try{await z(W),V({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(ne){A(ne),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(W,ne)=>{O(),F(W,ne),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},100);if(!t.length)return null;const N={};s.children&&(N.default=s.children),y.text&&typeof y.text=="string"&&(N.default=y.text),["default","submitting","submitted"].forEach(W=>{y.text&&typeof y.text!="string"&&W in y.text?N[W]=y.text[W]:N[W]||(N[W]=S.formatMessage({id:`form_${W==="default"?"submit":W}`}))}),delete y.text;const O=()=>{var de;let W=0;if((de=B==null?void 0:B.current)!=null&&de.id){const J=document.getElementById(B.current.id);J&&(W=J.getBoundingClientRect().top+window.scrollY)}const ne=document.getElementById("header");ne&&(W=W-ne.offsetHeight-C),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"})},U=W=>{W.preventDefault(),W.stopPropagation(),!X&&j()},ee=[{...y,icon:D?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",y.className),onClick:U,disabled:X||D||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:N[X?"submitting":D?"submitted":"default"]}];return k&&ee.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:X||D,onClick:M,children:o.text||S.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[x.createElement(e,{...h,id:r,className:K("form",n),ref:B},c.jsxs(c.Fragment,{children:[ae!=null&&ae.general?c.jsx(Qt,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,u,(!_||!X&&!D||b)&&t.map((W,ne)=>{const{id:de=W.name||ne,component:J,functions:ve={onChange:()=>{}},submitOnEnter:me=!1}=W;if(J)return c.jsx(J,{...W.props||{}},`component-${de}-${ne}`);const ye=(Q==null?void 0:Q[de])||"",Ee={...ve,onChange:Ce=>{V({type:"updateValue",payload:{key:de,value:Ce}}),ve.onChange(Ce,V)}};return me&&(Ee.onKeyDown=Ce=>{Ce.key==="Enter"&&(Ce.stopPropagation(),Ce.preventDefault(),j()),ve.onKeyDown&&ve.onKeyDown(Ce)}),c.jsx(Af,{intlPath:a,...W,showRequiredLabels:T,value:ye,error:W.type==="multiple-inputs"?ae:ae==null?void 0:ae[de],functions:Ee,fieldData:{fields:v.fieldsToValidate,multipleInputs:v.multipleInputs,setFields:m,dispatch:V}},de)}),g?null:(X||D)&&b?b:c.jsx(vr,{className:K("cta",{center:X||D,submitted:D}),buttons:ee})]})),L&&D&&c.jsx(ur,{className:"success",children:typeof L=="string"?L:S.formatMessage({id:"form_success"})})]})};const yi="passwordRules_",Bf="isMoreThanEightCharacters",Tf="includesNumberAndSymbol",Sf="includesLowerAndUppercase",Kv={[Bf]:"8Characters",[Tf]:"numberSymbol",[Sf]:"lowercaseUppercase"},Zv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${yi}intro`})}),c.jsx("ul",{children:[Bf,Tf,Sf].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${yi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${yi}rule_${Kv[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${yi}notMet`})]})]},`rule-${r}`))})]})},jf=x.memo(Zv);const Yv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[l,u]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(y=>({...y,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(y=>({...y,setUp:!0,disabled:!0})),i(g)}};if(x.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:f,rating:h,disabled:p}=l,v="ratings_",m={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!f||p))try{u(y=>({...y,rating:g,disabled:!0})),await r({id:f,value:g})}catch(y){u(C=>({...C,rating:null})),i(y)}finally{u(y=>({...y,disabled:!1}))}};return c.jsxs("div",{className:K("rating",a),children:[c.jsx("span",{className:"label",children:m[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const y=g+1;return c.jsx("li",{className:K({selected:h&&y<=h}),children:c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:`star${!h||y>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:y,total:t})}${y===1||y===t?` - ${m[y===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(y)},disabled:p})},`rating-${y}`)})})]})},Gv={id:"",showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},cn=x.createContext(Gv),Qv={tabbableOption:"",setFocus:()=>{},openTooltip:null,dispatch:()=>{}},ai=x.createContext(Qv);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(Z||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Jv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Xv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),r[Z.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var eb=rb,Pf="֑-߿יִ-﷽ﹰ-ﻼ",Of="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",tb=new RegExp("^[^"+Of+"]*["+Pf+"]"),nb=new RegExp("^[^"+Pf+"]*["+Of+"]");function rb(e){return e=String(e||""),tb.test(e)?"rtl":nb.test(e)?"ltr":"neutral"}const Mf=$n(eb);function ib(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ro=ib,ab=typeof ci=="object"&&ci&&ci.Object===Object&&ci,sb=ab,ob=sb,ub=typeof self=="object"&&self&&self.Object===Object&&self,lb=ob||ub||Function("return this")(),Nf=lb,cb=Nf,db=function(){return cb.Date.now()},fb=db,mb=/\s/;function hb(e){for(var t=e.length;t--&&mb.test(e.charAt(t)););return t}var pb=hb,gb=pb,vb=/^\s+/;function bb(e){return e&&e.slice(0,gb(e)+1).replace(vb,"")}var yb=bb,xb=Nf,wb=xb.Symbol,If=wb,rl=If,Rf=Object.prototype,Cb=Rf.hasOwnProperty,Db=Rf.toString,Br=rl?rl.toStringTag:void 0;function Eb(e){var t=Cb.call(e,Br),n=e[Br];try{e[Br]=void 0;var r=!0}catch{}var i=Db.call(e);return r&&(t?e[Br]=n:delete e[Br]),i}var _b=Eb,kb=Object.prototype,Fb=kb.toString;function Ab(e){return Fb.call(e)}var Bb=Ab,il=If,Tb=_b,Sb=Bb,jb="[object Null]",Pb="[object Undefined]",al=il?il.toStringTag:void 0;function Ob(e){return e==null?e===void 0?Pb:jb:al&&al in Object(e)?Tb(e):Sb(e)}var Mb=Ob;function Nb(e){return e!=null&&typeof e=="object"}var Ib=Nb,Rb=Mb,$b=Ib,Lb="[object Symbol]";function zb(e){return typeof e=="symbol"||$b(e)&&Rb(e)==Lb}var qb=zb,Ub=yb,sl=Ro,Wb=qb,ol=0/0,Vb=/^[-+]0x[0-9a-f]+$/i,Hb=/^0b[01]+$/i,Kb=/^0o[0-7]+$/i,Zb=parseInt;function Yb(e){if(typeof e=="number")return e;if(Wb(e))return ol;if(sl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=sl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ub(e);var n=Hb.test(e);return n||Kb.test(e)?Zb(e.slice(2),n?2:8):Vb.test(e)?ol:+e}var Gb=Yb,Qb=Ro,Ka=fb,ul=Gb,Jb="Expected a function",Xb=Math.max,e0=Math.min;function t0(e,t,n){var r,i,a,s,o,l,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(Jb);t=ul(t)||0,Qb(n)&&(d=!!n.leading,f="maxWait"in n,a=f?Xb(ul(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(_){var T=r,L=i;return r=i=void 0,u=_,s=e.apply(L,T),s}function v(_){return u=_,o=setTimeout(g,t),d?p(_):s}function m(_){var T=_-l,L=_-u,P=t-T;return f?e0(P,a-L):P}function b(_){var T=_-l,L=_-u;return l===void 0||T>=t||T<0||f&&L>=a}function g(){var _=Ka();if(b(_))return y(_);o=setTimeout(g,m(_))}function y(_){return o=void 0,h&&r?p(_):(r=i=void 0,s)}function C(){o!==void 0&&clearTimeout(o),u=0,r=l=i=o=void 0}function k(){return o===void 0?s:y(Ka())}function E(){var _=Ka(),T=b(_);if(r=arguments,i=this,l=_,T){if(o===void 0)return v(l);if(f)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=C,E.flush=k,E}var $f=t0;const n0=$n($f);var r0=$f,i0=Ro,a0="Expected a function";function s0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(a0);return i0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),r0(e,t,{leading:r,maxWait:t,trailing:i})}var o0=s0;const u0=$n(o0),ll=e=>typeof e=="object"&&e!=null&&e.nodeType===1,cl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Za=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return cl(n.overflowY,t)||cl(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},xi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,l0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},dl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:H=>H!==u;if(!ll(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;ll(v)&&f(v);){if(v=l0(v),v===h){p.push(v);break}v!=null&&v===document.body&&Za(v)&&!Za(document.documentElement)||v!=null&&Za(v,d)&&p.push(v)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:g,scrollY:y}=window,{height:C,width:k,top:E,right:_,bottom:T,left:L}=e.getBoundingClientRect(),{top:P,right:z,bottom:M,left:A}=(H=>{const V=window.getComputedStyle(H);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-P:o==="end"?T+M:E+C/2-P+M,S=l==="center"?L+k/2-A+z:l==="end"?_+z:L-A;const I=[];for(let H=0;H<p.length;H++){const V=p[H],{height:ae,width:X,top:D,right:Q,bottom:q,left:B}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&L>=0&&T<=b&&_<=m&&E>=D&&T<=q&&L>=B&&_<=Q)return I;const j=getComputedStyle(V),N=parseInt(j.borderLeftWidth,10),O=parseInt(j.borderTopWidth,10),U=parseInt(j.borderRightWidth,10),ee=parseInt(j.borderBottomWidth,10);let W=0,ne=0;const de="offsetWidth"in V?V.offsetWidth-V.clientWidth-N-U:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-O-ee:0,ve="offsetWidth"in V?V.offsetWidth===0?0:X/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:ae/V.offsetHeight:0;if(h===V)W=o==="start"?F:o==="end"?F-b:o==="nearest"?xi(y,y+b,b,O,ee,y+F,y+F+C,C):F-b/2,ne=l==="start"?S:l==="center"?S-m/2:l==="end"?S-m:xi(g,g+m,m,N,U,g+S,g+S+k,k),W=Math.max(0,W+y),ne=Math.max(0,ne+g);else{W=o==="start"?F-D-O:o==="end"?F-q+ee+J:o==="nearest"?xi(D,q,ae,O,ee+J,F,F+C,C):F-(D+ae/2)+J/2,ne=l==="start"?S-B-N:l==="center"?S-(B+X/2)+de/2:l==="end"?S-Q+U+de:xi(B,Q,X,N,U+de,S,S+k,k);const{scrollLeft:ye,scrollTop:Ee}=V;W=me===0?0:Math.max(0,Math.min(Ee+W/me,V.scrollHeight-ae/me+J)),ne=ve===0?0:Math.max(0,Math.min(ye+ne/ve,V.scrollWidth-X/ve+de)),F+=Ee-W,S+=ye-ne}I.push({el:V,top:W,left:ne})}return I},c0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function d0(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(dl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of dl(e,c0(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:o,left:l,behavior:r})}}/*!
67
67
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
68
68
  *
69
69
  * Copyright (c) 2014-2017, Jon Schlinkert.
@@ -162,4 +162,4 @@ ${p}${f?"1.":"-"} ${u}${h?`
162
162
 
163
163
  `.substring(0,i);return n+a+r}function i_(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var a_={isHistory(e){return ot(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||vn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||vn.isOperationList(e.undos[0].operations))}},vs=new WeakMap,bs=new WeakMap,nr={isHistoryEditor(e){return a_.isHistory(e.history)&&w.isEditor(e)},isMerging(e){return bs.get(e)},isSaving(e){return vs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);bs.set(e,!1),t(),bs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);vs.set(e,!1),t(),vs.set(e,n)}},s_=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&te.setSelection(t,a.selectionBefore),nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{var s=a.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&te.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=nr.isSaving(t),d=nr.isMerging(t);if(u==null&&(u=u_(r)),u){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=o_(r,l)),o&&d)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},o_=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&$.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&$.equals(e.path,t.path)),u_=(e,t)=>e.type!=="set_selection";const l_=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===Z.link){const i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var c_=h_,d_=/^(?:\w+:)?\/\/(\S+)$/,f_=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,m_=/^[^\s\.]+\.\S{2,}$/;function h_(e){if(typeof e!="string")return!1;var t=e.match(d_);if(!t)return!1;var n=t[1];return n?!!(f_.test(n)||m_.test(n)):!1}const p_=$n(c_),g_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[Z.link].includes(s.type)||i(a)},e.insertText=a=>{a&&p_(a)?su(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},v_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===Z.mention?!0:n(a),e.isVoid=a=>a.type===Z.mention?!0:r(a),e.markableVoid=a=>a.type===Z.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},b_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===Z.link&&le.string(r).trim()===""){te.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const cu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:l,...u})=>{const d=ie.useIntl(),f=Yh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=i||{},{listMembers:p,clickMentionFallback:v,onChange:m=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:y=()=>{},reportError:C=N=>{console.error(N)}}=a||{},k=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:k,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[_,T]=x.useReducer(pr,E),{editorKey:L,originalValue:P,initialValue:z,stringValue:M,lastAnchor:A,lastKey:F,hasInteracted:S,hasLoaded:I,enrichedUrl:H,mentionPopover:V}=_,ae=async N=>{const O=await g(N);O.url&&T([{type:"enrichedUrl",value:O}])},X=`rte-${e}`,D=x.useCallback(N=>c.jsx(Jv,{...N}),[]),Q=x.useCallback(N=>c.jsx(Xv,{...N}),[]),q=x.useMemo(()=>l_(g_(v_(b_(s_($w(qx())),C),C),X,C),C),[]),B=N=>{if(!q||N!==X)return;const O=w.end(q,[]);te.select(q,O),re.focus(q)};x.useEffect(()=>{const N=O=>{var W;const U=O,ee=((W=U==null?void 0:U.detail)==null?void 0:W.id)||null;ee&&B(ee)};return window.addEventListener("focusEditor",N),()=>{window.removeEventListener("focusEditor",N)}},[]),x.useEffect(()=>{if(q.children.length>0&&!I){if(T([{type:"hasLoaded",value:!0}]),!s)return;B(X)}},[q.children.length,z]),x.useEffect(()=>{P&&(async()=>{let O=Pt(P);if(O.includes("<")){ni.prototype.escape=ee=>ee;const U=new ni;U.addRule("br",{filter:["br"],replacement:ee=>ee+`
164
164
 
165
- `}),O=U.turndown(O)}o&&o.mentions&&(O=await kd({text:O,template:`[${to}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),pE(O,U=>{const ee=[{type:"initialValue",value:U},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(ee.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),T(ee),setTimeout(()=>{T([{type:"stringValue",value:Kc(q)}])},150)})})()},[P]),x.useEffect(()=>{if(H===void 0&&q){const O=bE(q);O&&ae(O)}const N=O=>{var W;const U=O,ee=((W=U==null?void 0:U.detail)==null?void 0:W.url)||null;ee&&H&&H.url===ee&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",N),()=>{window.removeEventListener("linkRemoved",N)}},[H]),x.useEffect(()=>{if(t){Hr.lastIndex=0;const N=t.match(Hr);N&&N.length===1&&N[0].length===t.length&&!S&&T([{type:"originalValue",value:t}])}t!==""||!q||Wi(P,t)&&!S||(w.withoutNormalizing(q,()=>{te.delete(q,{at:{anchor:w.start(q,[]),focus:w.end(q,[])}}),te.deselect(q),q.children.length!==0&&te.unwrapNodes(q,{at:[0]}),te.insertNodes(q,k,{at:[0]})}),T([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),x.useEffect(()=>{b({link:H})},[H]),x.useEffect(()=>{M===""&&H&&T([{type:"enrichedUrl",value:void 0}])},[M]);const j=Wr(()=>{xE({editor:q,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:X,className:"rich-text-editor input text-medium",children:c.jsxs(cn.Provider,{value:{..._,id:X,isInOverlay:h,dispatch:T,onMention:y,reportError:C},children:[c.jsxs(Iw,{editor:q,initialValue:z,onChange:N=>{if(q.operations.some(U=>U.type!=="set_selection")){let U=CE(N);U==="<br>"&&(U=""),m(U,H),T([{type:"stringValue",value:Kc(q)}]),S||T([{type:"hasInteracted",value:!0}]),j(),f&&console.log({serialized:U,json:N})}},...u,children:[c.jsx(Aw,{className:"editor",renderElement:D,renderLeaf:Q,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async N=>{const O=H!==!1,U=N.clipboardData.getData("text");if((W=>{try{return new URL(W),!0}catch{return!1}})(U)){let W=U;if(U){const{full:ne}=po(U);W=ne}if(U&&g&&!O){const ne=await g(W);ne.url&&T([{type:"enrichedUrl",value:ne}])}}},onKeyDown:N=>{if(N.key==="Enter"){V.show&&(N.preventDefault(),N.stopPropagation(),zm(q,V,T,X));const{selection:O}=q;if(O){const U=G.isCollapsed(O),[ee,W]=w.node(q,O,{depth:1});let ne=ee,de=ne.type;const J=ne.children[0];if(J&&(J==null?void 0:J[Z.h3])===!0&&(N.stopPropagation(),N.preventDefault(),te.insertNodes(q,k)),J&&[Z.ol,Z.ul].includes(J.type)&&(ne=J,de=J.type),ne&&he.isElement(ne)&&de!==Z.paragraph){if(de===Z.blockquote&&!N.shiftKey){N.stopPropagation(),N.preventDefault(),te.insertNodes(q,k);return}if(U){const[ve,me]=w.parent(q,O,{edge:"end"}),Ee=ve.type;if([Z.ul,Z.ol].includes(de))if(N.stopPropagation(),N.preventDefault(),Ee===Z.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&te.removeNodes(q,{at:me}),te.insertNodes(q,k,{at:$.next(W)}),te.select(q,w.end(q,$.next(W)));return}else{const[Ce,ze]=gE(q,Z.li),We={type:Z.li,children:[{text:""}]};te.insertNodes(q,We,{at:$.next(ze)}),te.select(q,w.end(q,$.next(ze)))}}}}}else if(N.key==="Escape"){if(V.show){N.preventDefault(),N.stopPropagation(),T([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(N.key)&&V.show){N.preventDefault(),N.stopPropagation();const{selectedUser:O,possibleUsers:U}=V;let ee=N.key==="ArrowUp"?O-1:O+1;ee<0&&(ee=U.length-1),ee>=U.length+1&&(ee=0),T([{type:"mentionPopover",value:{...V,selectedUser:ee}}])}T([{type:"lastKey",value:N.key}]),yE(N,q,T,C)},onBlur:()=>{q.selection&&T([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(A){if(!$.isPath(A.path)||!le.has(q,A.path))return;const N=le.get(q,A.path);let O=0;if(ge.isText(N)?O=N.text.length:N.children&&(O=N.children.length),A.offset>O)return;try{te.select(q,{anchor:A,focus:A})}catch(U){const ee=U.message;C(`Error focusing editor: ${ee}`)}}}}),H?c.jsx(Oo,{data:H,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const N=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(N)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:H.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(PE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(DE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},L),c.jsx(No,{id:`character-limit-${e}`,limit:r,valueLength:va(M)})]})}):c.jsx(c.Fragment,{})};const y_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.useEffect(()=>{r&&l(r)},[r]);const u=d=>{a||(l(d),i(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(d=>{const f=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:f,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:f,children:d.label})]},f)})})]})};function nh({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ie.useIntl(),l="profileImageChange_",[u,d]=x.useState(r),[f,h]=x.useState(!1),[p,v]=x.useState(!1),m=x.useRef(null),b=async k=>{h(!0),v(!1);try{const E=k.target.files&&k.target.files[0];if(!E||!t)throw h(!1),new Error("Image file or userID is missing");const _=await i({fileObject:E,userId:t}),T={thumbnail:_.thumbnailURL,full:_.originalURL};d(T),s(T)}catch{v(!0)}finally{h(!1)}h(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:y=o.formatMessage({id:`${l}cta_change`}),uploading:C=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:m,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ae,{onClick:()=>m.current&&m.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:f,children:f?C:u?y:g})]})}const rh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Xt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const x_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(Ph.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},ih=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED",gtm:f={context:"Form",event:"form-submit-click"},secondaryActionButton:h,meta:p})=>{const[v,m]=x.useState([]),[b,g]=x.useState(!0),[y,C]=x.useState(d),{formatMessage:k}=ie.useIntl(),E=async L=>{try{await u(v,L.message),m([]),C("SUCCESS")}catch(P){C("ERROR"),l(P)}},_=L=>{L.preventDefault(),C("NOT_SUBMITTED"),g(!0),m([])},T=L=>{L.preventDefault(),o(),C("CLOSED")};return y==="CLOSED"?null:y==="ERROR"||y==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:y==="SUCCESS"?c.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:y==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"secondary",onClick:_,children:k({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ae,{onClick:T,children:k({id:"inviteForm_ctaDone"})})]}):c.jsx(Ae,{onClick:_,children:k({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Xt,{id:"invite-form",fields:[{component:x_,props:{emails:v,setEmails:m,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:k({id:"inviteForm_message_label"}),placeholder:n||k({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:E},button:{text:r,size:"medium",disabled:b},gtm:f,meta:p,secondaryActionButton:h})]})},Ui=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},w_=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,i]=x.useState(null),[a,s]=x.useState(!1),[o,l]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Tt.NEW_PASSWORD]!==p[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ps(p[Tt.NEW_PASSWORD]).isValid,f=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ui(["required",d]),functions:{onChange:p=>l(Ps(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ui(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ui(["required"])}),a&&f.push({component:jf,props:{matchingRules:o}});const h={id:Tt.FORM_ID,fields:f,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(Tt.NEW_PASSWORD)||v.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Xt,{...h}),r&&c.jsx(Qt,{variant:"error",text:r})]})};const ah=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var L;const s=ie.useIntl(),o="profileForm_",l=x.useContext(it),[u,d]=x.useState(l.image),[f,h]=x.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async P=>{},onCancel:m=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:y,predictPlaces:C}=t.useMaps(),{context:k="ProfileForm",event:E="profile-form-submit-click"}=i||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(L=l.location)==null?void 0:L.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!f?!1:!y(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{f||h(!0)},onKeyInput:C}}],T=[{component:nh,props:{userName:l.name,userId:l.id,src:u,uploadImage:p,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Xt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:k,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:f?await g(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(M=>({...M,...z})),await v(z)}catch{b()}},onCancel:m,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},C_=()=>{const e=ie.useIntl(),[t,n]=x.useState(0);return x.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Vd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function D_({coverImage:e,setShowImagePicker:t}){return e&&e.url?c.jsx(Qt,{className:"cover-image-preview",text:c.jsx(Cn,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:c.jsx(Ae,{variant:"tertiary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):c.jsx(Qt,{button:{component:c.jsx(Ae,{variant:"secondary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var sh=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(sh||{});let ys=null;const et="publishArticleForm_",td={},nd=10,E_=({id:e="publish-article-form",values:t=td,setShowImagePicker:n,functions:r,meta:i,gtm:a})=>{var P;const s=ie.useIntl(),o=x.useContext(it),{create:l,onSuccess:u=()=>{},onFailure:d=()=>{}}=r||{},{isInOverlay:f=!1}=i||{},[h,p]=x.useState(!1),[v,m]=x.useState(t.body||""),[b,g]=x.useState(!1),[y,C]=x.useState("");x.useEffect(()=>{Wi(t,td)||Kr(t.body)&&t.body!==v&&t.body!==void 0&&m(t.body)},[t.body]);const k=()=>{!o||!o.id?g(s.formatMessage({id:`${et}error_loggedOut`})):b&&g(!1)},E=z=>({condition:M=>{const A=M[z];return!A||typeof A!="string"?!0:A.length<nd},error:s.formatMessage({id:`${et}error_underMinLength`},{length:nd})}),_=!!v&&Kr(v),T=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:s.formatMessage({id:`${et}disclaimer`})})]}),L=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:s.formatMessage({id:`${et}title_label`}),placeholder:s.formatMessage({id:`${et}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:k},validation:[{condition:"required"},E("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:s.formatMessage({id:`${et}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:s.formatMessage({id:`${et}subtitle_placeholder`}),functions:{onChange:k},validation:[{condition:"required"},E("subtitle")]},{component:aa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}body_label`})},showLabel:!0}},{component:cu,props:{id:`${e}-input`,value:v,placeholder:s.formatMessage({id:`${et}body_placeholder`}),meta:{isInOverlay:f},autoFocus:!1,functions:{onChange:z=>{m(z),k()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:s.formatMessage({id:`${et}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(sh).map(z=>({id:z,label:s.formatMessage({id:`${et}_tags_${z}`})})),multipleOptions:{limit:3},validation:[{condition:"required",error:s.formatMessage({id:`${et}tags_error_required`})},{condition:z=>{var M;return((M=z==null?void 0:z.tags)==null?void 0:M.length)>3},error:s.formatMessage({id:`${et}tags_error_over_three`})}]},{component:aa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}cover_image_label`})},showLabel:!0}},{component:D_,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return h?L.push({component:zt}):L.push({component:T}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Xt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async z=>{if(!o||!o.id||!_)return;ys&&clearTimeout(ys),p(!0);const M={...z,body:v,coverImage:t.coverImage};try{l&&await l(M),ys=setTimeout(()=>{C(s.formatMessage({id:`${et}aria_success`})),u(M)},500)}catch{g(s.formatMessage({id:`${et}error`})),C(""),d()}},onFailure:d},fields:L,intlPath:et,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!o||!o.id||!_||!((P=t==null?void 0:t.coverImage)!=null&&P.url),text:{default:s.formatMessage({id:`${et}cta_submit`}),submitting:s.formatMessage({id:`${et}cta_submitting`}),submitted:s.formatMessage({id:`${et}cta_submitted`})},customOnSubmit:b?c.jsx(c.Fragment,{}):c.jsx(C_,{})},gtm:a}),b&&c.jsx(ur,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:s.formatMessage({id:`${et}error`})}),y&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:y})]})};const oh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ie.useIntl(),u=x.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&d(f)}}),c.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},rd=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},__=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},k_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=__(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},F_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,f=(p,v)=>{p.current&&s.validFields[v]!==p.current.validity.valid&&o([{type:`validFields.${v}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(a.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{rd({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Ff,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const v=[];["name","email"].forEach(m=>{s.validFields[m]!==a[m].current.validity.valid&&(v.push({type:`validFields.${m}`,value:a[m].current.validity.valid}),m==="email"&&rd({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const A_=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const B_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},T_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ie.useIntl(),{title:u=!0,expectation:d=!1,url:f=!0,logInButton:h=!0,successMessage:p=!0}=i,v={title:u,expectation:d,url:f,logInButton:h,successMessage:p},[m,b]=x.useReducer(pr,B_),{validFields:g,emailDetails:y,shouldManuallyApprove:C,shouldDisableButton:k,showSuccessMessage:E,showError:_}=m,[T,L]=co.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{C===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[C]),x.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),x.useEffect(()=>{E&&T["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=x.useMemo(()=>F_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:P,state:m,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,v,m]),M=k?!0:C?!Object.values(g).every(A=>A===!0):!g.name||!g.email||["exists","pending","verify"].includes(y.boxType);return v.successMessage&&E?c.jsx(A_,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(Qt,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Xt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await k_({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:m})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const kn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const S_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(kn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(vr,{buttons:r})]})})};const lo="editSection_";function uh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const j_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${lo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(Ae,{href:r,variant:"secondary",size:"small",onClick:()=>uh({href:r,setShowModal:a}),children:n||s({id:`${lo}placeholder_cta`})})})]})},P_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ie.useIntl(),[f,h]=x.useState(!1),p=()=>h(!1),v=!!n||!!r,m=typeof i=="string"||v;let b;return r&&(b=x.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:K("edit-section",t),children:[v&&c.jsx(ln,{title:o||`Edit ${a}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:p},className:K("edit-section-modal"),children:b||(n?c.jsx(Xt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async g=>{var y,C;(y=n==null?void 0:n.functions)!=null&&y.onSuccess&&await((C=n==null?void 0:n.functions)==null?void 0:C.onSuccess(g)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),m&&c.jsx(Ae,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>uh({href:i,setShowModal:h}),children:d({id:`${lo}edit`})})]}),e||c.jsx(j_,{...l,href:i,setShowModal:h,showEditButton:m}),u&&c.jsx(zt,{})]})};const O_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:K("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&x.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:f,link:h=!1,description:p=!1},v)=>{if(!d||!d.url)return null;const m=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:f});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:h?c.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${v}`))})})]})};let xs;const ws="contactFooter_",M_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,i]=x.useState(0),[a,s]=x.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(xs),xs=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(xs),window.removeEventListener("resize",l)}),[]),c.jsx(kn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${ws}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${ws}text`})}),c.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${ws}email`})})]}),c.jsx(rh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},N_=({activeLink:e,profile:t,...n})=>c.jsx(kn,{children:c.jsx(_f,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Ef,{activeLink:e,profile:t}),c.jsx(qd,{...n})]})})});const Cs="cookieBanner_",Ds=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Es=new Date(Date.now()+12*30*24*60*60*1e3),lh=()=>{const e=ie.useIntl(),[t,n,r]=co.useCookies(Ds),[i,a]=x.useState(!t["apol-cookie-banner"]),s=()=>{Ds.forEach(d=>{n(d,!0,{path:"/",expires:Es,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Es}),Ds.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Es});return}r(d)}),a(!1)};if(!i)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${Cs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${Cs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Cs}text`})}),c.jsx(vr,{buttons:u})]})},nn={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Qn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Qn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Qn.support,gtmType:"concierge-email-click"},business:{email:Qn.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const rr="footer_",oa="SiteFooter",id=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(x.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":a,...s,children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(x.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},du=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(da,{element:"hr"}),c.jsx(Mo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(id,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(id,{group:nn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(nn.social.order)&&nn.social.order.map(e=>{const t=nn.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ue.handlerCalled[e]&&a-Ue.handlerCalled[e]<500)return;Ue.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=cd(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Ue.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Et.SITE:if(n){const u=Ue.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ue.findFirstChild(u.children,"id",Et.SITE);s=Ue.findFirstChild(d.children,"href")}else s=Ue.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=Ue.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ue.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ue.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ue.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ue.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ue.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ri={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ua=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ie.useIntl(),o=cd(ri,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=a===null?l?o.doTrack:!0:a,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const k=C.split("."),E=k[k.length-2];C=`${E==="topics"?`${E}-`:""}${k[k.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],v=p&&o[o.order[0]].order,m=h&&window.location.pathname===o.href;let b={},g={},y={};if(m&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,k={onClick:E=>Ue.events.onClick(E,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ue.events.onFocus({id:C}),onBlur:()=>Ue.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ue.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ue.events.onMouseEnter({id:C,callback:i})};g={...k,id:C===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(v&&(y={...k,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ue.events.onClick(E,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),g={...g,hidden:C in r?!r[C]:!0}),v||(g={...g})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":p,parent:v,active:m}),...b,children:[h?x.createElement(d?Ae:"a",h,s.formatMessage({id:f})):n&&o.order&&v?c.jsxs("button",{...y,children:[s.formatMessage({id:f}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:f}),o.order&&c.jsx("ul",{...g,children:o.order.map(C=>{if(!o[C])return null;const k={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[C].order?c.jsxs("li",{className:K({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${f}_${C}`}),c.jsx("ul",{children:o[C].order.map(E=>c.jsx(ua,{id:`${e}.${C}.${E}`,...k},E))})]},C):c.jsx(ua,{id:`${e}.${C}`,...k},C)})})]},e)};const I_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const fu=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=x.useContext(it),r=wn(!0,!0),i=n&&typeof n.id=="string",a=x.useMemo(()=>Ue.getIsDesktopVersion(i,r),[i,r]),[s,o]=x.useReducer(pr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,f=x.useRef(s);x.useEffect(()=>{f.current=s},[s]),gd({scrollPosition:I_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=f.current.menus;!a&&g["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=f.current.menus;!a&&g["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,y,C=!1)=>{Ue.handleMenus({id:g,value:y,menus:f.current.menus,dispatch:o,forceHandle:C})},p=x.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(y=>{f.current.menus[y]&&h(y,!1,!0)})};x.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",v)}},[]),or(()=>{u["site-navigation"]&&Ue.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&Ue.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const m=c.jsxs(c.Fragment,{children:[!a.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(oh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!a.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:a.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!a.navigation&&u["account-navigation"]?"account":"default",children:ri.order.map(g=>c.jsx(ua,{id:g,isLoggedIn:i,isDesktopVersion:a.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":i,"logged-out":!i,visible:l}),children:[c.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Mo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,m]}):c.jsxs(c.Fragment,{children:[m,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>Ue.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ue.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>Ue.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ri.buttons.order.map(g=>c.jsx(ua,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const R_=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(fu,{}),c.jsx("div",{id:"content",children:c.jsx(Qt,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(du,{})]})},ch=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const l=ie.useIntl(),{navigation:u=!0,footer:d=!0}=i,{background:f="default",variant:h="default",circle:p="default",modal:v="default"}=a,m=hd(),[b,g]=x.useState(""),y=T=>{const{detail:{message:L}}=T;g(L)};x.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",y),()=>{document.removeEventListener("ariaLive",y)}),[m]);const C=Oi(e,{locale:o}),k=Oi(t,{locale:o}),E=Oi(n,{locale:o}),_={};return f!=="default"&&(_[f]=!0),h!=="default"&&(_[h]=!0),p!=="default"&&(_[p]=!0),c.jsx(jh.ErrorBoundary,{onError:r,fallback:c.jsx(R_,{}),children:c.jsxs(x.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,_,{"has-footer":d}),"data-too-small":l.formatMessage({id:"pageLayout_browserTooSmall"}),children:[c.jsx(fu,{showNavigation:u}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":v==="large"}),children:k}),x.createElement(f==="bold"?wo:"div",{id:"content",children:C,className:K({"large-modal":v==="large"})})]}),E&&c.jsx("div",{className:"additional-content appended",children:E}),d&&c.jsx(du,{}),c.jsx(lh,{})]}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},ad={default:"tags_",headerTopics:"header_topics_topics_"},_s={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},$_={getTagDetails:e=>{if(e.includes("topic_")){if(e=_s.topic[e.replace("topic_","")],e){const t=ri.topics.topics[e].href;return t?{id:e,href:t,text:`${ad.headerTopics}${e}`}:null}return null}return _s[e]?(e=_s[e],{id:e,text:`${ad.default}${e}`}):null}};const L_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=$_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:K("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:d}):d},u.id)})})};const dh=25,z_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:f=""})=>{const h=ie.useIntl(),p="membersList",v=x.useContext(it),[m,b]=x.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",f),children:[u?c.jsxs("h1",{children:[h.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),c.jsx(Dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:h.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,y)=>v&&g.id===v.id?c.jsx(c.Fragment,{}):c.jsxs("li",{children:[c.jsx(an,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},y)),d&&e.length===0&&t>0?[...new Array(Math.min(t,dh))].map((g,y)=>c.jsx("li",{children:c.jsx(pa,{layout:"member"})},y)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(ka,{form:s,showModal:m,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},fh=z_,q_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ie.useIntl();return t?c.jsx("small",{children:Rt(i.formatMessage,`${e}explainer`,n,"action",{a:a=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):c.jsx(c.Fragment,{})},U_=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(aa,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},sd=5,od=2,W_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Gn=null;const Qe="discussion_form_",oi=({id:e,parentId:t,content:n={type:Be.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:f="DiscussionForm"})=>{var Y,se,be;const h=ie.useIntl(),p=x.useContext(it),[v,m]=x.useState(n.type),[b,g]=x.useState(""),{isLoading:y=!1,isInWrapper:C=!1,isInOverlay:k=!1,isAutoFocused:E=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:L=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:M=!0,showDivider:A=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:I=[]}=i||{},{onChange:H=()=>{},create:V=()=>{},createPoll:ae=()=>Promise,handleSaveEdit:X=()=>{},handleCancel:D=()=>{},callback:Q=()=>{},onMention:q=()=>{},listMembers:B=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:N=()=>Promise.resolve({}),props:O={create:{projectNames:["questions-answers"]}}}=u,[U,ee]=x.useState({body:_&&_.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[W,ne]=x.useState(l.error||!1),de={status:!1,title:T&&T.text||"",polls:0},[J,ve]=x.useState(de);x.useEffect(()=>{L&&!_&&P&&P!==U.body&&ee(oe=>({...oe,body:P.text||""}))},[P]),x.useEffect(()=>{m(n.type)},[n.type]);const me=Wr((oe,ce)=>{ee(ke=>({...ke,body:oe,data:{link:ce}})),H({body:oe});let pe;!p||!p.id?pe=Rt(h.formatMessage,`${Qe}error_loggedOut`,v,"action"):r?s>0&&oe.length>=s&&(pe=`${Qe}error_tooLong`):pe=Rt(h.formatMessage,`${Qe}error_noPermission`,v,"action"),pe?ne(pe):W&&ne(!1)},50);let ye=`${v}-form`;if(v===Be.Response||v===Be.Reply){const oe=((Y=n.slugs)==null?void 0:Y.reply)||((se=n.slugs)==null?void 0:se.answer)||((be=n.slugs)==null?void 0:be.question)||"";oe&&(ye=`${ye}-${oe.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const Ee=async oe=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ve(pe=>({...pe,status:"submitting"}));const ce=window.location.pathname;try{let pe;switch(v){case Be.Post:pe=await V({title:oe.title,content:oe.body,categories:oe.postType,data:oe.data});break;case Be.Poll:pe=await ae(W_(oe));break;case Be.Question:pe=await V({title:oe.body,authorId:p&&p.id,data:oe.data,...O==null?void 0:O.create});break;case Be.Response:pe=await V({questionSlug:n.slugs.question},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;case Be.Reply:pe=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;default:break}return await Zh(1e3),Q&&await Q(pe),Gn=setTimeout(()=>{ee({body:"",data:{}}),m(Be.Post),ve(qe=>({...qe,status:"submitted"})),g(Rt(h.formatMessage,`${Qe}success`,v,"action"));const ke=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ke),Ce()},850),pe}catch(pe){const ke=pe;let qe=`${Qe}error`;ke!=null&&ke.message.includes("entry already exists")&&(qe=Rt(h.formatMessage,`${Qe}error_alreadyExists`,v,"action")),ke!=null&&ke.message.includes("429")?qe=Rt(h.formatMessage,`${Qe}error_tooMany`,v,"action"):ke!=null&&ke.message.includes("400")&&(qe=`${Qe}error`),ne(qe),Ce()}},Ce=()=>{Gn=setTimeout(()=>{ne(!1),ve(de),g("")},5e3)},ze=Wr(async oe=>{const ce={...U,...oe};if(_){ve(pe=>({...pe,status:"submitting"})),X(ce);return}try{if(!await Ee(ce))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(y)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const We=!U.body||!Kr(U.body),He=!J.title||!Kr(J.title);let Ke=!1;v!==Be.Poll&&(Ke=We),T&&(Ke=Ke&&He);const Te=J.status==="submitting",Oe=[];v===Be.Poll?Oe.push({id:"poll-options",label:h.formatMessage({id:`${Qe}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:h.formatMessage({id:`${Qe}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:od,maxInputs:sd,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:oe=>{var pe;let ce=0;oe&&Array.isArray(oe)&&(ce=((pe=oe==null?void 0:oe.filter(ke=>ke!==""))==null?void 0:pe.length)||0),J.polls!==ce&&ve(ke=>({...ke,polls:ce})),H({polls:oe})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Oe.push({component:U_,props:{formID:ye,intlPath:Qe,showLabel:T!==!1,type:v}},{component:cu,props:{id:`${ye}-input`,value:J.status==="submitting"&&!W?"":U.body,placeholder:a||Rt(h.formatMessage,`${Qe}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:me,onChangeData:oe=>{ee(ce=>({...ce,data:oe}))},onMention:q,listMembers:B,clickMentionFallback:j,getLinkPreview:N},data:d,autoFocus:_!==!1||E&&!T,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:q_,props:{intlPath:Qe,showGuidelines:M,type:v,gtmContext:f}}),A&&Oe.push({component:zt}),T&&Oe.unshift({id:"title",type:"textarea",value:T.text,limit:250,label:h.formatMessage({id:`${Qe}${v===Be.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:h.formatMessage({id:`${Qe}${v===Be.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:oe=>{ve(ce=>({...ce,title:oe})),H({title:oe})}},validation:v===Be.Poll?[{condition:"required"}]:[]}),S&&Oe.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Qe}postType_label`}),options:I.map(oe=>({id:oe.slug,label:oe.name})),validation:[{condition:"required"}],functions:{onChange:oe=>{H({postType:oe}),oe.includes(Be.Poll)?m(Be.Poll):v!==Be.Post&&m(Be.Post)}}});let we=!p||!p.id||!r||Te;if(v===Be.Poll){const oe=J.polls;we=we||He||oe<od||oe>sd}else we=we||Ke,_&&(T?we=we||U.body===_.text&&J.title===T.text:we=we||U.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Xt,{id:ye,className:K("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Te||l.cancel},functions:{onSuccess:async oe=>{await ze(oe)},onCancel:D},fields:Oe,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":f,"data-gtm-event-type":`${_?"save":"submit"}-${v}-click`,"data-testid":"save-button",disabled:we,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Qe}${_?"save":"post"}`}),submitting:h.formatMessage({id:`${Qe}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":f,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!U.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Qe}cancel`})},gtm:{context:f,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===Be.Question&&c.jsx("h2",{children:Rt(h.formatMessage,`${Qe}title`,v,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:f,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]}})]}),J.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(h.formatMessage,`${Qe}success`,v,"action")}),W&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof W=="string"?W.includes(" ")?W:h.formatMessage({id:W},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):W}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})},V_=Object.freeze(Object.defineProperty({__proto__:null,default:oi},Symbol.toStringTag,{value:"Module"}));const H_={showForm:!1},_a=x.createContext(H_),mh=({children:e})=>{const[t,n]=x.useState({showForm:!1});return c.jsx(_a.Provider,{value:{...t,updateConversation:n},children:e})};function K_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var f;const o="discussion_",l=ie.useIntl(),u=(f=i==null?void 0:i.componentProps)==null?void 0:f.member.additionalContent,d=u?u.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:K({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Me,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const ks=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function Z_({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?c.jsx(c.Fragment,{}):c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?c.jsx(c.Fragment,{}):c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))})}var la=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(la||{});const Y_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,G_=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const Q_=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=x.useState(t.hasUserVoted);let f=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(f=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${f}%`});const v=g=>{g.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},m={htmlFor:t.id,className:K({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var y;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const C=g.code==="ArrowUp"?"prev":"next",{nextElement:k,nextIndex:E}=G_(g.currentTarget.parentElement,"selected",C,n);k&&((y=k.querySelector("label"))==null||y.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...m,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(un,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[f,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const hh=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ie.useIntl(),s=x.useContext(it),{showRemoveVote:o=!1,allowMultipleVotes:l=!1,resultsVisibility:u=la.AfterVoting}=n||{},[d,f]=x.useState(Y_(t,l,s==null?void 0:s.id)),h=t.reduce((g,y)=>g+y.numVotes,0),p=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),m=x.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=x.useCallback(async()=>{t.forEach(async g=>{g.hasUserVoted&&g.userVote&&r.removeVote({reactionId:g.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:h})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ae,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:p===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((g,y)=>c.jsx(Q_,{isTabbable:d===y,user:s,option:g,optionIndex:y,totalPollVotes:h,showResults:u==la.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:m,setTabbableOption:f}},g.id))})})}),c.jsxs(Me,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&c.jsx("ul",{children:v.map(g=>c.jsx("li",{children:g.label}))})]})]})};function J_({content:e,contentData:t,functions:n}){return c.jsx(hh,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function X_({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx(jd,{text:t.postBody,markdownOptions:{overrides:{a:Ms,blockquote:{component:ks}}}}):c.jsx(On,{options:{overrides:{a:Ms,blockquote:{component:ks}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(On,{options:{wrapper:r.type===Be.Question?"h1":x.Fragment,forceWrapper:r.type===Be.Question,forceInline:r.type===Be.Question,forceBlock:r.type!==Be.Question,overrides:{blockquote:{component:ks}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(Oo,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const It="discussion_",ek=195;let Ti=null;const ui=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:f,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:m,basePath:b,parentId:g,locale:y="en"})=>{var Oe,we,Y,se,be,oe;const C=ie.useIntl(),k=x.useContext(_a),E=x.useContext(it),{createContent:_=async()=>{},deleteContent:T=async()=>{},updateContent:L=async()=>{}}=o.content||{},{createLike:P=()=>{},deleteLike:z=()=>{},listLikes:M=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:I=()=>{},removeVote:H=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ae,createdAt:X,id:D,likes:Q=0,userLiked:q,comments:B=0,data:j}=t,N=uv(t.title,y),O=E&&E.id&&typeof ae!="string"&&ae.id&&ae.id===E.id||!1,U=O&&(!t.createdAt||Hh(t.createdAt,10,"seconds")),ee=x.useRef(null),[W,ne]=x.useState({title:t.body!==N&&N||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[de,J]=x.useState(!1),[ve,me]=x.useState(U?"highlighted":"default"),[ye,Ee]=x.useState("");x.useEffect(()=>{const ce=ee.current;if(!(!ce||ve==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ce.addEventListener("transitionend",ze),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ce.removeEventListener("transitionend",ze)}},[]),x.useEffect(()=>{ne(ce=>({...ce,title:t&&N||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),x.useEffect(()=>{(async()=>{const pe=await jo(W.body,h,j==null?void 0:j.mentions,F);ne(ke=>({...ke,postBody:pe}))})()},[W.body,j==null?void 0:j.mentions]);const Ce=()=>{setTimeout(()=>{me("fading")},1e3)},ze=({propertyName:ce})=>{ce==="background-color"&&me(pe=>(pe==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ee.current&&ee.current.removeEventListener("transitionend",ze)),pe==="fading"?"default":pe))};if(i||!t||t.type===Be.Answer&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const We=async({title:ce,body:pe,data:ke})=>{ce||(ce=""),pe||(pe=""),Ee("");try{if(!Wi(ce,W.title)||!Wi(pe,W.body)){const qe=t.type===Be.Question?{title:pe}:{title:ce,body:pe,data:ke};await L(Ls(t.slugs),qe)}ne(qe=>({...qe,title:ce||"",body:pe||"",data:{...qe.data,...ke},isEditing:!1,didEdit:!0}))}catch{Ee(`${It}form_error`)}},He=()=>{if(k&&k.updateConversation){const ce={showForm:!0},pe=t.author;pe&&pe.id&&(v&&(ce.prepopulateForm=`@{{${pe.id}}}`),ce.mentionData={id:pe.id,name:pe.name}),k.updateConversation(ce)}setTimeout(()=>{var At,pt,tt;const pe=`reply-form-${(t.type===Be.Answer?t.slug:((At=t.slugs)==null?void 0:At.reply)||((pt=t.slugs)==null?void 0:pt.answer)||((tt=t.slugs)==null?void 0:tt.question)||"").toLowerCase().slice(-15)}`,ke=document.getElementById(pe),qe=document.getElementById(`${pe}-input`);qe&&qe.focus(),ke&&ke.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{J(!1);try{t.type===Be.Poll?(await V(),window.location.href=`${b}/${g}`):await T(Ls(t.slugs))}catch{Ee("delete-error")}},Te=[];return n&&O&&(t.type!==Be.Poll&&Te.push({text:C.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>ne(ce=>({...ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),Te.push({text:C.formatMessage({id:`${It}moreMenu_delete`}),onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...sf(`delete-${t.slug}-modal`,de)})),r&&o.pins&&Te.push({text:C.formatMessage({id:`${It}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),p&&((Oe=ee==null?void 0:ee.current)==null||Oe.focus(),(we=ee==null?void 0:ee.current)==null||we.scrollIntoView({behavior:"smooth"})),x.createElement(e,{className:K("discussion-post",u,{[ve]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!W.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:ee,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ce=>{if(!l.post||W.isEditing||t.type===Be.Poll&&ov(ce,["poll-options","poll-info"],"discussion-post"))return;ce.preventDefault(),ce.stopPropagation(),Ti&&clearTimeout(Ti),Ti=setTimeout(()=>{window.location.href=l.post},150);const pe=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ti}});document.dispatchEvent(pe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:D||t.slug,className:K("discussion-card text-medium",t.type,{editing:W.isEditing,"has-link":l.post&&!W.isEditing}),children:[!W.isEditing&&c.jsx(K_,{author:ae,originalAuthorId:a,createdAt:X,contentData:{didEdit:W.didEdit},content:t,gtmContext:d,badges:m}),W.isEditing?c.jsx(oi,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Be.Question?250:5e4,forceShow:{error:ye!==""&&ye!=="delete-error"?C.formatMessage({id:ye},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:We,handleCancel:()=>{Ee(""),ne(ce=>({...ce,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:j}):c.jsxs(c.Fragment,{children:[t.type===Be.Poll?c.jsx(J_,{content:t,contentData:W,functions:{createVote:I,removeVote:H}}):c.jsx(X_,{links:l,contentData:W,postCutOff:ek,content:t}),c.jsx(Z_,{content:t})]}),!W.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(wf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Q||0,userLiked:q||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:P,deleteLike:z,listLikes:M},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Be.Question,Be.Post].includes(t.type)||l.comments)?{count:B||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:He}}:!1,shareLink:{url:`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(se=t.slugs)==null?void 0:se.answer}${(be=t.slugs)!=null&&be.reply?`#${(oe=t.slugs)==null?void 0:oe.reply}`:""}`},moreMenu:{options:Te,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),f,c.jsx(ln,{id:`delete-${t.slug}-modal`,isOpen:de,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:ye==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},title:C.formatMessage({id:`${It}delete_title`},{action:C.formatMessage({id:`${It}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:C.formatMessage({id:`${It}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ke,children:C.formatMessage({id:`${It}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:ce=>c.jsx("p",{children:ce}),action:C.formatMessage({id:`${It}action_${t.type}`})}})})]})})};const tk=x.lazy(()=>Promise.resolve().then(()=>pk)),nk=65,ph=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=x.useContext(it)||"community",l=ga(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const u=wn(!0,!1),d=u?u<768:0,{modal:f=!1}=e||{},[h,p]=x.useState({form:f||Fd("showPost")==="true"||!1,warning:!1}),[v,m]=x.useState({showCachedText:!1});x.useEffect(()=>{if(!v.showCachedText)return;(async()=>{const C=await jo(v.title||v.body||"",nk,v.mentions);m(k=>({...k,prettifiedText:C}))})()},[v.showCachedText,v.title,v.body]);const b=y=>{if(!v.showCachedText||typeof h.warning=="string")return;let C;if("detail"in y&&y.detail.link)y.detail.timeout&&clearTimeout(y.detail.timeout),C=y.detail.link;else{const k=y;k.preventDefault(),k.stopPropagation();const _=k.target.closest("a");C=_&&_.getAttribute("href")}p(k=>({...k,warning:C||!1}))};x.useEffect(()=>{if(!v.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,b),document.removeEventListener(rt.MEMBER_CLICKED,b),document.removeEventListener("click",b);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,b),document.addEventListener(rt.MEMBER_CLICKED,b),document.addEventListener("click",b),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,b),document.removeEventListener(rt.MEMBER_CLICKED,b),document.removeEventListener("click",b)}},[v.showCachedText]),x.useEffect(()=>{const y=C=>{if(!(!v.showCachedText||h.warning!==!1))return C.preventDefault(),C.returnValue=""};return window.addEventListener("beforeunload",y,{capture:!0}),()=>{window.removeEventListener("beforeunload",y,{capture:!0})}},[v.showCachedText,h.warning]);let g=r.formatMessage({id:`${i}placeholder${d?"":"_long"}`});return v.showCachedText&&(v.title||v.body)&&(g=v.prettifiedText||g),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:y=>{y.preventDefault(),y.stopPropagation(),p(C=>({...C,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:l.name,src:l.image,alt:""}),c.jsx(On,{className:K("input",{placeholder:!v.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:g})]}),c.jsxs(br,{children:[c.jsx(tk,{showModal:h.form,functions:{cacheText:m,onClose:()=>{p(y=>({...y,form:!1}))}},form:t,cachedText:v,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:h.warning!==!1,functions:{onClose:()=>{p(y=>({...y,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:y=>{y.preventDefault(),y.stopPropagation(),typeof h.warning=="string"&&(window.location.href=h.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{p({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},rk=x.lazy(()=>Promise.resolve().then(()=>V_)),mu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=_o})=>{if(a&&!i)return c.jsx(Qt,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Eo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:f,meta:h,...p}=t,v={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...f,create:(f==null?void 0:f.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(ph,{form:v}):c.jsx(rk,{...v})},hu=({form:e})=>{const t=x.useContext(it),n=ie.useIntl(),[r,i]=x.useState(!1),a=()=>{tp(t)||i(!0)};x.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(ka,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Fs="discussion_responses_",gh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Fs}title`},{action:r.formatMessage({id:`${Fs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Fs}empty`,e,e)})]})};const vh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ie.useIntl(),s=x.useContext(_a),o=Oi(i,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(ii,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(oi,{...r})]})};function ik(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function ak({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(uf({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&lf({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function sk({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function ok({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Qi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Qi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function uk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ji({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ji({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function lk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Re.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function ck({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(cf({activity:s,reactionId:a}),s)),onError:n});return i}function dk({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=Re.useQueryClient(),d=ha(),f={queryClient:u,queryKey:l},h={mutationHandlers:{error:ko(f),mutate:Fo(f)},user:d,...f},p=sk({...h,mutationFn:t}),v=ok({...h,mutationFn:n}),m=fk({...h,mutationFn:r}),b=uk({...h,mutationFn:i}),g=mk({...h,mutationFn:a}),y=ak({...h,mutationFn:s}),C=ck({...h,mutationFn:o}),{activity:k,...E}=lk({queryKey:l,queryFn:e});return{activity:k,mutations:{edit:p,like:v,unlike:m,pin:b,unpin:g,createVote:y,removeVote:C},user:d,...E}}function fk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&df({activity:s,user:r}),s)),onError:n});return i}function mk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&ff({activity:s,user:r}),s))),onError:n});return i}const hk=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:f,polls:h},profile:p,categories:v,locale:m=_o})=>{var q,B,j,N,O,U,ee,W,ne,de,J,ve;const b=ie.useIntl(),g={...s,...h},{activity:y,error:C,isLoading:k,mutations:{edit:E,like:_,unlike:T,pin:L,unpin:P,createVote:z,removeVote:M}}=dk({queryFns:g,queryKey:[e,t,n]});if(k)return c.jsx(Nt,{style:{height:"400px"}});if(C||!y)return c.jsx(Qt,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:A,verb:F,latest_reactions:S,mentioned_users:I,additional_data:H}=y,V=(((q=S==null?void 0:S.like)==null?void 0:q.length)||0)>0,ae=(((B=A==null?void 0:A.like)==null?void 0:B.length)||0)>0,X=ae?A==null?void 0:A.like[0].id:"",D=V?(j=S==null?void 0:S.like)==null?void 0:j.map(me=>{var ye,Ee,Ce;return{id:(ye=me==null?void 0:me.user)==null?void 0:ye.id,name:(Ce=(Ee=me==null?void 0:me.user)==null?void 0:Ee.data)==null?void 0:Ce.name}}):!1,Q=y==null?void 0:y.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ui,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:y==null?void 0:y.title,body:y==null?void 0:y.content,categories:Po((y==null?void 0:y.categories)||[],v||[]),createdAt:(y==null?void 0:y.time)||"",slugs:{question:`${e}/${t}`,answer:y==null?void 0:y.id},slug:n,author:xr(Q),userLiked:ae,likes:((N=y==null?void 0:y.reaction_counts)==null?void 0:N.like)||0,comments:(y==null?void 0:y.total_replies)||0,peopleWhoLiked:D,data:{mentions:I,...H||{}},pinned:((O=y==null?void 0:y.reaction_counts)==null?void 0:O.pin)&&((U=y==null?void 0:y.reaction_counts)==null?void 0:U.pin)>0||!1,pollOptions:of(y,m),pollSettings:{showRemoveVote:(ee=y==null?void 0:y.settings)==null?void 0:ee.show_remove_vote,allowMultipleVotes:(W=y==null?void 0:y.settings)==null?void 0:W.allow_multiple_votes,deadlineAt:(ne=y==null?void 0:y.settings)==null?void 0:ne.deadline_at,hideParticipants:(de=y==null?void 0:y.settings)==null?void 0:de.hide_participants,numberOfWinners:(J=y==null?void 0:y.settings)==null?void 0:J.number_of_winners,resultsVisibility:(ve=y==null?void 0:y.settings)==null?void 0:ve.results_visibility}},originalAuthorId:Q==null?void 0:Q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(me,{title:ye,body:Ee})=>E({title:ye,content:Ee})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:X}),listLikes:me=>o.list({activityId:n,...me})},comments:{openComments:()=>{}},pins:{createPin:()=>L({activityId:n}),deletePin:()=>{var me;return P({activityId:n,reactionId:(me=S==null?void 0:S.pin)==null?void 0:me[0].id})}},polls:{createVote:({reactionId:me})=>z({reactionId:me}),removeVote:({reactionId:me})=>M({reactionId:me}),removePoll:()=>h.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(vf,{basePath:e,parentId:t,activityId:n,showReplies:F===Be.Poll?ik(y):!0,activityTotalReplies:(y==null?void 0:y.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:f},profile:p})]})};const bh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:f}=n,{title:h="",body:p="",mentions:v}=r||{},m="discussion-form-modal";return c.jsx(ln,{id:m,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",i),children:c.jsx(oi,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${m}-overlay`,hasTitleField:{text:h},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...f,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const y=v||{};y[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(C=>({...C,mentions:y}))},create:async b=>{o(),f.create&&await f.create(b),l({showCachedText:!1})},createPoll:async b=>{const g=()=>{o(),l({showCachedText:!1})};if(f.createPoll)try{const y=await f.createPoll(b);return new Promise(C=>(g(),C(y)))}catch{return new Promise((C,k)=>k())}else return g(),new Promise(y=>y({}))},handleSaveEdit:async b=>{o(),f.handleSaveEdit&&await f.handleSaveEdit(b),l({showCachedText:!1})}}})})},pk=Object.freeze(Object.defineProperty({__proto__:null,default:bh},Symbol.toStringTag,{value:"Module"}));const gk=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const f=ie.useIntl();return i||(i=f.formatMessage({id:"inviteModal_formTitle"})),a||(a=f.formatMessage({id:"inviteModal_formLabel"})),s||(s=f.formatMessage({id:"inviteModal_cta"})),c.jsx(ln,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:K("invite-modal",e,{success:!!n}),children:c.jsx(ih,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const vk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ie.useIntl(),[l,u]=x.useState(Fd("showProfile")==="true"||e);x.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:K("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ah,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async f=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(f)}finally{d()}}}})]})})},ka=vk,bk=Object.freeze(Object.defineProperty({__proto__:null,default:ka},Symbol.toStringTag,{value:"Module"}));const yk=({members:e})=>{const[t,n]=x.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:a,src:l}),c.jsx("p",{children:a}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(ln,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(On,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const xk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:K("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(an,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),wk=x.memo(xk);const Ck=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[i,a]=x.useState(e);return x.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&c.jsxs(_t,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Fa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const f=d/60,h=Math.floor(f),p=(f-h)*60,v=Math.round(p),m=`${a.formatMessage({id:`${s}hours`},{time:h})}${h>0&&v>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${h>0?`${a.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${v>0?a.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:f}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:K("time-to-complete",i),"aria-label":u,children:l})};const Dk=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(Cn,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const Ek=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],_k=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,m;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},h={};d.forEach(b=>{if(!t[b]){h[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){h[b]=t[b];const{text:g,element:y}=t[b];if(y&&Ek.includes(y.toLowerCase()))return;h[b]={text:g,element:f[b]};return}h[b]={text:t[b],element:f[b]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(kn,{className:K("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&h.eyebrow&&h.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(h[b]&&typeof h[b]=="object"){const{text:g,element:y=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:g},b):x.createElement(y,{key:b,className:b},g)}return null}),l,p&&c.jsx(Ae,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&c.jsx(Cn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},kk=x.memo(_k);const Fk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(kn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const Ak=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(kn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Cn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Bk=x.memo(Ak);const Tk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ae,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Sk=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const f=i&&js(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ho(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&js(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},jk={title:66,text:3e3,secondaryText:1e3,partner:34},ca={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Pk=({data:e,cta:t,link:n,gtmContext:r})=>{var m,b;const i=ie.useIntl(),[a,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:f}=e,h=e.contentType;let p="";if((m=ca[h])!=null&&m.gtmEvent&&(p=ca[h].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(Ae,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(h)&&d!=="premium"){const g=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),y=async C=>{if(C.preventDefault(),C.stopPropagation(),!(g||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ae,{onClick:y,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${f}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${h}${g?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Ok({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=x.useContext(it),[i,a]=x.useState({count:"...",isMember:!1,memberType:""});return x.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),a({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const pu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,S;const u=ie.useIntl(),d=x.useContext(it),f=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=x.useRef(null),[m,b]=x.useState({data:null,isLoading:!0});x.useEffect(()=>{n(i,f).then(I=>{b({data:I,isLoading:!1})}).catch(()=>b(I=>({...I,isLoading:!1})))},[i,f,n]);const{data:g,isLoading:y}=m;if(y||!g)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:C}=g;if(!C||!ca[C])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:k="",className:E,length:_,gtmEvent:T}=ca[C];let L=h&&g.slug?`${k}${g.slug}`:!1;h&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(L=g.slug);const P=I=>{L&&(I.preventDefault(),I.stopPropagation(),window.location.href=L)},z={...jk,..._};let M={className:"card"},A={};return L&&(A={href:L,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(A.target="_blank"),M={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(M={...M,tabIndex:"0"},(F=v==null?void 0:v.current)==null||F.focus(),(S=v==null?void 0:v.current)==null||S.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",E,t,{"has-link":L,"no-link":!L,"has-image":g.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...M,ref:v,children:[c.jsx(Bd,{className:"card-label",contentType:C,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),C==="communityPage"&&(g==null?void 0:g.createdAt)&&Kh(g==null?void 0:g.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):Ed(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Cn,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(un,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(xo,{contributors:{data:g.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(C)?u.formatMessage({id:`card_contributors_${C}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):sr(g.partner[0],z.partner)}),["title","text","secondaryText"].map(I=>{const H=g[I];if(!H)return null;const V=yd(I),ae={key:I,className:V,"data-testid":V},X={wrapper:"p",forceWrapper:!0,forceInline:!0},D=sr(H,z[I]);return["title","text"].includes(I)&&L?(X.wrapper="a",c.jsx("p",{...ae,children:c.jsx(Zt,{options:X,...A,children:D})})):c.jsx(Zt,{options:X,...ae,children:D})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(Ok,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(Sk,{type:E||"",data:g}),c.jsx(Pk,{data:g,cta:a,link:L||"",gtmContext:s})]})})};const yh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(pu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Mk=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},Nk=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return x.createElement(i,{className:K("title",a,s,{"highlighted-title":a==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const As={fourCards:1024,threeCards:769,twoCards:480};let Si=null,Bs=null;const Ik=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,f]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,m]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[y,C]=x.useState(""),k=t.length,E=Math.ceil(k/h),_=x.useRef(null),T=wn(!0,!0,_==null?void 0:_.current);x.useEffect(()=>{let F=1;T&&(T>=As.fourCards?F=4:T>=As.threeCards?F=3:T>=As.twoCards&&(F=2),F>k&&(F=k)),f(S=>({...S,cardsPerPage:F,isLoading:!1}))},[T,k]);const L=(F="next")=>{Bs&&clearTimeout(Bs);let S=b;if(typeof F=="string")if(F==="next")if(b<E-1)S=b+1;else return;else if(b>0)S=b-1;else return;else S=F;C(""),m(H=>({...H,currentPage:S,loadedPages:[...new Set([...g,S])]}));const I=()=>{const H=S*d.cardsPerPage,V=H+d.cardsPerPage;return t.slice(H,V).length};Bs=setTimeout(()=>{C(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:I()}))},500)},P=F=>{Si=F.touches[0].clientX},z=F=>{if(Si===null)return;const S=F.touches[0].clientX,I=Si-S;I>5?L("next"):I<-5&&L("previous"),Si=null},M={"--width":`${T||0}px`,"--total-cards":k,"--cards-per-page":h,"--page":b};if(p)return c.jsx(pa,{layout:`carousel${i?"-with-title":""}`});const A=(F,S)=>{var H;let I=null;return(H=F==null?void 0:F.sys)!=null&&H.id?I=`card-${F.sys.id}`:F!=null&&F.slug?I=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(I=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),I};return c.jsxs("section",{ref:_,className:K("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Nk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:M,"data-testid":"carousel-list",children:t.map((F,S)=>{let I=A(F,S);const{inView:H,isLoaded:V}=Mk(S,h,b,g);return I&&(H||V)?c.jsx(pu,{id:I,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:H},...o},I):(I=I||`${e}-card-${S}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},I))})}),E<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ae,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((F,S)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:S===b}),onClick:I=>{I.preventDefault(),I.stopPropagation(),L(S)},children:c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:S+1,total:E})})})},`page-indicator-${S}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ae,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:y})]})]})},Rk=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=a?window.btoa(a):`carousel-${u}`,f=u===e.length-1;return t?c.jsxs(x.Fragment,{children:[c.jsx(pa,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(x.Fragment,{children:[c.jsx(Ik,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),f?null:c.jsx(zt,{})]},`carousel-${d}`)});const $k=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:f=>{l&&(f.preventDefault(),f.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),x.createElement(e,{className:K("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!i}),children:i&&c.jsx(Cn,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Lk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return x.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":a==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>c.jsx("strong",{children:f}),number:u})}),u<100&&i&&c.jsx(Fa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(yo,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const xh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>x.createElement(e,{className:K("lesson-name",i),"data-number":`${t}.${n}`,children:r});const wh=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ie.useIntl(),o=fa(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):wd(i||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Fa,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const zk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const f=ie.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(ma,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[f.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?f.formatMessage({id:`${h}time_completed`}):c.jsx(Fa,{time:s,appendedText:i?f.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:m,contentType:b,icon:g,image:y,isIntroduction:C,optional:k,slug:E,subsectionId:_,title:T,type:L})=>{const P=i&&t||C,z={};return y&&(z.style={"--image":`url(${y})`}),c.jsx("li",{className:K({article:b===jr.ARTICLE,discussion:b===jr.DISCUSSION,quiz:b===jr.QUIZ,completed:v&&b===jr.ARTICLE,locked:!P}),...z,children:c.jsx(Dn,{href:P?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${xd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(xh,{sectionId:a,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(wh,{completionTime:m,icon:g,optional:k,type:L,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const qk=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ae,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Uk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),ud=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ji="notFoundError_",Wk=()=>{const e=ie.useIntl(),t=[];return ud.forEach((n,r)=>{n.title=e.formatMessage({id:`${ji}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(ch,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(kn,{children:[c.jsx(yh,{cards:ud,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(Ae,{href:"/solution-articles/",children:e.formatMessage({id:`${ji}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ji}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ji}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=wf;exports.ActionButton=Zr;exports.ActivitiesFeed=lv;exports.ActivitySection=hk;exports.ActivityType=yr;exports.AddPost=mu;exports.Badge=Ud;exports.BadgeScope=ut;exports.Badges=Wd;exports.BadgesContext=go;exports.BadgesProvider=Od;exports.Banner=Dk;exports.BannerSection=kk;exports.Breadcrumbs=Bv;exports.Buckets=lp;exports.Button=Ae;exports.ButtonWrapper=vr;exports.COURSE_CONTENT_TYPES=jr;exports.CacheProvider=Md;exports.Card=pu;exports.CardBlock=yh;exports.Carousel=Rk;exports.CharacterLimit=No;exports.Checkbox=Io;exports.CollapsibleSection=ma;exports.Columns=_f;exports.CommunityDetails=Bg;exports.ContactFooter=M_;exports.ContactForm=rh;exports.ContentTypeLabel=Bd;exports.Contributors=xo;exports.ConversationContext=_a;exports.CookieBanner=lh;exports.CourseProgression=Lk;exports.CourseStructure=zk;exports.CustomContentBanner=Fk;exports.CustomEvents=rt;exports.DELETED_USER_ID=Vr;exports.Directory=yk;exports.DiscussionContentType=Be;exports.DiscussionConversation=mh;exports.DiscussionForm=oi;exports.DiscussionFormCard=ph;exports.DiscussionFormModal=bh;exports.DiscussionPost=ui;exports.DiscussionThread=vh;exports.Divider=zt;exports.DownloadSection=S_;exports.EMAILS=Qn;exports.EditSection=P_;exports.EmailHelperTextBox=Ff;exports.EmptyStateBox=Qt;exports.EnrichedUrl=Oo;exports.FeatureFlags=Id;exports.Filters=Cf;exports.FlagsProvider=Nd;exports.Footer=du;exports.Form=Xt;exports.Formatting=Z;exports.Fragment=St;exports.FullWidthSection=kn;exports.GET_STREAM_USER_PREFIX=Ss;exports.GlobalProviders=xp;exports.Header=fu;exports.HelperTextBox=Sd;exports.HiddenFromScreenReaders=da;exports.HideShowTextBox=jd;exports.HighlightSection=Bk;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=Cd;exports.IconBulletedList=fp;exports.ImageContainer=ap;exports.IntlProvider=Rd;exports.InviteForm=ih;exports.InviteModal=gk;exports.JoinButton=Eo;exports.Label=aa;exports.LanguageContext=vo;exports.LanguageSwitcher=Sv;exports.LessonName=xh;exports.LessonType=wh;exports.LikesButton=pf;exports.LikesFeed=bf;exports.LikesModal=yf;exports.Link=Dn;exports.LoadMore=ii;exports.LoadingBlock=Vd;exports.LoadingPlaceholder=Nt;exports.LoadingState=pa;exports.Logo=Mo;exports.LogoSection=O_;exports.MEMBERS_PER_PAGE=dh;exports.MENTION_REGEX=Dd;exports.MarkCompleteButton=qk;exports.MarkdownText=On;exports.MarketingBlock=Tk;exports.Marks=Kt;exports.Member=an;exports.MembersList=fh;exports.Modal=wo;exports.MoreMenu=Df;exports.NUMBER_OF_COUNTRIES=Wh;exports.NUMBER_OF_USERS=Uh;exports.NarrowCard=$k;exports.NavigationMenu=Ef;exports.NotFoundError=Wk;exports.Overlay=ln;exports.OverlayContext=bo;exports.OverlayProvider=zd;exports.PageHeading=qd;exports.PageLayout=ch;exports.PasswordForm=w_;exports.PasswordRules=jf;exports.Pill=Yt;exports.Poll=hh;exports.Popover=Ad;exports.Portal=br;exports.ProfileForm=ah;exports.ProfileImageChange=nh;exports.ProfileModal=ka;exports.ProfileModalLauncher=hu;exports.ProfilePicture=un;exports.ProgressBar=yo;exports.ProgressTracker=op;exports.PublishArticleForm=E_;exports.Rating=Yv;exports.RepliesFeed=vf;exports.ResponsesHeading=gh;exports.ResponsiveImage=Cn;exports.ResultsVisibility=la;exports.ReturnToNavButton=up;exports.RichTextEditor=cu;exports.SearchForm=oh;exports.ShareLink=xf;exports.ShareLinks=Iv;exports.SignupForm=T_;exports.Span=Ms;exports.StatusBanner=ur;exports.TableOfContents=Ck;exports.Tabs=Rv;exports.Tags=L_;exports.TestimonialBlock=wk;exports.TimeToComplete=Fa;exports.Toggle=y_;exports.Tooltip=Ln;exports.TopLevelPage=N_;exports.UUID_V4_REGEX=Hr;exports.UserContext=it;exports.UserProvider=$d;exports.VisuallyHidden=Me;exports.addAriaProps=sf;exports.basicReducer=pr;exports.camelCaseToDashCase=yd;exports.checkIntlPathExists=fa;exports.enrichPostCategories=Po;exports.generateConditions=Ui;exports.generateCssIcon=Vh;exports.getAuthorData=xr;exports.getCharacterLimitProps=kf;exports.getLongDate=ho;exports.getMember=ga;exports.getPostBody=jo;exports.getShortDate=Ed;exports.getValueLength=va;exports.headerData=ri;exports.likesResponseMock=Fv;exports.mapGetStreamData=Uk;exports.pageReady=_d;exports.passwordValidator=Ps;exports.repliesFeedMock=cv;exports.supportedLanguages=Mi;exports.toCamelCase=xd;exports.toCapitalisedCase=qh;exports.toSentenceCase=wd;exports.transformSlugs=Ls;exports.useAutoResize=md;exports.useBadges=Pd;exports.useCurrentPath=hd;exports.useEffectAfterMount=or;exports.useElementWidth=wn;exports.useOverlay=Ld;exports.useScrollListener=gd;exports.useScrollToHash=fo;exports.useTooltips=mo;exports.useUser=ha;
165
+ `}),O=U.turndown(O)}o&&o.mentions&&(O=await kd({text:O,template:`[${to}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),pE(O,U=>{const ee=[{type:"initialValue",value:U},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(ee.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),T(ee),setTimeout(()=>{T([{type:"stringValue",value:Kc(q)}])},150)})})()},[P]),x.useEffect(()=>{if(H===void 0&&q){const O=bE(q);O&&ae(O)}const N=O=>{var W;const U=O,ee=((W=U==null?void 0:U.detail)==null?void 0:W.url)||null;ee&&H&&H.url===ee&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",N),()=>{window.removeEventListener("linkRemoved",N)}},[H]),x.useEffect(()=>{if(t){Hr.lastIndex=0;const N=t.match(Hr);N&&N.length===1&&N[0].length===t.length&&!S&&T([{type:"originalValue",value:t}])}t!==""||!q||Wi(P,t)&&!S||(w.withoutNormalizing(q,()=>{te.delete(q,{at:{anchor:w.start(q,[]),focus:w.end(q,[])}}),te.deselect(q),q.children.length!==0&&te.unwrapNodes(q,{at:[0]}),te.insertNodes(q,k,{at:[0]})}),T([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),x.useEffect(()=>{b({link:H})},[H]),x.useEffect(()=>{M===""&&H&&T([{type:"enrichedUrl",value:void 0}])},[M]);const j=Wr(()=>{xE({editor:q,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:X,className:"rich-text-editor input text-medium",children:c.jsxs(cn.Provider,{value:{..._,id:X,isInOverlay:h,dispatch:T,onMention:y,reportError:C},children:[c.jsxs(Iw,{editor:q,initialValue:z,onChange:N=>{if(q.operations.some(U=>U.type!=="set_selection")){let U=CE(N);U==="<br>"&&(U=""),m(U,H),T([{type:"stringValue",value:Kc(q)}]),S||T([{type:"hasInteracted",value:!0}]),j(),f&&console.log({serialized:U,json:N})}},...u,children:[c.jsx(Aw,{className:"editor",renderElement:D,renderLeaf:Q,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async N=>{const O=H!==!1,U=N.clipboardData.getData("text");if((W=>{try{return new URL(W),!0}catch{return!1}})(U)){let W=U;if(U){const{full:ne}=po(U);W=ne}if(U&&g&&!O){const ne=await g(W);ne.url&&T([{type:"enrichedUrl",value:ne}])}}},onKeyDown:N=>{if(N.key==="Enter"){V.show&&(N.preventDefault(),N.stopPropagation(),zm(q,V,T,X));const{selection:O}=q;if(O){const U=G.isCollapsed(O),[ee,W]=w.node(q,O,{depth:1});let ne=ee,de=ne.type;const J=ne.children[0];if(J&&(J==null?void 0:J[Z.h3])===!0&&(N.stopPropagation(),N.preventDefault(),te.insertNodes(q,k)),J&&[Z.ol,Z.ul].includes(J.type)&&(ne=J,de=J.type),ne&&he.isElement(ne)&&de!==Z.paragraph){if(de===Z.blockquote&&!N.shiftKey){N.stopPropagation(),N.preventDefault(),te.insertNodes(q,k);return}if(U){const[ve,me]=w.parent(q,O,{edge:"end"}),Ee=ve.type;if([Z.ul,Z.ol].includes(de))if(N.stopPropagation(),N.preventDefault(),Ee===Z.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&te.removeNodes(q,{at:me}),te.insertNodes(q,k,{at:$.next(W)}),te.select(q,w.end(q,$.next(W)));return}else{const[Ce,ze]=gE(q,Z.li),We={type:Z.li,children:[{text:""}]};te.insertNodes(q,We,{at:$.next(ze)}),te.select(q,w.end(q,$.next(ze)))}}}}}else if(N.key==="Escape"){if(V.show){N.preventDefault(),N.stopPropagation(),T([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(N.key)&&V.show){N.preventDefault(),N.stopPropagation();const{selectedUser:O,possibleUsers:U}=V;let ee=N.key==="ArrowUp"?O-1:O+1;ee<0&&(ee=U.length-1),ee>=U.length+1&&(ee=0),T([{type:"mentionPopover",value:{...V,selectedUser:ee}}])}T([{type:"lastKey",value:N.key}]),yE(N,q,T,C)},onBlur:()=>{q.selection&&T([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(A){if(!$.isPath(A.path)||!le.has(q,A.path))return;const N=le.get(q,A.path);let O=0;if(ge.isText(N)?O=N.text.length:N.children&&(O=N.children.length),A.offset>O)return;try{te.select(q,{anchor:A,focus:A})}catch(U){const ee=U.message;C(`Error focusing editor: ${ee}`)}}}}),H?c.jsx(Oo,{data:H,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const N=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(N)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:H.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(PE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(DE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},L),c.jsx(No,{id:`character-limit-${e}`,limit:r,valueLength:va(M)})]})}):c.jsx(c.Fragment,{})};const y_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.useEffect(()=>{r&&l(r)},[r]);const u=d=>{a||(l(d),i(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(d=>{const f=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:f,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:f,children:d.label})]},f)})})]})};function nh({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ie.useIntl(),l="profileImageChange_",[u,d]=x.useState(r),[f,h]=x.useState(!1),[p,v]=x.useState(!1),m=x.useRef(null),b=async k=>{h(!0),v(!1);try{const E=k.target.files&&k.target.files[0];if(!E||!t)throw h(!1),new Error("Image file or userID is missing");const _=await i({fileObject:E,userId:t}),T={thumbnail:_.thumbnailURL,full:_.originalURL};d(T),s(T)}catch{v(!0)}finally{h(!1)}h(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:y=o.formatMessage({id:`${l}cta_change`}),uploading:C=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:m,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ae,{onClick:()=>m.current&&m.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:f,children:f?C:u?y:g})]})}const rh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Xt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const x_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(Ph.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},ih=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED",gtm:f={context:"Form",event:"form-submit-click"},secondaryActionButton:h,meta:p})=>{const[v,m]=x.useState([]),[b,g]=x.useState(!0),[y,C]=x.useState(d),{formatMessage:k}=ie.useIntl(),E=async L=>{try{await u(v,L.message),m([]),C("SUCCESS")}catch(P){C("ERROR"),l(P)}},_=L=>{L.preventDefault(),C("NOT_SUBMITTED"),g(!0),m([])},T=L=>{L.preventDefault(),o(),C("CLOSED")};return y==="CLOSED"?null:y==="ERROR"||y==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:y==="SUCCESS"?c.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:y==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"secondary",onClick:_,children:k({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ae,{onClick:T,children:k({id:"inviteForm_ctaDone"})})]}):c.jsx(Ae,{onClick:_,children:k({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Xt,{id:"invite-form",fields:[{component:x_,props:{emails:v,setEmails:m,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:k({id:"inviteForm_message_label"}),placeholder:n||k({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:E},button:{text:r,size:"medium",disabled:b},gtm:f,meta:p,secondaryActionButton:h})]})},Ui=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},w_=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,i]=x.useState(null),[a,s]=x.useState(!1),[o,l]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Tt.NEW_PASSWORD]!==p[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ps(p[Tt.NEW_PASSWORD]).isValid,f=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ui(["required",d]),functions:{onChange:p=>l(Ps(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ui(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ui(["required"])}),a&&f.push({component:jf,props:{matchingRules:o}});const h={id:Tt.FORM_ID,fields:f,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(Tt.NEW_PASSWORD)||v.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Xt,{...h}),r&&c.jsx(Qt,{variant:"error",text:r})]})};const ah=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var L;const s=ie.useIntl(),o="profileForm_",l=x.useContext(it),[u,d]=x.useState(l.image),[f,h]=x.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async P=>{},onCancel:m=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:y,predictPlaces:C}=t.useMaps(),{context:k="ProfileForm",event:E="profile-form-submit-click"}=i||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(L=l.location)==null?void 0:L.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!f?!1:!y(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{f||h(!0)},onKeyInput:C}}],T=[{component:nh,props:{userName:l.name,userId:l.id,src:u,uploadImage:p,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:l.name,autoComplete:"name",validation:[{condition:"required"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Xt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:k,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:f?await g(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(M=>({...M,...z})),await v(z)}catch{b()}},onCancel:m,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},C_=()=>{const e=ie.useIntl(),[t,n]=x.useState(0);return x.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Vd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function D_({coverImage:e,setShowImagePicker:t}){return e&&e.url?c.jsx(Qt,{className:"cover-image-preview",text:c.jsx(Cn,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:c.jsx(Ae,{variant:"tertiary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):c.jsx(Qt,{button:{component:c.jsx(Ae,{variant:"secondary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var sh=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(sh||{});let ys=null;const et="publishArticleForm_",td={},nd=10,E_=({id:e="publish-article-form",values:t=td,setShowImagePicker:n,functions:r,meta:i,gtm:a})=>{var P;const s=ie.useIntl(),o=x.useContext(it),{create:l,onSuccess:u=()=>{},onFailure:d=()=>{}}=r||{},{isInOverlay:f=!1}=i||{},[h,p]=x.useState(!1),[v,m]=x.useState(t.body||""),[b,g]=x.useState(!1),[y,C]=x.useState("");x.useEffect(()=>{Wi(t,td)||Kr(t.body)&&t.body!==v&&t.body!==void 0&&m(t.body)},[t.body]);const k=()=>{!o||!o.id?g(s.formatMessage({id:`${et}error_loggedOut`})):b&&g(!1)},E=z=>({condition:M=>{const A=M[z];return!A||typeof A!="string"?!0:A.length<nd},error:s.formatMessage({id:`${et}error_underMinLength`},{length:nd})}),_=!!v&&Kr(v),T=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:s.formatMessage({id:`${et}disclaimer`})})]}),L=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:s.formatMessage({id:`${et}title_label`}),placeholder:s.formatMessage({id:`${et}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:k},validation:[{condition:"required"},E("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:s.formatMessage({id:`${et}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:s.formatMessage({id:`${et}subtitle_placeholder`}),functions:{onChange:k},validation:[{condition:"required"},E("subtitle")]},{component:aa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}body_label`})},showLabel:!0}},{component:cu,props:{id:`${e}-input`,value:v,placeholder:s.formatMessage({id:`${et}body_placeholder`}),meta:{isInOverlay:f},autoFocus:!1,functions:{onChange:z=>{m(z),k()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:s.formatMessage({id:`${et}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(sh).map(z=>({id:z,label:s.formatMessage({id:`${et}_tags_${z}`})})),multipleOptions:{limit:3},validation:[{condition:"required",error:s.formatMessage({id:`${et}tags_error_required`})},{condition:z=>{var M;return((M=z==null?void 0:z.tags)==null?void 0:M.length)>3},error:s.formatMessage({id:`${et}tags_error_over_three`})}]},{component:aa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}cover_image_label`})},showLabel:!0}},{component:D_,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return h?L.push({component:zt}):L.push({component:T}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Xt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async z=>{if(!o||!o.id||!_)return;ys&&clearTimeout(ys),p(!0);const M={...z,body:v,coverImage:t.coverImage};try{l&&await l(M),ys=setTimeout(()=>{C(s.formatMessage({id:`${et}aria_success`})),u(M)},500)}catch{g(s.formatMessage({id:`${et}error`})),C(""),d()}},onFailure:d},fields:L,intlPath:et,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!o||!o.id||!_||!((P=t==null?void 0:t.coverImage)!=null&&P.url),text:{default:s.formatMessage({id:`${et}cta_submit`}),submitting:s.formatMessage({id:`${et}cta_submitting`}),submitted:s.formatMessage({id:`${et}cta_submitted`})},customOnSubmit:b?c.jsx(c.Fragment,{}):c.jsx(C_,{})},gtm:a}),b&&c.jsx(ur,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:s.formatMessage({id:`${et}error`})}),y&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:y})]})};const oh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ie.useIntl(),u=x.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&d(f)}}),c.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},rd=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},__=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},k_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=__(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},F_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,f=(p,v)=>{p.current&&s.validFields[v]!==p.current.validity.valid&&o([{type:`validFields.${v}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(a.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{rd({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Ff,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const v=[];["name","email"].forEach(m=>{s.validFields[m]!==a[m].current.validity.valid&&(v.push({type:`validFields.${m}`,value:a[m].current.validity.valid}),m==="email"&&rd({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const A_=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const B_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},T_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ie.useIntl(),{title:u=!0,expectation:d=!1,url:f=!0,logInButton:h=!0,successMessage:p=!0}=i,v={title:u,expectation:d,url:f,logInButton:h,successMessage:p},[m,b]=x.useReducer(pr,B_),{validFields:g,emailDetails:y,shouldManuallyApprove:C,shouldDisableButton:k,showSuccessMessage:E,showError:_}=m,[T,L]=co.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{C===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[C]),x.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),x.useEffect(()=>{E&&T["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=x.useMemo(()=>F_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:P,state:m,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,v,m]),M=k?!0:C?!Object.values(g).every(A=>A===!0):!g.name||!g.email||["exists","pending","verify"].includes(y.boxType);return v.successMessage&&E?c.jsx(A_,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(Qt,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Xt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await k_({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:m})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const kn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const S_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(kn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(vr,{buttons:r})]})})};const lo="editSection_";function uh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const j_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${lo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(Ae,{href:r,variant:"secondary",size:"small",onClick:()=>uh({href:r,setShowModal:a}),children:n||s({id:`${lo}placeholder_cta`})})})]})},P_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ie.useIntl(),[f,h]=x.useState(!1),p=()=>h(!1),v=!!n||!!r,m=typeof i=="string"||v;let b;return r&&(b=x.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:K("edit-section",t),children:[v&&c.jsx(ln,{title:o||`Edit ${a}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:p},className:K("edit-section-modal"),children:b||(n?c.jsx(Xt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async g=>{var y,C;(y=n==null?void 0:n.functions)!=null&&y.onSuccess&&await((C=n==null?void 0:n.functions)==null?void 0:C.onSuccess(g)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),m&&c.jsx(Ae,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>uh({href:i,setShowModal:h}),children:d({id:`${lo}edit`})})]}),e||c.jsx(j_,{...l,href:i,setShowModal:h,showEditButton:m}),u&&c.jsx(zt,{})]})};const O_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:K("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&x.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:f,link:h=!1,description:p=!1},v)=>{if(!d||!d.url)return null;const m=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:f});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:h?c.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${v}`))})})]})};let xs;const ws="contactFooter_",M_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,i]=x.useState(0),[a,s]=x.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(xs),xs=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(xs),window.removeEventListener("resize",l)}),[]),c.jsx(kn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${ws}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${ws}text`})}),c.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${ws}email`})})]}),c.jsx(rh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},N_=({activeLink:e,profile:t,...n})=>c.jsx(kn,{children:c.jsx(_f,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Ef,{activeLink:e,profile:t}),c.jsx(qd,{...n})]})})});const Cs="cookieBanner_",Ds=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Es=new Date(Date.now()+12*30*24*60*60*1e3),lh=()=>{const e=ie.useIntl(),[t,n,r]=co.useCookies(Ds),[i,a]=x.useState(!t["apol-cookie-banner"]),s=()=>{Ds.forEach(d=>{n(d,!0,{path:"/",expires:Es,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Es}),Ds.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Es});return}r(d)}),a(!1)};if(!i)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${Cs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${Cs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Cs}text`})}),c.jsx(vr,{buttons:u})]})},nn={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Qn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Qn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Qn.support,gtmType:"concierge-email-click"},business:{email:Qn.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const rr="footer_",oa="SiteFooter",id=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(x.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":a,...s,children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(x.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},du=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(da,{element:"hr"}),c.jsx(Mo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(id,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(id,{group:nn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(nn.social.order)&&nn.social.order.map(e=>{const t=nn.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":oa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ue.handlerCalled[e]&&a-Ue.handlerCalled[e]<500)return;Ue.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=cd(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Ue.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Et.SITE:if(n){const u=Ue.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ue.findFirstChild(u.children,"id",Et.SITE);s=Ue.findFirstChild(d.children,"href")}else s=Ue.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=Ue.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ue.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ue.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ue.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ue.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ue.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ri={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ua=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ie.useIntl(),o=cd(ri,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=a===null?l?o.doTrack:!0:a,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const k=C.split("."),E=k[k.length-2];C=`${E==="topics"?`${E}-`:""}${k[k.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],v=p&&o[o.order[0]].order,m=h&&window.location.pathname===o.href;let b={},g={},y={};if(m&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,k={onClick:E=>Ue.events.onClick(E,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ue.events.onFocus({id:C}),onBlur:()=>Ue.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ue.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ue.events.onMouseEnter({id:C,callback:i})};g={...k,id:C===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(v&&(y={...k,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ue.events.onClick(E,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),g={...g,hidden:C in r?!r[C]:!0}),v||(g={...g})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":p,parent:v,active:m}),...b,children:[h?x.createElement(d?Ae:"a",h,s.formatMessage({id:f})):n&&o.order&&v?c.jsxs("button",{...y,children:[s.formatMessage({id:f}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:f}),o.order&&c.jsx("ul",{...g,children:o.order.map(C=>{if(!o[C])return null;const k={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[C].order?c.jsxs("li",{className:K({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${f}_${C}`}),c.jsx("ul",{children:o[C].order.map(E=>c.jsx(ua,{id:`${e}.${C}.${E}`,...k},E))})]},C):c.jsx(ua,{id:`${e}.${C}`,...k},C)})})]},e)};const I_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const fu=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=x.useContext(it),r=wn(!0,!0),i=n&&typeof n.id=="string",a=x.useMemo(()=>Ue.getIsDesktopVersion(i,r),[i,r]),[s,o]=x.useReducer(pr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,f=x.useRef(s);x.useEffect(()=>{f.current=s},[s]),gd({scrollPosition:I_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=f.current.menus;!a&&g["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=f.current.menus;!a&&g["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,y,C=!1)=>{Ue.handleMenus({id:g,value:y,menus:f.current.menus,dispatch:o,forceHandle:C})},p=x.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(y=>{f.current.menus[y]&&h(y,!1,!0)})};x.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",v)}},[]),or(()=>{u["site-navigation"]&&Ue.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&Ue.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const m=c.jsxs(c.Fragment,{children:[!a.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(oh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!a.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:a.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!a.navigation&&u["account-navigation"]?"account":"default",children:ri.order.map(g=>c.jsx(ua,{id:g,isLoggedIn:i,isDesktopVersion:a.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":i,"logged-out":!i,visible:l}),children:[c.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Mo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,m]}):c.jsxs(c.Fragment,{children:[m,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>Ue.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ue.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>Ue.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ri.buttons.order.map(g=>c.jsx(ua,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const R_=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(fu,{}),c.jsx("div",{id:"content",children:c.jsx(Qt,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(du,{})]})},ch=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const l=ie.useIntl(),{navigation:u=!0,footer:d=!0}=i,{background:f="default",variant:h="default",circle:p="default",modal:v="default"}=a,m=hd(),[b,g]=x.useState(""),y=T=>{const{detail:{message:L}}=T;g(L)};x.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",y),()=>{document.removeEventListener("ariaLive",y)}),[m]);const C=Oi(e,{locale:o}),k=Oi(t,{locale:o}),E=Oi(n,{locale:o}),_={};return f!=="default"&&(_[f]=!0),h!=="default"&&(_[h]=!0),p!=="default"&&(_[p]=!0),c.jsx(jh.ErrorBoundary,{onError:r,fallback:c.jsx(R_,{}),children:c.jsxs(x.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,_,{"has-footer":d}),"data-too-small":l.formatMessage({id:"pageLayout_browserTooSmall"}),children:[c.jsx(fu,{showNavigation:u}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":v==="large"}),children:k}),x.createElement(f==="bold"?wo:"div",{id:"content",children:C,className:K({"large-modal":v==="large"})})]}),E&&c.jsx("div",{className:"additional-content appended",children:E}),d&&c.jsx(du,{}),c.jsx(lh,{})]}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},ad={default:"tags_",headerTopics:"header_topics_topics_"},_s={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},$_={getTagDetails:e=>{if(e.includes("topic_")){if(e=_s.topic[e.replace("topic_","")],e){const t=ri.topics.topics[e].href;return t?{id:e,href:t,text:`${ad.headerTopics}${e}`}:null}return null}return _s[e]?(e=_s[e],{id:e,text:`${ad.default}${e}`}):null}};const L_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=$_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:K("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:d}):d},u.id)})})};const dh=25,z_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:f=""})=>{const h=ie.useIntl(),p="membersList",v=x.useContext(it),[m,b]=x.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",f),children:[u?c.jsxs("h1",{children:[h.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),c.jsx(Dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:h.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,y)=>v&&g.id===v.id?c.jsx(c.Fragment,{}):c.jsxs("li",{children:[c.jsx(an,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},y)),d&&e.length===0&&t>0?[...new Array(Math.min(t,dh))].map((g,y)=>c.jsx("li",{children:c.jsx(pa,{layout:"member"})},y)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(ka,{form:s,showModal:m,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},fh=z_,q_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ie.useIntl();return t?c.jsx("small",{children:Rt(i.formatMessage,`${e}explainer`,n,"action",{a:a=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):c.jsx(c.Fragment,{})},U_=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(aa,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},sd=5,od=2,W_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Gn=null;const Qe="discussion_form_",oi=({id:e,parentId:t,content:n={type:Be.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:f="DiscussionForm"})=>{var Y,se,be;const h=ie.useIntl(),p=x.useContext(it),[v,m]=x.useState(n.type),[b,g]=x.useState(""),{isLoading:y=!1,isInWrapper:C=!1,isInOverlay:k=!1,isAutoFocused:E=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:L=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:M=!0,showDivider:A=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:I=[]}=i||{},{onChange:H=()=>{},create:V=()=>{},createPoll:ae=()=>Promise,handleSaveEdit:X=()=>{},handleCancel:D=()=>{},callback:Q=()=>{},onMention:q=()=>{},listMembers:B=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:N=()=>Promise.resolve({}),props:O={create:{projectNames:["questions-answers"]}}}=u,[U,ee]=x.useState({body:_&&_.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[W,ne]=x.useState(l.error||!1),de={status:!1,title:T&&T.text||"",polls:0},[J,ve]=x.useState(de);x.useEffect(()=>{L&&!_&&P&&P!==U.body&&ee(oe=>({...oe,body:P.text||""}))},[P]),x.useEffect(()=>{m(n.type)},[n.type]);const me=Wr((oe,ce)=>{ee(ke=>({...ke,body:oe,data:{link:ce}})),H({body:oe});let pe;!p||!p.id?pe=Rt(h.formatMessage,`${Qe}error_loggedOut`,v,"action"):r?s>0&&oe.length>=s&&(pe=`${Qe}error_tooLong`):pe=Rt(h.formatMessage,`${Qe}error_noPermission`,v,"action"),pe?ne(pe):W&&ne(!1)},50);let ye=`${v}-form`;if(v===Be.Response||v===Be.Reply){const oe=((Y=n.slugs)==null?void 0:Y.reply)||((se=n.slugs)==null?void 0:se.answer)||((be=n.slugs)==null?void 0:be.question)||"";oe&&(ye=`${ye}-${oe.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const Ee=async oe=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ve(pe=>({...pe,status:"submitting"}));const ce=window.location.pathname;try{let pe;switch(v){case Be.Post:pe=await V({title:oe.title,content:oe.body,categories:oe.postType,data:oe.data});break;case Be.Poll:pe=await ae(W_(oe));break;case Be.Question:pe=await V({title:oe.body,authorId:p&&p.id,data:oe.data,...O==null?void 0:O.create});break;case Be.Response:pe=await V({questionSlug:n.slugs.question},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;case Be.Reply:pe=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;default:break}return await Zh(1e3),Q&&await Q(pe),Gn=setTimeout(()=>{ee({body:"",data:{}}),m(Be.Post),ve(qe=>({...qe,status:"submitted"})),g(Rt(h.formatMessage,`${Qe}success`,v,"action"));const ke=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ke),Ce()},850),pe}catch(pe){const ke=pe;let qe=`${Qe}error`;ke!=null&&ke.message.includes("entry already exists")&&(qe=Rt(h.formatMessage,`${Qe}error_alreadyExists`,v,"action")),ke!=null&&ke.message.includes("429")?qe=Rt(h.formatMessage,`${Qe}error_tooMany`,v,"action"):ke!=null&&ke.message.includes("400")&&(qe=`${Qe}error`),ne(qe),Ce()}},Ce=()=>{Gn=setTimeout(()=>{ne(!1),ve(de),g("")},5e3)},ze=Wr(async oe=>{const ce={...U,...oe};if(_){ve(pe=>({...pe,status:"submitting"})),X(ce);return}try{if(!await Ee(ce))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(y)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const We=!U.body||!Kr(U.body),He=!J.title||!Kr(J.title);let Ke=!1;v!==Be.Poll&&(Ke=We),T&&(Ke=Ke&&He);const Te=J.status==="submitting",Oe=[];v===Be.Poll?Oe.push({id:"poll-options",label:h.formatMessage({id:`${Qe}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:h.formatMessage({id:`${Qe}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:od,maxInputs:sd,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:oe=>{var pe;let ce=0;oe&&Array.isArray(oe)&&(ce=((pe=oe==null?void 0:oe.filter(ke=>ke!==""))==null?void 0:pe.length)||0),J.polls!==ce&&ve(ke=>({...ke,polls:ce})),H({polls:oe})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Oe.push({component:U_,props:{formID:ye,intlPath:Qe,showLabel:T!==!1,type:v}},{component:cu,props:{id:`${ye}-input`,value:J.status==="submitting"&&!W?"":U.body,placeholder:a||Rt(h.formatMessage,`${Qe}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:me,onChangeData:oe=>{ee(ce=>({...ce,data:oe}))},onMention:q,listMembers:B,clickMentionFallback:j,getLinkPreview:N},data:d,autoFocus:_!==!1||E&&!T,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:q_,props:{intlPath:Qe,showGuidelines:M,type:v,gtmContext:f}}),A&&Oe.push({component:zt}),T&&Oe.unshift({id:"title",type:"textarea",value:T.text,limit:250,label:h.formatMessage({id:`${Qe}${v===Be.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:h.formatMessage({id:`${Qe}${v===Be.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:oe=>{ve(ce=>({...ce,title:oe})),H({title:oe})}},validation:v===Be.Poll?[{condition:"required"}]:[]}),S&&Oe.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Qe}postType_label`}),options:I.map(oe=>({id:oe.slug,label:oe.name})),validation:[{condition:"required"}],functions:{onChange:oe=>{H({postType:oe}),oe.includes(Be.Poll)?m(Be.Poll):v!==Be.Post&&m(Be.Post)}}});let we=!p||!p.id||!r||Te;if(v===Be.Poll){const oe=J.polls;we=we||He||oe<od||oe>sd}else we=we||Ke,_&&(T?we=we||U.body===_.text&&J.title===T.text:we=we||U.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Xt,{id:ye,className:K("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Te||l.cancel},functions:{onSuccess:async oe=>{await ze(oe)},onCancel:D},fields:Oe,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":f,"data-gtm-event-type":`${_?"save":"submit"}-${v}-click`,"data-testid":"save-button",disabled:we,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Qe}${_?"save":"post"}`}),submitting:h.formatMessage({id:`${Qe}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":f,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!U.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Qe}cancel`})},gtm:{context:f,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===Be.Question&&c.jsx("h2",{children:Rt(h.formatMessage,`${Qe}title`,v,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:f,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]}})]}),J.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(h.formatMessage,`${Qe}success`,v,"action")}),W&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof W=="string"?W.includes(" ")?W:h.formatMessage({id:W},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):W}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})},V_=Object.freeze(Object.defineProperty({__proto__:null,default:oi},Symbol.toStringTag,{value:"Module"}));const H_={showForm:!1},_a=x.createContext(H_),mh=({children:e})=>{const[t,n]=x.useState({showForm:!1});return c.jsx(_a.Provider,{value:{...t,updateConversation:n},children:e})};function K_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var f;const o="discussion_",l=ie.useIntl(),u=(f=i==null?void 0:i.componentProps)==null?void 0:f.member.additionalContent,d=u?u.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:K({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Me,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const ks=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function Z_({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?c.jsx(c.Fragment,{}):c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?c.jsx(c.Fragment,{}):c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))})}var la=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(la||{});const Y_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,G_=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const Q_=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=x.useState(t.hasUserVoted);let f=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(f=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${f}%`});const v=g=>{g.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},m={htmlFor:t.id,className:K({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var y;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const C=g.code==="ArrowUp"?"prev":"next",{nextElement:k,nextIndex:E}=G_(g.currentTarget.parentElement,"selected",C,n);k&&((y=k.querySelector("label"))==null||y.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...m,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(un,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[f,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const hh=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ie.useIntl(),s=x.useContext(it),{showRemoveVote:o=!1,allowMultipleVotes:l=!1,resultsVisibility:u=la.AfterVoting}=n||{},[d,f]=x.useState(Y_(t,l,s==null?void 0:s.id)),h=t.reduce((g,y)=>g+y.numVotes,0),p=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),m=x.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=x.useCallback(async()=>{t.forEach(async g=>{g.hasUserVoted&&g.userVote&&r.removeVote({reactionId:g.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:h})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ae,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:p===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((g,y)=>c.jsx(Q_,{isTabbable:d===y,user:s,option:g,optionIndex:y,totalPollVotes:h,showResults:u==la.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:m,setTabbableOption:f}},g.id))})})}),c.jsxs(Me,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&c.jsx("ul",{children:v.map(g=>c.jsx("li",{children:g.label}))})]})]})};function J_({content:e,contentData:t,functions:n}){return c.jsx(hh,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function X_({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx(jd,{text:t.postBody,markdownOptions:{overrides:{a:Ms,blockquote:{component:ks}}}}):c.jsx(On,{options:{overrides:{a:Ms,blockquote:{component:ks}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(On,{options:{wrapper:r.type===Be.Question?"h1":x.Fragment,forceWrapper:r.type===Be.Question,forceInline:r.type===Be.Question,forceBlock:r.type!==Be.Question,overrides:{blockquote:{component:ks}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(Oo,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const It="discussion_",ek=195;let Ti=null;const ui=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:f,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:m,basePath:b,parentId:g,locale:y="en"})=>{var Oe,we,Y,se,be,oe;const C=ie.useIntl(),k=x.useContext(_a),E=x.useContext(it),{createContent:_=async()=>{},deleteContent:T=async()=>{},updateContent:L=async()=>{}}=o.content||{},{createLike:P=()=>{},deleteLike:z=()=>{},listLikes:M=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:I=()=>{},removeVote:H=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ae,createdAt:X,id:D,likes:Q=0,userLiked:q,comments:B=0,data:j}=t,N=uv(t.title,y),O=E&&E.id&&typeof ae!="string"&&ae.id&&ae.id===E.id||!1,U=O&&(!t.createdAt||Hh(t.createdAt,10,"seconds")),ee=x.useRef(null),[W,ne]=x.useState({title:t.body!==N&&N||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[de,J]=x.useState(!1),[ve,me]=x.useState(U?"highlighted":"default"),[ye,Ee]=x.useState("");x.useEffect(()=>{const ce=ee.current;if(!(!ce||ve==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ce.addEventListener("transitionend",ze),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ce.removeEventListener("transitionend",ze)}},[]),x.useEffect(()=>{ne(ce=>({...ce,title:t&&N||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),x.useEffect(()=>{(async()=>{const pe=await jo(W.body,h,j==null?void 0:j.mentions,F);ne(ke=>({...ke,postBody:pe}))})()},[W.body,j==null?void 0:j.mentions]);const Ce=()=>{setTimeout(()=>{me("fading")},1e3)},ze=({propertyName:ce})=>{ce==="background-color"&&me(pe=>(pe==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Ce),ee.current&&ee.current.removeEventListener("transitionend",ze)),pe==="fading"?"default":pe))};if(i||!t||t.type===Be.Answer&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const We=async({title:ce,body:pe,data:ke})=>{ce||(ce=""),pe||(pe=""),Ee("");try{if(!Wi(ce,W.title)||!Wi(pe,W.body)){const qe=t.type===Be.Question?{title:pe}:{title:ce,body:pe,data:ke};await L(Ls(t.slugs),qe)}ne(qe=>({...qe,title:ce||"",body:pe||"",data:{...qe.data,...ke},isEditing:!1,didEdit:!0}))}catch{Ee(`${It}form_error`)}},He=()=>{if(k&&k.updateConversation){const ce={showForm:!0},pe=t.author;pe&&pe.id&&(v&&(ce.prepopulateForm=`@{{${pe.id}}}`),ce.mentionData={id:pe.id,name:pe.name}),k.updateConversation(ce)}setTimeout(()=>{var At,pt,tt;const pe=`reply-form-${(t.type===Be.Answer?t.slug:((At=t.slugs)==null?void 0:At.reply)||((pt=t.slugs)==null?void 0:pt.answer)||((tt=t.slugs)==null?void 0:tt.question)||"").toLowerCase().slice(-15)}`,ke=document.getElementById(pe),qe=document.getElementById(`${pe}-input`);qe&&qe.focus(),ke&&ke.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{J(!1);try{t.type===Be.Poll?(await V(),window.location.href=`${b}/${g}`):await T(Ls(t.slugs))}catch{Ee("delete-error")}},Te=[];return n&&O&&(t.type!==Be.Poll&&Te.push({text:C.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>ne(ce=>({...ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),Te.push({text:C.formatMessage({id:`${It}moreMenu_delete`}),onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...sf(`delete-${t.slug}-modal`,de)})),r&&o.pins&&Te.push({text:C.formatMessage({id:`${It}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),p&&((Oe=ee==null?void 0:ee.current)==null||Oe.focus(),(we=ee==null?void 0:ee.current)==null||we.scrollIntoView({behavior:"smooth"})),x.createElement(e,{className:K("discussion-post",u,{[ve]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!W.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:ee,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ce=>{if(!l.post||W.isEditing||t.type===Be.Poll&&ov(ce,["poll-options","poll-info"],"discussion-post"))return;ce.preventDefault(),ce.stopPropagation(),Ti&&clearTimeout(Ti),Ti=setTimeout(()=>{window.location.href=l.post},150);const pe=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ti}});document.dispatchEvent(pe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:D||t.slug,className:K("discussion-card text-medium",t.type,{editing:W.isEditing,"has-link":l.post&&!W.isEditing}),children:[!W.isEditing&&c.jsx(K_,{author:ae,originalAuthorId:a,createdAt:X,contentData:{didEdit:W.didEdit},content:t,gtmContext:d,badges:m}),W.isEditing?c.jsx(oi,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Be.Question?250:5e4,forceShow:{error:ye!==""&&ye!=="delete-error"?C.formatMessage({id:ye},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:We,handleCancel:()=>{Ee(""),ne(ce=>({...ce,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:j}):c.jsxs(c.Fragment,{children:[t.type===Be.Poll?c.jsx(J_,{content:t,contentData:W,functions:{createVote:I,removeVote:H}}):c.jsx(X_,{links:l,contentData:W,postCutOff:ek,content:t}),c.jsx(Z_,{content:t})]}),!W.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(wf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Q||0,userLiked:q||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:P,deleteLike:z,listLikes:M},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Be.Question,Be.Post].includes(t.type)||l.comments)?{count:B||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:He}}:!1,shareLink:{url:`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(se=t.slugs)==null?void 0:se.answer}${(be=t.slugs)!=null&&be.reply?`#${(oe=t.slugs)==null?void 0:oe.reply}`:""}`},moreMenu:{options:Te,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),f,c.jsx(ln,{id:`delete-${t.slug}-modal`,isOpen:de,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:ye==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},title:C.formatMessage({id:`${It}delete_title`},{action:C.formatMessage({id:`${It}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:C.formatMessage({id:`${It}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ke,children:C.formatMessage({id:`${It}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:ce=>c.jsx("p",{children:ce}),action:C.formatMessage({id:`${It}action_${t.type}`})}})})]})})};const tk=x.lazy(()=>Promise.resolve().then(()=>pk)),nk=65,ph=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=x.useContext(it)||"community",l=ga(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const u=wn(!0,!1),d=u?u<768:0,{modal:f=!1}=e||{},[h,p]=x.useState({form:f||Fd("showPost")==="true"||!1,warning:!1}),[v,m]=x.useState({showCachedText:!1});x.useEffect(()=>{if(!v.showCachedText)return;(async()=>{const C=await jo(v.title||v.body||"",nk,v.mentions);m(k=>({...k,prettifiedText:C}))})()},[v.showCachedText,v.title,v.body]);const b=y=>{if(!v.showCachedText||typeof h.warning=="string")return;let C;if("detail"in y&&y.detail.link)y.detail.timeout&&clearTimeout(y.detail.timeout),C=y.detail.link;else{const k=y;k.preventDefault(),k.stopPropagation();const _=k.target.closest("a");C=_&&_.getAttribute("href")}p(k=>({...k,warning:C||!1}))};x.useEffect(()=>{if(!v.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,b),document.removeEventListener(rt.MEMBER_CLICKED,b),document.removeEventListener("click",b);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,b),document.addEventListener(rt.MEMBER_CLICKED,b),document.addEventListener("click",b),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,b),document.removeEventListener(rt.MEMBER_CLICKED,b),document.removeEventListener("click",b)}},[v.showCachedText]),x.useEffect(()=>{const y=C=>{if(!(!v.showCachedText||h.warning!==!1))return C.preventDefault(),C.returnValue=""};return window.addEventListener("beforeunload",y,{capture:!0}),()=>{window.removeEventListener("beforeunload",y,{capture:!0})}},[v.showCachedText,h.warning]);let g=r.formatMessage({id:`${i}placeholder${d?"":"_long"}`});return v.showCachedText&&(v.title||v.body)&&(g=v.prettifiedText||g),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:y=>{y.preventDefault(),y.stopPropagation(),p(C=>({...C,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:l.name,src:l.image,alt:""}),c.jsx(On,{className:K("input",{placeholder:!v.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:g})]}),c.jsxs(br,{children:[c.jsx(tk,{showModal:h.form,functions:{cacheText:m,onClose:()=>{p(y=>({...y,form:!1}))}},form:t,cachedText:v,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:h.warning!==!1,functions:{onClose:()=>{p(y=>({...y,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:y=>{y.preventDefault(),y.stopPropagation(),typeof h.warning=="string"&&(window.location.href=h.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{p({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},rk=x.lazy(()=>Promise.resolve().then(()=>V_)),mu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=_o})=>{if(a&&!i)return c.jsx(Qt,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Eo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:f,meta:h,...p}=t,v={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...f,create:(f==null?void 0:f.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(ph,{form:v}):c.jsx(rk,{...v})},hu=({form:e})=>{const t=x.useContext(it),n=ie.useIntl(),[r,i]=x.useState(!1),a=()=>{tp(t)||i(!0)};x.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(ka,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Fs="discussion_responses_",gh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Fs}title`},{action:r.formatMessage({id:`${Fs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Fs}empty`,e,e)})]})};const vh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ie.useIntl(),s=x.useContext(_a),o=Oi(i,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(ii,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(oi,{...r})]})};function ik(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function ak({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(uf({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&lf({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function sk({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function ok({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Qi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Qi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function uk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ji({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ji({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function lk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Re.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function ck({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(cf({activity:s,reactionId:a}),s)),onError:n});return i}function dk({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=Re.useQueryClient(),d=ha(),f={queryClient:u,queryKey:l},h={mutationHandlers:{error:ko(f),mutate:Fo(f)},user:d,...f},p=sk({...h,mutationFn:t}),v=ok({...h,mutationFn:n}),m=fk({...h,mutationFn:r}),b=uk({...h,mutationFn:i}),g=mk({...h,mutationFn:a}),y=ak({...h,mutationFn:s}),C=ck({...h,mutationFn:o}),{activity:k,...E}=lk({queryKey:l,queryFn:e});return{activity:k,mutations:{edit:p,like:v,unlike:m,pin:b,unpin:g,createVote:y,removeVote:C},user:d,...E}}function fk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&df({activity:s,user:r}),s)),onError:n});return i}function mk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&ff({activity:s,user:r}),s))),onError:n});return i}const hk=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:f,polls:h},profile:p,categories:v,locale:m=_o})=>{var q,B,j,N,O,U,ee,W,ne,de,J,ve;const b=ie.useIntl(),g={...s,...h},{activity:y,error:C,isLoading:k,mutations:{edit:E,like:_,unlike:T,pin:L,unpin:P,createVote:z,removeVote:M}}=dk({queryFns:g,queryKey:[e,t,n]});if(k)return c.jsx(Nt,{style:{height:"400px"}});if(C||!y)return c.jsx(Qt,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:A,verb:F,latest_reactions:S,mentioned_users:I,additional_data:H}=y,V=(((q=S==null?void 0:S.like)==null?void 0:q.length)||0)>0,ae=(((B=A==null?void 0:A.like)==null?void 0:B.length)||0)>0,X=ae?A==null?void 0:A.like[0].id:"",D=V?(j=S==null?void 0:S.like)==null?void 0:j.map(me=>{var ye,Ee,Ce;return{id:(ye=me==null?void 0:me.user)==null?void 0:ye.id,name:(Ce=(Ee=me==null?void 0:me.user)==null?void 0:Ee.data)==null?void 0:Ce.name}}):!1,Q=y==null?void 0:y.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ui,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:y==null?void 0:y.title,body:y==null?void 0:y.content,categories:Po((y==null?void 0:y.categories)||[],v||[]),createdAt:(y==null?void 0:y.time)||"",slugs:{question:`${e}/${t}`,answer:y==null?void 0:y.id},slug:n,author:xr(Q),userLiked:ae,likes:((N=y==null?void 0:y.reaction_counts)==null?void 0:N.like)||0,comments:(y==null?void 0:y.total_replies)||0,peopleWhoLiked:D,data:{mentions:I,...H||{}},pinned:((O=y==null?void 0:y.reaction_counts)==null?void 0:O.pin)&&((U=y==null?void 0:y.reaction_counts)==null?void 0:U.pin)>0||!1,pollOptions:of(y,m),pollSettings:{showRemoveVote:(ee=y==null?void 0:y.settings)==null?void 0:ee.show_remove_vote,allowMultipleVotes:(W=y==null?void 0:y.settings)==null?void 0:W.allow_multiple_votes,deadlineAt:(ne=y==null?void 0:y.settings)==null?void 0:ne.deadline_at,hideParticipants:(de=y==null?void 0:y.settings)==null?void 0:de.hide_participants,numberOfWinners:(J=y==null?void 0:y.settings)==null?void 0:J.number_of_winners,resultsVisibility:(ve=y==null?void 0:y.settings)==null?void 0:ve.results_visibility}},originalAuthorId:Q==null?void 0:Q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(me,{title:ye,body:Ee})=>E({title:ye,content:Ee})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:X}),listLikes:me=>o.list({activityId:n,...me})},comments:{openComments:()=>{}},pins:{createPin:()=>L({activityId:n}),deletePin:()=>{var me;return P({activityId:n,reactionId:(me=S==null?void 0:S.pin)==null?void 0:me[0].id})}},polls:{createVote:({reactionId:me})=>z({reactionId:me}),removeVote:({reactionId:me})=>M({reactionId:me}),removePoll:()=>h.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(vf,{basePath:e,parentId:t,activityId:n,showReplies:F===Be.Poll?ik(y):!0,activityTotalReplies:(y==null?void 0:y.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:f},profile:p})]})};const bh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:f}=n,{title:h="",body:p="",mentions:v}=r||{},m="discussion-form-modal";return c.jsx(ln,{id:m,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",i),children:c.jsx(oi,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${m}-overlay`,hasTitleField:{text:h},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...f,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const y=v||{};y[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(C=>({...C,mentions:y}))},create:async b=>{o(),f.create&&await f.create(b),l({showCachedText:!1})},createPoll:async b=>{const g=()=>{o(),l({showCachedText:!1})};if(f.createPoll)try{const y=await f.createPoll(b);return new Promise(C=>(g(),C(y)))}catch{return new Promise((C,k)=>k())}else return g(),new Promise(y=>y({}))},handleSaveEdit:async b=>{o(),f.handleSaveEdit&&await f.handleSaveEdit(b),l({showCachedText:!1})}}})})},pk=Object.freeze(Object.defineProperty({__proto__:null,default:bh},Symbol.toStringTag,{value:"Module"}));const gk=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const f=ie.useIntl();return i||(i=f.formatMessage({id:"inviteModal_formTitle"})),a||(a=f.formatMessage({id:"inviteModal_formLabel"})),s||(s=f.formatMessage({id:"inviteModal_cta"})),c.jsx(ln,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:K("invite-modal",e,{success:!!n}),children:c.jsx(ih,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const vk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ie.useIntl(),[l,u]=x.useState(Fd("showProfile")==="true"||e);x.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:K("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ah,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async f=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(f)}finally{d()}}}})]})})},ka=vk,bk=Object.freeze(Object.defineProperty({__proto__:null,default:ka},Symbol.toStringTag,{value:"Module"}));const yk=({members:e})=>{const[t,n]=x.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:a,src:l}),c.jsx("p",{children:a}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(ln,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(On,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const xk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:K("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(an,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),wk=x.memo(xk);const Ck=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[i,a]=x.useState(e);return x.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&c.jsxs(_t,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Fa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const f=d/60,h=Math.floor(f),p=(f-h)*60,v=Math.round(p),m=`${a.formatMessage({id:`${s}hours`},{time:h})}${h>0&&v>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${h>0?`${a.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${v>0?a.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:f}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:K("time-to-complete",i),"aria-label":u,children:l})};const Dk=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(Cn,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const Ek=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],_k=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,m;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},h={};d.forEach(b=>{if(!t[b]){h[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){h[b]=t[b];const{text:g,element:y}=t[b];if(y&&Ek.includes(y.toLowerCase()))return;h[b]={text:g,element:f[b]};return}h[b]={text:t[b],element:f[b]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(kn,{className:K("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&h.eyebrow&&h.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(h[b]&&typeof h[b]=="object"){const{text:g,element:y=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:g},b):x.createElement(y,{key:b,className:b},g)}return null}),l,p&&c.jsx(Ae,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&c.jsx(Cn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},kk=x.memo(_k);const Fk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(kn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const Ak=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(kn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Cn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Bk=x.memo(Ak);const Tk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ae,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Sk=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const f=i&&js(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ho(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&js(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},jk={title:66,text:3e3,secondaryText:1e3,partner:34},ca={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Pk=({data:e,cta:t,link:n,gtmContext:r})=>{var m,b;const i=ie.useIntl(),[a,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:f}=e,h=e.contentType;let p="";if((m=ca[h])!=null&&m.gtmEvent&&(p=ca[h].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(Ae,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(h)&&d!=="premium"){const g=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),y=async C=>{if(C.preventDefault(),C.stopPropagation(),!(g||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ae,{onClick:y,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${f}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${h}${g?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Ok({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=x.useContext(it),[i,a]=x.useState({count:"...",isMember:!1,memberType:""});return x.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),a({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const pu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,S;const u=ie.useIntl(),d=x.useContext(it),f=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=x.useRef(null),[m,b]=x.useState({data:null,isLoading:!0});x.useEffect(()=>{n(i,f).then(I=>{b({data:I,isLoading:!1})}).catch(()=>b(I=>({...I,isLoading:!1})))},[i,f,n]);const{data:g,isLoading:y}=m;if(y||!g)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:C}=g;if(!C||!ca[C])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:k="",className:E,length:_,gtmEvent:T}=ca[C];let L=h&&g.slug?`${k}${g.slug}`:!1;h&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(L=g.slug);const P=I=>{L&&(I.preventDefault(),I.stopPropagation(),window.location.href=L)},z={...jk,..._};let M={className:"card"},A={};return L&&(A={href:L,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(A.target="_blank"),M={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(M={...M,tabIndex:"0"},(F=v==null?void 0:v.current)==null||F.focus(),(S=v==null?void 0:v.current)==null||S.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",E,t,{"has-link":L,"no-link":!L,"has-image":g.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...M,ref:v,children:[c.jsx(Bd,{className:"card-label",contentType:C,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),C==="communityPage"&&(g==null?void 0:g.createdAt)&&Kh(g==null?void 0:g.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):Ed(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Cn,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(un,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(xo,{contributors:{data:g.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(C)?u.formatMessage({id:`card_contributors_${C}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):sr(g.partner[0],z.partner)}),["title","text","secondaryText"].map(I=>{const H=g[I];if(!H)return null;const V=yd(I),ae={key:I,className:V,"data-testid":V},X={wrapper:"p",forceWrapper:!0,forceInline:!0},D=sr(H,z[I]);return["title","text"].includes(I)&&L?(X.wrapper="a",c.jsx("p",{...ae,children:c.jsx(Zt,{options:X,...A,children:D})})):c.jsx(Zt,{options:X,...ae,children:D})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(Ok,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(Sk,{type:E||"",data:g}),c.jsx(Pk,{data:g,cta:a,link:L||"",gtmContext:s})]})})};const yh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(pu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Mk=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},Nk=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return x.createElement(i,{className:K("title",a,s,{"highlighted-title":a==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const As={fourCards:1024,threeCards:769,twoCards:480};let Si=null,Bs=null;const Ik=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,f]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,m]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[y,C]=x.useState(""),k=t.length,E=Math.ceil(k/h),_=x.useRef(null),T=wn(!0,!0,_==null?void 0:_.current);x.useEffect(()=>{let F=1;T&&(T>=As.fourCards?F=4:T>=As.threeCards?F=3:T>=As.twoCards&&(F=2),F>k&&(F=k)),f(S=>({...S,cardsPerPage:F,isLoading:!1}))},[T,k]);const L=(F="next")=>{Bs&&clearTimeout(Bs);let S=b;if(typeof F=="string")if(F==="next")if(b<E-1)S=b+1;else return;else if(b>0)S=b-1;else return;else S=F;C(""),m(H=>({...H,currentPage:S,loadedPages:[...new Set([...g,S])]}));const I=()=>{const H=S*d.cardsPerPage,V=H+d.cardsPerPage;return t.slice(H,V).length};Bs=setTimeout(()=>{C(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:I()}))},500)},P=F=>{Si=F.touches[0].clientX},z=F=>{if(Si===null)return;const S=F.touches[0].clientX,I=Si-S;I>5?L("next"):I<-5&&L("previous"),Si=null},M={"--width":`${T||0}px`,"--total-cards":k,"--cards-per-page":h,"--page":b};if(p)return c.jsx(pa,{layout:`carousel${i?"-with-title":""}`});const A=(F,S)=>{var H;let I=null;return(H=F==null?void 0:F.sys)!=null&&H.id?I=`card-${F.sys.id}`:F!=null&&F.slug?I=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(I=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),I};return c.jsxs("section",{ref:_,className:K("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Nk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:M,"data-testid":"carousel-list",children:t.map((F,S)=>{let I=A(F,S);const{inView:H,isLoaded:V}=Mk(S,h,b,g);return I&&(H||V)?c.jsx(pu,{id:I,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:H},...o},I):(I=I||`${e}-card-${S}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},I))})}),E<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ae,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((F,S)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:S===b}),onClick:I=>{I.preventDefault(),I.stopPropagation(),L(S)},children:c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:S+1,total:E})})})},`page-indicator-${S}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ae,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),L("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:y})]})]})},Rk=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=a?window.btoa(a):`carousel-${u}`,f=u===e.length-1;return t?c.jsxs(x.Fragment,{children:[c.jsx(pa,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(x.Fragment,{children:[c.jsx(Ik,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),f?null:c.jsx(zt,{})]},`carousel-${d}`)});const $k=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:f=>{l&&(f.preventDefault(),f.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),x.createElement(e,{className:K("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!i}),children:i&&c.jsx(Cn,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Lk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return x.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":a==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>c.jsx("strong",{children:f}),number:u})}),u<100&&i&&c.jsx(Fa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(yo,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const xh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>x.createElement(e,{className:K("lesson-name",i),"data-number":`${t}.${n}`,children:r});const wh=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ie.useIntl(),o=fa(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):wd(i||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Fa,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const zk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const f=ie.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(ma,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[f.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?f.formatMessage({id:`${h}time_completed`}):c.jsx(Fa,{time:s,appendedText:i?f.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:m,contentType:b,icon:g,image:y,isIntroduction:C,optional:k,slug:E,subsectionId:_,title:T,type:L})=>{const P=i&&t||C,z={};return y&&(z.style={"--image":`url(${y})`}),c.jsx("li",{className:K({article:b===jr.ARTICLE,discussion:b===jr.DISCUSSION,quiz:b===jr.QUIZ,completed:v&&b===jr.ARTICLE,locked:!P}),...z,children:c.jsx(Dn,{href:P?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${xd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(xh,{sectionId:a,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(wh,{completionTime:m,icon:g,optional:k,type:L,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const qk=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ae,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Uk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),ud=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ji="notFoundError_",Wk=()=>{const e=ie.useIntl(),t=[];return ud.forEach((n,r)=>{n.title=e.formatMessage({id:`${ji}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(ch,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(kn,{children:[c.jsx(yh,{cards:ud,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(Ae,{href:"/solution-articles/",children:e.formatMessage({id:`${ji}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ji}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ji}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=wf;exports.ActionButton=Zr;exports.ActivitiesFeed=lv;exports.ActivitySection=hk;exports.ActivityType=yr;exports.AddPost=mu;exports.Badge=Ud;exports.BadgeScope=ut;exports.Badges=Wd;exports.BadgesContext=go;exports.BadgesProvider=Od;exports.Banner=Dk;exports.BannerSection=kk;exports.Breadcrumbs=Bv;exports.Buckets=lp;exports.Button=Ae;exports.ButtonWrapper=vr;exports.COURSE_CONTENT_TYPES=jr;exports.CacheProvider=Md;exports.Card=pu;exports.CardBlock=yh;exports.Carousel=Rk;exports.CharacterLimit=No;exports.Checkbox=Io;exports.CollapsibleSection=ma;exports.Columns=_f;exports.CommunityDetails=Bg;exports.ContactFooter=M_;exports.ContactForm=rh;exports.ContentTypeLabel=Bd;exports.Contributors=xo;exports.ConversationContext=_a;exports.CookieBanner=lh;exports.CourseProgression=Lk;exports.CourseStructure=zk;exports.CustomContentBanner=Fk;exports.CustomEvents=rt;exports.DELETED_USER_ID=Vr;exports.Directory=yk;exports.DiscussionContentType=Be;exports.DiscussionConversation=mh;exports.DiscussionForm=oi;exports.DiscussionFormCard=ph;exports.DiscussionFormModal=bh;exports.DiscussionPost=ui;exports.DiscussionThread=vh;exports.Divider=zt;exports.DownloadSection=S_;exports.EMAILS=Qn;exports.EditSection=P_;exports.EmailHelperTextBox=Ff;exports.EmptyStateBox=Qt;exports.EnrichedUrl=Oo;exports.FeatureFlags=Id;exports.Filters=Cf;exports.FlagsProvider=Nd;exports.Footer=du;exports.Form=Xt;exports.Formatting=Z;exports.Fragment=St;exports.FullWidthSection=kn;exports.GET_STREAM_USER_PREFIX=Ss;exports.GlobalProviders=xp;exports.Header=fu;exports.HelperTextBox=Sd;exports.HiddenFromScreenReaders=da;exports.HideShowTextBox=jd;exports.HighlightSection=Bk;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=Cd;exports.IconBulletedList=fp;exports.ImageContainer=ap;exports.IntlProvider=Rd;exports.InviteForm=ih;exports.InviteModal=gk;exports.JoinButton=Eo;exports.Label=aa;exports.LanguageContext=vo;exports.LanguageSwitcher=Sv;exports.LessonName=xh;exports.LessonType=wh;exports.LikesButton=pf;exports.LikesFeed=bf;exports.LikesModal=yf;exports.Link=Dn;exports.LoadMore=ii;exports.LoadingBlock=Vd;exports.LoadingPlaceholder=Nt;exports.LoadingState=pa;exports.Logo=Mo;exports.LogoSection=O_;exports.MEMBERS_PER_PAGE=dh;exports.MENTION_REGEX=Dd;exports.MarkCompleteButton=qk;exports.MarkdownText=On;exports.MarketingBlock=Tk;exports.Marks=Kt;exports.Member=an;exports.MembersList=fh;exports.Modal=wo;exports.MoreMenu=Df;exports.NUMBER_OF_COUNTRIES=Wh;exports.NUMBER_OF_USERS=Uh;exports.NarrowCard=$k;exports.NavigationMenu=Ef;exports.NotFoundError=Wk;exports.Overlay=ln;exports.OverlayContext=bo;exports.OverlayProvider=zd;exports.PageHeading=qd;exports.PageLayout=ch;exports.PasswordForm=w_;exports.PasswordRules=jf;exports.Pill=Yt;exports.Poll=hh;exports.Popover=Ad;exports.Portal=br;exports.ProfileForm=ah;exports.ProfileImageChange=nh;exports.ProfileModal=ka;exports.ProfileModalLauncher=hu;exports.ProfilePicture=un;exports.ProgressBar=yo;exports.ProgressTracker=op;exports.PublishArticleForm=E_;exports.Rating=Yv;exports.RepliesFeed=vf;exports.ResponsesHeading=gh;exports.ResponsiveImage=Cn;exports.ResultsVisibility=la;exports.ReturnToNavButton=up;exports.RichTextEditor=cu;exports.SearchForm=oh;exports.ShareLink=xf;exports.ShareLinks=Iv;exports.SignupForm=T_;exports.Span=Ms;exports.StatusBanner=ur;exports.TableOfContents=Ck;exports.Tabs=Rv;exports.Tags=L_;exports.TestimonialBlock=wk;exports.TimeToComplete=Fa;exports.Toggle=y_;exports.Tooltip=Ln;exports.TopLevelPage=N_;exports.UUID_V4_REGEX=Hr;exports.UserContext=it;exports.UserProvider=$d;exports.VisuallyHidden=Me;exports.addAriaProps=sf;exports.basicReducer=pr;exports.camelCaseToDashCase=yd;exports.checkIntlPathExists=fa;exports.enrichPostCategories=Po;exports.generateConditions=Ui;exports.generateCssIcon=Vh;exports.getAuthorData=xr;exports.getCharacterLimitProps=kf;exports.getLongDate=ho;exports.getMember=ga;exports.getPostBody=jo;exports.getShortDate=Ed;exports.getValueLength=va;exports.headerData=ri;exports.likesResponseMock=Fv;exports.mapGetStreamData=Uk;exports.pageReady=_d;exports.passwordValidator=Ps;exports.repliesFeedMock=cv;exports.supportedLanguages=Mi;exports.toCamelCase=xd;exports.toCapitalisedCase=qh;exports.toSentenceCase=wd;exports.transformSlugs=Ls;exports.useAutoResize=md;exports.useBadges=Pd;exports.useCurrentPath=hd;exports.useEffectAfterMount=or;exports.useElementWidth=wn;exports.useOverlay=Ld;exports.useScrollListener=gd;exports.useScrollToHash=fo;exports.useTooltips=mo;exports.useUser=ha;