@apolitical/component-library 6.6.10-beta.0 → 6.6.10-beta.1

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 +2 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -63,7 +63,7 @@ Valid keys: `+JSON.stringify(Object.keys(D),null," "));var X=oe($,ne,j,q,P+"."+
63
63
 
64
64
  `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await _d({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},So=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),iv=(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},av=(e,t)=>e?typeof e=="string"?e:e[t]:"",sv=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:d},profile:m,locale:h=Do})=>{const p=ae.useIntl(),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,g]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),x={...a,...d},{activities:C,error:A,fetchNextPage:E,hasNextPage:_,isLoading:T,mutations:{create:L,edit:O,remove:z,like:R,unlike:B,pin:F,unpin:S,createPoll:M,createVote:U,removeVote:V,removePoll:ie}}=Gg({queryKey:[e,t,"activities",v],queryFns:x,filterOption:v[0]});y.useEffect(()=>{i&&g(b.concat(i==null?void 0:i.map(({slug:Y,name:k})=>({id:Y,text:k,type:"category"}))))},[i]);const[te,D]=y.useState(null),J=()=>{D(C.length),E()};return mf(),A?c.jsx(wn,{variant:"error",text:A.message}):c.jsxs("section",{children:[c.jsx(fu,{isCard:!0,parentId:t,categories:i,form:{content:{type:br.Post,slugs:{}},functions:{create:L,createPoll:M,...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(wf,{className:"activities-feed-filtering",options:b.map(({id:Y,text:k})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${k}`,defaultMessage:k})})),defaultOptions:v.map(({id:Y,text:k})=>({id:Y,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${k}`,defaultMessage:k})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:Y,previous:k})=>{if(Y[0]===k[0])return;f([b.find(P=>P.id===Y[0])]);const j=b.find(P=>P.id===Y[0]);if(!j)return;const q=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${j.text}`,defaultMessage:j.text})})}});document.dispatchEvent(q)}}),C==null?void 0:C.map((Y,k)=>{var be,Te,Ae,We,Le,ze,Ke,je,Ne;const{id:j,own_reactions:q,latest_reactions:P,reaction_counts:$,mentioned_users:K,total_replies:G,additional_data:ne}=Y,oe=(((be=P==null?void 0:P.like)==null?void 0:be.length)||0)>0,X=(((Te=q==null?void 0:q.like)==null?void 0:Te.length)||0)>0,ge=X?q==null?void 0:q.like[0].id:"",de=oe?(Ae=P==null?void 0:P.like)==null?void 0:Ae.map(we=>{var Z,se,ve;return{id:(Z=we==null?void 0:we.user)==null?void 0:Z.id,name:(ve=(se=we==null?void 0:we.user)==null?void 0:se.data)==null?void 0:ve.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(oi,{content:{type:Y.verb,title:Y==null?void 0:Y.title,body:Y==null?void 0:Y.content,canLike:n,createdAt:(Y==null?void 0:Y.time)||"",slugs:{question:`${e}/${t}`,answer:j},slug:j,author:yr(Y==null?void 0:Y.actor),userLiked:X,likes:($==null?void 0:$.like)||0,comments:G||0,peopleWhoLiked:de,data:{mentions:K,...ne||{}},pinned:($==null?void 0:$.pin)&&($==null?void 0:$.pin)>0||!1,categories:So((Y==null?void 0:Y.categories)||[],i||[]),pollOptions:sf(Y,h),pollSettings:{showRemoveVote:(We=Y==null?void 0:Y.settings)==null?void 0:We.show_remove_vote,allowMultipleVotes:(Le=Y==null?void 0:Y.settings)==null?void 0:Le.allow_multiple_votes,deadlineAt:(ze=Y==null?void 0:Y.settings)==null?void 0:ze.deadline_at,hideParticipants:(Ke=Y==null?void 0:Y.settings)==null?void 0:Ke.hide_participants,numberOfWinners:(je=Y==null?void 0:Y.settings)==null?void 0:je.number_of_winners,resultsVisibility:(Ne=Y==null?void 0:Y.settings)==null?void 0:Ne.results_visibility}},links:{post:`${e}/${t}/${j}`,comments:`${e}/${t}/${j}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:j}),updateContent:(we,{body:Z})=>O({activityId:j,content:Z})},likes:{createLike:()=>R({activityId:j}),deleteLike:()=>B({activityId:j,reactionId:ge}),listLikes:we=>u.list({activityId:j,...we})},comments:{openComments:()=>null},pins:{createPin:()=>F({activityId:j}),deletePin:()=>S({activityId:j,reactionId:P==null?void 0:P.pin[0].id})},polls:{createVote:({reactionId:we})=>U({activityId:j,reactionId:we}),removeVote:({reactionId:we})=>V({activityId:j,reactionId:we}),removePoll:()=>ie({activityId:j})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:k===te,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]},basePath:e,parentId:t})},j)}),!T&&c.jsx(ii,{hasNextPage:_,loadNextPage:J,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(Ft,{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(Fe,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(mu,{form:m})]})},ov={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 uv({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=ae.useIntl();return c.jsx(fu,{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 lv({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=ae.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 cv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=$e.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Qu({reply:Ng(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=Qu({reply:o,user:a});r.setQueryData(i,cr(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Ao(d.id,"reply")},0)}});return s}function dv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=$e.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=Dt(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function fv({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 f,b,g,x;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((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 A;return((A=C==null?void 0:C.user)==null?void 0:A.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",v=m?(x=i==null?void 0:i.like)==null?void 0:x.map(C=>{var A,E,_;return{id:(A=C==null?void 0:C.user)==null?void 0:A.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:hv(s),createdAt:o,data:mv(s),likeId:p,liked:m,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!h}})}function mv(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 hv(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function pf({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=$e.useQueryClient(),l=fa(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Eo(u),mutate:_o(u)},user:l,...u},m=cv({...d,mutationFn:e}),h=dv({...d,mutationFn:t}),p=pv({...d,mutationFn:n}),v=vv({...d,mutationFn:i}),f=bv({...d,mutationFn:a}),{replies:b,...g}=gv({queryKey:s,queryFn:r});return{replies:fv({replies:b,user:l}),mutations:{create:m,edit:h,remove:v,like:p,unlike:f},user:l,...g}}function pv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=$e.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Dt(s,o);return l&&Ju({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Dt(o,l);u&&Ju({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function gv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=$e.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Fo(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function vv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=$e.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>ff(i,a)),onError:n});return r}function bv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=Dt(a,s);return o&&Ig({reply:o,user:r}),s}),onError:n});return i}const yv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:v,edit:f,like:b,remove:g,unlike:x}}=pf({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:E=>a.list({...E,reactionId:i})}});lo([p]);const[C,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Fe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!C),children:l.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&c.jsx(ph,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},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:O,userLiked:z,peopleWhoLiked:R,parent:B,user:F,likeId:S})=>c.jsx(oi,{isCommunity:!0,content:{id:E,type:Be.Reply,body:L,canLike:n,createdAt:O,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:yr(F),userLiked:z,likes:_,peopleWhoLiked:R,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:E}),updateContent:(M,{body:U})=>f({replyId:E,content:U})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>x({replyId:E,reactionId:S}),listLikes:M=>o.list({replyId:E,...M})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:r||""},{scope:dt.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function xv({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:l,likeId:u,likes:d,peopleWhoLiked:m,replyId:h,createdAt:p,user:v,userLiked:f}=s,{edit:b,like:g,remove:x,unlike:C}=e.mutations;return c.jsx(dh,{children:c.jsx(oi,{isCommunity:!0,content:{id:h,type:Be.Reply,body:o,canLike:i,createdAt:p,slugs:{question:`${n}/${a}`,answer:t,reply:h},slug:h,author:yr(v),userLiked:f,likes:d,peopleWhoLiked:m,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:h}),updateContent:(A,{body:E})=>b({replyId:h,content:E})},likes:{createLike:()=>g({replyId:h}),deleteLike:()=>C({replyId:h,reactionId:u}),listLikes:A=>e.likes.list({replyId:h,...A})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:a||""},{scope:dt.Platform,area:"all"}]},children:c.jsx(yv,{basePath:n,parentId:a,activityId:t,replyId:h,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},h)},h)}const gf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:x,like:C,unlike:A}}=pf({queryKey:[t,n,e,"replies"],queryFns:u}),[E,_]=y.useState(null);lo([v]),mf();const T={create:(L,O)=>{const{body:z}=O;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(hh,{type:"comment",responses:r,isLoading:v}),m?c.jsxs(c.Fragment,{children:[c.jsx(uv,{parentId:n,isMember:i,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map((L,O)=>c.jsx(xv,{activityId:e,basePath:t,focus:E===O,formFns:{form:a,likes:l,reactions:u,mutations:{remove:g,edit:x,like:C,unlike:A}},isMember:i,parentId:n,reply:L},L.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(lv,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:_,totalReplies:f.length})]}):c.jsx(Ft,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(mu,{form:d})]})};function wv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=$e.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Fo(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function Cv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=wv({queryKey:t,queryFn:e});return{likes:n,...r}}function vf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=Cv({queryKey:[e,t,n,"likes"],queryFns:i.likes});y.useEffect(()=>{l()},[l]);const u=a.map(({user:d})=>d).map(d=>d?yr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(ch,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const bf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=ae.useIntl();return c.jsx(un,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:W("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(vf,{...a,likeCount:r??0,functions:{likes:n}})})},Dv=Object.freeze(Object.defineProperty({__proto__:null,default:bf},Symbol.toStringTag,{value:"Module"})),Ev={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 _v=3e3,yf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[i,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Kr,{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})},_v)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx($n,{className:W({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Vn="discussion_",xf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Vn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Vn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Vn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:W("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(hf,{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(Kr,{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:`${Vn}comments_screenReader`},{count:i.count}),children:l.formatMessage({id:`${Vn}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Kr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Vn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(yf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(Cf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const kv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:W("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(xn,{href:s?void 0:a,...l,children:sr(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const jo=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:W("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:m=>{if(m.preventDefault(),m.stopPropagation(),a){a(m);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 wf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(v=>v.id):[]),[m,h]=y.useState(0),p=(v,f)=>{let b=[];u.includes(v)&&!a?b=u.filter(g=>g!==v):v==="all"?b=["all"]:r?b=[...u.filter(g=>g!=="all"),v]:b=[v],d(g=>(i&&typeof i=="function"&&i({current:b,previous:g}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:W("filters",s),children:l.map(({id:v,text:f,disabled:b=!1,callback:g=()=>{}},x)=>{let C={tabIndex:m===x?0:-1};return b&&(C={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:W(v,{selected:u.includes(v)}),onClick:A=>{A.preventDefault(),A.stopPropagation(),p(v,g)},onKeyDown:A=>{var L,O;let E=x+1,_,T;switch(A.code){case"Enter":case"Space":A.preventDefault(),A.stopPropagation(),p(v,g);break;case"ArrowLeft":case"ArrowRight":A.preventDefault(),A.stopPropagation(),A.code==="ArrowLeft"?(E=x-1,E<0&&(E=l.length-1)):E>=l.length&&(E=0),h(E),_=A.currentTarget.closest("li"),T=(L=_==null?void 0:_.parentElement)==null?void 0:L.children[E],(O=T==null?void 0:T.querySelector("button"))==null||O.focus();break}},"aria-selected":u.includes(v),...C,children:f})},v)})})},Fv=(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 pi="languageSwitcher_",Av=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(po),[m,h]=y.useState(e);if(y.useEffect(()=>{e!==m&&h(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=m!==e;return c.jsxs("div",{className:W("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${pi}label`})}),c.jsx("ul",{children:v.map(b=>{var C;if(!Pi[b])return null;const g=(C=r[b])==null?void 0:C.post_name;let x={className:b};if(m===b)x["aria-label"]=u.formatMessage({id:`${pi}selected`},{language:Pi[b]});else{const A=Fv(b,g,a);x={...x,href:typeof A=="string"?A:A.url,onClick:E=>{h(b),d(b),typeof i<"u"&&(E.preventDefault(),E.stopPropagation(),i(b,typeof A=="string"?A:A.urlForRouter))}}}return c.jsx("li",{children:c.jsx(xn,{...x,fallbackElement:"span",children:Pi[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${pi}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${pi}disclaimer`},{email:Qn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const qa=ae.createIntl({locale:"en",messages:pr}),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:qa.formatMessage({id:"loadMore_button"}),endOfFeed:qa.formatMessage({id:"loadMore_endOfFeed"}),error:qa.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),h=async p=>{if(!n)try{await t(p)}catch(v){v instanceof Error?m(v.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:W("load-more",l),children:!d&&e?c.jsx(Fe,{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 Po=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:W("logo",e,t,n),...r,children:c.jsx(Me,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let gi=!1;const Cf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=ae.useIntl(),a=y.useRef(null),[s,o]=y.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:a,className:W("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Fe,{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:m,icon:h,...p},v)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{gi&&(clearTimeout(gi),gi=!1)},onBlur:()=>{gi=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Fe,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${v}`)})})]})})},Bv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Tv=y.lazy(()=>Promise.resolve().then(()=>Ap)),Sv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Df=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(at),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Sv.map(({key:a,href:s})=>{const o=Bv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:W(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(Tv,{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"})]})},Fr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,jv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Fr(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(`${Fr(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(`${Fr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${Fr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Fr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Pv="shareLinks_",Ov=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ae.useIntl(),l=jv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:W("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:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const v={};return p&&(v.onClick=f=>p(f,m)),c.jsx("li",{children:c.jsx(Fe,{size:i,variant:"tertiary",icon:{icon:d||u},href:m,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:`${Pv}link_${u}`}),...v})},u)})})]})};const Mv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),i=Rn(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){a=g;break}}}const[s,o]=y.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const x=r(e[g].id,e[g].text,g),C=document.getElementById(`tab-${x}`);C==null||C.focus(),u(x);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:g,href:x,hasCarousel:C,breakpoint:A},E)=>{if(A&&!m(A))return;f=r(f,b,E);const _=s===f,T={};x||(T["aria-controls"]=f,T.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:x||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:W({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:L=>d(L,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:W("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const Nv={"2-1":901,"1-3":769,"1-1":769},Ef=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=Rn(!0);let s=i;return y.Children.count(i)===1&&(s=y.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:W("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<Nv[e]?null:o)})};const Oo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ae.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:W("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})})]})},pa=e=>(e==null?void 0:e.toString().length)||0,_f=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{pa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const vi="emailHelperTextBox_",kf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ae.useIntl(),[s,o]=y.useState({path:`${vi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${vi}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"){f(a.formatMessage({id:`${vi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,i]);y.useEffect(()=>{let v=vi,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="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",f="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",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>d(x),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="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:f,link:b,mail:g})},[t]);const m={};return["link","mail"].forEach(v=>{m[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(Td,{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(It,{element:"span"}),c.jsx(It,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...m,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:m={},...h})=>{const p=y.useRef(),v=r||p,{autosizeToFit:f=!1}=m;return fd(f&&t==="textarea",v),y.useEffect(()=>{var b;u&&((b=v.current)==null||b.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:v,...h,id:n,name:a,className:W(e,t,{autoresize:f}),value:l,placeholder:s,autoFocus:u,...i,onChange:b=>{const g=b.target;i.onChange(g.value)}})};const Wn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Iv=500,Rv=({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},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{v||m(E=>({...E,debouncedInput:l}))},Iv);return()=>{clearTimeout(A)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];f(_=>({..._,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(_=>({..._,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,v]),y.useEffect(()=>{p>=0&&h[p]&&m(A=>({...A,displayInput:h[p].description}))},[p,h]);const g=A=>{[Wn.DOWN,Wn.UP,Wn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Wn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):A.key===Wn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):A.key===Wn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=A=>{s(A.target.value),m(E=>({...E,input:A.target.value,displayInput:A.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},C=A=>{s(A.description),m(E=>({...E,input:A.description,displayInput:A.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((A,E)=>c.jsx("li",{onClick:()=>C(A),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:E})),className:W("predictions-list-item",{active:E===p}),children:A.description},E))})]})};const Mo=({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:m=!1}={}}={},...h})=>{const p=ae.useIntl(),{onChange:v,...f}=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:W("pretty-checkbox",{radio:u==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:x=>{(x.key==="Enter"||x.code==="Space")&&(x.preventDefault(),x.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return y.createElement(n,{onClick:x=>{const C=x.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(x.preventDefault(),x.stopPropagation(),b())},onKeyDown:m?x=>{var C,A,E;if(x.key!=="Tab")switch(x.code){case"Enter":case"Space":x.stopPropagation(),x.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":x.stopPropagation(),x.preventDefault();const _=x.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(x.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=(A=_==null?void 0:_.parentElement)==null?void 0:A.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:W(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},g)};const $v=y.memo(function({direction:t="down"}){return c.jsx(la,{className:W("rotating-chevron",`direction-${t}`)})});const Lv=({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=ae.useIntl(),[m,h]=y.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:x,onMultiSelectSubmit:C,...A}=i,E=T=>{if(o){let L=[];f!=null&&f.includes(T.id)?L=f.filter(O=>O!==T.id):L=[...f,T.id],b([...L]),x&&x([...L])}else b([T]),x&&x(T.id),h(!1)},_=T=>{if(T==="all"){const L=(t==null?void 0:t.map(O=>O.id))||[];b(L),x&&x(L)}else b([]),x&&x([])};return c.jsxs("div",{className:W("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:g.label,c.jsx($v,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const L=t&&t.find(O=>O.id===T.target.value);E(L)},hidden:!m,...A,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:!m,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:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Fe,{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(Fe,{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||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:W("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:O=>{O.preventDefault(),O.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:W({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Fe,{variant:"secondary",onClick:()=>{C&&C(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Pr=(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 Ua=null;const zv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=ae.useIntl(),{showCount:p=!1,label:v,defaultInputs:f=1,maxInputs:b=100,hasButton:g=!1,allowDuplicateValues:x=!1}=o||{},[C,A]=y.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),E=C.filter(z=>z!==""),_=()=>{if(!u)return;const z=Ot(u.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),R=[];C.map((F,S)=>{if(b&&S>=b)return;const M=Ot(l??[]);e&&(x||M.push({condition:U=>{var D;const V=U[e].toLowerCase(),ie=((D=U[`${e}-all`])==null?void 0:D.length)??0,te=new Set(U[`${e}-all`].map(J=>J.toLowerCase()));return te.has(V)&&te.size<ie},error:h==null?void 0:h.formatMessage({id:"form_error_multipleInputs_same"})}),M.forEach(U=>{const{condition:V,error:ie}=U;if(typeof V=="function")U.condition=te=>{var Y;let D=(Y=te==null?void 0:te[e])==null?void 0:Y[S];D||(te[e]&&!Array.isArray(te[e])?D=te[e]:D="");const J=Ot(te);return J[e]=D,J[`${e}-all`]=te[e],typeof V=="function"&&V(J)?ie:!1};else{const te=V;U.condition=D=>{var Y;let J=(Y=D==null?void 0:D[e])==null?void 0:Y[S];switch(J||(D[e]&&!Array.isArray(D[e])?J=D[e]:J=""),te){case"required":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ie||(U.error=ie||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Pr(te,J)?U.error:!1}}}),R.push({id:`${e}-${S}`,validation:M,value:F}))});const B={fieldsToValidate:z.concat(R)};u.multipleInputs.includes(e)&&(B.multipleInputs=u.multipleInputs.filter(F=>F!==e)),u.setFields(F=>({...F,...B}))};y.useEffect(()=>{_()},[C.length]),y.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&_()},[u==null?void 0:u.multipleInputs]);const T=()=>{(!b||C.length<b)&&A([...C,""])},L=z=>{const R=document.getElementById(`${e}-${z+1}`);R==null||R.focus()},O=(z,R)=>z.replace("{number}",R+1);return c.jsxs("fieldset",{className:W("multiple-inputs field-wrapper",{"has-button":g,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",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,R)=>{if(b&&R>=b)return c.jsx(c.Fragment,{});let B=!1;t?B=c.jsx(Me,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:R+1})}):v&&(B=O(v,R));const F=`${e}-${R}`,S=R+1>f;return c.jsx(Ff,{id:F,type:"text",label:B,value:z,placeholder:i?O(i,R):void 0,className:W({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{g||R!==C.length-1||T()},onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),M.stopPropagation(),Ua&&clearTimeout(Ua),R!==C.length-1?L(R):(T(),Ua=setTimeout(()=>L(R),100)))},onChange:M=>{const U=C[R].toLowerCase(),V=Ot(C);V[R]=M,A(V),u==null||u.dispatch({type:"removeError",payload:{key:F}}),x||V.forEach((ie,te)=>{Hr(ie)&&te!==R&&ie.toLowerCase()===U&&(u==null||u.dispatch({type:"removeError",payload:{key:`${e}-${te}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(Fe,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const M=Ot(C);M.splice(R,1),A(M),u==null||u.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(M)}}):void 0,...m},F)}),g?c.jsx(Fe,{...g,onClick:T,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const tl=({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:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const v=ae.useIntl(),f=a?d:[],b=d;return c.jsx("ul",{...p,className:W("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:x=!1,value:C=g,disabled:A=!1})=>{const E=`${r}_${g}`,_=()=>{if(A)return;let T;if(a){const L=f==null?void 0:f.indexOf(C);Array.isArray(f)&&L>=0?(T=f,T.splice(L,1)):(!f||f.length===0?T=[]:T=f,T.push(C))}else T=b===C?void 0:C;t.onChange(T)};return c.jsx(Mo,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:C,value:a?f==null?void 0:f.includes(C):b===C,functions:{...t,onChange:_},intlPath:n,label:x||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:A,accessibilityOptions:m},E)})})};const qv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),h=()=>{var p;u(!l),m(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:W("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:Mo},checkboxes:{component:tl,props:{multiSelect:!0}},radio:{component:tl,props:{multiSelect:!1}},select:{component:Lv},password:{component:qv},autocomplete:{component:Rv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Ff=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:v,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(zv,{...e});const b=d&&d.some(({condition:S})=>S==="required"),g=pa(m),x=u&&Hn[u]&&Hn[u].component?Hn[u].component:Jn,C=u&&["checkboxes","radio"].includes(u),A=u&&["autocomplete"].includes(u),E=a&&`error-${n}`,_=`character-limit-${n}`,T={};C?T.element="legend":T.htmlFor=n;let L={...f,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const O=S=>{L["aria-describedby"]?L["aria-describedby"]+=` ${S}`:L["aria-describedby"]=S};if(o>0){const S=_f(o,s);O(`${_}-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,O(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),R=({...S})=>a?y.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(x,{...L,label:z,className:W("field-wrapper",i)}),c.jsx(R,{as:"p"})]});const B={};C?T.className="legend-as-label text-small":B.className="field-label";const F=({element:S,...M})=>y.createElement(S||"label",{...M,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(C?"fieldset":"div",{className:W("field-wrapper text-medium",i,`${u}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(C?y.Fragment:"p",B,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(C||A?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(x,{...L}),c.jsx(Oo,{id:_,limit:o,valueLength:g}),v]})),c.jsx(R,{})]}))})},Uv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Ot(e.errors):{},a=e.values?Ot(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,m=Ot(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:f=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=f||g)}else{const g=a[h.id],x=v;switch(x){case"required":Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Pr(x,g)&&(b=f||(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}}),m.push(h.id);break}}return m.length===0?l(a):u(a,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Va=null;const Jt=({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:m,...h})=>{const p=(t||[]).filter($=>$.type==="multiple-inputs").map($=>$.id),[v,f]=y.useState({fieldsToValidate:t,multipleInputs:p});y.useEffect(()=>{v.multipleInputs.length||f($=>({...$,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:g,...x}=s,C=40,{shouldShowCancelButton:A=!1,shouldReset:E=!0,shouldHide:_=!0,showRequiredLabels:T=!0,showSuccessMessage:L=!1}=l||{},{onSuccess:O=async()=>{},onCancel:z=()=>{},onCatch:R=()=>{},onFailure:B=()=>{}}=m||{},F=ae.useIntl(),S={};t.length&&t.forEach($=>{const K=$.id||$.name;K&&(S[K]=$.value||"")});const[M,U]=y.useReducer(Uv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:S}),{errors:V,isSubmitting:ie,formSubmitted:te,values:D}=M;y.useEffect(()=>{E&&te&&(Va=setTimeout(()=>{U({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[te]),y.useEffect(()=>()=>{Va&&clearTimeout(Va)},[]),y.useEffect(()=>{const $=K=>{U({type:"updateValue",payload:{key:K.detail.id,value:K.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",$),()=>{document.removeEventListener("dropdownMultiSelectSubmit",$)}},[]);const J=y.useRef(null),Y=i||J,k=Ur(()=>{if(!ie){if(U({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&U({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:U,intl:F}});return}U({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:U,onSuccess:async $=>{try{await O($),U({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(K){R(K),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:($,K)=>{B($,K),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:F}})}},100);if(!t.length)return null;const j={};s.children&&(j.default=s.children),x.text&&typeof x.text=="string"&&(j.default=x.text),["default","submitting","submitted"].forEach($=>{x.text&&typeof x.text!="string"&&$ in x.text?j[$]=x.text[$]:j[$]||(j[$]=F.formatMessage({id:`form_${$==="default"?"submit":$}`}))}),delete x.text;const q=$=>{var ne;if($.preventDefault(),$.stopPropagation(),ie)return;let K=0;if((ne=Y==null?void 0:Y.current)!=null&&ne.id){const oe=document.getElementById(Y.current.id);oe&&(K=oe.getBoundingClientRect().top+window.scrollY)}const G=document.getElementById("header");G&&(K=K-G.offsetHeight-C),K<0&&(K=0),window.scrollTo({top:K,behavior:"smooth"}),k()},P=[{...x,icon:te?{icon:"tick",position:"left"}:!1,className:W("gtm-trackable",x.className),onClick:q,disabled:ie||te||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:j[ie?"submitting":te?"submitted":"default"]}];return A&&P.unshift({...o,className:W("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ie||te,onClick:z,children:o.text||F.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:W("form",n),ref:Y},c.jsxs(c.Fragment,{children:[V!=null&&V.general?c.jsx(wn,{variant:"error",text:F.formatMessage({id:"form_error_generalError"})}):null,u,(!_||!ie&&!te||b)&&t.map(($,K)=>{const{id:G=$.name||K,component:ne,functions:oe={onChange:()=>{}},submitOnEnter:X=!1}=$;if(ne)return c.jsx(ne,{...$.props||{}},`component-${G}-${K}`);const ge=(D==null?void 0:D[G])||"",de={...oe,onChange:be=>{U({type:"updateValue",payload:{key:G,value:be}}),oe.onChange(be,U)}};return X&&(de.onKeyDown=be=>{be.key==="Enter"&&(be.stopPropagation(),be.preventDefault(),k()),oe.onKeyDown&&oe.onKeyDown(be)}),c.jsx(Ff,{intlPath:a,...$,showRequiredLabels:T,value:ge,error:$.type==="multiple-inputs"?V:V==null?void 0:V[G],functions:de,fieldData:{fields:v.fieldsToValidate,multipleInputs:v.multipleInputs,setFields:f,dispatch:U}},G)}),g?null:(ie||te)&&b?b:c.jsx(gr,{className:W("cta",{center:ie||te,submitted:te}),buttons:P})]})),L&&te&&c.jsx(ur,{className:"success",children:typeof L=="string"?L:F.formatMessage({id:"form_success"})})]})};const bi="passwordRules_",Af="isMoreThanEightCharacters",Bf="includesNumberAndSymbol",Tf="includesLowerAndUppercase",Vv={[Af]:"8Characters",[Bf]:"numberSymbol",[Tf]:"lowercaseUppercase"},Wv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:W("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${bi}intro`})}),c.jsx("ul",{children:[Af,Bf,Tf].map(r=>c.jsxs("li",{className:W({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${bi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${bi}rule_${Vv[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${bi}notMet`})]})]},`rule-${r}`))})]})},Sf=y.memo(Wv);const Hv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(x=>({...x,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(x=>({...x,setUp:!0,disabled:!0})),i(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(It,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,v="ratings_",f={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(!(!m||p))try{u(x=>({...x,rating:g,disabled:!0})),await r({id:m,value:g})}catch(x){u(C=>({...C,rating:null})),i(x)}finally{u(x=>({...x,disabled:!1}))}};return c.jsxs("div",{className:W("rating",a),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const x=g+1;return c.jsx("li",{className:W({selected:h&&x<=h}),children:c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:`star${!h||x>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:x,total:t})}${x===1||x===t?` - ${f[x===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(x)},disabled:p})},`rating-${x}`)})})]})},Kv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,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)}},ln=y.createContext(Kv);var H=(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))(H||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Zv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Yv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var Gv=Xv,jf="֑-߿יִ-﷽ﹰ-ﻼ",Pf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Qv=new RegExp("^[^"+Pf+"]*["+jf+"]"),Jv=new RegExp("^[^"+jf+"]*["+Pf+"]");function Xv(e){return e=String(e||""),Qv.test(e)?"rtl":Jv.test(e)?"ltr":"neutral"}const Of=In(Gv);function eb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var No=eb,tb=typeof li=="object"&&li&&li.Object===Object&&li,nb=tb,rb=nb,ib=typeof self=="object"&&self&&self.Object===Object&&self,ab=rb||ib||Function("return this")(),Mf=ab,sb=Mf,ob=function(){return sb.Date.now()},ub=ob,lb=/\s/;function cb(e){for(var t=e.length;t--&&lb.test(e.charAt(t)););return t}var db=cb,fb=db,mb=/^\s+/;function hb(e){return e&&e.slice(0,fb(e)+1).replace(mb,"")}var pb=hb,gb=Mf,vb=gb.Symbol,Nf=vb,nl=Nf,If=Object.prototype,bb=If.hasOwnProperty,yb=If.toString,Ar=nl?nl.toStringTag:void 0;function xb(e){var t=bb.call(e,Ar),n=e[Ar];try{e[Ar]=void 0;var r=!0}catch{}var i=yb.call(e);return r&&(t?e[Ar]=n:delete e[Ar]),i}var wb=xb,Cb=Object.prototype,Db=Cb.toString;function Eb(e){return Db.call(e)}var _b=Eb,rl=Nf,kb=wb,Fb=_b,Ab="[object Null]",Bb="[object Undefined]",il=rl?rl.toStringTag:void 0;function Tb(e){return e==null?e===void 0?Bb:Ab:il&&il in Object(e)?kb(e):Fb(e)}var Sb=Tb;function jb(e){return e!=null&&typeof e=="object"}var Pb=jb,Ob=Sb,Mb=Pb,Nb="[object Symbol]";function Ib(e){return typeof e=="symbol"||Mb(e)&&Ob(e)==Nb}var Rb=Ib,$b=pb,al=No,Lb=Rb,sl=0/0,zb=/^[-+]0x[0-9a-f]+$/i,qb=/^0b[01]+$/i,Ub=/^0o[0-7]+$/i,Vb=parseInt;function Wb(e){if(typeof e=="number")return e;if(Lb(e))return sl;if(al(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=al(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$b(e);var n=qb.test(e);return n||Ub.test(e)?Vb(e.slice(2),n?2:8):zb.test(e)?sl:+e}var Hb=Wb,Kb=No,Wa=ub,ol=Hb,Zb="Expected a function",Yb=Math.max,Gb=Math.min;function Qb(e,t,n){var r,i,a,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Zb);t=ol(t)||0,Kb(n)&&(d=!!n.leading,m="maxWait"in n,a=m?Yb(ol(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 f(_){var T=_-l,L=_-u,O=t-T;return m?Gb(O,a-L):O}function b(_){var T=_-l,L=_-u;return l===void 0||T>=t||T<0||m&&L>=a}function g(){var _=Wa();if(b(_))return x(_);o=setTimeout(g,f(_))}function x(_){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 A(){return o===void 0?s:x(Wa())}function E(){var _=Wa(),T=b(_);if(r=arguments,i=this,l=_,T){if(o===void 0)return v(l);if(m)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=C,E.flush=A,E}var Rf=Qb;const Jb=In(Rf);var Xb=Rf,e0=No,t0="Expected a function";function n0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(t0);return e0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Xb(e,t,{leading:r,maxWait:t,trailing:i})}var r0=n0;const i0=In(r0),ul=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ll=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ha=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ll(n.overflowY,t)||ll(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},yi=(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,a0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},cl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:U=>U!==u;if(!ul(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;ul(v)&&m(v);){if(v=a0(v),v===h){p.push(v);break}v!=null&&v===document.body&&Ha(v)&&!Ha(document.documentElement)||v!=null&&Ha(v,d)&&p.push(v)}const f=(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:x}=window,{height:C,width:A,top:E,right:_,bottom:T,left:L}=e.getBoundingClientRect(),{top:O,right:z,bottom:R,left:B}=(U=>{const V=window.getComputedStyle(U);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-O:o==="end"?T+R:E+C/2-O+R,S=l==="center"?L+A/2-B+z:l==="end"?_+z:L-B;const M=[];for(let U=0;U<p.length;U++){const V=p[U],{height:ie,width:te,top:D,right:J,bottom:Y,left:k}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&L>=0&&T<=b&&_<=f&&E>=D&&T<=Y&&L>=k&&_<=J)return M;const j=getComputedStyle(V),q=parseInt(j.borderLeftWidth,10),P=parseInt(j.borderTopWidth,10),$=parseInt(j.borderRightWidth,10),K=parseInt(j.borderBottomWidth,10);let G=0,ne=0;const oe="offsetWidth"in V?V.offsetWidth-V.clientWidth-q-$:0,X="offsetHeight"in V?V.offsetHeight-V.clientHeight-P-K:0,ge="offsetWidth"in V?V.offsetWidth===0?0:te/V.offsetWidth:0,de="offsetHeight"in V?V.offsetHeight===0?0:ie/V.offsetHeight:0;if(h===V)G=o==="start"?F:o==="end"?F-b:o==="nearest"?yi(x,x+b,b,P,K,x+F,x+F+C,C):F-b/2,ne=l==="start"?S:l==="center"?S-f/2:l==="end"?S-f:yi(g,g+f,f,q,$,g+S,g+S+A,A),G=Math.max(0,G+x),ne=Math.max(0,ne+g);else{G=o==="start"?F-D-P:o==="end"?F-Y+K+X:o==="nearest"?yi(D,Y,ie,P,K+X,F,F+C,C):F-(D+ie/2)+X/2,ne=l==="start"?S-k-q:l==="center"?S-(k+te/2)+oe/2:l==="end"?S-J+$+oe:yi(k,J,te,q,$+oe,S,S+A,A);const{scrollLeft:be,scrollTop:Te}=V;G=de===0?0:Math.max(0,Math.min(Te+G/de,V.scrollHeight-ie/de+X)),ne=ge===0?0:Math.max(0,Math.min(be+ne/ge,V.scrollWidth-te/ge+oe)),F+=Te-G,S+=be-ne}M.push({el:V,top:G,left:ne})}return M},s0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function o0(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(cl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of cl(e,s0(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${Fr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Fr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Pv="shareLinks_",Ov=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ae.useIntl(),l=jv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:W("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:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const v={};return p&&(v.onClick=f=>p(f,m)),c.jsx("li",{children:c.jsx(Fe,{size:i,variant:"tertiary",icon:{icon:d||u},href:m,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:`${Pv}link_${u}`}),...v})},u)})})]})};const Mv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),i=Rn(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){a=g;break}}}const[s,o]=y.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const x=r(e[g].id,e[g].text,g),C=document.getElementById(`tab-${x}`);C==null||C.focus(),u(x);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:g,href:x,hasCarousel:C,breakpoint:A},E)=>{if(A&&!m(A))return;f=r(f,b,E);const _=s===f,T={};x||(T["aria-controls"]=f,T.onClick=L=>{L.preventDefault(),L.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:x||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:W({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:L=>d(L,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:W("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const Nv={"2-1":901,"1-3":769,"1-1":769},Ef=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=Rn(!0);let s=i;return y.Children.count(i)===1&&(s=y.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:W("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&a&&a<Nv[e]?null:o)})};const Oo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ae.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:W("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})})]})},pa=e=>(e==null?void 0:e.toString().length)||0,_f=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{pa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const vi="emailHelperTextBox_",kf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ae.useIntl(),[s,o]=y.useState({path:`${vi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${vi}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"){f(a.formatMessage({id:`${vi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,i]);y.useEffect(()=>{let v=vi,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="unrecognisedEmail",f="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",f="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",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>d(x),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="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:f,link:b,mail:g})},[t]);const m={};return["link","mail"].forEach(v=>{m[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(Td,{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(It,{element:"span"}),c.jsx(It,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...m,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:m={},...h})=>{const p=y.useRef(),v=r||p,{autosizeToFit:f=!1}=m;return fd(f&&t==="textarea",v),y.useEffect(()=>{var b;u&&((b=v.current)==null||b.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:v,...h,id:n,name:a,className:W(e,t,{autoresize:f}),value:l,placeholder:s,autoFocus:u,...i,onChange:b=>{const g=b.target;i.onChange(g.value)}})};const Wn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Iv=500,Rv=({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},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{v||m(E=>({...E,debouncedInput:l}))},Iv);return()=>{clearTimeout(A)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const E=await o(d)||[];f(_=>({..._,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(_=>({..._,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,v]),y.useEffect(()=>{p>=0&&h[p]&&m(A=>({...A,displayInput:h[p].description}))},[p,h]);const g=A=>{[Wn.DOWN,Wn.UP,Wn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Wn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):A.key===Wn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):A.key===Wn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=A=>{s(A.target.value),m(E=>({...E,input:A.target.value,displayInput:A.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},C=A=>{s(A.description),m(E=>({...E,input:A.description,displayInput:A.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((A,E)=>c.jsx("li",{onClick:()=>C(A),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:E})),className:W("predictions-list-item",{active:E===p}),children:A.description},E))})]})};const Mo=({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:m=!1}={}}={},...h})=>{const p=ae.useIntl(),{onChange:v,...f}=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:W("pretty-checkbox",{radio:u==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:x=>{(x.key==="Enter"||x.code==="Space")&&(x.preventDefault(),x.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return y.createElement(n,{onClick:x=>{const C=x.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(x.preventDefault(),x.stopPropagation(),b())},onKeyDown:m?x=>{var C,A,E;if(x.key!=="Tab")switch(x.code){case"Enter":case"Space":x.stopPropagation(),x.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":x.stopPropagation(),x.preventDefault();const _=x.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(x.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=(A=_==null?void 0:_.parentElement)==null?void 0:A.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:W(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},g)};const $v=y.memo(function({direction:t="down"}){return c.jsx(la,{className:W("rotating-chevron",`direction-${t}`)})});const Lv=({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=ae.useIntl(),[m,h]=y.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:x,onMultiSelectSubmit:C,...A}=i,E=T=>{if(o){let L=[];f!=null&&f.includes(T.id)?L=f.filter(O=>O!==T.id):L=[...f,T.id],b([...L]),x&&x([...L])}else b([T]),x&&x(T.id),h(!1)},_=T=>{if(T==="all"){const L=(t==null?void 0:t.map(O=>O.id))||[];b(L),x&&x(L)}else b([]),x&&x([])};return c.jsxs("div",{className:W("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:g.label,c.jsx($v,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const L=t&&t.find(O=>O.id===T.target.value);E(L)},hidden:!m,...A,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:!m,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:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Fe,{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(Fe,{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||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:W("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:O=>{O.preventDefault(),O.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:W({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Fe,{variant:"secondary",onClick:()=>{C&&C(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Pr=(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 Ua=null;const zv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=ae.useIntl(),{showCount:p=!1,label:v,defaultInputs:f=1,maxInputs:b=100,hasButton:g=!1,allowDuplicateValues:x=!1}=o||{},[C,A]=y.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),E=C.filter(z=>z!==""),_=()=>{if(!u)return;const z=Ot(u.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),R=[];C.map((F,S)=>{if(b&&S>=b)return;const M=Ot(l??[]);e&&(x||M.push({condition:U=>{var D;const V=U[e].toLowerCase(),ie=((D=U[`${e}-all`])==null?void 0:D.length)??0,te=new Set(U[`${e}-all`].map(J=>J.toLowerCase()));return te.has(V)&&te.size<ie},error:h==null?void 0:h.formatMessage({id:"form_error_multipleInputs_same"})}),M.forEach(U=>{const{condition:V,error:ie}=U;if(typeof V=="function")U.condition=te=>{var Y;let D=(Y=te==null?void 0:te[e])==null?void 0:Y[S];D||(te[e]&&!Array.isArray(te[e])?D=te[e]:D="");const J=Ot(te);return J[e]=D,J[`${e}-all`]=te[e],typeof V=="function"&&V(J)?ie:!1};else{const te=V;U.condition=D=>{var Y;let J=(Y=D==null?void 0:D[e])==null?void 0:Y[S];switch(J||(D[e]&&!Array.isArray(D[e])?J=D[e]:J=""),te){case"required":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ie||(U.error=ie||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":ie||(U.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Pr(te,J)?U.error:!1}}}),R.push({id:`${e}-${S}`,validation:M,value:F}))});const B={fieldsToValidate:z.concat(R)};u.multipleInputs.includes(e)&&(B.multipleInputs=u.multipleInputs.filter(F=>F!==e)),u.setFields(F=>({...F,...B}))};y.useEffect(()=>{_()},[C.length]),y.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&_()},[u==null?void 0:u.multipleInputs]);const T=()=>{(!b||C.length<b)&&A([...C,""])},L=z=>{const R=document.getElementById(`${e}-${z+1}`);R==null||R.focus()},O=(z,R)=>z.replace("{number}",R+1);return c.jsxs("fieldset",{className:W("multiple-inputs field-wrapper",{"has-button":g,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",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,R)=>{if(b&&R>=b)return c.jsx(c.Fragment,{});let B=!1;t?B=c.jsx(Me,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:R+1})}):v&&(B=O(v,R));const F=`${e}-${R}`,S=R+1>f;return c.jsx(Ff,{id:F,type:"text",label:B,value:z,placeholder:i?O(i,R):void 0,className:W({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{g||R!==C.length-1||T()},onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),M.stopPropagation(),Ua&&clearTimeout(Ua),R!==C.length-1?L(R):(T(),Ua=setTimeout(()=>L(R),100)))},onChange:M=>{const U=C[R].toLowerCase(),V=Ot(C);V[R]=M,A(V),u==null||u.dispatch({type:"removeError",payload:{key:F}}),x||V.forEach((ie,te)=>{Hr(ie)&&te!==R&&ie.toLowerCase()===U&&(u==null||u.dispatch({type:"removeError",payload:{key:`${e}-${te}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(Fe,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const M=Ot(C);M.splice(R,1),A(M),u==null||u.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(M)}}):void 0,...m},F)}),g?c.jsx(Fe,{...g,onClick:T,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const tl=({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:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const v=ae.useIntl(),f=a?d:[],b=d;return c.jsx("ul",{...p,className:W("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:x=!1,value:C=g,disabled:A=!1})=>{const E=`${r}_${g}`,_=()=>{if(A)return;let T;if(a){const L=f==null?void 0:f.indexOf(C);Array.isArray(f)&&L>=0?(T=f,T.splice(L,1)):(!f||f.length===0?T=[]:T=f,T.push(C))}else T=b===C?void 0:C;t.onChange(T)};return c.jsx(Mo,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:C,value:a?f==null?void 0:f.includes(C):b===C,functions:{...t,onChange:_},intlPath:n,label:x||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:A,accessibilityOptions:m},E)})})};const qv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),h=()=>{var p;u(!l),m(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:W("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:Mo},checkboxes:{component:tl,props:{multiSelect:!0}},radio:{component:tl,props:{multiSelect:!1}},select:{component:Lv},password:{component:qv},autocomplete:{component:Rv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Ff=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:v,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(zv,{...e});const b=d&&d.some(({condition:S})=>S==="required"),g=pa(m),x=u&&Hn[u]&&Hn[u].component?Hn[u].component:Jn,C=u&&["checkboxes","radio"].includes(u),A=u&&["autocomplete"].includes(u),E=a&&`error-${n}`,_=`character-limit-${n}`,T={};C?T.element="legend":T.htmlFor=n;let L={...f,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const O=S=>{L["aria-describedby"]?L["aria-describedby"]+=` ${S}`:L["aria-describedby"]=S};if(o>0){const S=_f(o,s);O(`${_}-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,O(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),R=({...S})=>a?y.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(x,{...L,label:z,className:W("field-wrapper",i)}),c.jsx(R,{as:"p"})]});const B={};C?T.className="legend-as-label text-small":B.className="field-label";const F=({element:S,...M})=>y.createElement(S||"label",{...M,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(C?"fieldset":"div",{className:W("field-wrapper text-small",i,`${u}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(C?y.Fragment:"p",B,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(C||A?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(x,{...L}),c.jsx(Oo,{id:_,limit:o,valueLength:g}),v]})),c.jsx(R,{})]}))})},Uv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Ot(e.errors):{},a=e.values?Ot(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,m=Ot(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:f=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=f||g)}else{const g=a[h.id],x=v;switch(x){case"required":Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Pr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Pr(x,g)&&(b=f||(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}}),m.push(h.id);break}}return m.length===0?l(a):u(a,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Va=null;const Jt=({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:m,...h})=>{const p=(t||[]).filter($=>$.type==="multiple-inputs").map($=>$.id),[v,f]=y.useState({fieldsToValidate:t,multipleInputs:p});y.useEffect(()=>{v.multipleInputs.length||f($=>({...$,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:g,...x}=s,C=40,{shouldShowCancelButton:A=!1,shouldReset:E=!0,shouldHide:_=!0,showRequiredLabels:T=!0,showSuccessMessage:L=!1}=l||{},{onSuccess:O=async()=>{},onCancel:z=()=>{},onCatch:R=()=>{},onFailure:B=()=>{}}=m||{},F=ae.useIntl(),S={};t.length&&t.forEach($=>{const K=$.id||$.name;K&&(S[K]=$.value||"")});const[M,U]=y.useReducer(Uv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:S}),{errors:V,isSubmitting:ie,formSubmitted:te,values:D}=M;y.useEffect(()=>{E&&te&&(Va=setTimeout(()=>{U({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[te]),y.useEffect(()=>()=>{Va&&clearTimeout(Va)},[]),y.useEffect(()=>{const $=K=>{U({type:"updateValue",payload:{key:K.detail.id,value:K.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",$),()=>{document.removeEventListener("dropdownMultiSelectSubmit",$)}},[]);const J=y.useRef(null),Y=i||J,k=Ur(()=>{if(!ie){if(U({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&U({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:U,intl:F}});return}U({type:"submitForm",payload:{fields:v.fieldsToValidate,dispatch:U,onSuccess:async $=>{try{await O($),U({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(K){R(K),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:($,K)=>{B($,K),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:F}})}},100);if(!t.length)return null;const j={};s.children&&(j.default=s.children),x.text&&typeof x.text=="string"&&(j.default=x.text),["default","submitting","submitted"].forEach($=>{x.text&&typeof x.text!="string"&&$ in x.text?j[$]=x.text[$]:j[$]||(j[$]=F.formatMessage({id:`form_${$==="default"?"submit":$}`}))}),delete x.text;const q=$=>{var ne;if($.preventDefault(),$.stopPropagation(),ie)return;let K=0;if((ne=Y==null?void 0:Y.current)!=null&&ne.id){const oe=document.getElementById(Y.current.id);oe&&(K=oe.getBoundingClientRect().top+window.scrollY)}const G=document.getElementById("header");G&&(K=K-G.offsetHeight-C),K<0&&(K=0),window.scrollTo({top:K,behavior:"smooth"}),k()},P=[{...x,icon:te?{icon:"tick",position:"left"}:!1,className:W("gtm-trackable",x.className),onClick:q,disabled:ie||te||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:j[ie?"submitting":te?"submitted":"default"]}];return A&&P.unshift({...o,className:W("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ie||te,onClick:z,children:o.text||F.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:W("form",n),ref:Y},c.jsxs(c.Fragment,{children:[V!=null&&V.general?c.jsx(wn,{variant:"error",text:F.formatMessage({id:"form_error_generalError"})}):null,u,(!_||!ie&&!te||b)&&t.map(($,K)=>{const{id:G=$.name||K,component:ne,functions:oe={onChange:()=>{}},submitOnEnter:X=!1}=$;if(ne)return c.jsx(ne,{...$.props||{}},`component-${G}-${K}`);const ge=(D==null?void 0:D[G])||"",de={...oe,onChange:be=>{U({type:"updateValue",payload:{key:G,value:be}}),oe.onChange(be,U)}};return X&&(de.onKeyDown=be=>{be.key==="Enter"&&(be.stopPropagation(),be.preventDefault(),k()),oe.onKeyDown&&oe.onKeyDown(be)}),c.jsx(Ff,{intlPath:a,...$,showRequiredLabels:T,value:ge,error:$.type==="multiple-inputs"?V:V==null?void 0:V[G],functions:de,fieldData:{fields:v.fieldsToValidate,multipleInputs:v.multipleInputs,setFields:f,dispatch:U}},G)}),g?null:(ie||te)&&b?b:c.jsx(gr,{className:W("cta",{center:ie||te,submitted:te}),buttons:P})]})),L&&te&&c.jsx(ur,{className:"success",children:typeof L=="string"?L:F.formatMessage({id:"form_success"})})]})};const bi="passwordRules_",Af="isMoreThanEightCharacters",Bf="includesNumberAndSymbol",Tf="includesLowerAndUppercase",Vv={[Af]:"8Characters",[Bf]:"numberSymbol",[Tf]:"lowercaseUppercase"},Wv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:W("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${bi}intro`})}),c.jsx("ul",{children:[Af,Bf,Tf].map(r=>c.jsxs("li",{className:W({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${bi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${bi}rule_${Vv[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${bi}notMet`})]})]},`rule-${r}`))})]})},Sf=y.memo(Wv);const Hv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(x=>({...x,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(x=>({...x,setUp:!0,disabled:!0})),i(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(It,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,v="ratings_",f={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(!(!m||p))try{u(x=>({...x,rating:g,disabled:!0})),await r({id:m,value:g})}catch(x){u(C=>({...C,rating:null})),i(x)}finally{u(x=>({...x,disabled:!1}))}};return c.jsxs("div",{className:W("rating",a),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const x=g+1;return c.jsx("li",{className:W({selected:h&&x<=h}),children:c.jsx(Fe,{variant:"tertiary",size:"small",icon:{icon:`star${!h||x>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:x,total:t})}${x===1||x===t?` - ${f[x===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(x)},disabled:p})},`rating-${x}`)})})]})},Kv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,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)}},ln=y.createContext(Kv);var H=(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))(H||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Zv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Yv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var Gv=Xv,jf="֑-߿יִ-﷽ﹰ-ﻼ",Pf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Qv=new RegExp("^[^"+Pf+"]*["+jf+"]"),Jv=new RegExp("^[^"+jf+"]*["+Pf+"]");function Xv(e){return e=String(e||""),Qv.test(e)?"rtl":Jv.test(e)?"ltr":"neutral"}const Of=In(Gv);function eb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var No=eb,tb=typeof li=="object"&&li&&li.Object===Object&&li,nb=tb,rb=nb,ib=typeof self=="object"&&self&&self.Object===Object&&self,ab=rb||ib||Function("return this")(),Mf=ab,sb=Mf,ob=function(){return sb.Date.now()},ub=ob,lb=/\s/;function cb(e){for(var t=e.length;t--&&lb.test(e.charAt(t)););return t}var db=cb,fb=db,mb=/^\s+/;function hb(e){return e&&e.slice(0,fb(e)+1).replace(mb,"")}var pb=hb,gb=Mf,vb=gb.Symbol,Nf=vb,nl=Nf,If=Object.prototype,bb=If.hasOwnProperty,yb=If.toString,Ar=nl?nl.toStringTag:void 0;function xb(e){var t=bb.call(e,Ar),n=e[Ar];try{e[Ar]=void 0;var r=!0}catch{}var i=yb.call(e);return r&&(t?e[Ar]=n:delete e[Ar]),i}var wb=xb,Cb=Object.prototype,Db=Cb.toString;function Eb(e){return Db.call(e)}var _b=Eb,rl=Nf,kb=wb,Fb=_b,Ab="[object Null]",Bb="[object Undefined]",il=rl?rl.toStringTag:void 0;function Tb(e){return e==null?e===void 0?Bb:Ab:il&&il in Object(e)?kb(e):Fb(e)}var Sb=Tb;function jb(e){return e!=null&&typeof e=="object"}var Pb=jb,Ob=Sb,Mb=Pb,Nb="[object Symbol]";function Ib(e){return typeof e=="symbol"||Mb(e)&&Ob(e)==Nb}var Rb=Ib,$b=pb,al=No,Lb=Rb,sl=0/0,zb=/^[-+]0x[0-9a-f]+$/i,qb=/^0b[01]+$/i,Ub=/^0o[0-7]+$/i,Vb=parseInt;function Wb(e){if(typeof e=="number")return e;if(Lb(e))return sl;if(al(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=al(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$b(e);var n=qb.test(e);return n||Ub.test(e)?Vb(e.slice(2),n?2:8):zb.test(e)?sl:+e}var Hb=Wb,Kb=No,Wa=ub,ol=Hb,Zb="Expected a function",Yb=Math.max,Gb=Math.min;function Qb(e,t,n){var r,i,a,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Zb);t=ol(t)||0,Kb(n)&&(d=!!n.leading,m="maxWait"in n,a=m?Yb(ol(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 f(_){var T=_-l,L=_-u,O=t-T;return m?Gb(O,a-L):O}function b(_){var T=_-l,L=_-u;return l===void 0||T>=t||T<0||m&&L>=a}function g(){var _=Wa();if(b(_))return x(_);o=setTimeout(g,f(_))}function x(_){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 A(){return o===void 0?s:x(Wa())}function E(){var _=Wa(),T=b(_);if(r=arguments,i=this,l=_,T){if(o===void 0)return v(l);if(m)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=C,E.flush=A,E}var Rf=Qb;const Jb=In(Rf);var Xb=Rf,e0=No,t0="Expected a function";function n0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(t0);return e0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Xb(e,t,{leading:r,maxWait:t,trailing:i})}var r0=n0;const i0=In(r0),ul=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ll=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ha=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ll(n.overflowY,t)||ll(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},yi=(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,a0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},cl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:U=>U!==u;if(!ul(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;ul(v)&&m(v);){if(v=a0(v),v===h){p.push(v);break}v!=null&&v===document.body&&Ha(v)&&!Ha(document.documentElement)||v!=null&&Ha(v,d)&&p.push(v)}const f=(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:x}=window,{height:C,width:A,top:E,right:_,bottom:T,left:L}=e.getBoundingClientRect(),{top:O,right:z,bottom:R,left:B}=(U=>{const V=window.getComputedStyle(U);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-O:o==="end"?T+R:E+C/2-O+R,S=l==="center"?L+A/2-B+z:l==="end"?_+z:L-B;const M=[];for(let U=0;U<p.length;U++){const V=p[U],{height:ie,width:te,top:D,right:J,bottom:Y,left:k}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&L>=0&&T<=b&&_<=f&&E>=D&&T<=Y&&L>=k&&_<=J)return M;const j=getComputedStyle(V),q=parseInt(j.borderLeftWidth,10),P=parseInt(j.borderTopWidth,10),$=parseInt(j.borderRightWidth,10),K=parseInt(j.borderBottomWidth,10);let G=0,ne=0;const oe="offsetWidth"in V?V.offsetWidth-V.clientWidth-q-$:0,X="offsetHeight"in V?V.offsetHeight-V.clientHeight-P-K:0,ge="offsetWidth"in V?V.offsetWidth===0?0:te/V.offsetWidth:0,de="offsetHeight"in V?V.offsetHeight===0?0:ie/V.offsetHeight:0;if(h===V)G=o==="start"?F:o==="end"?F-b:o==="nearest"?yi(x,x+b,b,P,K,x+F,x+F+C,C):F-b/2,ne=l==="start"?S:l==="center"?S-f/2:l==="end"?S-f:yi(g,g+f,f,q,$,g+S,g+S+A,A),G=Math.max(0,G+x),ne=Math.max(0,ne+g);else{G=o==="start"?F-D-P:o==="end"?F-Y+K+X:o==="nearest"?yi(D,Y,ie,P,K+X,F,F+C,C):F-(D+ie/2)+X/2,ne=l==="start"?S-k-q:l==="center"?S-(k+te/2)+oe/2:l==="end"?S-J+$+oe:yi(k,J,te,q,$+oe,S,S+A,A);const{scrollLeft:be,scrollTop:Te}=V;G=de===0?0:Math.max(0,Math.min(Te+G/de,V.scrollHeight-ie/de+X)),ne=ge===0?0:Math.max(0,Math.min(be+ne/ge,V.scrollWidth-te/ge+oe)),F+=Te-G,S+=be-ne}M.push({el:V,top:G,left:ne})}return M},s0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function o0(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(cl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of cl(e,s0(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}${m?"1.":"-"} ${u}${h?`
162
162
 
163
163
  `.substring(0,i);return n+a+r}function XE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var e_={isHistory(e){return ot(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||gn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||gn.isOperationList(e.undos[0].operations))}},ps=new WeakMap,gs=new WeakMap,nr={isHistoryEditor(e){return e_.isHistory(e.history)&&w.isEditor(e)},isMerging(e){return gs.get(e)},isSaving(e){return ps.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);gs.set(e,!1),t(),gs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);ps.set(e,!1),t(),ps.set(e,n)}},t_=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&&ee.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(gn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&ee.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=r_(r)),u){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=n_(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},n_=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),r_=(e,t)=>e.type!=="set_selection";const i_=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.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 a_=l_,s_=/^(?:\w+:)?\/\/(\S+)$/,o_=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,u_=/^[^\s\.]+\.\S{2,}$/;function l_(e){if(typeof e!="string")return!1;var t=e.match(s_);if(!t)return!1;var n=t[1];return n?!!(o_.test(n)||u_.test(n)):!1}const c_=In(a_),d_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[H.link].includes(s.type)||i(a)},e.insertText=a=>{a&&c_(a)?au(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},f_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===H.mention?!0:n(a),e.isVoid=a=>a.type===H.mention?!0:r(a),e.markableVoid=a=>a.type===H.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},m_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===H.link&&ce.string(r).trim()===""){ee.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const lu=({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=ae.useIntl(),m=Hh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=i||{},{listMembers:p,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:x=()=>{},reportError:C=P=>{console.error(P)}}=a||{},A=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:A,tabbableOption:ra[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[_,T]=y.useReducer(ri,E),{editorKey:L,originalValue:O,initialValue:z,stringValue:R,lastAnchor:B,lastKey:F,hasInteracted:S,hasLoaded:M,enrichedUrl:U,mentionPopover:V}=_,ie=P=>{P&&T([{type:"tabbableOption",value:P||ra[0]}])},te=async P=>{const $=await g(P);$.url&&T([{type:"enrichedUrl",value:$}])},D=`rte-${e}`,J=y.useCallback(P=>c.jsx(Zv,{...P}),[]),Y=y.useCallback(P=>c.jsx(Yv,{...P}),[]),k=y.useMemo(()=>i_(d_(f_(m_(t_(Mw(Rx())),C),C),D,C),C),[]),j=P=>{if(!k||P!==D)return;const $=w.end(k,[]);ee.select(k,$),re.focus(k)};y.useEffect(()=>{const P=$=>{var ne;const K=$,G=((ne=K==null?void 0:K.detail)==null?void 0:ne.id)||null;G&&j(G)};return window.addEventListener("focusEditor",P),()=>{window.removeEventListener("focusEditor",P)}},[]),y.useEffect(()=>{if(k.children.length>0&&!M){if(T([{type:"hasLoaded",value:!0}]),!s)return;j(D)}},[k.children.length,z]),y.useEffect(()=>{O&&(async()=>{let $=Ot(O);if($.includes("<")){ti.prototype.escape=G=>G;const K=new ti;K.addRule("br",{filter:["br"],replacement:G=>G+`
164
164
 
165
- `}),$=K.turndown($)}o&&o.mentions&&($=await _d({text:$,template:`[${Xs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),dE($,K=>{const G=[{type:"initialValue",value:K},{type:"editorKey",value:O.toString()}];o!=null&&o.link&&(G.push({type:"enrichedUrl",value:o.link}),o.link.url&&te(o.link.url)),T(G),setTimeout(()=>{T([{type:"stringValue",value:Hc(k)}])},150)})})()},[O]),y.useEffect(()=>{if(U===void 0&&k){const $=hE(k);$&&te($)}const P=$=>{var ne;const K=$,G=((ne=K==null?void 0:K.detail)==null?void 0:ne.url)||null;G&&U&&U.url===G&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",P),()=>{window.removeEventListener("linkRemoved",P)}},[U]),y.useEffect(()=>{if(t){Wr.lastIndex=0;const P=t.match(Wr);P&&P.length===1&&P[0].length===t.length&&!S&&T([{type:"originalValue",value:t}])}t!==""||!k||qi(O,t)&&!S||(w.withoutNormalizing(k,()=>{ee.delete(k,{at:{anchor:w.start(k,[]),focus:w.end(k,[])}}),ee.deselect(k),k.children.length!==0&&ee.unwrapNodes(k,{at:[0]}),ee.insertNodes(k,A,{at:[0]})}),T([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{R===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[R]);const q=Ur(()=>{gE({editor:k,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:D,className:"rich-text-editor input",children:c.jsxs(ln.Provider,{value:{..._,id:D,isInOverlay:h,setFocus:ie,dispatch:T,getLinkPreview:g,onMention:x,reportError:C},children:[c.jsxs(Pw,{editor:k,initialValue:z,onChange:P=>{if(k.operations.some(K=>K.type!=="set_selection")){let K=bE(P);K==="<br>"&&(K=""),f(K,U),T([{type:"stringValue",value:Hc(k)}]),S||T([{type:"hasInteracted",value:!0}]),q(),m&&console.log({serialized:K,json:P})}},...u,children:[c.jsx(Ew,{className:"editor",renderElement:J,renderLeaf:Y,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async P=>{const $=U!==!1,K=P.clipboardData.getData("text");if((ne=>{try{return new URL(ne),!0}catch{return!1}})(K)){let ne=K;if(K){const{full:oe}=mo(K);ne=oe}if(K&&g&&!$){const oe=await g(ne);oe.url&&T([{type:"enrichedUrl",value:oe}])}}},onKeyDown:P=>{if(P.key==="Enter"){V.show&&(P.preventDefault(),P.stopPropagation(),Lm(k,V,T,D));const{selection:$}=k;if($){const K=Q.isCollapsed($),[G,ne]=w.node(k,$,{depth:1});let oe=G,X=oe.type;const ge=oe.children[0];if(ge&&(ge==null?void 0:ge[H.h3])===!0&&(P.stopPropagation(),P.preventDefault(),ee.insertNodes(k,A)),ge&&[H.ol,H.ul].includes(ge.type)&&(oe=ge,X=ge.type),oe&&me.isElement(oe)&&X!==H.paragraph){if(X===H.blockquote&&!P.shiftKey){P.stopPropagation(),P.preventDefault(),ee.insertNodes(k,A);return}if(K){const[de,be]=w.parent(k,$,{edge:"end"}),Ae=de.type;if([H.ul,H.ol].includes(X))if(P.stopPropagation(),P.preventDefault(),Ae===H.li&&F==="Enter"){de.children.length===1&&"text"in de.children[0]&&de.children[0].text===""&&ee.removeNodes(k,{at:be}),ee.insertNodes(k,A,{at:I.next(ne)}),ee.select(k,w.end(k,I.next(ne)));return}else{const[We,Le]=fE(k,H.li),ze={type:H.li,children:[{text:""}]};ee.insertNodes(k,ze,{at:I.next(Le)}),ee.select(k,w.end(k,I.next(Le)))}}}}}else if(P.key==="Escape"){if(V.show){P.preventDefault(),P.stopPropagation(),T([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(P.key)&&V.show){P.preventDefault(),P.stopPropagation();const{selectedUser:$,possibleUsers:K}=V;let G=P.key==="ArrowUp"?$-1:$+1;G<0&&(G=K.length-1),G>=K.length+1&&(G=0),T([{type:"mentionPopover",value:{...V,selectedUser:G}}])}T([{type:"lastKey",value:P.key}]),pE(P,k,T,C)},onBlur:()=>{k.selection&&T([{type:"lastAnchor",value:k.selection.anchor}])},onFocus:()=>{if(B){if(!I.isPath(B.path)||!ce.has(k,B.path))return;const P=ce.get(k,B.path);let $=0;if(pe.isText(P)?$=P.text.length:P.children&&($=P.children.length),B.offset>$)return;try{ee.select(k,{anchor:B,focus:B})}catch(K){const G=K.message;C(`Error focusing editor: ${G}`)}}}}),U?c.jsx(jo,{data:U,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const P=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(P)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(AE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(yE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},L),c.jsx(Oo,{id:`character-limit-${e}`,limit:r,valueLength:pa(R)})]})}):c.jsx(c.Fragment,{})};const h_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{a||(l(d),i(d))};return c.jsxs("div",{className:W("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:W("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function th({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,v]=y.useState(!1),f=y.useRef(null),b=async A=>{h(!0),v(!1);try{const E=A.target.files&&A.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:x=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:W("profile-image-change-figure",e),children:[c.jsx(on,{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:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Fe,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?C:u?x:g})]})}const nh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Jt,{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 p_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(Sh.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(Fe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},rh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ae.useIntl(),x=async E=>{try{await u(m,E.message),h([]),b("SUCCESS")}catch(_){b("ERROR"),l(_)}},C=E=>{E.preventDefault(),b("NOT_SUBMITTED"),v(!0),h([])},A=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"secondary",onClick:C,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Fe,{onClick:A,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Fe,{onClick:C,children:g({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(Jt,{id:"invite-form",fields:[{component:p_,props:{emails:m,setEmails:h,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:x},button:{text:r,size:"medium",disabled:p}})]})},zi=e=>e.map(t=>({condition:t})),St={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},g_=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[St.NEW_PASSWORD]!==p[St.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ss(p[St.NEW_PASSWORD]).isValid,m=[{"data-testid":St.NEW_PASSWORD,id:St.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:zi(["required",d]),functions:{onChange:p=>l(Ss(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":St.CONFIRMED_PASSWORD,id:St.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:zi(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":St.CURRENT_PASSWORD,id:St.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:zi(["required"])}),a&&m.push({component:Sf,props:{matchingRules:o}});const h={id:St.FORM_ID,fields:m,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(St.NEW_PASSWORD)||v.includes(St.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(wn,{variant:"error",text:r})]})};const ih=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var L;const s=ae.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async O=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:x,predictPlaces:C}=t.useMaps(),{context:A="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:O})=>O&&!m?!1:!x(O),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:C}}],T=[{component:th,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:qt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:E},functions:{onSuccess:async O=>{try{const z={...O,image:u||null,location:m?await g(O==null?void 0:O.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...z})),await v(z)}catch{b()}},onCancel:f,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})},v_=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Vd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let vs=null;const ct="publishArticleForm_",ed={},td=10,b_=({id:e="publish-article-form",values:t=ed,functions:n,meta:r,gtm:i})=>{const a=ae.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,x]=y.useState("");y.useEffect(()=>{qi(t,ed)||Hr(t.body)&&t.body!==p&&t.body!==void 0&&v(t.body)},[t.body]);const C=()=>{!s||!s.id?b(a.formatMessage({id:`${ct}error_loggedOut`})):f&&b(!1)},A=L=>({condition:O=>{const z=O[L];return!z||typeof z!="string"?!0:z.length<td},error:a.formatMessage({id:`${ct}error_underMinLength`},{length:td})}),E=!!p&&Hr(p),_=()=>c.jsxs(c.Fragment,{children:[c.jsx(qt,{}),c.jsx("p",{className:"text-medium",children:a.formatMessage({id:`${ct}disclaimer`})})]}),T=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:a.formatMessage({id:`${ct}title_label`}),placeholder:a.formatMessage({id:`${ct}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:C},validation:[{condition:"required"},A("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:a.formatMessage({id:`${ct}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:a.formatMessage({id:`${ct}subtitle_placeholder`}),functions:{onChange:C},validation:[{condition:"required"},A("subtitle")]},{component:ru,props:{formID:e,label:{visible:a.formatMessage({id:`${ct}body_label`})},showLabel:!0}},{component:lu,props:{id:`${e}-input`,value:p,placeholder:a.formatMessage({id:`${ct}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:L=>{v(L),C()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:qt}):T.push({component:_}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async L=>{if(!s||!s.id||!E)return;vs&&clearTimeout(vs),h(!0);const O={...L,body:p};try{o&&await o(O),vs=setTimeout(()=>{x(a.formatMessage({id:`${ct}aria_success`})),l(O)},500)}catch{b(a.formatMessage({id:`${ct}error`})),x(""),u()}},onFailure:u},fields:T,intlPath:ct,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":i==null?void 0:i.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!E,text:{default:a.formatMessage({id:`${ct}cta_submit`}),submitting:a.formatMessage({id:`${ct}cta_submitting`}),submitted:a.formatMessage({id:`${ct}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(v_,{})},gtm:i}),f&&c.jsx(ur,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:a.formatMessage({id:`${ct}error`})}),g&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const ah=({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=ae.useIntl(),u=y.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.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:W("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:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.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"})})})]})})})},nd=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}])},y_=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"]}},x_=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=y_(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}])},w_=({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,m=(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:()=>m(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:()=>{nd({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:kf,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:()=>m(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:()=>{m(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(f=>{s.validFields[f]!==a[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&nd({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const C_=({className:e=""})=>c.jsxs("div",{className:W("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const D_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},E_=({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=ae.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=i,v={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(ri,D_),{validFields:g,emailDetails:x,shouldManuallyApprove:C,shouldDisableButton:A,showSuccessMessage:E,showError:_}=f,[T,L]=uo.useCookies(["signup-this-session","functional-cookie-consent"]),O={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{C===!0&&O.jobTitle.current&&O.jobTitle.current.focus()},[C]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>w_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:O,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,O,v,f]),R=A?!0:C?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(x.boxType);return v.successMessage&&E?c.jsx(C_,{className:e}):c.jsxs("fieldset",{className:W("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(wn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:O.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:R?{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 x_({refs:O,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:O.hiddenValidation})]})};const En=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:W("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const __=({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(En,{className:W("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(gr,{buttons:r})]})})};const oo="editSection_";function sh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const k_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(Ft,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${oo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(Fe,{href:r,variant:"secondary",size:"small",onClick:()=>sh({href:r,setShowModal:a}),children:n||s({id:`${oo}placeholder_cta`})})})]})},F_=({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}=ae.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),v=!!n||!!r,f=typeof i=="string"||v;let b;return r&&(b=y.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:W("edit-section",t),children:[v&&c.jsx(un,{title:o||`Edit ${a}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:W("edit-section-modal"),children:b||(n?c.jsx(Jt,{...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 x,C;(x=n==null?void 0:n.functions)!=null&&x.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:W("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),f&&c.jsx(Fe,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>sh({href:i,setShowModal:h}),children:d({id:`${oo}edit`})})]}),e||c.jsx(k_,{...l,href:i,setShowModal:h,showEditButton:f}),u&&c.jsx(qt,{})]})};const A_=({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:W("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:W("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:W({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:h=!1,description:p=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});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:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${v}`))})})]})};let bs;const ys="contactFooter_",B_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(bs),bs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(bs),window.removeEventListener("resize",l)}),[]),c.jsx(En,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${ys}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(ae.FormattedMessage,{id:`${ys}text`})}),c.jsx(xn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${ys}email`})})]}),c.jsx(nh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},T_=({activeLink:e,profile:t,...n})=>c.jsx(En,{children:c.jsx(Ef,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Df,{activeLink:e,profile:t}),c.jsx(jd,{...n})]})})});const xs="cookieBanner_",ws=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Cs=new Date(Date.now()+12*30*24*60*60*1e3),oh=()=>{const e=ae.useIntl(),[t,n,r]=uo.useCookies(ws),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{ws.forEach(d=>{n(d,!0,{path:"/",expires:Cs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Cs}),ws.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Cs});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:`${xs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${xs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${xs}text`})}),c.jsx(gr,{buttons:u})]})},tn={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:["correspondence","registered","berlin","support","business"],correspondence:{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_",aa="SiteFooter",rd=({group:e})=>{const t=tn[e].order||[];let n=!1;return"text"in tn[e]&&(n=tn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.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}=tn[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":aa,"data-gtm-event-type":a,...s,children:c.jsx(ae.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(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.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":aa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},cu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(la,{element:"hr"}),c.jsx(Po,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":aa,"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(rd,{group:e}),Object.keys(tn[e]).includes("child")&&c.jsx(rd,{group:tn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(tn.social.order)&&tn.social.order.map(e=>{const t=tn.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":aa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ve={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===kt.ACCOUNT&&t===!1&&n[kt.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ve.handlerCalled[e]&&a-Ve.handlerCalled[e]<500)return;Ve.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 kt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case kt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case kt.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=ld(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?Ve.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 kt.SITE:if(n){const u=Ve.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ve.findFirstChild(u.children,"id",kt.SITE);s=Ve.findFirstChild(d.children,"href")}else s=Ve.findFirstChild(t.current.children,"href");break;case kt.ACCOUNT:if(o=Ve.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ve.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(Ve.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ve.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ve.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ve.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ni={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"}}}},sa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ae.useIntl(),o=ld(ni,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 m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const A=C.split("."),E=A[A.length-2];C=`${E==="topics"?`${E}-`:""}${A[A.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,f=h&&window.location.pathname===o.href;let b={},g={},x={};if(f&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,A={onClick:E=>Ve.events.onClick(E,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ve.events.onFocus({id:C}),onBlur:()=>Ve.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ve.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ve.events.onMouseEnter({id:C,callback:i})};g={...A,id:C===kt.SITE?kt.SITE:kt.ACCOUNT},n&&(v&&(x={...A,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ve.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:W({[o.className]:o.className,"has-submenu":p,parent:v,active:f}),...b,children:[h?y.createElement(d?Fe:"a",h,s.formatMessage({id:m})):n&&o.order&&v?c.jsxs("button",{...x,children:[s.formatMessage({id:m}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[kt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...g,children:o.order.map(C=>{if(!o[C])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[C].order?c.jsxs("li",{className:W({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${m}_${C}`}),c.jsx("ul",{children:o[C].order.map(E=>c.jsx(sa,{id:`${e}.${C}.${E}`,...A},E))})]},C):c.jsx(sa,{id:`${e}.${C}`,...A},C)})})]},e)};const S_={height:67,height_desktop:83};var kt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(kt||{});const du=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(at),r=Rn(!0,!0),i=n&&typeof n.id=="string",a=y.useMemo(()=>Ve.getIsDesktopVersion(i,r),[i,r]),[s,o]=y.useReducer(ri,{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,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),pd({scrollPosition:S_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=m.current.menus;!a&&g["site-navigation"]||Ve.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=m.current.menus;!a&&g["site-navigation"]||Ve.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,x,C=!1)=>{Ve.handleMenus({id:g,value:x,menus:m.current.menus,dispatch:o,forceHandle:C})},p=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{m.current.menus[x]&&h(x,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",v)}},[]),or(()=>{u["site-navigation"]&&Ve.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&Ve.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=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(ah,{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:ni.order.map(g=>c.jsx(sa,{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:W({"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(Po,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>Ve.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ve.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>Ve.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(on,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ni.buttons.order.map(g=>c.jsx(sa,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:W("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const j_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(du,{}),c.jsx("div",{id:"content",children:c.jsx(wn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(cu,{})]})},uh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=i,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=a,v=md(),[f,b]=y.useState(""),g=_=>{const{detail:{message:T}}=_;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const x=ji(e,{locale:o}),C=ji(t,{locale:o}),A=ji(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),m!=="default"&&(E[m]=!0),h!=="default"&&(E[h]=!0),c.jsx(Th.ErrorBoundary,{onError:r,fallback:c.jsx(j_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:W(s,E,{"has-footer":u}),children:[c.jsx(du,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[C&&c.jsx("div",{className:W("additional-content prepended",{"large-modal":p==="large"}),children:C}),y.createElement(d==="bold"?yo:"div",{id:"content",children:x,className:W({"large-modal":p==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(cu,{}),c.jsx(oh,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},id={default:"tags_",headerTopics:"header_topics_topics_"},Ds={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"},P_={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ds.topic[e.replace("topic_","")],e){const t=ni.topics.topics[e].href;return t?{id:e,href:t,text:`${id.headerTopics}${e}`}:null}return null}return Ds[e]?(e=Ds[e],{id:e,text:`${id.default}${e}`}):null}};const O_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=P_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:W("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 lh=25,M_=({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:m=""})=>{const h=ae.useIntl(),p="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:W("members-list",m),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(rn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),c.jsx(xn,{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,x)=>c.jsxs("li",{children:[c.jsx(rn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},x)),d&&e.length===0&&t>0?[...new Array(Math.min(t,lh))].map((g,x)=>c.jsx("li",{children:c.jsx(ma,{layout:"member"})},x)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Ea,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},ch=M_,N_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ae.useIntl();return t?c.jsx("small",{children:$t(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,{})},I_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(ru,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:$t(r.formatMessage,`${e}label_action`,t,"action")},...n})},ad=5,sd=2,R_=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_",si=({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:m="DiscussionForm"})=>{var Z,se,ve;const h=ae.useIntl(),p=y.useContext(at),[v,f]=y.useState(n.type),[b,g]=y.useState(""),{isLoading:x=!1,isInWrapper:C=!1,isInOverlay:A=!1,isAutoFocused:E=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:L=!1,isPrepopulated:O=!1,showTitle:z=!1,showGuidelines:R=!0,showDivider:B=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:M=[]}=i||{},{onChange:U=()=>{},create:V=()=>{},createPoll:ie=()=>Promise,handleSaveEdit:te=()=>{},handleCancel:D=()=>{},callback:J=()=>{},onMention:Y=()=>{},listMembers:k=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:q=()=>Promise.resolve({}),props:P={create:{projectNames:["questions-answers"]}}}=u,[$,K]=y.useState({body:_&&_.text||O&&O.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[G,ne]=y.useState(l.error||!1),oe={status:!1,title:T&&T.text||"",polls:0},[X,ge]=y.useState(oe);y.useEffect(()=>{L&&!_&&O&&O!==$.body&&K(ue=>({...ue,body:O.text||""}))},[O]),y.useEffect(()=>{f(n.type)},[n.type]);const de=Ur((ue,ye)=>{K(he=>({...he,body:ue,data:{link:ye}})),U({body:ue});let De;!p||!p.id?De=$t(h.formatMessage,`${Qe}error_loggedOut`,v,"action"):r?s>0&&ue.length>=s&&(De=`${Qe}error_tooLong`):De=$t(h.formatMessage,`${Qe}error_noPermission`,v,"action"),De?ne(De):G&&ne(!1)},50);let be=`${v}-form`;if(v===Be.Response||v===Be.Reply){const ue=((Z=n.slugs)==null?void 0:Z.reply)||((se=n.slugs)==null?void 0:se.answer)||((ve=n.slugs)==null?void 0:ve.question)||"";ue&&(be=`${be}-${ue.slice(-15)}`)}e&&(be=`${e}-${be}`);const Te=async ue=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ge(De=>({...De,status:"submitting"}));const ye=window.location.pathname;try{let De;switch(v){case Be.Post:De=await V({title:ue.title,content:ue.body,categories:ue.categories,data:ue.data});break;case Be.Poll:De=await ie(R_(ue));break;case Be.Question:De=await V({title:ue.body,authorId:p&&p.id,data:ue.data,...P==null?void 0:P.create});break;case Be.Response:De=await V({questionSlug:n.slugs.question},{body:ue.body,authorId:p&&p.id,contentPath:ye,data:ue.data});break;case Be.Reply:De=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ue.body,authorId:p&&p.id,contentPath:ye,data:ue.data});break;default:break}return await Wh(1e3),J&&await J(De),Gn=setTimeout(()=>{K({body:"",data:{}}),f(Be.Post),ge(ke=>({...ke,status:"submitted"})),g($t(h.formatMessage,`${Qe}success`,v,"action"));const he=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(he),Ae()},850),De}catch(De){const he=De;let ke=`${Qe}error`;he!=null&&he.message.includes("entry already exists")&&(ke=$t(h.formatMessage,`${Qe}error_alreadyExists`,v,"action")),he!=null&&he.message.includes("429")?ke=$t(h.formatMessage,`${Qe}error_tooMany`,v,"action"):he!=null&&he.message.includes("400")&&(ke=`${Qe}error`),ne(ke),Ae()}},Ae=()=>{Gn=setTimeout(()=>{ne(!1),ge(oe),g("")},5e3)},We=Ur(async ue=>{const ye={...$,...ue};if(_){ge(De=>({...De,status:"submitting"})),te(ye);return}try{if(!await Te(ye))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(x)return c.jsx(It,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Le=!$.body||!Hr($.body),ze=!X.title||!Hr(X.title);let Ke=!1;v!==Be.Poll&&(Ke=Le),T&&(Ke=Ke&&ze);const je=X.status==="submitting",Ne=[];v===Be.Poll?Ne.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:sd,maxInputs:ad,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ue=>{var De;let ye=0;ue&&Array.isArray(ue)&&(ye=((De=ue==null?void 0:ue.filter(he=>he!==""))==null?void 0:De.length)||0),X.polls!==ye&&ge(he=>({...he,polls:ye})),U({polls:ue})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Ne.push({component:I_,props:{formID:be,intlPath:Qe,showLabel:T!==!1,type:v}},{component:lu,props:{id:`${be}-input`,value:X.status==="submitting"&&!G?"":$.body,placeholder:a||$t(h.formatMessage,`${Qe}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:A},functions:{onChange:de,onChangeData:ue=>{K(ye=>({...ye,data:ue}))},onMention:Y,listMembers:k,clickMentionFallback:j,getLinkPreview:q},data:d,autoFocus:_!==!1||E&&!T,"aria-invalid":!!G,"aria-errormessage":"error-message"}},{component:N_,props:{intlPath:Qe,showGuidelines:R,type:v,gtmContext:m}}),B&&Ne.push({component:qt}),T&&Ne.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:ue=>{ge(ye=>({...ye,title:ue})),U({title:ue})}},validation:v===Be.Poll?[{condition:"required"}]:[]}),S&&Ne.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Qe}postType_label`}),options:M.map(ue=>({id:ue.slug,label:ue.name})),validation:[{condition:"required"}],functions:{onChange:ue=>{U({postType:ue}),ue.includes(Be.Poll)?f(Be.Poll):v!==Be.Post&&f(Be.Post)}}});let we=!p||!p.id||!r||je;if(v===Be.Poll){const ue=X.polls;we=we||ze||ue<sd||ue>ad}else we=we||Ke,_&&(T?we=we||$.body===_.text&&X.title===T.text:we=we||$.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:be,className:W("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!je||l.cancel},functions:{onSuccess:async ue=>{await We(ue)},onCancel:D},fields:Ne,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"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":m,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!$.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Qe}cancel`})},gtm:{context:m,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===Be.Question&&c.jsx("h2",{children:$t(h.formatMessage,`${Qe}title`,v,"action")}),c.jsx(rn,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]}})]}),X.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:$t(h.formatMessage,`${Qe}success`,v,"action")}),G&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof G=="string"?G.includes(" ")?G:h.formatMessage({id:G},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):G}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})},$_=Object.freeze(Object.defineProperty({__proto__:null,default:si},Symbol.toStringTag,{value:"Module"}));const L_={showForm:!1},Da=y.createContext(L_),dh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Da.Provider,{value:{...t,updateConversation:n},children:e})};function z_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var m;const o="discussion_",l=ae.useIntl(),u=(m=i==null?void 0:i.componentProps)==null?void 0:m.member.additionalContent,d=u?u.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(rn,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:W({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 Es=({children:e,class:t,...n})=>{const r={...n,class:W("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function q_({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 oa=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(oa||{});const U_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,V_=(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 W_=({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]=y.useState(t.hasUserVoted);let m=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const v=g=>{g.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:W({"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 x;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:A,nextIndex:E}=V_(g.currentTarget.parentElement,"selected",C,n);A&&((x=A.querySelector("label"))==null||x.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:W("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(on,{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:[m,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const fh=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ae.useIntl(),s=y.useContext(at),{showRemoveVote:o=!1,allowMultipleVotes:l=!1,resultsVisibility:u=oa.AfterVoting}=n||{},[d,m]=y.useState(U_(t,l,s==null?void 0:s.id)),h=t.reduce((g,x)=>g+x.numVotes,0),p=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),f=y.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=y.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(Fe,{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,x)=>c.jsx(W_,{isTabbable:d===x,user:s,option:g,optionIndex:x,totalPollVotes:h,showResults:u==oa.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:f,setTabbableOption:m}},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 H_({content:e,contentData:t,functions:n}){return c.jsx(fh,{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 K_({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(Sd,{text:t.postBody,markdownOptions:{overrides:{a:Ps,blockquote:{component:Es}}}}):c.jsx(jn,{options:{overrides:{a:Ps,blockquote:{component:Es}}},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(jn,{options:{wrapper:r.type===Be.Question?"h1":y.Fragment,forceWrapper:r.type===Be.Question,forceInline:r.type===Be.Question,forceBlock:r.type!==Be.Question,overrides:{blockquote:{component:Es}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(jo,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const Rt="discussion_",Z_=195;let Ai=null;const oi=({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:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g,locale:x="en"})=>{var Z,se,ve,ue,ye,De;const C=ae.useIntl(),A=y.useContext(Da),E=y.useContext(at),{createContent:_=async()=>{},deleteContent:T=async()=>{},updateContent:L=async()=>{}}=o.content||{},{createLike:O=()=>{},deleteLike:z=()=>{},listLikes:R=async()=>({})}=o.likes||{},{openComments:B=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:M=()=>{},removeVote:U=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ie,canLike:te,createdAt:D,id:J,likes:Y=0,userLiked:k,comments:j=0,data:q}=t,P=av(t.title,x),$=E&&E.id&&typeof ie!="string"&&ie.id&&ie.id===E.id||!1,K=typeof te=="boolean"?te:!0,G=$&&(!t.createdAt||Uh(t.createdAt,10,"seconds")),ne=y.useRef(null),[oe,X]=y.useState({title:t.body!==P&&P||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[ge,de]=y.useState(!1),[be,Te]=y.useState(G?"highlighted":"default"),[Ae,We]=y.useState("");y.useEffect(()=>{const he=ne.current;if(!(!he||be==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),he.addEventListener("transitionend",ze),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),he.removeEventListener("transitionend",ze)}},[]),y.useEffect(()=>{X(he=>({...he,title:t&&P||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const ke=await To(oe.body,h,q==null?void 0:q.mentions,F);X(st=>({...st,postBody:ke}))})()},[oe.body,q==null?void 0:q.mentions]);const Le=()=>{setTimeout(()=>{Te("fading")},1e3)},ze=({propertyName:he})=>{he==="background-color"&&Te(ke=>(ke==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),ne.current&&ne.current.removeEventListener("transitionend",ze)),ke==="fading"?"default":ke))};if(i||!t||t.type===Be.Answer&&(!t.slugs||!t.slugs.question)||oe.postBody===""&&t.title==="")return c.jsx(It,{className:"discussion-card"});const Ke=async({title:he,body:ke,data:st})=>{he||(he=""),ke||(ke=""),We("");try{if(!qi(he,oe.title)||!qi(ke,oe.body)){const et=t.type===Be.Question?{title:ke}:{title:he,body:ke,data:st};await L(Rs(t.slugs),et)}X(et=>({...et,title:he||"",body:ke||"",data:{...et.data,...st},isEditing:!1,didEdit:!0}))}catch{We(`${Rt}form_error`)}},je=()=>{if(A&&A.updateConversation){const he={showForm:!0},ke=t.author;ke&&ke.id&&(v&&(he.prepopulateForm=`@{{${ke.id}}}`),he.mentionData={id:ke.id,name:ke.name}),A.updateConversation(he)}setTimeout(()=>{var tt,_t,ut;const ke=`reply-form-${(t.type===Be.Answer?t.slug:((tt=t.slugs)==null?void 0:tt.reply)||((_t=t.slugs)==null?void 0:_t.answer)||((ut=t.slugs)==null?void 0:ut.question)||"").toLowerCase().slice(-15)}`,st=document.getElementById(ke),et=document.getElementById(`${ke}-input`);et&&et.focus(),st&&st.scrollIntoView({behavior:"smooth"})},0)},Ne=async()=>{de(!1);try{t.type===Be.Poll?(await V(),window.location.href=`${b}/${g}`):await T(Rs(t.slugs))}catch{We("delete-error")}},we=[];return n&&$&&(t.type!==Be.Poll&&we.push({text:C.formatMessage({id:`${Rt}moreMenu_edit`}),onClick:()=>X(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),we.push({text:C.formatMessage({id:`${Rt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),de(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...af(`delete-${t.slug}-modal`,ge)})),r&&o.pins&&we.push({text:C.formatMessage({id:`${Rt}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&&((Z=ne==null?void 0:ne.current)==null||Z.focus(),(se=ne==null?void 0:ne.current)==null||se.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:W("discussion-post",u,{[be]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!oe.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:ne,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:he=>{if(!l.post||oe.isEditing||t.type===Be.Poll&&iv(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),Ai&&clearTimeout(Ai),Ai=setTimeout(()=>{window.location.href=l.post},150);const ke=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ai}});document.dispatchEvent(ke)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:J||t.slug,className:W("discussion-card",t.type,{editing:oe.isEditing,"has-link":l.post&&!oe.isEditing}),children:[!oe.isEditing&&c.jsx(z_,{author:ie,originalAuthorId:a,createdAt:D,contentData:{didEdit:oe.didEdit},content:t,gtmContext:d,badges:f}),oe.isEditing?c.jsx(si,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:oe.title!==""?{text:oe.title}:!1,isEditing:{text:oe.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Be.Question?250:5e4,forceShow:{error:Ae!==""&&Ae!=="delete-error"?C.formatMessage({id:Ae},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:Ke,handleCancel:()=>{We(""),X(he=>({...he,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:q}):c.jsxs(c.Fragment,{children:[t.type===Be.Poll?c.jsx(H_,{content:t,contentData:oe,functions:{createVote:M,removeVote:U}}):c.jsx(K_,{links:l,contentData:oe,postCutOff:Z_,content:t}),c.jsx(q_,{content:t})]}),!oe.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(xf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Y||0,userLiked:k||!1,canLike:K,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:O,deleteLike:z,listLikes:R},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Be.Question,Be.Post].includes(t.type)||l.comments)?{count:j||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof B=="function"&&B()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:je}}:!1,shareLink:{url:`${window.location.origin}${(ve=t.slugs)==null?void 0:ve.question}/${(ue=t.slugs)==null?void 0:ue.answer}${(ye=t.slugs)!=null&&ye.reply?`#${(De=t.slugs)==null?void 0:De.reply}`:""}`},moreMenu:{options:we,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),m,c.jsx(un,{id:`delete-${t.slug}-modal`,isOpen:ge,functions:{onOpen:()=>{},onClose:()=>de(!1)},forceShow:{error:Ae==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},title:C.formatMessage({id:`${Rt}delete_title`},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>de(!1),children:C.formatMessage({id:`${Rt}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ne,children:C.formatMessage({id:`${Rt}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>c.jsx("p",{children:he}),action:C.formatMessage({id:`${Rt}action_${t.type}`})}})})]})})};const Y_=y.lazy(()=>Promise.resolve().then(()=>lk)),G_=65,mh=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=y.useContext(at)||"community",l=ha(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||kd("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const g=await To(h.title||h.body||"",G_,h.mentions);p(x=>({...x,prettifiedText:g}))})()},[h.showCachedText,h.title,h.body]);const v=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const A=x.target.closest("a");g=A&&A.getAttribute("href")}m(x=>({...x,warning:g||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,v),document.addEventListener(rt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[h.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!h.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${i}placeholder`});return h.showCachedText&&(h.title||h.body)&&(f=h.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:W("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(on,{name:l.name,src:l.image,alt:""}),c.jsx(jn,{className:W("input",{placeholder:!h.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:jt,blockquote:jt,br:jt,em:jt,li:jt,ol:jt,p:jt,s:jt,span:jt,strong:jt,ul:jt}},children:f})]}),c.jsxs(vr,{children:[c.jsx(Y_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(un,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{m({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`})})})]})]})},Q_=y.lazy(()=>Promise.resolve().then(()=>$_)),fu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=Do})=>{if(a&&!i)return c.jsx(wn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Co,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:m,meta:h,...p}=t,v={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...m,create:(m==null?void 0:m.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(mh,{form:v}):c.jsx(Q_,{...v})},mu=({form:e})=>{const t=y.useContext(at),n=ae.useIntl(),[r,i]=y.useState(!1),a=()=>{Jh(t)||i(!0)};y.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(Ea,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const _s="discussion_responses_",hh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${_s}title`},{action:r.formatMessage({id:`${_s}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:$t(r.formatMessage,`${_s}empty`,e,e)})]})};const ph=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ae.useIntl(),s=y.useContext(Da),o=ji(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:W("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(si,{...r})]})};function J_(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 X_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=$e.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(of({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&uf({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function ek({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=$e.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 tk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=$e.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Yi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Yi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function nk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=$e.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Gi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Gi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function rk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=$e.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function ik({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(lf({activity:s,reactionId:a}),s)),onError:n});return i}function ak({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=$e.useQueryClient(),d=fa(),m={queryClient:u,queryKey:l},h={mutationHandlers:{error:Eo(m),mutate:_o(m)},user:d,...m},p=ek({...h,mutationFn:t}),v=tk({...h,mutationFn:n}),f=sk({...h,mutationFn:r}),b=nk({...h,mutationFn:i}),g=ok({...h,mutationFn:a}),x=X_({...h,mutationFn:s}),C=ik({...h,mutationFn:o}),{activity:A,...E}=rk({queryKey:l,queryFn:e});return{activity:A,mutations:{edit:p,like:v,unlike:f,pin:b,unpin:g,createVote:x,removeVote:C},user:d,...E}}function sk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&cf({activity:s,user:r}),s)),onError:n});return i}function ok({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&df({activity:s,user:r}),s))),onError:n});return i}const uk=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:m,polls:h},profile:p,categories:v,locale:f=Do})=>{var Y,k,j,q,P,$,K,G,ne,oe,X,ge;const b=ae.useIntl(),g={...s,...h},{activity:x,error:C,isLoading:A,mutations:{edit:E,like:_,unlike:T,pin:L,unpin:O,createVote:z,removeVote:R}}=ak({queryFns:g,queryKey:[e,t,n]});if(A)return c.jsx(It,{style:{height:"400px"}});if(C||!x)return c.jsx(wn,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:B,verb:F,latest_reactions:S,mentioned_users:M,additional_data:U}=x,V=(((Y=S==null?void 0:S.like)==null?void 0:Y.length)||0)>0,ie=(((k=B==null?void 0:B.like)==null?void 0:k.length)||0)>0,te=ie?B==null?void 0:B.like[0].id:"",D=V?(j=S==null?void 0:S.like)==null?void 0:j.map(de=>{var be,Te,Ae;return{id:(be=de==null?void 0:de.user)==null?void 0:be.id,name:(Ae=(Te=de==null?void 0:de.user)==null?void 0:Te.data)==null?void 0:Ae.name}}):!1,J=x==null?void 0:x.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(oi,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:x==null?void 0:x.title,body:x==null?void 0:x.content,categories:So((x==null?void 0:x.categories)||[],v||[]),canLike:r,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:x==null?void 0:x.id},slug:n,author:yr(J),userLiked:ie,likes:((q=x==null?void 0:x.reaction_counts)==null?void 0:q.like)||0,comments:(x==null?void 0:x.total_replies)||0,peopleWhoLiked:D,data:{mentions:M,...U||{}},pinned:((P=x==null?void 0:x.reaction_counts)==null?void 0:P.pin)&&(($=x==null?void 0:x.reaction_counts)==null?void 0:$.pin)>0||!1,pollOptions:sf(x,f),pollSettings:{showRemoveVote:(K=x==null?void 0:x.settings)==null?void 0:K.show_remove_vote,allowMultipleVotes:(G=x==null?void 0:x.settings)==null?void 0:G.allow_multiple_votes,deadlineAt:(ne=x==null?void 0:x.settings)==null?void 0:ne.deadline_at,hideParticipants:(oe=x==null?void 0:x.settings)==null?void 0:oe.hide_participants,numberOfWinners:(X=x==null?void 0:x.settings)==null?void 0:X.number_of_winners,resultsVisibility:(ge=x==null?void 0:x.settings)==null?void 0:ge.results_visibility}},originalAuthorId:J==null?void 0:J.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(de,{title:be,body:Te})=>E({title:be,content:Te})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:te}),listLikes:de=>o.list({activityId:n,...de})},comments:{openComments:()=>{}},pins:{createPin:()=>L({activityId:n}),deletePin:()=>{var de;return O({activityId:n,reactionId:(de=S==null?void 0:S.pin)==null?void 0:de[0].id})}},polls:{createVote:({reactionId:de})=>z({reactionId:de}),removeVote:({reactionId:de})=>R({reactionId:de}),removePoll:()=>h.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(gf,{basePath:e,parentId:t,activityId:n,showReplies:F===Be.Poll?J_(x):!0,activityTotalReplies:(x==null?void 0:x.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:p})]})};const gh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(un,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:W("discussion-form-modal",i),children:c.jsx(si,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-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:{...m,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const x=v||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(C=>({...C,mentions:x}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},createPoll:async b=>{const g=()=>{o(),l({showCachedText:!1})};if(m.createPoll)try{const x=await m.createPoll(b);return new Promise(C=>(g(),C(x)))}catch{return new Promise((C,A)=>A())}else return g(),new Promise(x=>x({}))},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},lk=Object.freeze(Object.defineProperty({__proto__:null,default:gh},Symbol.toStringTag,{value:"Module"}));const ck=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=ae.useIntl();return i||(i=m.formatMessage({id:"inviteModal_formTitle"})),a||(a=m.formatMessage({id:"inviteModal_formLabel"})),s||(s=m.formatMessage({id:"inviteModal_cta"})),c.jsx(un,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:W("invite-modal",e,{success:!!n}),children:c.jsx(rh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const dk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(kd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(un,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:W("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(ih,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async m=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(m)}finally{d()}}}})]})})},Ea=dk,fk=Object.freeze(Object.defineProperty({__proto__:null,default:Ea},Symbol.toStringTag,{value:"Module"}));const mk=({members:e})=>{const[t,n]=y.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(on,{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(un,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(jn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const hk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:W("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(rn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:W("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:W("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),pk=y.memo(hk);const gk=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[i,a]=y.useState(e);return y.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(Ft,{variant:"subtle",className:W("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 _a=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ae.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,h=Math.floor(m),p=(m-h)*60,v=Math.round(p),f=`${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:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:W("time-to-complete",i),"aria-label":u,children:l})};const vk=({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(Ln,{...n,className:W("banner",e),image:{...t,aspect:"banner"}})):null;const bk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],yk=({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,f;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={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:x}=t[b];if(x&&bk.includes(x.toLowerCase()))return;h[b]={text:g,element:m[b]};return}h[b]={text:t[b],element:m[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(En,{className:W("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:x=""}=h[b];return b==="text"?c.jsx(jn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(x,{key:b,className:b},g)}return null}),l,p&&c.jsx(Fe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:W({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Ln,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},xk=y.memo(yk);const wk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(En,{className:W("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const Ck=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(jn,{children:n}):n;return c.jsxs(En,{className:W("highlight-section",t),children:[r&&c.jsx("div",{className:W("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Ln,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:W("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:W("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Dk=y.memo(Ck);const Ek=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:W("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Fe,{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})]}),_k=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=i&&Ts(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):fo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&Ts(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},kk={title:66,text:3e3,secondaryText:1e3,partner:34},ua={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"}},Fk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=ae.useIntl(),[a,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=ua[h])!=null&&f.gtmEvent&&(p=ua[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(Fe,{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),x=async C=>{if(C.preventDefault(),C.stopPropagation(),!(g||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:W("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Fe,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"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 Ak({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(at),[i,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.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 hu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,S;const u=ae.useIntl(),d=y.useContext(at),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(i,m).then(M=>{b({data:M,isLoading:!1})}).catch(()=>b(M=>({...M,isLoading:!1})))},[i,m,n]);const{data:g,isLoading:x}=f;if(x||!g)return c.jsx(It,{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||!ua[C])return c.jsx(It,{element:"li",className:"card-wrapper"});const{basePath:A="",className:E,length:_,gtmEvent:T}=ua[C];let L=h&&g.slug?`${A}${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 O=M=>{L&&(M.preventDefault(),M.stopPropagation(),window.location.href=L)},z={...kk,..._};let R={className:"card"},B={};return L&&(B={href:L,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(R={...R,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:W("card-wrapper text-medium",E,t,{"has-link":L,"no-link":!L,"has-image":g.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...R,ref:v,children:[c.jsx(Ad,{className:"card-label",contentType:C,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),C==="communityPage"&&(g==null?void 0:g.createdAt)&&Vh(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"}):Dd(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(Ln,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(on,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(bo,{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(M=>{const U=g[M];if(!U)return null;const V=bd(M),ie={key:M,className:V,"data-testid":V},te={wrapper:"p",forceWrapper:!0,forceInline:!0},D=sr(U,z[M]);return["title","text"].includes(M)&&L?(te.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Zt,{options:te,...B,children:D})})):c.jsx(Zt,{options:te,...ie,children:D})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(Ak,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(_k,{type:E||"",data:g}),c.jsx(Fk,{data:g,cta:a,link:L||"",gtmContext:s})]})})};const vh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:W("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(hu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Bk=(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}},Tk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return y.createElement(i,{className:W("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 ks={fourCards:1024,threeCards:769,twoCards:480};let Bi=null,Fs=null;const Sk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[x,C]=y.useState(""),A=t.length,E=Math.ceil(A/h),_=y.useRef(null),T=Rn(!0,!0,_==null?void 0:_.current);y.useEffect(()=>{let F=1;T&&(T>=ks.fourCards?F=4:T>=ks.threeCards?F=3:T>=ks.twoCards&&(F=2),F>A&&(F=A)),m(S=>({...S,cardsPerPage:F,isLoading:!1}))},[T,A]);const L=(F="next")=>{Fs&&clearTimeout(Fs);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(""),f(U=>({...U,currentPage:S,loadedPages:[...new Set([...g,S])]}));const M=()=>{const U=S*d.cardsPerPage,V=U+d.cardsPerPage;return t.slice(U,V).length};Fs=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:M()}))},500)},O=F=>{Bi=F.touches[0].clientX},z=F=>{if(Bi===null)return;const S=F.touches[0].clientX,M=Bi-S;M>5?L("next"):M<-5&&L("previous"),Bi=null},R={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":b};if(p)return c.jsx(ma,{layout:`carousel${i?"-with-title":""}`});const B=(F,S)=>{var U;let M=null;return(U=F==null?void 0:F.sys)!=null&&U.id?M=`card-${F.sys.id}`:F!=null&&F.slug?M=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(M=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),M};return c.jsxs("section",{ref:_,className:W("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Tk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:z,style:R,"data-testid":"carousel-list",children:t.map((F,S)=>{let M=B(F,S);const{inView:U,isLoaded:V}=Bk(S,h,b,g);return M&&(U||V)?c.jsx(hu,{id:M,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},M):(M=M||`${e}-card-${S}`,c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},M))})}),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(Fe,{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:W("page-indicator",{selected:S===b}),onClick:M=>{M.preventDefault(),M.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(Fe,{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:x})]})]})},jk=({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}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(ma,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(Sk,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const Pk=({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:m=>{l&&(m.preventDefault(),m.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:W("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:W("img",{private:o,"no-image":!i}),children:i&&c.jsx(Ln,{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 Ok=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:W("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:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&i&&c.jsx(_a,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(vo,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const bh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>y.createElement(e,{className:W("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yh=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ae.useIntl(),o=ca(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):xd(i||"");return c.jsxs("small",{className:W("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:W("type",n),children:o})," ",t>0&&!r&&c.jsx(_a,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const Mk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=ae.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(da,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(_a,{time:s,appendedText:i?m.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:f,contentType:b,icon:g,image:x,isIntroduction:C,optional:A,slug:E,subsectionId:_,title:T,type:L})=>{const O=i&&t||C,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:W({article:b===Sr.ARTICLE,discussion:b===Sr.DISCUSSION,quiz:b===Sr.QUIZ,completed:v&&b===Sr.ARTICLE,locked:!O}),...z,children:c.jsx(xn,{href:O?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${yd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(bh,{sectionId:a,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(yh,{completionTime:f,icon:g,optional:A,type:L,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const Nk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Fe,{...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:W("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Ik=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),od=[{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 Ti="notFoundError_",Rk=()=>{const e=ae.useIntl(),t=[];return od.forEach((n,r)=>{n.title=e.formatMessage({id:`${Ti}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(uh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(En,{children:[c.jsx(vh,{cards:od,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(Fe,{href:"/solution-articles/",children:e.formatMessage({id:`${Ti}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Ti}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Ti}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=xf;exports.ActionButton=Kr;exports.ActivitiesFeed=sv;exports.ActivitySection=uk;exports.ActivityType=br;exports.AddPost=fu;exports.Badge=qd;exports.BadgeScope=dt;exports.Badges=Ud;exports.BadgesContext=ho;exports.BadgesProvider=Od;exports.Banner=vk;exports.BannerSection=xk;exports.Breadcrumbs=kv;exports.Buckets=sp;exports.Button=Fe;exports.ButtonWrapper=gr;exports.COURSE_CONTENT_TYPES=Sr;exports.CacheProvider=Md;exports.Card=hu;exports.CardBlock=vh;exports.Carousel=jk;exports.CharacterLimit=Oo;exports.Checkbox=Mo;exports.CollapsibleSection=da;exports.Columns=Ef;exports.CommunityDetails=kg;exports.ContactFooter=B_;exports.ContactForm=nh;exports.ContentTypeLabel=Ad;exports.Contributors=bo;exports.ConversationContext=Da;exports.CookieBanner=oh;exports.CourseProgression=Ok;exports.CourseStructure=Mk;exports.CustomContentBanner=wk;exports.CustomEvents=rt;exports.DELETED_USER_ID=Vr;exports.Directory=mk;exports.DiscussionContentType=Be;exports.DiscussionConversation=dh;exports.DiscussionForm=si;exports.DiscussionFormCard=mh;exports.DiscussionFormModal=gh;exports.DiscussionPost=oi;exports.DiscussionThread=ph;exports.Divider=qt;exports.DownloadSection=__;exports.EMAILS=Qn;exports.EditSection=F_;exports.EmailHelperTextBox=kf;exports.EmptyStateBox=wn;exports.EnrichedUrl=jo;exports.FeatureFlags=Id;exports.Filters=wf;exports.FlagsProvider=Nd;exports.Footer=cu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=jt;exports.FullWidthSection=En;exports.GET_STREAM_USER_PREFIX=Bs;exports.GlobalProviders=xp;exports.Header=du;exports.HelperTextBox=Td;exports.HiddenFromScreenReaders=la;exports.HideShowTextBox=Sd;exports.HighlightSection=Dk;exports.HighlightedTextBox=Ft;exports.INVALID_TOKEN=wd;exports.IconBulletedList=lp;exports.ImageContainer=np;exports.IntlProvider=Rd;exports.InviteForm=rh;exports.InviteModal=ck;exports.JoinButton=Co;exports.Label=ru;exports.LanguageContext=po;exports.LanguageSwitcher=Av;exports.LessonName=bh;exports.LessonType=yh;exports.LikesButton=hf;exports.LikesFeed=vf;exports.LikesModal=bf;exports.Link=xn;exports.LoadMore=ii;exports.LoadingBlock=Vd;exports.LoadingPlaceholder=It;exports.LoadingState=ma;exports.Logo=Po;exports.LogoSection=A_;exports.MEMBERS_PER_PAGE=lh;exports.MENTION_REGEX=Cd;exports.MarkCompleteButton=Nk;exports.MarkdownText=jn;exports.MarketingBlock=Ek;exports.Marks=Kt;exports.Member=rn;exports.MembersList=ch;exports.Modal=yo;exports.MoreMenu=Cf;exports.NUMBER_OF_COUNTRIES=zh;exports.NUMBER_OF_USERS=Lh;exports.NarrowCard=Pk;exports.NavigationMenu=Df;exports.NotFoundError=Rk;exports.Overlay=un;exports.OverlayContext=go;exports.OverlayProvider=zd;exports.PageHeading=jd;exports.PageLayout=uh;exports.PasswordForm=g_;exports.PasswordRules=Sf;exports.Pill=Yt;exports.Poll=fh;exports.Popover=Fd;exports.Portal=vr;exports.ProfileForm=ih;exports.ProfileImageChange=th;exports.ProfileModal=Ea;exports.ProfileModalLauncher=mu;exports.ProfilePicture=on;exports.ProgressBar=vo;exports.ProgressTracker=ip;exports.PublishArticleForm=b_;exports.Rating=Hv;exports.RepliesFeed=gf;exports.ResponsesHeading=hh;exports.ResponsiveImage=Ln;exports.ResultsVisibility=oa;exports.ReturnToNavButton=ap;exports.RichTextEditor=lu;exports.SearchForm=ah;exports.ShareLink=yf;exports.ShareLinks=Ov;exports.SignupForm=E_;exports.Span=Ps;exports.StatusBanner=ur;exports.TableOfContents=gk;exports.Tabs=Mv;exports.Tags=O_;exports.TestimonialBlock=pk;exports.TimeToComplete=_a;exports.Toggle=h_;exports.Tooltip=$n;exports.TopLevelPage=T_;exports.UUID_V4_REGEX=Wr;exports.UserContext=at;exports.UserProvider=$d;exports.VisuallyHidden=Me;exports.addAriaProps=af;exports.basicReducer=ri;exports.camelCaseToDashCase=bd;exports.checkIntlPathExists=ca;exports.enrichPostCategories=So;exports.generateConditions=zi;exports.generateCssIcon=qh;exports.getAuthorData=yr;exports.getCharacterLimitProps=_f;exports.getLongDate=fo;exports.getMember=ha;exports.getPostBody=To;exports.getShortDate=Dd;exports.getValueLength=pa;exports.headerData=ni;exports.likesResponseMock=Ev;exports.mapGetStreamData=Ik;exports.pageReady=Ed;exports.passwordValidator=Ss;exports.repliesFeedMock=ov;exports.supportedLanguages=Pi;exports.toCamelCase=yd;exports.toCapitalisedCase=$h;exports.toSentenceCase=xd;exports.transformSlugs=Rs;exports.useAutoResize=fd;exports.useBadges=Pd;exports.useCurrentPath=md;exports.useEffectAfterMount=or;exports.useElementWidth=Rn;exports.useOverlay=Ld;exports.useScrollListener=pd;exports.useScrollToHash=lo;exports.useTooltips=co;exports.useUser=fa;
165
+ `}),$=K.turndown($)}o&&o.mentions&&($=await _d({text:$,template:`[${Xs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),dE($,K=>{const G=[{type:"initialValue",value:K},{type:"editorKey",value:O.toString()}];o!=null&&o.link&&(G.push({type:"enrichedUrl",value:o.link}),o.link.url&&te(o.link.url)),T(G),setTimeout(()=>{T([{type:"stringValue",value:Hc(k)}])},150)})})()},[O]),y.useEffect(()=>{if(U===void 0&&k){const $=hE(k);$&&te($)}const P=$=>{var ne;const K=$,G=((ne=K==null?void 0:K.detail)==null?void 0:ne.url)||null;G&&U&&U.url===G&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",P),()=>{window.removeEventListener("linkRemoved",P)}},[U]),y.useEffect(()=>{if(t){Wr.lastIndex=0;const P=t.match(Wr);P&&P.length===1&&P[0].length===t.length&&!S&&T([{type:"originalValue",value:t}])}t!==""||!k||qi(O,t)&&!S||(w.withoutNormalizing(k,()=>{ee.delete(k,{at:{anchor:w.start(k,[]),focus:w.end(k,[])}}),ee.deselect(k),k.children.length!==0&&ee.unwrapNodes(k,{at:[0]}),ee.insertNodes(k,A,{at:[0]})}),T([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{R===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[R]);const q=Ur(()=>{gE({editor:k,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:D,className:"rich-text-editor input text-medium",children:c.jsxs(ln.Provider,{value:{..._,id:D,isInOverlay:h,setFocus:ie,dispatch:T,getLinkPreview:g,onMention:x,reportError:C},children:[c.jsxs(Pw,{editor:k,initialValue:z,onChange:P=>{if(k.operations.some(K=>K.type!=="set_selection")){let K=bE(P);K==="<br>"&&(K=""),f(K,U),T([{type:"stringValue",value:Hc(k)}]),S||T([{type:"hasInteracted",value:!0}]),q(),m&&console.log({serialized:K,json:P})}},...u,children:[c.jsx(Ew,{className:"editor",renderElement:J,renderLeaf:Y,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async P=>{const $=U!==!1,K=P.clipboardData.getData("text");if((ne=>{try{return new URL(ne),!0}catch{return!1}})(K)){let ne=K;if(K){const{full:oe}=mo(K);ne=oe}if(K&&g&&!$){const oe=await g(ne);oe.url&&T([{type:"enrichedUrl",value:oe}])}}},onKeyDown:P=>{if(P.key==="Enter"){V.show&&(P.preventDefault(),P.stopPropagation(),Lm(k,V,T,D));const{selection:$}=k;if($){const K=Q.isCollapsed($),[G,ne]=w.node(k,$,{depth:1});let oe=G,X=oe.type;const ge=oe.children[0];if(ge&&(ge==null?void 0:ge[H.h3])===!0&&(P.stopPropagation(),P.preventDefault(),ee.insertNodes(k,A)),ge&&[H.ol,H.ul].includes(ge.type)&&(oe=ge,X=ge.type),oe&&me.isElement(oe)&&X!==H.paragraph){if(X===H.blockquote&&!P.shiftKey){P.stopPropagation(),P.preventDefault(),ee.insertNodes(k,A);return}if(K){const[de,be]=w.parent(k,$,{edge:"end"}),Ae=de.type;if([H.ul,H.ol].includes(X))if(P.stopPropagation(),P.preventDefault(),Ae===H.li&&F==="Enter"){de.children.length===1&&"text"in de.children[0]&&de.children[0].text===""&&ee.removeNodes(k,{at:be}),ee.insertNodes(k,A,{at:I.next(ne)}),ee.select(k,w.end(k,I.next(ne)));return}else{const[We,Le]=fE(k,H.li),ze={type:H.li,children:[{text:""}]};ee.insertNodes(k,ze,{at:I.next(Le)}),ee.select(k,w.end(k,I.next(Le)))}}}}}else if(P.key==="Escape"){if(V.show){P.preventDefault(),P.stopPropagation(),T([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(P.key)&&V.show){P.preventDefault(),P.stopPropagation();const{selectedUser:$,possibleUsers:K}=V;let G=P.key==="ArrowUp"?$-1:$+1;G<0&&(G=K.length-1),G>=K.length+1&&(G=0),T([{type:"mentionPopover",value:{...V,selectedUser:G}}])}T([{type:"lastKey",value:P.key}]),pE(P,k,T,C)},onBlur:()=>{k.selection&&T([{type:"lastAnchor",value:k.selection.anchor}])},onFocus:()=>{if(B){if(!I.isPath(B.path)||!ce.has(k,B.path))return;const P=ce.get(k,B.path);let $=0;if(pe.isText(P)?$=P.text.length:P.children&&($=P.children.length),B.offset>$)return;try{ee.select(k,{anchor:B,focus:B})}catch(K){const G=K.message;C(`Error focusing editor: ${G}`)}}}}),U?c.jsx(jo,{data:U,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const P=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(P)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(AE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(yE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},L),c.jsx(Oo,{id:`character-limit-${e}`,limit:r,valueLength:pa(R)})]})}):c.jsx(c.Fragment,{})};const h_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{a||(l(d),i(d))};return c.jsxs("div",{className:W("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:W("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function th({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,v]=y.useState(!1),f=y.useRef(null),b=async A=>{h(!0),v(!1);try{const E=A.target.files&&A.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:x=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:W("profile-image-change-figure",e),children:[c.jsx(on,{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:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Fe,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?C:u?x:g})]})}const nh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Jt,{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 p_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(Sh.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(Fe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},rh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=ae.useIntl(),x=async E=>{try{await u(m,E.message),h([]),b("SUCCESS")}catch(_){b("ERROR"),l(_)}},C=E=>{E.preventDefault(),b("NOT_SUBMITTED"),v(!0),h([])},A=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Fe,{variant:"secondary",onClick:C,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Fe,{onClick:A,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(Fe,{onClick:C,children:g({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(Jt,{id:"invite-form",fields:[{component:p_,props:{emails:m,setEmails:h,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:x},button:{text:r,size:"medium",disabled:p}})]})},zi=e=>e.map(t=>({condition:t})),St={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},g_=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[St.NEW_PASSWORD]!==p[St.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ss(p[St.NEW_PASSWORD]).isValid,m=[{"data-testid":St.NEW_PASSWORD,id:St.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:zi(["required",d]),functions:{onChange:p=>l(Ss(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":St.CONFIRMED_PASSWORD,id:St.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:zi(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":St.CURRENT_PASSWORD,id:St.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:zi(["required"])}),a&&m.push({component:Sf,props:{matchingRules:o}});const h={id:St.FORM_ID,fields:m,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(St.NEW_PASSWORD)||v.includes(St.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(wn,{variant:"error",text:r})]})};const ih=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var L;const s=ae.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async O=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:x,predictPlaces:C}=t.useMaps(),{context:A="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:O})=>O&&!m?!1:!x(O),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:C}}],T=[{component:th,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:qt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:E},functions:{onSuccess:async O=>{try{const z={...O,image:u||null,location:m?await g(O==null?void 0:O.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(R=>({...R,...z})),await v(z)}catch{b()}},onCancel:f,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})},v_=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Vd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let vs=null;const ct="publishArticleForm_",ed={},td=10,b_=({id:e="publish-article-form",values:t=ed,functions:n,meta:r,gtm:i})=>{const a=ae.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,x]=y.useState("");y.useEffect(()=>{qi(t,ed)||Hr(t.body)&&t.body!==p&&t.body!==void 0&&v(t.body)},[t.body]);const C=()=>{!s||!s.id?b(a.formatMessage({id:`${ct}error_loggedOut`})):f&&b(!1)},A=L=>({condition:O=>{const z=O[L];return!z||typeof z!="string"?!0:z.length<td},error:a.formatMessage({id:`${ct}error_underMinLength`},{length:td})}),E=!!p&&Hr(p),_=()=>c.jsxs(c.Fragment,{children:[c.jsx(qt,{}),c.jsx("p",{className:"text-medium",children:a.formatMessage({id:`${ct}disclaimer`})})]}),T=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:a.formatMessage({id:`${ct}title_label`}),placeholder:a.formatMessage({id:`${ct}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:C},validation:[{condition:"required"},A("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:a.formatMessage({id:`${ct}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:a.formatMessage({id:`${ct}subtitle_placeholder`}),functions:{onChange:C},validation:[{condition:"required"},A("subtitle")]},{component:ru,props:{formID:e,label:{visible:a.formatMessage({id:`${ct}body_label`})},showLabel:!0}},{component:lu,props:{id:`${e}-input`,value:p,placeholder:a.formatMessage({id:`${ct}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:L=>{v(L),C()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:qt}):T.push({component:_}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async L=>{if(!s||!s.id||!E)return;vs&&clearTimeout(vs),h(!0);const O={...L,body:p};try{o&&await o(O),vs=setTimeout(()=>{x(a.formatMessage({id:`${ct}aria_success`})),l(O)},500)}catch{b(a.formatMessage({id:`${ct}error`})),x(""),u()}},onFailure:u},fields:T,intlPath:ct,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":i==null?void 0:i.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!E,text:{default:a.formatMessage({id:`${ct}cta_submit`}),submitting:a.formatMessage({id:`${ct}cta_submitting`}),submitted:a.formatMessage({id:`${ct}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(v_,{})},gtm:i}),f&&c.jsx(ur,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:a.formatMessage({id:`${ct}error`})}),g&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const ah=({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=ae.useIntl(),u=y.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.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:W("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:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.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"})})})]})})})},nd=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}])},y_=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"]}},x_=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=y_(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}])},w_=({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,m=(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:()=>m(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:()=>{nd({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:kf,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:()=>m(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:()=>{m(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(f=>{s.validFields[f]!==a[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&nd({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const C_=({className:e=""})=>c.jsxs("div",{className:W("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const D_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},E_=({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=ae.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=i,v={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(ri,D_),{validFields:g,emailDetails:x,shouldManuallyApprove:C,shouldDisableButton:A,showSuccessMessage:E,showError:_}=f,[T,L]=uo.useCookies(["signup-this-session","functional-cookie-consent"]),O={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{C===!0&&O.jobTitle.current&&O.jobTitle.current.focus()},[C]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>w_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:O,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,O,v,f]),R=A?!0:C?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(x.boxType);return v.successMessage&&E?c.jsx(C_,{className:e}):c.jsxs("fieldset",{className:W("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(wn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:O.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:R?{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 x_({refs:O,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:O.hiddenValidation})]})};const En=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:W("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const __=({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(En,{className:W("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(gr,{buttons:r})]})})};const oo="editSection_";function sh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const k_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(Ft,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${oo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(Fe,{href:r,variant:"secondary",size:"small",onClick:()=>sh({href:r,setShowModal:a}),children:n||s({id:`${oo}placeholder_cta`})})})]})},F_=({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}=ae.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),v=!!n||!!r,f=typeof i=="string"||v;let b;return r&&(b=y.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:W("edit-section",t),children:[v&&c.jsx(un,{title:o||`Edit ${a}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:W("edit-section-modal"),children:b||(n?c.jsx(Jt,{...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 x,C;(x=n==null?void 0:n.functions)!=null&&x.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:W("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),f&&c.jsx(Fe,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>sh({href:i,setShowModal:h}),children:d({id:`${oo}edit`})})]}),e||c.jsx(k_,{...l,href:i,setShowModal:h,showEditButton:f}),u&&c.jsx(qt,{})]})};const A_=({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:W("logos",i,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:W("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:W({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:h=!1,description:p=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});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:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${v}`))})})]})};let bs;const ys="contactFooter_",B_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(bs),bs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(bs),window.removeEventListener("resize",l)}),[]),c.jsx(En,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${ys}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(ae.FormattedMessage,{id:`${ys}text`})}),c.jsx(xn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${ys}email`})})]}),c.jsx(nh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},T_=({activeLink:e,profile:t,...n})=>c.jsx(En,{children:c.jsx(Ef,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Df,{activeLink:e,profile:t}),c.jsx(jd,{...n})]})})});const xs="cookieBanner_",ws=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Cs=new Date(Date.now()+12*30*24*60*60*1e3),oh=()=>{const e=ae.useIntl(),[t,n,r]=uo.useCookies(ws),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{ws.forEach(d=>{n(d,!0,{path:"/",expires:Cs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Cs}),ws.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Cs});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:`${xs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${xs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${xs}text`})}),c.jsx(gr,{buttons:u})]})},tn={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:["correspondence","registered","berlin","support","business"],correspondence:{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_",aa="SiteFooter",rd=({group:e})=>{const t=tn[e].order||[];let n=!1;return"text"in tn[e]&&(n=tn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.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}=tn[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":aa,"data-gtm-event-type":a,...s,children:c.jsx(ae.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(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.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":aa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},cu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(la,{element:"hr"}),c.jsx(Po,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":aa,"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(rd,{group:e}),Object.keys(tn[e]).includes("child")&&c.jsx(rd,{group:tn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(tn.social.order)&&tn.social.order.map(e=>{const t=tn.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":aa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ve={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===kt.ACCOUNT&&t===!1&&n[kt.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ve.handlerCalled[e]&&a-Ve.handlerCalled[e]<500)return;Ve.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 kt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case kt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case kt.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=ld(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?Ve.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 kt.SITE:if(n){const u=Ve.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ve.findFirstChild(u.children,"id",kt.SITE);s=Ve.findFirstChild(d.children,"href")}else s=Ve.findFirstChild(t.current.children,"href");break;case kt.ACCOUNT:if(o=Ve.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ve.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(Ve.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ve.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ve.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ve.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ni={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"}}}},sa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ae.useIntl(),o=ld(ni,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 m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const A=C.split("."),E=A[A.length-2];C=`${E==="topics"?`${E}-`:""}${A[A.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,f=h&&window.location.pathname===o.href;let b={},g={},x={};if(f&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,A={onClick:E=>Ve.events.onClick(E,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ve.events.onFocus({id:C}),onBlur:()=>Ve.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ve.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ve.events.onMouseEnter({id:C,callback:i})};g={...A,id:C===kt.SITE?kt.SITE:kt.ACCOUNT},n&&(v&&(x={...A,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ve.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:W({[o.className]:o.className,"has-submenu":p,parent:v,active:f}),...b,children:[h?y.createElement(d?Fe:"a",h,s.formatMessage({id:m})):n&&o.order&&v?c.jsxs("button",{...x,children:[s.formatMessage({id:m}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[kt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...g,children:o.order.map(C=>{if(!o[C])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[C].order?c.jsxs("li",{className:W({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${m}_${C}`}),c.jsx("ul",{children:o[C].order.map(E=>c.jsx(sa,{id:`${e}.${C}.${E}`,...A},E))})]},C):c.jsx(sa,{id:`${e}.${C}`,...A},C)})})]},e)};const S_={height:67,height_desktop:83};var kt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(kt||{});const du=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(at),r=Rn(!0,!0),i=n&&typeof n.id=="string",a=y.useMemo(()=>Ve.getIsDesktopVersion(i,r),[i,r]),[s,o]=y.useReducer(ri,{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,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),pd({scrollPosition:S_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=m.current.menus;!a&&g["site-navigation"]||Ve.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=m.current.menus;!a&&g["site-navigation"]||Ve.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,x,C=!1)=>{Ve.handleMenus({id:g,value:x,menus:m.current.menus,dispatch:o,forceHandle:C})},p=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{m.current.menus[x]&&h(x,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",v)}},[]),or(()=>{u["site-navigation"]&&Ve.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&Ve.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=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(ah,{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:ni.order.map(g=>c.jsx(sa,{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:W({"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(Po,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>Ve.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ve.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>Ve.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(on,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ni.buttons.order.map(g=>c.jsx(sa,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:W("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const j_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(du,{}),c.jsx("div",{id:"content",children:c.jsx(wn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(cu,{})]})},uh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=i,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=a,v=md(),[f,b]=y.useState(""),g=_=>{const{detail:{message:T}}=_;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const x=ji(e,{locale:o}),C=ji(t,{locale:o}),A=ji(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),m!=="default"&&(E[m]=!0),h!=="default"&&(E[h]=!0),c.jsx(Th.ErrorBoundary,{onError:r,fallback:c.jsx(j_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:W(s,E,{"has-footer":u}),children:[c.jsx(du,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[C&&c.jsx("div",{className:W("additional-content prepended",{"large-modal":p==="large"}),children:C}),y.createElement(d==="bold"?yo:"div",{id:"content",children:x,className:W({"large-modal":p==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(cu,{}),c.jsx(oh,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},id={default:"tags_",headerTopics:"header_topics_topics_"},Ds={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"},P_={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ds.topic[e.replace("topic_","")],e){const t=ni.topics.topics[e].href;return t?{id:e,href:t,text:`${id.headerTopics}${e}`}:null}return null}return Ds[e]?(e=Ds[e],{id:e,text:`${id.default}${e}`}):null}};const O_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=P_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:W("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 lh=25,M_=({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:m=""})=>{const h=ae.useIntl(),p="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:W("members-list",m),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(rn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),c.jsx(xn,{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,x)=>c.jsxs("li",{children:[c.jsx(rn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},x)),d&&e.length===0&&t>0?[...new Array(Math.min(t,lh))].map((g,x)=>c.jsx("li",{children:c.jsx(ma,{layout:"member"})},x)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Ea,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},ch=M_,N_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ae.useIntl();return t?c.jsx("small",{children:$t(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,{})},I_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(ru,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:$t(r.formatMessage,`${e}label_action`,t,"action")},...n})},ad=5,sd=2,R_=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_",si=({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:m="DiscussionForm"})=>{var Z,se,ve;const h=ae.useIntl(),p=y.useContext(at),[v,f]=y.useState(n.type),[b,g]=y.useState(""),{isLoading:x=!1,isInWrapper:C=!1,isInOverlay:A=!1,isAutoFocused:E=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:L=!1,isPrepopulated:O=!1,showTitle:z=!1,showGuidelines:R=!0,showDivider:B=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:M=[]}=i||{},{onChange:U=()=>{},create:V=()=>{},createPoll:ie=()=>Promise,handleSaveEdit:te=()=>{},handleCancel:D=()=>{},callback:J=()=>{},onMention:Y=()=>{},listMembers:k=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:q=()=>Promise.resolve({}),props:P={create:{projectNames:["questions-answers"]}}}=u,[$,K]=y.useState({body:_&&_.text||O&&O.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[G,ne]=y.useState(l.error||!1),oe={status:!1,title:T&&T.text||"",polls:0},[X,ge]=y.useState(oe);y.useEffect(()=>{L&&!_&&O&&O!==$.body&&K(ue=>({...ue,body:O.text||""}))},[O]),y.useEffect(()=>{f(n.type)},[n.type]);const de=Ur((ue,ye)=>{K(he=>({...he,body:ue,data:{link:ye}})),U({body:ue});let De;!p||!p.id?De=$t(h.formatMessage,`${Qe}error_loggedOut`,v,"action"):r?s>0&&ue.length>=s&&(De=`${Qe}error_tooLong`):De=$t(h.formatMessage,`${Qe}error_noPermission`,v,"action"),De?ne(De):G&&ne(!1)},50);let be=`${v}-form`;if(v===Be.Response||v===Be.Reply){const ue=((Z=n.slugs)==null?void 0:Z.reply)||((se=n.slugs)==null?void 0:se.answer)||((ve=n.slugs)==null?void 0:ve.question)||"";ue&&(be=`${be}-${ue.slice(-15)}`)}e&&(be=`${e}-${be}`);const Te=async ue=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ge(De=>({...De,status:"submitting"}));const ye=window.location.pathname;try{let De;switch(v){case Be.Post:De=await V({title:ue.title,content:ue.body,categories:ue.categories,data:ue.data});break;case Be.Poll:De=await ie(R_(ue));break;case Be.Question:De=await V({title:ue.body,authorId:p&&p.id,data:ue.data,...P==null?void 0:P.create});break;case Be.Response:De=await V({questionSlug:n.slugs.question},{body:ue.body,authorId:p&&p.id,contentPath:ye,data:ue.data});break;case Be.Reply:De=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ue.body,authorId:p&&p.id,contentPath:ye,data:ue.data});break;default:break}return await Wh(1e3),J&&await J(De),Gn=setTimeout(()=>{K({body:"",data:{}}),f(Be.Post),ge(ke=>({...ke,status:"submitted"})),g($t(h.formatMessage,`${Qe}success`,v,"action"));const he=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(he),Ae()},850),De}catch(De){const he=De;let ke=`${Qe}error`;he!=null&&he.message.includes("entry already exists")&&(ke=$t(h.formatMessage,`${Qe}error_alreadyExists`,v,"action")),he!=null&&he.message.includes("429")?ke=$t(h.formatMessage,`${Qe}error_tooMany`,v,"action"):he!=null&&he.message.includes("400")&&(ke=`${Qe}error`),ne(ke),Ae()}},Ae=()=>{Gn=setTimeout(()=>{ne(!1),ge(oe),g("")},5e3)},We=Ur(async ue=>{const ye={...$,...ue};if(_){ge(De=>({...De,status:"submitting"})),te(ye);return}try{if(!await Te(ye))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(x)return c.jsx(It,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Le=!$.body||!Hr($.body),ze=!X.title||!Hr(X.title);let Ke=!1;v!==Be.Poll&&(Ke=Le),T&&(Ke=Ke&&ze);const je=X.status==="submitting",Ne=[];v===Be.Poll?Ne.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:sd,maxInputs:ad,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ue=>{var De;let ye=0;ue&&Array.isArray(ue)&&(ye=((De=ue==null?void 0:ue.filter(he=>he!==""))==null?void 0:De.length)||0),X.polls!==ye&&ge(he=>({...he,polls:ye})),U({polls:ue})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Ne.push({component:I_,props:{formID:be,intlPath:Qe,showLabel:T!==!1,type:v}},{component:lu,props:{id:`${be}-input`,value:X.status==="submitting"&&!G?"":$.body,placeholder:a||$t(h.formatMessage,`${Qe}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:A},functions:{onChange:de,onChangeData:ue=>{K(ye=>({...ye,data:ue}))},onMention:Y,listMembers:k,clickMentionFallback:j,getLinkPreview:q},data:d,autoFocus:_!==!1||E&&!T,"aria-invalid":!!G,"aria-errormessage":"error-message"}},{component:N_,props:{intlPath:Qe,showGuidelines:R,type:v,gtmContext:m}}),B&&Ne.push({component:qt}),T&&Ne.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:ue=>{ge(ye=>({...ye,title:ue})),U({title:ue})}},validation:v===Be.Poll?[{condition:"required"}]:[]}),S&&Ne.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Qe}postType_label`}),options:M.map(ue=>({id:ue.slug,label:ue.name})),validation:[{condition:"required"}],functions:{onChange:ue=>{U({postType:ue}),ue.includes(Be.Poll)?f(Be.Poll):v!==Be.Post&&f(Be.Post)}}});let we=!p||!p.id||!r||je;if(v===Be.Poll){const ue=X.polls;we=we||ze||ue<sd||ue>ad}else we=we||Ke,_&&(T?we=we||$.body===_.text&&X.title===T.text:we=we||$.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:be,className:W("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!je||l.cancel},functions:{onSuccess:async ue=>{await We(ue)},onCancel:D},fields:Ne,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"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":m,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!$.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Qe}cancel`})},gtm:{context:m,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===Be.Question&&c.jsx("h2",{children:$t(h.formatMessage,`${Qe}title`,v,"action")}),c.jsx(rn,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]}})]}),X.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:$t(h.formatMessage,`${Qe}success`,v,"action")}),G&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof G=="string"?G.includes(" ")?G:h.formatMessage({id:G},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):G}),b&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})},$_=Object.freeze(Object.defineProperty({__proto__:null,default:si},Symbol.toStringTag,{value:"Module"}));const L_={showForm:!1},Da=y.createContext(L_),dh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Da.Provider,{value:{...t,updateConversation:n},children:e})};function z_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var m;const o="discussion_",l=ae.useIntl(),u=(m=i==null?void 0:i.componentProps)==null?void 0:m.member.additionalContent,d=u?u.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(rn,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:W({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 Es=({children:e,class:t,...n})=>{const r={...n,class:W("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function q_({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 oa=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(oa||{});const U_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,V_=(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 W_=({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]=y.useState(t.hasUserVoted);let m=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const v=g=>{g.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:W({"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 x;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:A,nextIndex:E}=V_(g.currentTarget.parentElement,"selected",C,n);A&&((x=A.querySelector("label"))==null||x.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:W("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(on,{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:[m,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const fh=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ae.useIntl(),s=y.useContext(at),{showRemoveVote:o=!1,allowMultipleVotes:l=!1,resultsVisibility:u=oa.AfterVoting}=n||{},[d,m]=y.useState(U_(t,l,s==null?void 0:s.id)),h=t.reduce((g,x)=>g+x.numVotes,0),p=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),f=y.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=y.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(Fe,{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,x)=>c.jsx(W_,{isTabbable:d===x,user:s,option:g,optionIndex:x,totalPollVotes:h,showResults:u==oa.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:f,setTabbableOption:m}},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 H_({content:e,contentData:t,functions:n}){return c.jsx(fh,{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 K_({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(Sd,{text:t.postBody,markdownOptions:{overrides:{a:Ps,blockquote:{component:Es}}}}):c.jsx(jn,{options:{overrides:{a:Ps,blockquote:{component:Es}}},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(jn,{options:{wrapper:r.type===Be.Question?"h1":y.Fragment,forceWrapper:r.type===Be.Question,forceInline:r.type===Be.Question,forceBlock:r.type!==Be.Question,overrides:{blockquote:{component:Es}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(jo,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const Rt="discussion_",Z_=195;let Ai=null;const oi=({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:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g,locale:x="en"})=>{var Z,se,ve,ue,ye,De;const C=ae.useIntl(),A=y.useContext(Da),E=y.useContext(at),{createContent:_=async()=>{},deleteContent:T=async()=>{},updateContent:L=async()=>{}}=o.content||{},{createLike:O=()=>{},deleteLike:z=()=>{},listLikes:R=async()=>({})}=o.likes||{},{openComments:B=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:M=()=>{},removeVote:U=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ie,canLike:te,createdAt:D,id:J,likes:Y=0,userLiked:k,comments:j=0,data:q}=t,P=av(t.title,x),$=E&&E.id&&typeof ie!="string"&&ie.id&&ie.id===E.id||!1,K=typeof te=="boolean"?te:!0,G=$&&(!t.createdAt||Uh(t.createdAt,10,"seconds")),ne=y.useRef(null),[oe,X]=y.useState({title:t.body!==P&&P||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[ge,de]=y.useState(!1),[be,Te]=y.useState(G?"highlighted":"default"),[Ae,We]=y.useState("");y.useEffect(()=>{const he=ne.current;if(!(!he||be==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),he.addEventListener("transitionend",ze),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),he.removeEventListener("transitionend",ze)}},[]),y.useEffect(()=>{X(he=>({...he,title:t&&P||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const ke=await To(oe.body,h,q==null?void 0:q.mentions,F);X(st=>({...st,postBody:ke}))})()},[oe.body,q==null?void 0:q.mentions]);const Le=()=>{setTimeout(()=>{Te("fading")},1e3)},ze=({propertyName:he})=>{he==="background-color"&&Te(ke=>(ke==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Le),ne.current&&ne.current.removeEventListener("transitionend",ze)),ke==="fading"?"default":ke))};if(i||!t||t.type===Be.Answer&&(!t.slugs||!t.slugs.question)||oe.postBody===""&&t.title==="")return c.jsx(It,{className:"discussion-card"});const Ke=async({title:he,body:ke,data:st})=>{he||(he=""),ke||(ke=""),We("");try{if(!qi(he,oe.title)||!qi(ke,oe.body)){const et=t.type===Be.Question?{title:ke}:{title:he,body:ke,data:st};await L(Rs(t.slugs),et)}X(et=>({...et,title:he||"",body:ke||"",data:{...et.data,...st},isEditing:!1,didEdit:!0}))}catch{We(`${Rt}form_error`)}},je=()=>{if(A&&A.updateConversation){const he={showForm:!0},ke=t.author;ke&&ke.id&&(v&&(he.prepopulateForm=`@{{${ke.id}}}`),he.mentionData={id:ke.id,name:ke.name}),A.updateConversation(he)}setTimeout(()=>{var tt,_t,ut;const ke=`reply-form-${(t.type===Be.Answer?t.slug:((tt=t.slugs)==null?void 0:tt.reply)||((_t=t.slugs)==null?void 0:_t.answer)||((ut=t.slugs)==null?void 0:ut.question)||"").toLowerCase().slice(-15)}`,st=document.getElementById(ke),et=document.getElementById(`${ke}-input`);et&&et.focus(),st&&st.scrollIntoView({behavior:"smooth"})},0)},Ne=async()=>{de(!1);try{t.type===Be.Poll?(await V(),window.location.href=`${b}/${g}`):await T(Rs(t.slugs))}catch{We("delete-error")}},we=[];return n&&$&&(t.type!==Be.Poll&&we.push({text:C.formatMessage({id:`${Rt}moreMenu_edit`}),onClick:()=>X(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),we.push({text:C.formatMessage({id:`${Rt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),de(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...af(`delete-${t.slug}-modal`,ge)})),r&&o.pins&&we.push({text:C.formatMessage({id:`${Rt}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&&((Z=ne==null?void 0:ne.current)==null||Z.focus(),(se=ne==null?void 0:ne.current)==null||se.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:W("discussion-post",u,{[be]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!oe.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:ne,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:he=>{if(!l.post||oe.isEditing||t.type===Be.Poll&&iv(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),Ai&&clearTimeout(Ai),Ai=setTimeout(()=>{window.location.href=l.post},150);const ke=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ai}});document.dispatchEvent(ke)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:J||t.slug,className:W("discussion-card",t.type,{editing:oe.isEditing,"has-link":l.post&&!oe.isEditing}),children:[!oe.isEditing&&c.jsx(z_,{author:ie,originalAuthorId:a,createdAt:D,contentData:{didEdit:oe.didEdit},content:t,gtmContext:d,badges:f}),oe.isEditing?c.jsx(si,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:oe.title!==""?{text:oe.title}:!1,isEditing:{text:oe.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Be.Question?250:5e4,forceShow:{error:Ae!==""&&Ae!=="delete-error"?C.formatMessage({id:Ae},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:Ke,handleCancel:()=>{We(""),X(he=>({...he,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:q}):c.jsxs(c.Fragment,{children:[t.type===Be.Poll?c.jsx(H_,{content:t,contentData:oe,functions:{createVote:M,removeVote:U}}):c.jsx(K_,{links:l,contentData:oe,postCutOff:Z_,content:t}),c.jsx(q_,{content:t})]}),!oe.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(xf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Y||0,userLiked:k||!1,canLike:K,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:O,deleteLike:z,listLikes:R},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Be.Question,Be.Post].includes(t.type)||l.comments)?{count:j||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof B=="function"&&B()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:je}}:!1,shareLink:{url:`${window.location.origin}${(ve=t.slugs)==null?void 0:ve.question}/${(ue=t.slugs)==null?void 0:ue.answer}${(ye=t.slugs)!=null&&ye.reply?`#${(De=t.slugs)==null?void 0:De.reply}`:""}`},moreMenu:{options:we,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),m,c.jsx(un,{id:`delete-${t.slug}-modal`,isOpen:ge,functions:{onOpen:()=>{},onClose:()=>de(!1)},forceShow:{error:Ae==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},title:C.formatMessage({id:`${Rt}delete_title`},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>de(!1),children:C.formatMessage({id:`${Rt}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ne,children:C.formatMessage({id:`${Rt}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>c.jsx("p",{children:he}),action:C.formatMessage({id:`${Rt}action_${t.type}`})}})})]})})};const Y_=y.lazy(()=>Promise.resolve().then(()=>lk)),G_=65,mh=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=y.useContext(at)||"community",l=ha(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||kd("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const g=await To(h.title||h.body||"",G_,h.mentions);p(x=>({...x,prettifiedText:g}))})()},[h.showCachedText,h.title,h.body]);const v=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const A=x.target.closest("a");g=A&&A.getAttribute("href")}m(x=>({...x,warning:g||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,v),document.addEventListener(rt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[h.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!h.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${i}placeholder`});return h.showCachedText&&(h.title||h.body)&&(f=h.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:W("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(on,{name:l.name,src:l.image,alt:""}),c.jsx(jn,{className:W("input",{placeholder:!h.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:jt,blockquote:jt,br:jt,em:jt,li:jt,ol:jt,p:jt,s:jt,span:jt,strong:jt,ul:jt}},children:f})]}),c.jsxs(vr,{children:[c.jsx(Y_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(un,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{m({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`})})})]})]})},Q_=y.lazy(()=>Promise.resolve().then(()=>$_)),fu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=Do})=>{if(a&&!i)return c.jsx(wn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Co,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:m,meta:h,...p}=t,v={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...m,create:(m==null?void 0:m.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(mh,{form:v}):c.jsx(Q_,{...v})},mu=({form:e})=>{const t=y.useContext(at),n=ae.useIntl(),[r,i]=y.useState(!1),a=()=>{Jh(t)||i(!0)};y.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(Ea,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const _s="discussion_responses_",hh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${_s}title`},{action:r.formatMessage({id:`${_s}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:$t(r.formatMessage,`${_s}empty`,e,e)})]})};const ph=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ae.useIntl(),s=y.useContext(Da),o=ji(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:W("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(si,{...r})]})};function J_(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 X_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=$e.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(of({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&uf({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function ek({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=$e.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 tk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=$e.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Yi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Yi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function nk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=$e.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Gi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Gi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function rk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=$e.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function ik({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(lf({activity:s,reactionId:a}),s)),onError:n});return i}function ak({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=$e.useQueryClient(),d=fa(),m={queryClient:u,queryKey:l},h={mutationHandlers:{error:Eo(m),mutate:_o(m)},user:d,...m},p=ek({...h,mutationFn:t}),v=tk({...h,mutationFn:n}),f=sk({...h,mutationFn:r}),b=nk({...h,mutationFn:i}),g=ok({...h,mutationFn:a}),x=X_({...h,mutationFn:s}),C=ik({...h,mutationFn:o}),{activity:A,...E}=rk({queryKey:l,queryFn:e});return{activity:A,mutations:{edit:p,like:v,unlike:f,pin:b,unpin:g,createVote:x,removeVote:C},user:d,...E}}function sk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&cf({activity:s,user:r}),s)),onError:n});return i}function ok({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=$e.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&df({activity:s,user:r}),s))),onError:n});return i}const uk=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:m,polls:h},profile:p,categories:v,locale:f=Do})=>{var Y,k,j,q,P,$,K,G,ne,oe,X,ge;const b=ae.useIntl(),g={...s,...h},{activity:x,error:C,isLoading:A,mutations:{edit:E,like:_,unlike:T,pin:L,unpin:O,createVote:z,removeVote:R}}=ak({queryFns:g,queryKey:[e,t,n]});if(A)return c.jsx(It,{style:{height:"400px"}});if(C||!x)return c.jsx(wn,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:B,verb:F,latest_reactions:S,mentioned_users:M,additional_data:U}=x,V=(((Y=S==null?void 0:S.like)==null?void 0:Y.length)||0)>0,ie=(((k=B==null?void 0:B.like)==null?void 0:k.length)||0)>0,te=ie?B==null?void 0:B.like[0].id:"",D=V?(j=S==null?void 0:S.like)==null?void 0:j.map(de=>{var be,Te,Ae;return{id:(be=de==null?void 0:de.user)==null?void 0:be.id,name:(Ae=(Te=de==null?void 0:de.user)==null?void 0:Te.data)==null?void 0:Ae.name}}):!1,J=x==null?void 0:x.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(oi,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:x==null?void 0:x.title,body:x==null?void 0:x.content,categories:So((x==null?void 0:x.categories)||[],v||[]),canLike:r,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:x==null?void 0:x.id},slug:n,author:yr(J),userLiked:ie,likes:((q=x==null?void 0:x.reaction_counts)==null?void 0:q.like)||0,comments:(x==null?void 0:x.total_replies)||0,peopleWhoLiked:D,data:{mentions:M,...U||{}},pinned:((P=x==null?void 0:x.reaction_counts)==null?void 0:P.pin)&&(($=x==null?void 0:x.reaction_counts)==null?void 0:$.pin)>0||!1,pollOptions:sf(x,f),pollSettings:{showRemoveVote:(K=x==null?void 0:x.settings)==null?void 0:K.show_remove_vote,allowMultipleVotes:(G=x==null?void 0:x.settings)==null?void 0:G.allow_multiple_votes,deadlineAt:(ne=x==null?void 0:x.settings)==null?void 0:ne.deadline_at,hideParticipants:(oe=x==null?void 0:x.settings)==null?void 0:oe.hide_participants,numberOfWinners:(X=x==null?void 0:x.settings)==null?void 0:X.number_of_winners,resultsVisibility:(ge=x==null?void 0:x.settings)==null?void 0:ge.results_visibility}},originalAuthorId:J==null?void 0:J.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(de,{title:be,body:Te})=>E({title:be,content:Te})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:te}),listLikes:de=>o.list({activityId:n,...de})},comments:{openComments:()=>{}},pins:{createPin:()=>L({activityId:n}),deletePin:()=>{var de;return O({activityId:n,reactionId:(de=S==null?void 0:S.pin)==null?void 0:de[0].id})}},polls:{createVote:({reactionId:de})=>z({reactionId:de}),removeVote:({reactionId:de})=>R({reactionId:de}),removePoll:()=>h.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(gf,{basePath:e,parentId:t,activityId:n,showReplies:F===Be.Poll?J_(x):!0,activityTotalReplies:(x==null?void 0:x.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:p})]})};const gh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(un,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:W("discussion-form-modal",i),children:c.jsx(si,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-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:{...m,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const x=v||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(C=>({...C,mentions:x}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},createPoll:async b=>{const g=()=>{o(),l({showCachedText:!1})};if(m.createPoll)try{const x=await m.createPoll(b);return new Promise(C=>(g(),C(x)))}catch{return new Promise((C,A)=>A())}else return g(),new Promise(x=>x({}))},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},lk=Object.freeze(Object.defineProperty({__proto__:null,default:gh},Symbol.toStringTag,{value:"Module"}));const ck=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=ae.useIntl();return i||(i=m.formatMessage({id:"inviteModal_formTitle"})),a||(a=m.formatMessage({id:"inviteModal_formLabel"})),s||(s=m.formatMessage({id:"inviteModal_cta"})),c.jsx(un,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:W("invite-modal",e,{success:!!n}),children:c.jsx(rh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const dk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(kd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(un,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:W("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(ih,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async m=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(m)}finally{d()}}}})]})})},Ea=dk,fk=Object.freeze(Object.defineProperty({__proto__:null,default:Ea},Symbol.toStringTag,{value:"Module"}));const mk=({members:e})=>{const[t,n]=y.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(on,{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(un,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(jn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const hk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:W("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(rn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:W("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:W("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),pk=y.memo(hk);const gk=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[i,a]=y.useState(e);return y.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(Ft,{variant:"subtle",className:W("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 _a=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ae.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,h=Math.floor(m),p=(m-h)*60,v=Math.round(p),f=`${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:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:W("time-to-complete",i),"aria-label":u,children:l})};const vk=({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(Ln,{...n,className:W("banner",e),image:{...t,aspect:"banner"}})):null;const bk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],yk=({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,f;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={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:x}=t[b];if(x&&bk.includes(x.toLowerCase()))return;h[b]={text:g,element:m[b]};return}h[b]={text:t[b],element:m[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(En,{className:W("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:x=""}=h[b];return b==="text"?c.jsx(jn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(x,{key:b,className:b},g)}return null}),l,p&&c.jsx(Fe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:W({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Ln,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},xk=y.memo(yk);const wk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(En,{className:W("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const Ck=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(jn,{children:n}):n;return c.jsxs(En,{className:W("highlight-section",t),children:[r&&c.jsx("div",{className:W("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Ln,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:W("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:W("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Dk=y.memo(Ck);const Ek=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:W("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Fe,{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})]}),_k=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=i&&Ts(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):fo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&Ts(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},kk={title:66,text:3e3,secondaryText:1e3,partner:34},ua={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"}},Fk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=ae.useIntl(),[a,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=ua[h])!=null&&f.gtmEvent&&(p=ua[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(Fe,{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),x=async C=>{if(C.preventDefault(),C.stopPropagation(),!(g||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:W("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Fe,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"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 Ak({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(at),[i,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.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 hu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,S;const u=ae.useIntl(),d=y.useContext(at),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(i,m).then(M=>{b({data:M,isLoading:!1})}).catch(()=>b(M=>({...M,isLoading:!1})))},[i,m,n]);const{data:g,isLoading:x}=f;if(x||!g)return c.jsx(It,{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||!ua[C])return c.jsx(It,{element:"li",className:"card-wrapper"});const{basePath:A="",className:E,length:_,gtmEvent:T}=ua[C];let L=h&&g.slug?`${A}${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 O=M=>{L&&(M.preventDefault(),M.stopPropagation(),window.location.href=L)},z={...kk,..._};let R={className:"card"},B={};return L&&(B={href:L,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(R={...R,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:W("card-wrapper text-medium",E,t,{"has-link":L,"no-link":!L,"has-image":g.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...R,ref:v,children:[c.jsx(Ad,{className:"card-label",contentType:C,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),C==="communityPage"&&(g==null?void 0:g.createdAt)&&Vh(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"}):Dd(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(Ln,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(on,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(bo,{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(M=>{const U=g[M];if(!U)return null;const V=bd(M),ie={key:M,className:V,"data-testid":V},te={wrapper:"p",forceWrapper:!0,forceInline:!0},D=sr(U,z[M]);return["title","text"].includes(M)&&L?(te.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Zt,{options:te,...B,children:D})})):c.jsx(Zt,{options:te,...ie,children:D})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(Ak,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(_k,{type:E||"",data:g}),c.jsx(Fk,{data:g,cta:a,link:L||"",gtmContext:s})]})})};const vh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:W("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(hu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Bk=(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}},Tk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return y.createElement(i,{className:W("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 ks={fourCards:1024,threeCards:769,twoCards:480};let Bi=null,Fs=null;const Sk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[x,C]=y.useState(""),A=t.length,E=Math.ceil(A/h),_=y.useRef(null),T=Rn(!0,!0,_==null?void 0:_.current);y.useEffect(()=>{let F=1;T&&(T>=ks.fourCards?F=4:T>=ks.threeCards?F=3:T>=ks.twoCards&&(F=2),F>A&&(F=A)),m(S=>({...S,cardsPerPage:F,isLoading:!1}))},[T,A]);const L=(F="next")=>{Fs&&clearTimeout(Fs);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(""),f(U=>({...U,currentPage:S,loadedPages:[...new Set([...g,S])]}));const M=()=>{const U=S*d.cardsPerPage,V=U+d.cardsPerPage;return t.slice(U,V).length};Fs=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:M()}))},500)},O=F=>{Bi=F.touches[0].clientX},z=F=>{if(Bi===null)return;const S=F.touches[0].clientX,M=Bi-S;M>5?L("next"):M<-5&&L("previous"),Bi=null},R={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":b};if(p)return c.jsx(ma,{layout:`carousel${i?"-with-title":""}`});const B=(F,S)=>{var U;let M=null;return(U=F==null?void 0:F.sys)!=null&&U.id?M=`card-${F.sys.id}`:F!=null&&F.slug?M=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(M=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),M};return c.jsxs("section",{ref:_,className:W("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Tk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:z,style:R,"data-testid":"carousel-list",children:t.map((F,S)=>{let M=B(F,S);const{inView:U,isLoaded:V}=Bk(S,h,b,g);return M&&(U||V)?c.jsx(hu,{id:M,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},M):(M=M||`${e}-card-${S}`,c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},M))})}),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(Fe,{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:W("page-indicator",{selected:S===b}),onClick:M=>{M.preventDefault(),M.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(Fe,{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:x})]})]})},jk=({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}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(ma,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(Sk,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const Pk=({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:m=>{l&&(m.preventDefault(),m.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:W("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:W("img",{private:o,"no-image":!i}),children:i&&c.jsx(Ln,{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 Ok=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:W("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:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&i&&c.jsx(_a,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(vo,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const bh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>y.createElement(e,{className:W("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yh=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ae.useIntl(),o=ca(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):xd(i||"");return c.jsxs("small",{className:W("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:W("type",n),children:o})," ",t>0&&!r&&c.jsx(_a,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const Mk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=ae.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(da,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(_a,{time:s,appendedText:i?m.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:f,contentType:b,icon:g,image:x,isIntroduction:C,optional:A,slug:E,subsectionId:_,title:T,type:L})=>{const O=i&&t||C,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:W({article:b===Sr.ARTICLE,discussion:b===Sr.DISCUSSION,quiz:b===Sr.QUIZ,completed:v&&b===Sr.ARTICLE,locked:!O}),...z,children:c.jsx(xn,{href:O?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${yd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(bh,{sectionId:a,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(yh,{completionTime:f,icon:g,optional:A,type:L,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const Nk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Fe,{...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:W("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Ik=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),od=[{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 Ti="notFoundError_",Rk=()=>{const e=ae.useIntl(),t=[];return od.forEach((n,r)=>{n.title=e.formatMessage({id:`${Ti}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(uh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(En,{children:[c.jsx(vh,{cards:od,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(Fe,{href:"/solution-articles/",children:e.formatMessage({id:`${Ti}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Ti}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Ti}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=xf;exports.ActionButton=Kr;exports.ActivitiesFeed=sv;exports.ActivitySection=uk;exports.ActivityType=br;exports.AddPost=fu;exports.Badge=qd;exports.BadgeScope=dt;exports.Badges=Ud;exports.BadgesContext=ho;exports.BadgesProvider=Od;exports.Banner=vk;exports.BannerSection=xk;exports.Breadcrumbs=kv;exports.Buckets=sp;exports.Button=Fe;exports.ButtonWrapper=gr;exports.COURSE_CONTENT_TYPES=Sr;exports.CacheProvider=Md;exports.Card=hu;exports.CardBlock=vh;exports.Carousel=jk;exports.CharacterLimit=Oo;exports.Checkbox=Mo;exports.CollapsibleSection=da;exports.Columns=Ef;exports.CommunityDetails=kg;exports.ContactFooter=B_;exports.ContactForm=nh;exports.ContentTypeLabel=Ad;exports.Contributors=bo;exports.ConversationContext=Da;exports.CookieBanner=oh;exports.CourseProgression=Ok;exports.CourseStructure=Mk;exports.CustomContentBanner=wk;exports.CustomEvents=rt;exports.DELETED_USER_ID=Vr;exports.Directory=mk;exports.DiscussionContentType=Be;exports.DiscussionConversation=dh;exports.DiscussionForm=si;exports.DiscussionFormCard=mh;exports.DiscussionFormModal=gh;exports.DiscussionPost=oi;exports.DiscussionThread=ph;exports.Divider=qt;exports.DownloadSection=__;exports.EMAILS=Qn;exports.EditSection=F_;exports.EmailHelperTextBox=kf;exports.EmptyStateBox=wn;exports.EnrichedUrl=jo;exports.FeatureFlags=Id;exports.Filters=wf;exports.FlagsProvider=Nd;exports.Footer=cu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=jt;exports.FullWidthSection=En;exports.GET_STREAM_USER_PREFIX=Bs;exports.GlobalProviders=xp;exports.Header=du;exports.HelperTextBox=Td;exports.HiddenFromScreenReaders=la;exports.HideShowTextBox=Sd;exports.HighlightSection=Dk;exports.HighlightedTextBox=Ft;exports.INVALID_TOKEN=wd;exports.IconBulletedList=lp;exports.ImageContainer=np;exports.IntlProvider=Rd;exports.InviteForm=rh;exports.InviteModal=ck;exports.JoinButton=Co;exports.Label=ru;exports.LanguageContext=po;exports.LanguageSwitcher=Av;exports.LessonName=bh;exports.LessonType=yh;exports.LikesButton=hf;exports.LikesFeed=vf;exports.LikesModal=bf;exports.Link=xn;exports.LoadMore=ii;exports.LoadingBlock=Vd;exports.LoadingPlaceholder=It;exports.LoadingState=ma;exports.Logo=Po;exports.LogoSection=A_;exports.MEMBERS_PER_PAGE=lh;exports.MENTION_REGEX=Cd;exports.MarkCompleteButton=Nk;exports.MarkdownText=jn;exports.MarketingBlock=Ek;exports.Marks=Kt;exports.Member=rn;exports.MembersList=ch;exports.Modal=yo;exports.MoreMenu=Cf;exports.NUMBER_OF_COUNTRIES=zh;exports.NUMBER_OF_USERS=Lh;exports.NarrowCard=Pk;exports.NavigationMenu=Df;exports.NotFoundError=Rk;exports.Overlay=un;exports.OverlayContext=go;exports.OverlayProvider=zd;exports.PageHeading=jd;exports.PageLayout=uh;exports.PasswordForm=g_;exports.PasswordRules=Sf;exports.Pill=Yt;exports.Poll=fh;exports.Popover=Fd;exports.Portal=vr;exports.ProfileForm=ih;exports.ProfileImageChange=th;exports.ProfileModal=Ea;exports.ProfileModalLauncher=mu;exports.ProfilePicture=on;exports.ProgressBar=vo;exports.ProgressTracker=ip;exports.PublishArticleForm=b_;exports.Rating=Hv;exports.RepliesFeed=gf;exports.ResponsesHeading=hh;exports.ResponsiveImage=Ln;exports.ResultsVisibility=oa;exports.ReturnToNavButton=ap;exports.RichTextEditor=lu;exports.SearchForm=ah;exports.ShareLink=yf;exports.ShareLinks=Ov;exports.SignupForm=E_;exports.Span=Ps;exports.StatusBanner=ur;exports.TableOfContents=gk;exports.Tabs=Mv;exports.Tags=O_;exports.TestimonialBlock=pk;exports.TimeToComplete=_a;exports.Toggle=h_;exports.Tooltip=$n;exports.TopLevelPage=T_;exports.UUID_V4_REGEX=Wr;exports.UserContext=at;exports.UserProvider=$d;exports.VisuallyHidden=Me;exports.addAriaProps=af;exports.basicReducer=ri;exports.camelCaseToDashCase=bd;exports.checkIntlPathExists=ca;exports.enrichPostCategories=So;exports.generateConditions=zi;exports.generateCssIcon=qh;exports.getAuthorData=yr;exports.getCharacterLimitProps=_f;exports.getLongDate=fo;exports.getMember=ha;exports.getPostBody=To;exports.getShortDate=Dd;exports.getValueLength=pa;exports.headerData=ni;exports.likesResponseMock=Ev;exports.mapGetStreamData=Ik;exports.pageReady=Ed;exports.passwordValidator=Ss;exports.repliesFeedMock=ov;exports.supportedLanguages=Pi;exports.toCamelCase=yd;exports.toCapitalisedCase=$h;exports.toSentenceCase=xd;exports.transformSlugs=Rs;exports.useAutoResize=fd;exports.useBadges=Pd;exports.useCurrentPath=md;exports.useEffectAfterMount=or;exports.useElementWidth=Rn;exports.useOverlay=Ld;exports.useScrollListener=pd;exports.useScrollToHash=lo;exports.useTooltips=co;exports.useUser=fa;
package/index.mjs CHANGED
@@ -9544,7 +9544,7 @@ const Qn = {
9544
9544
  w ? "fieldset" : "div",
9545
9545
  {
9546
9546
  className: V(
9547
- "field-wrapper text-medium",
9547
+ "field-wrapper text-small",
9548
9548
  i,
9549
9549
  `${u}-wrapper`,
9550
9550
  { "multiple-options-wrapper": w }
@@ -23999,7 +23999,7 @@ const _m = ({
23999
23999
  dispatch: B
24000
24000
  });
24001
24001
  }, 100);
24002
- return L ? /* @__PURE__ */ c.jsx("div", { id: D, className: "rich-text-editor input", children: /* @__PURE__ */ c.jsxs(
24002
+ return L ? /* @__PURE__ */ c.jsx("div", { id: D, className: "rich-text-editor input text-medium", children: /* @__PURE__ */ c.jsxs(
24003
24003
  pn.Provider,
24004
24004
  {
24005
24005
  value: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "6.6.10-beta.0",
3
+ "version": "6.6.10-beta.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {