1import{cB as pt,al as ft,am as bt,j as n,eY as Ua,$ as K,eZ as Ba,ar as vt,as as Re,e_ as Wa,e$ as $a,f0 as Ha,cG as Ga,aC as Y,f1 as A,A as w,f2 as kt,e as vn,a as N,h as be,f3 as Ge,f4 as ee,f5 as I,f6 as qa,f7 as ne,f8 as yt,d8 as xt,c$ as Za,aZ as mn,bE as Ya,aJ as re,bq as Be,W as kn,cL as St,G as te,w as W,g as L,bB as yn,f9 as Ue,_ as ie,aU as Qa,aq as Ka,dV as xe,fa as Ja,bC as Xa,fb as ei,fc as ni,aL as _t,aN as ti,ag as jt,eD as Xe,B as Z,fd as wt,fe as E,ff as ai,I as Nt,X as Te,u as ii,a2 as Ct,F as si,L as Wn,ah as Ne,eq as oi,a6 as li,bm as ri,dQ as ci,fg as di,fh as ui,fi as mi,aS as Ve,t as Fe,z as gi,i as Dt,bi as gn,b as We,dX as hi,ac as pi,bJ as fi,bh as It,fj as bi,c2 as Tt,fk as xn,fl as Ft,fm as Mt,fn as vi,fo as ki,bH as $e,eG as Lt,cJ as $n,S as yi,bD as qe,a3 as Pt,fp as xi,fq as zt,b2 as Si,fr as he,bK as _i,bn as At,bF as ji,fs as en,ft as wi,dy as Ni,bN as Sn,e5 as Ci,fu as Di,ad as hn,fv as Ii,aE as Ti,e6 as Fi,fw as Mi,d as Rt,at as _n,fx as Li,o as Pi,fy as zi,di as Ai,fz as Vt,k as Ot,x as Et,fA as Ut,fB as Ri,s as Hn,l as Vi,db as jn,c as Oi,a1 as Ei,n as Ui,fC as Bi,p as Wi,r as $i,q as Hi,fD as Gi,T as qi,a9 as Zi,f as Yi,e9 as Qi,eo as Ki,ct as Ji,fE as Xi,bR as Gn,ek as pe,bA as le,e3 as qn,e2 as nn,az as fe,fF as es,cK as Zn,bG as ns,fG as Yn,fH as ts,fI as tn,fJ as as,fK as is,ei as Bt,fL as ss,aB as Oe,fM as os}from"./index-ZWP6Dbbj.js";import{r as m,m as B,F as se,ca as ls,ap as rs,aq as cs,am as ds,aj as Wt,a2 as us,aX as $t,K as ms,a3 as gs,cb as hs,cc as ps,cd as fs}from"./vendor-DKtCm5W2.js";import{a as Ht,b as Gt,g as qt}from"./searchTypes-CVthkd6e.js";import{g as Zt,a as wn,t as Yt}from"./sdgs-D-0m7pdW.js";import{p as Qt}from"./deedFormats-DUyDm4Ow.js";import{t as bs}from"./searchDeeds-B5bMfSVj.js";import{bM as an,bN as vs,bO as sn,bP as on,bQ as G,bR as ln,bS as ks,bT as rn,bU as Qn,bV as Ce,bW as Kn,bX as Ee,bY as cn,bZ as Jn,b_ as ye,b$ as Xn,c0 as dn,c1 as ys,c2 as et,c3 as me,c4 as xs,c5 as we,c6 as nt}from"./app-BUG-_G7c.js";import{D as Ss}from"./DeedCard-DyaoK884.js";import{D as q}from"./DisplayMode-DE4fU1Gm.js";import{c as _s}from"./index.module-DtN7QIjo.js";import{s as js}from"./postcode-groups-DFi0pRxl.js";import{u as Kt}from"./usePostcodeGroupName-DAkTIuCs.js";import{i as He}from"./isEqual-C2cGUvZL.js";import{P as ws}from"./PostcodeGroupsPicker-abOEW2zA.js";import{D as Ns}from"./DeedSearch-DCLLXKQW.js";import{D as Jt,t as Se,u as Cs,a as Xt}from"./hooks-C860FyNb.js";import{t as Nn}from"./sectionKeys-Bw8COPBE.js";import{A as Ds,f as Is,l as Ts,O as Fs,h as Ms,i as Ls,j as Ps}from"./OrganizationContextSelect-CTlTm-Yd.js";import{u as zs,a as As}from"./useCreateReport-Cf9AjaVr.js";import{U as Rs,a as Vs,H as un,C as Os}from"./UserMiniProfile-DyffcZDz.js";import{W as Es}from"./datatable.render.whitelabelsOnUI-CUk2IoZq.js";import{W as Us}from"./contract.graphql-DNz_JU1C.js";import{A as Bs}from"./Alert-QeeEGDQH.js";import{P as Ws}from"./Pagination-VWWeEXnf.js";import{S as ea}from"./index-D0-Zk_9f.js";import{u as na}from"./usePostcodeGroups-D8S5aoAt.js";import{Z as tt,a as at,u as $s}from"./useClusteredMap-Bf2PnSh4.js";import{u as Ze,g as ta,h as aa}from"./tags.hooks-DjTpgCep.js";import{T as Hs}from"./TagTooltipContent-QqTpIMnn.js";import{a as Gs,b as qs}from"./SDGPicker-UqeYW0mf.js";import{L as Zs}from"./LayoutSelect-_mEILBU6.js";import{f as Ys,b as Qs}from"./formatFilterOptions-DuUZlxuS.js";import{d as it}from"./url-5Il71Jq1.js";import{O as Ks}from"./OrganizationCard-DlUIZlLU.js";import{o as Js}from"./organization-types-BtuFjqnn.js";import{R as Xs}from"./ReactQueryLoader-CPW5a88G.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ea256956-ee47-4e54-92ca-fccc9206eb3b",e._sentryDebugIdIdentifier="sentry-dbid-ea256956-ee47-4e54-92ca-fccc9206eb3b")}catch{}var ia={root:"m_7f854edf"};const eo={position:{bottom:0,right:0},zIndex:Ba("modal"),withinPortal:!0},no=vt((e,{zIndex:t,position:a})=>({root:{"--affix-z-index":t?.toString(),"--affix-top":Re(a?.top),"--affix-left":Re(a?.left),"--affix-bottom":Re(a?.bottom),"--affix-right":Re(a?.right)}})),Cn=pt((e,t)=>{const a=ft("Affix",eo,e),{classNames:o,className:s,style:i,styles:c,unstyled:l,vars:u,portalProps:r,zIndex:d,withinPortal:g,position:h,attributes:p,...v}=a,f=bt({name:"Affix",classes:ia,props:a,className:s,style:i,classNames:o,styles:c,unstyled:l,attributes:p,vars:u,varsResolver:no});return n.jsx(Ua,{...r,withinPortal:g,children:n.jsx(K,{ref:t,...f("root"),...v})})});Cn.classes=ia;Cn.displayName="@mantine/core/Affix";var sa={root:"m_e2125a27",closeButton:"m_5abab665"};const to={shadow:"md",p:"md",withBorder:!1,transitionProps:{transition:"pop-top-right",duration:200},position:{bottom:30,right:30}},ao=vt((e,{size:t})=>({root:{"--dialog-size":Ga(t,"dialog-size")}})),Dn=pt((e,t)=>{const a=ft("Dialog",to,e),{classNames:o,className:s,style:i,styles:c,unstyled:l,vars:u,zIndex:r,position:d,
1keepMounted:g,opened:h,transitionProps:p,withCloseButton:v,withinPortal:f,children:b,onClose:S,portalProps:k,attributes:y,...j}=a,T=bt({name:"Dialog",classes:sa,props:a,className:s,style:i,classNames:o,styles:c,unstyled:l,attributes:y,vars:u,varsResolver:ao});return n.jsx(Cn,{zIndex:r,position:d,ref:t,withinPortal:f,portalProps:k,unstyled:l,children:n.jsx(Wa,{keepMounted:g,mounted:h,...p,children:z=>n.jsxs($a,{unstyled:l,...T("root",{style:z}),...j,children:[v&&n.jsx(Ha,{onClick:S,unstyled:l,...T("closeButton")}),b]})})})});Dn.classes=sa;Dn.displayName="@mantine/core/Dialog";function In({children:e,withHover:t=!0,...a}){return n.jsx("div",{className:Y(an.card,an.listCard,t&&an.hover),...a,children:e})}function Ye(e,t){const[a]=m.useState(t);if(!a)return null;const o=m.useRef(0),{setSearchState:s}=A(),i=m.useRef(null);return m.useEffect(()=>{function c(r){e<=0&&r||s(d=>{const g=r?Math.abs(e):Math.abs(e)+2;return d.page!==g?d:{...d,page:r?d.page+1:Math.max(d.page-1,1)}})}let l;const u=i.current;return u&&(l=new window.IntersectionObserver(r=>{if(u)for(const d of r){let g=0,h=u.parentElement;for(;h&&!h.scrollTop;)h=h.parentElement;if(h&&(g=h.scrollTop),d.isIntersecting&&d.intersectionRatio>=.9){const p=o.current<g;c(p)}o.current=g}},{rootMargin:"300px 0px 200px 0px",threshold:[.85,.95]}),l.observe(u)),()=>{l&&u&&l.unobserve(u)}},[i]),i}const _e=B.createContext({hover(e){},objectID:0}),io=B.memo(function(t){const a=Ye(t.page,!!t.isScrollWatcher),{hover:o}=m.useContext(_e);if(!t.hit)return null;const s=n.jsx(Ss,{...t,deed:t.hit,containerRef:a,postcodeGroups:t.postcodeGroups,openInNewTab:t.openInNewTab});function i(){o(t.hit.id)}function c(){o(null)}const l=w(kt.hit);return t.display===q.List?n.jsx(In,{...l,children:s}):n.jsx("div",{...l,onMouseEnter:i,onMouseLeave:c,children:s})});var O=(e=>(e.sidebar="sidebar",e.toolbar="toolbar",e))(O||{});const so={en:"Address or postcode",nl:"Adres of postcode"},oo={en:"Type address or postcode",nl:"Typ het adres of de postcode"},lo={en:"change",nl:"verander"},ro={en:"Clear location",nl:"Locatie resetten"},co={en:"use my location",nl:"gebruik mijn locatie"},uo={en:"Error",nl:"Error"},mo={en:"or",nl:"of"},go={en:"Save location to profile",nl:"Locatie opslaan in profiel"},ho={en:"%{g:deeds | capitalize} in your area",nl:"%{g:deeds | capitalize} in de buurt"},po={en:"Location",nl:"Kies je adres"},fo={en:"Use my profile address",nl:"Gebruik mijn profieladres"},bo={addressAriaLabel:so,addressPlaceholder:oo,changeLocation:lo,clearLocation:ro,deviceLocation:co,fail:uo,or:mo,saveLocToProfile:go,selectLocation:ho,selectLocationButton:po,useMyProfileLocation:fo},vo={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateOwnLocation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"coordinates"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CoordinatesInput"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"address"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"countryCode"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}
1,{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"postcode"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"city"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateUser"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"coordinates"},value:{kind:"Variable",name:{kind:"Name",value:"coordinates"}}},{kind:"ObjectField",name:{kind:"Name",value:"address"},value:{kind:"Variable",name:{kind:"Name",value:"address"}}},{kind:"ObjectField",name:{kind:"Name",value:"countryCode"},value:{kind:"Variable",name:{kind:"Name",value:"countryCode"}}},{kind:"ObjectField",name:{kind:"Name",value:"postcode"},value:{kind:"Variable",name:{kind:"Name",value:"postcode"}}},{kind:"ObjectField",name:{kind:"Name",value:"city"},value:{kind:"Variable",name:{kind:"Name",value:"city"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"coordinates"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lat"}},{kind:"Field",name:{kind:"Name",value:"lng"}}]}},{kind:"Field",name:{kind:"Name",value:"address"}},{kind:"Field",name:{kind:"Name",value:"countryCode"}},{kind:"Field",name:{kind:"Name",value:"postcode"}},{kind:"Field",name:{kind:"Name",value:"city"}}]}}]}}]}}]},ko=e=>{const[t,a]=m.useState(!e.location),{setSearchState:o}=A(),s=vn(),i=m.useRef(null),c=N(bo),l=be(k=>!!k.auth.user?.id),u=be(k=>!!k.auth.user?.coordinates?.lat),r=be(Ge),d=m.useMemo(()=>r?{key:"profile",label:c("useMyProfileLocation"),value:r}:null,[c,r]),{autoFocus:g=!0}=e;m.useEffect(()=>{t&&g&&setTimeout(()=>{i.current?.input?.focus()},50)},[t,g]);const h=m.useCallback(k=>{o(y=>{if(ee(y))return{...y,page:1,location:k===null?{type:I.all}:qa(k)?{type:k}:{type:"location",location:k}};if(ne(y)){if(yt(k))throw new Error("Received special internal location in organization search state -- not supported");return{...y,page:1,location:k===null||k===I.all?{type:I.all}:{type:"location",location:k}}}throw new Error("Unhandled search state in `setLocation`")})},[o]),[p]=xt(vo),v=m.useCallback(k=>{l&&k&&typeof k=="object"&&k.coordinates&&!u&&p({variables:{coordinates:k.coordinates,address:k.address,countryCode:k.country_code,postcode:k.postcode,city:k.city}}).then(({data:y})=>{if(y)return s(Za({coordinates:y.updateUser.user.coordinates,address:y.updateUser.user.address,country_code:y.updateUser.user.countryCode,postcode:y.updateUser.user.postcode,city:y.updateUser.user.city}))}).catch(()=>{})},[s,p,l,u]),f=m.useCallback(()=>{h(null)},[h]);function b(){a(!1)}const S=m.useCallback(k=>{if(!k){f();return}try{h(k),b()}catch{mn.warning({message:c("fail"),duration:2})}},[f,c,h]);return n.jsx("div",{className:vs.wrapper,role:"search","aria-label":c("addressPlaceholder"),children:n.jsx(Ya,{inputRef:i,enableFlexibleLocation:e.enableStaticLocationOptions,enableFromHome:e.enableStaticLocationOptions,presets:d?[d]:[],forceAsInput:!0,value:e.location,"aria-label":c("addressAriaLabel"),placeholder:c("addressPlaceholder"),onChange:S,onSettled:v,size:"sm"})})},yo={en:"Anywhere",nl:"Overal"},xo={en:"Areas",nl:"Gebied"},So={en:"Anywhere",nl:"Overal"},_o={all:yo,areas:xo,selectPostcode:So};function jo({postcodeGroups:e,postcodes:t,enableStaticLocationOptions:a=!1,location:o}){const{setSearchState:s}=A(),i=N(_o),c=Kt(),l=m.useCallback(d=>{s(g=>{if(ne(g)){if(typeof d!="number"&&yt(d))throw new Error("Received special internal location in organization search state -- not supported");return{...g,page:1,location:typeof d=="number"?{type:"postcodes",postcodes:[d.toString()]}:{type:I.all}}}if(ee(g))return{...g,page:1,location:typeof d=="number"?{type:"postcodes",postcodes:[d.toString()]}:d===I.all?{type:I.all}:{type:d}};throw new Error("Unhandled search state in `pickValue`")})},[s]),u=m.useMemo(()=>{const d=(p,v)=>n.jsxs("div",{className:sn.optionInner,children:[n.jsx(se,{className:sn.optionIcon,icon:v,fixedWidth:!0}),n.jsx("span",{children:p})]}
1),g=i("all"),h=[{value:I.all,label:g,optionLabel:d(g,ls)}];if(a){const p=re(i.g("from_home")),v=re(i.g("flexible_location"));h.push({value:I.from_home,label:p,optionLabel:d(p,rs)},{value:I.flexible_location,label:v,optionLabel:d(v,cs)})}return[...h,{label:i("areas"),options:js(e).map(p=>{const v=c(p);return{value:p.id,label:v,optionLabel:d(v,ds)}})}]},[a,c,e,i]),r=m.useMemo(()=>t&&t.length>0?Number(t[0]):o===I.from_home||o===I.flexible_location?o:I.all,[t,o]);return n.jsx("div",{...w("search-postcode-group-picker"),className:sn.root,"aria-label":i("selectPostcode"),children:n.jsx(Be,{size:"sm",placeholder:i("selectPostcode"),value:r,onChange:l,options:u})})}function oa({query:e,postcodes:t,postcodeGroups:a,enableStaticLocationOptions:o,location:s,layout:i}){const c=kn(),l=N(),{setSearchState:u}=A(),r=i===O.sidebar,[d,g]=m.useState(e),h=m.useRef(e),p=_s(f=>{h.current=f,u(b=>({...b,query:f,page:1}))},300);m.useEffect(()=>{e!==h.current&&(h.current=e,g(e))},[e]);function v(f){g(f),f===""?(p.cancel(),h.current="",u(b=>({...b,query:"",page:1}))):p(f)}return n.jsxs(n.Fragment,{children:[n.jsx(St,{type:"search",size:"sm",...r?{w:"100%"}:{flex:"1 1 250px"},placeholder:l.g("search"),"aria-label":l.g("search"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,leftSection:n.jsx(se,{icon:Wt}),value:d,onChange:f=>v(f.currentTarget.value)}),n.jsx(K,{...r?{w:"100%"}:{flex:"1 1 300px"},children:c.settings.postcode_group_mode?n.jsx(jo,{postcodes:t||[],postcodeGroups:a,enableStaticLocationOptions:o,location:s}):n.jsx(ko,{enableStaticLocationOptions:o,location:s})})]})}const wo={en:"Subactivities for %{parentActivityName}",nl:"Subactiviteiten voor %{parentActivityName}"},No={subactivities:wo};function la({icon:e,label:t,bold:a,labelProps:o}){return n.jsxs(te,{gap:4,align:"flex-start",justify:"flex-start",wrap:"nowrap",children:[e!=null&&n.jsx(W,{fz:"xl","aria-hidden":!0,style:{flexShrink:0},children:e}),n.jsx(W,{fw:a?"bold":"normal",style:{minWidth:0,wordBreak:"break-word"},...o,children:t})]})}function Co(e,t){return a=>(a={...a},e.length===1?a.activities.some(([s])=>s===e[0])?a.activities=a.activities.filter(([s])=>s!==e[0]):a.activities=[...a.activities,...t.find(s=>s.id===e[0])?.label?.values?.map(s=>[e[0],s.id])||[]]:a.activities.findIndex(([s,i])=>s===e[0]&&i===e[1])===-1?a.activities=[...a.activities,e]:a.activities=a.activities.filter(([s,i])=>!(s===e[0]&&i===e[1])),a.page=1,a)}const st=({activityId:e,checked:t,indeterminate:a,activities:o,site:s,t:i,fill:c})=>{const{setSearchState:l}=A(),u=Ue(e,i.locale);if(!u)return null;const r=e.length===1;return n.jsx(xe,{onChange:()=>l(Co(e,o)),checked:t,indeterminate:a,"aria-label":u,style:c?{flex:1,minWidth:0}:void 0,styles:c?{body:{alignItems:"flex-start"},labelWrapper:{minWidth:0}}:void 0,label:n.jsx(la,{icon:r&&s.whitelabel.settings.show_emojis?Ja(e):void 0,label:u,bold:t||a,labelProps:w(`activities-menu-filter--label--${e.join("-")}`)})})},pn=e=>{const t=N(No),a=L(),o=yn(),[s,i]=m.useState(new Set),c=u=>{i(r=>{const d=new Set(r);return d.has(u)?d.delete(u):d.add(u),d})},l=m.useMemo(()=>o.map(u=>{const r=u.value,d=u.label.values.map(S=>[r,S.id]),g=d.every(([S,k])=>e.selected.some(([y,j])=>y===r&&j===k)),h=d.some(([S,k])=>e.selected.some(([y,j])=>y===r&&j===k))&&!g,p=Ue([r],t.locale);if(!p)return null;const v={activities:o,site:a,t},f=s.has(r),b=r===9?[...d].sort((S,k)=>{const y=Ue(S,t.locale),j=Ue(k,t.locale);return!y||!j?1:y.localeCompare(j)}):d;return n.jsxs(ie,{gap:0,mb:2,children:[n.jsxs(te,{gap:"xs",align:"flex-start",justify:"flex-start",wrap:"nowrap",children:[n.jsx(st,{activityId:[r],checked:g,indeterminate:h,fill:!0,...v}),b.length>0&&n.jsx(Qa,{onClick:()=>c(r),"aria-expanded":f,"aria-label":f?`Collapse ${p} sub-activities`:`Expand ${p} sub-activities`,variant:"subtle",size:"sm",style:{flexShrink:0},className:Y(on.chevron,{[on.chevronExpanded]:f}),children:n.jsx(se,{icon:us})})]}),b.length>0&&n.jsx(Ka,{in:f,children:n.jsx(ie,{gap:2,ml:8,children:b.map(([S,k])=>n.jsx(st,{activityId:[r,k],checked:e.selected.some(([y,j])=>y===r&&j===k),...v},k))})})]},r)}),[o,e.selected,a,t,s]);return n.jsx(n.Fragment,{children:l.length>0?n.jsxs("fieldset",{className:G.fieldset,"aria-label":e.withLegend?void 0:t.g("activities"),children:[e.withLegend?n.jsx("legend",{className:G.legend,children:t.g("activities")}):null,l]}):n.jsx("span",{className:on.noResults,children:t.g("noResults")})})},Tn=e=>{const{setSearchState:t}=A(),a=L(),o=N(),s=Xa(),i=m.useMemo(()=>ei(s).map((c,l)=>n.jsxs("fieldset",{className:G.fieldset,children:[n.jsx("legend",{className:G.legend,children:c.label.category_name}),n.jsx("ul",{className:Y(G.list,ln.list,{[ln.listToolbar]:e.layout==="toolbar"}),children:c.label.values.map(u=>{const r=e.selected.includes(u.id);return n.jsx("li",{children:n.jsx(xe,{checked:r,onChange:()=>t(Pa("causes",u.id)),styles:{labelWrapper:{minWidth:0}},...w(`cause-menu-checkbox--${u.id}`),label:n.jsx(la,{icon:a.whitelabel.settings.show_emojis?u.icon:void 0,label:u.label,bold:r,labelProps:w(`cause-menu-filter--label--${u.id}`)})})},u.id)})})]},l)),[s,e.selected,e.layout,t,a.whitelabel.settings.show_emojis]);return n.jsx(n.Fragment,{children:i.length>0?i:n.jsx("span",{className:ln.noResults,children:o.g("noResults")})})};function ot({deed:e,whitelabel:t,language:a,translateToMyLanguage:o}){if(e)return{id:e.id,title:jt({obj:e.title,currentlyActiveLanguage:a,shouldAttemptTranslateToUserLanguage:o,originalContentLanguage:e.detected_primary_language,whitelabel:t}),image:e.image}}function Do(e){return t=>({...t,page:1,deed:e})}const ra=e=>{const t=L(),{setSearchState:a}=A(),{ids:o,isLoading:s,error:i}=ni(),c=m.useContext(_t),u=ti()||s||i?void 0:o,r=d=>{e.onChange?e.onChange(ot({deed:d,translateToMyLanguage:c,whitelabel:t.whitelabel,language:t.language})):a(Do(ot({deed:d,translateToMyLanguage:c,whitelabel:t.whitelabel,language:t.language})))};return n.jsx(Ns,{id:e.inputId,organization_ids:u,onChange:r,value:e.selected,size:e.size})},Fn=({children:e})=>n.jsx(te,{gap:4,wrap:"wrap",align:"start",p:{base:"0 0 8px 0",sm:"0 4px 8px 4px"},bg:"var(--navbar-background-color)",children:e}),Mn=({children:e})=>n.jsx(te,{gap:4,wrap:"wrap",w:"100%",children:e}),U=({label:e,children:t,activeCount:a,buttonProps:o})=>{const s=!!a&&a>0;return n.jsxs(Xe,{withinPortal:!0,position:"bottom-start",trapFocus:!0,children:[n.jsx(Xe.Target,{children:n.jsxs(Z,{variant:"default",size:"sm",rightSection:n.jsx(se,{icon:$t,size:"sm"}),...o,className:Y(o?.className,s&&ks.active),children:[e,s?` (${a})`:""]})}),n.jsx(Xe.Dropdown,{children:t})]})},De=(...e)=>e.filter(Boolean).length,ca=e=>e.type.length+e.format.length+De(e.p2p_only),da=e=>De(e.date.length>0,e.subtype,e.min_hours||e.max_hours,e.required_availability),ua=e=>e.causes.length,ma=(e,t)=>{const a=new Set,o=new Map;e.forEach(i=>
1{const[c,l]=i;if(i.length===1||l===void 0){a.add(c);return}const u=o.get(c)??new Set;u.add(l),o.set(c,u)});let s=a.size;return o.forEach((i,c)=>{if(a.has(c))return;const l=t.find(r=>r.id===c)?.label?.values??[],u=l.length>0&&l.every(r=>i.has(r.id));s+=u?1:i.size}),s},ga=e=>e.sdgs.length,Io=({state:e,enabledMoreFilters:t,sdgsUnderMoreFilters:a=!1})=>t.filter(o=>o!==Jt.p2p_only&&e[o]).length+e.tags.length+(a?e.sdgs.length:0),ha=e=>e.types.length,pa=e=>e.causes.length,fa=e=>e.sdgs.length,ba=e=>e.tags.length,va=e=>e.causes.length,fn=e=>e.postcodeGroups?.length??0,ka=e=>e.availabilitySlots?.length??0,ya=e=>e.languages?.length??0,xa=e=>e.skills?.trim()?1:0;function To(e){return ee(e)?De(ca(e),da(e),ua(e),e.activities.length,ga(e),e.tags.length,e.organization_tags.length,...Object.values(Jt).map(t=>e[t]))>0:ne(e)?De(ha(e),pa(e),fa(e),ba(e))>0:wt(e)?De(va(e),e.activities.length,fn(e),ka(e),ya(e),xa(e))>0:!1}const Fo={en:"Volunteers who are free at any of the times you tick â and everyone who said they are flexible.",nl:"Vrijwilligers die vrij zijn op een van de momenten die je aanvinkt â en iedereen die heeft aangegeven flexibel te zijn."},Mo={en:"Cause",nl:"Interesses"},Lo={en:"Languages spoken",nl:"Gesproken talen"},Po={en:"Pick one or more languages",nl:"Kies een of meer talen"},zo={en:"We only show volunteers who fit within the set criteria.",nl:"We tonen alleen vrijwilligers die passen binnen de gestelde criteria."},Ao={en:"No potential volunteers matching the filters found",nl:"Geen potentiële vrijwilligers gevonden met deze filters"},Ro={en:"%{quotaLeft} reach outs remaining",nl:"%{quotaLeft} pogingen over"},Vo={en:"Reach out limit is per day, per %{g:organization}",nl:"Aanschrijvingslimiet is per dag, per %{g:organization}"},Oo={en:"Searching as %{organization_name}",nl:"Zoeken als %{organization_name}"},Eo={en:"Every word you type has to appear in the same skill, so a longer search narrows it down.",nl:"Elk woord dat je typt moet in dezelfde vaardigheid voorkomen, dus een langere zoekopdracht verfijnt het."},Uo={en:"Skills",nl:"Vaardigheden"},Bo={en:"e.g. first aid",nl:"bijv. eerste hulp"},Me={availabilityFilterHelp:Fo,cause:Mo,languagesFilterLabel:Lo,languagesFilterPlaceholder:Po,noUsersDescription:zo,noUsersTitle:Ao,quotaLeft:Ro,quotaLeftDescription:Vo,searchingAsOrganization:Oo,skillsFilterHelp:Eo,skillsFilterLabel:Uo,skillsFilterPlaceholder:Bo},Ln=()=>{const{setSearchState:e}=A();return e},Wo=({selected:e})=>{const t=N(Me),a=N(Nn),o=Ln(),s=B.useId(),i=new Set(e),c=l=>{o(u=>{const r=new Set(u.availabilitySlots??[]);return r.has(l)?r.delete(l):r.add(l),{...u,page:1,availabilitySlots:[...r]}})};return n.jsxs(ie,{gap:"xs",w:320,maw:"calc(100vw - 48px)",children:[n.jsx(W,{id:s,size:"sm",c:"textSecondary",children:t("availabilityFilterHelp")}),n.jsx(Ds,{role:"group","aria-label":a("section_availability"),"aria-describedby":s,...w(E.availabilityGrid),renderCell:({slot:l,day:u,part:r})=>n.jsx(Is,{day:u,part:r,selected:i.has(l),onToggle:()=>c(l),testId:E.availabilitySlot(l)})})]})},$o=({selected:e})=>{const t=N(Me),a=Ln();return n.jsx(K,{w:280,...w(E.languagesInput),children:n.jsx(Be,{isMulti:!0,searchable:!0,label:t("languagesFilterLabel"),placeholder:t("languagesFilterPlaceholder"),options:Ts([]),value:[...e],onChange:o=>{a(s=>({...s,page:1,languages:o}))}})})},Ho=({selected:e})=>{const t=N(Me),a=Ln(),[o,s]=B.useState(e),i=B.useRef(e),c=g=>{i.current=g,s(g)};B.useEffect(()=>{i.current=e,s(e)},[e]);const l=()=>{const g=i.current.trim();g!==e.trim()&&a(h=>({...h,page:1,skills:g}))},u=B.useRef(l);u.current=l,B.useEffect(()=>()=>u.current(),[]);const r=B.useRef(null),d=B.useRef(e);return d.current=e,B.useEffect(()=>{const g=h=>{h.key==="Escape"&&h.target===r.current&&(i.current=d.current)};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[]),n.jsx(St,{ref:r,w:260,value:o,maxLength:ai,label:t("skillsFilterLabel"),description:t("skillsFilterHelp"),placeholder:t("skillsFilterPlaceholder"),onChange:g=>c(g.currentTarget.value),onBlur:l,onKeyDown:g=>{g.key==="Enter"?(g.preventDefault(),l()):g.key==="Escape"&&c(e)},...w(E.skillsInput)})},lt=(e,t)=>e?!t&&e.actingOrganizations.length>=2?"picker":e.organizationContext?"line":"none":"none",Go=({answer:e,answerIsCurrent:t,deedSelected:a,selectedOrganizationId:o,onChange:s})=>{const i=N(Me);if(!t)return lt(e,e?.deedId!==void 0)==="none"?null:n.jsx(K,{className:rn.slot,...w(E.contextSlot)});const c=lt(e,a);if(c==="none")return null;if(c==="line")return n.jsx(K,{className:rn.slot,...w(E.contextSlot),children:n.jsx(W,{size:"sm",...w(E.contextLine),children:i("searchingAsOrganization",{organization_name:e.organizationContext.name})})});const l=e.actingOrganizations,u=l.some(({id:r})=>r===o)?o:void 0;return n.jsx(K,{className:rn.slot,...w(E.contextPicker),children:n.jsx(Fs,{organizations:l,selectedOrganizationId:u,onChange:s,selectProps:w(E.contextPickerSelect)})})},qo=640,Zo=300,Sa=e=>
1n.jsx(Nt,{...e,asBackgroundImage:!0,width:qo,height:Zo,className:Qn.image,classNameLoaded:Qn.imageLoaded,lazy:!0,fit:"crop"}),Yo={en:"You or your %{g:organization} have already reached out to this user.",nl:"Jijzelf of iemand anders in je %{g:organization} heeft deze gebruiker al aangeschreven"},Qo={en:"Asking",nl:"Je vraagt"},Ko={en:"for help with:",nl:"om hulp voor:"},Jo={en:"Write a personal message explaining why you think %{first_names} would be a good fit for your %{g:deed}",nl:"Schrijf een persoonlijk bericht waarin je uitlegt waarom je denkt dat %{first_names} goed bij jouw %{g:deed} past"},Xo={en:"Reach out",nl:"Aanschrijven"},el={en:"The selected user is not eligible for this %{g:deed} based on his/her preferences and the settings of the %{g:deed}, such as location preferences and interests.",nl:"De geselecteerde gebruiker komt niet in aanmerking voor %{g:thisDeed} %{g:deed} op basis van zijn/haar voorkeuren (locaties, interesses, etc.) en de instellingen van %{g:theDeed} %{g:deed}."},nl={alreadyReachedOut:Yo,asking:Qo,forHelpWith:Ko,message:Jo,send:Xo,userNotEligible:el},tl={definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VolunteerBankUserHitFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ListVolunteerBankUsersResultItem"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deedApplication"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}},{kind:"Field",name:{kind:"Name",value:"organizationContext"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"about"}},{kind:"Field",name:{kind:"Name",value:"accountVerified"}},{kind:"Field",name:{kind:"Name",value:"activityPublicEnabled"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"firstNames"}},{kind:"Field",name:{kind:"Name",value:"fullName"}},{kind:"Field",name:{kind:"Name",value:"lastName"}},{kind:"Field",name:{kind:"Name",value:"image"}},{kind:"Field",name:{kind:"Name",value:"notInterestedInFromHome"}},{kind:"Field",name:{kind:"Name",value:"isExternal"}},{kind:"Field",name:{kind:"Name",value:"language"}},{kind:"Field",name:{kind:"Name",value:"activities"}},{kind:"Field",name:{kind:"Name",value:"postcode"}},{kind:"Field",name:{kind:"Name",value:"searchRadius"}},{kind:"Field",name:{kind:"Name",value:"address"}},{kind:"Field",name:{kind:"Name",value:"causes"}},{kind:"Field",name:{kind:"Name",value:"city"}},{kind:"Field",name:{kind:"Name",value:"claimed"}},{kind:"Field",name:{kind:"Name",value:"coordinates"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lat"}},{kind:"Field",name:{kind:"Name",value:"lng"}}]}},{kind:"Field",name:{kind:"Name",value:"countryCode"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"memberships"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"image"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"slug"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"availability"},selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VolunteerBankAvailability"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"slots"}},{kind:"Field",name:{kind:"Name",value:"flexible"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"skillsAndLanguages"},selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VolunteerBankSkillsAndLanguages"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"languages"}},{kind:"Field",name:{kind:"Name",value:"skills"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"stats"}},{kind:"Field",name:{kind:"Name",value:"translateToMyLanguage"}},{kind:"Field",name:{kind:"Name",value:"whitelabelMemberships"},selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"UserWhitelabelMembershipList"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"memberships"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"whitelabel"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"WhitelabelTagData"}}]}}]}}]}}]}}]}}]}}]},_a={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"VolunteerBankUsersQuery"}
1,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"activities"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"causes"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CauseValue"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"deedId"}},type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"postcodeGroups"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"availabilitySlots"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"languages"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"skills"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}
1,{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"organizationId"}},type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"listVolunteerBankUsers"},arguments:[{kind:"Argument",name:{kind:"Name",value:"activities"},value:{kind:"Variable",name:{kind:"Name",value:"activities"}}},{kind:"Argument",name:{kind:"Name",value:"causes"},value:{kind:"Variable",name:{kind:"Name",value:"causes"}}},{kind:"Argument",name:{kind:"Name",value:"deedId"},value:{kind:"Variable",name:{kind:"Name",value:"deedId"}}},{kind:"Argument",name:{kind:"Name",value:"page"},value:{kind:"Variable",name:{kind:"Name",value:"page"}}},{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}},{kind:"Argument",name:{kind:"Name",value:"postcodeGroups"},value:{kind:"Variable",name:{kind:"Name",value:"postcodeGroups"}}},{kind:"Argument",name:{kind:"Name",value:"availabilitySlots"},value:{kind:"Variable",name:{kind:"Name",value:"availabilitySlots"}}},{kind:"Argument",name:{kind:"Name",value:"languages"},value:{kind:"Variable",name:{kind:"Name",value:"languages"}}},{kind:"Argument",name:{kind:"Name",value:"skills"},value:{kind:"Variable",name:{kind:"Name",value:"skills"}}},{kind:"Argument",name:{kind:"Name",value:"organizationId"},value:{kind:"Variable",name:{kind:"Name",value:"organizationId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"quota"}},{kind:"Field",name:{kind:"Name",value:"actingOrganizations"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"organizationContext"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VolunteerBankUserHitFragment"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"page"}},{kind:"Field",name:{kind:"Name",value:"pageSize"}},{kind:"Field",name:{kind:"Name",value:"total"}},{kind:"Field",name:{kind:"Name",value:"totalPages"}}]}}]}}]}},...tl.definitions,...Us.definitions]},jd={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"IsUserReachableInVolunteerBankQuery"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:{kind:"Name",value:"isReachable"},name:{kind:"Name",value:"volunteerBankIsUserReachable"},arguments:[{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}}]}]}}]},al={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"InviteUserToDeedViaVolunteerBank"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"deedId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"initialMessage"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"inviteUserToDeedViaVolunteerBank"},arguments:[{kind:"Argument",name:{kind:"Name",value:"deedId"},value:{kind:"Variable",name:{kind:"Name",value:"deedId"}}},{kind:"Argument",name:{kind:"Name",value:"initialMessage"},value:{kind:"Variable",name:{kind:"Name",value:"initialMessage"}}},{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},il=({id:e,user:t,onSubmit:a,initialValues:o})=>{const s=N(nl),[i,c]=m.useState(null),[l,u]=m.useState(null),r=Te(),d=ii({onSubmit:a,initialValues:o}),g=d.binding("deed"),h=Ct();return m.useEffect(()=>{(async()=>
1{if(c(null),u(null),!!g.value)try{const{data:p}=await h.query({query:_a,fetchPolicy:"network-only",variables:{deedId:g.value.id.toString(),userId:t.id.toString()}}),v=p.listVolunteerBankUsers.results.find(f=>f.user.id===t.id);if(!v){c(!1);return}if(c(!0),v?.deedApplication){u(!0);return}u(!1)}catch(p){console.error(p)}})()},[g.value,h,r,t]),n.jsxs(si,{id:e,...w("volunteer-bank-invite-user-to-deed-form"),form:d,children:[n.jsx(Wn,{label:s("asking"),children:n.jsx(Rs,{user:t})}),n.jsx(Ne,{label:s("forHelpWith"),required:!0,children:({inputId:p})=>n.jsxs("span",{children:[n.jsx(ra,{inputId:p,selected:g.value,onChange:g.onChange}),n.jsx(oi,{required:!0,passes:!!g.value&&i===!0&&l===!1})]})}),i===!1||l===!0?n.jsx("div",{children:n.jsx(li,{status:"danger",children:s(i===!1?"userNotEligible":"alreadyReachedOut")})}):null,n.jsx(Wn,{label:s("message",{first_names:t.firstNames||""}),required:!0,children:n.jsx(ri,{disabled:!g.value||i===!1||l===!0,rows:6,name:"initial_message",...w("volunteer-bank-invite-user-initial-message"),...d.binding("initial_message"),required:!0})}),n.jsx(ci,{children:n.jsx(Z,{type:"submit",loading:d.submitting,mt:"xs",children:s("send")})})]})},sl={en:"This potential volunteer already has an open application or reach out for this %{g:deed}",nl:"Deze potentiële vrijwilliger heeft al een open aanmelding of aanschrijving voor %{g:thisDeed} %{g:deed}"},ol={en:"Sent!",nl:"Verzonden!"},ll={en:"Fire confetti",nl:"Vuurconfetti"},rl={en:"Their phone number is %{phone_number}.",nl:"Hun telefoonnummer is %{phone_number} ."},cl={en:"Postcode",nl:"Postcode"},dl={en:"Feel free to reach out to %{first_names} by phone, they might respond quicker.",nl:"Voel je vrij om telefonisch contact op te nemen met %{first_names}, ze reageren misschien sneller."},ul={en:"Reach out",nl:"Aanschrijven"},ml={en:"Reaching out to %{first_names}",nl:"%{first_names} aanschrijven"},gl={en:"View profile",nl:"Profiel bekijken"},hl={en:"View profile of %{full_name}",nl:"Profiel bekijken van %{full_name}"},ja={alreadyApplied:sl,done:ol,fireConfetti:ll,phoneNumberIs:rl,postcode:cl,preferPhone:dl,reachOut:ul,title:ml,viewProfile:gl,viewProfileOf:hl},pl=({user:e})=>{const t=N(Nn),a=e.availability.__typename==="VolunteerBankAvailability"?e.availability:void 0,o=e.skillsAndLanguages.__typename==="VolunteerBankSkillsAndLanguages"?e.skillsAndLanguages:void 0,s=a&&(a.flexible||a.slots.length>0)?a:void 0,i=o&&(o.languages.length>0||o.skills.length>0)?o:void 0;if(!s&&!i)return null;const c=di.map(l=>({day:l,parts:ui.filter(u=>s?.slots.includes(mi(l,u)))})).filter(({parts:l})=>l.length>0);return n.jsxs(ie,{gap:4,mb:"xs",...w(E.hitProfileFacts),"data-testuserid":e.id,children:[s&&n.jsxs(te,{gap:"xs",...w(E.hitAvailability),children:[n.jsx(W,{size:"sm",fw:"bold",children:t("section_availability")}),s.flexible&&n.jsx(Ve,{size:"xsmall",marginless:!0,children:t("availability_flexible")}),c.map(({day:l,parts:u})=>n.jsx(Ve,{size:"xsmall",marginless:!0,children:`${t(Ms[l])}: ${u.map(r=>t(Ls[r])).join(", ")}`},l))]}),i&&n.jsxs(K,{children:[i.languages.length>0&&n.jsxs(te,{gap:"xs",...w(E.hitLanguages),children:[n.jsx(W,{size:"sm",fw:"bold",children:t("skills_languages_label")}),i.languages.map(l=>n.jsx(Ve,{size:"xsmall",marginless:!0,children:Ps(l)},l))]}),i.skills.length>0&&n.jsxs(te,{gap:"xs",...w(E.hitSkills),children:[n.jsx(W,{size:"sm",fw:"bold",children:t("skills_skills_label")}),i.skills.map((l,u)=>n.jsx(Ve,{size:"xsmall",marginless:!0,children:l},`${l}-${u}`))]})]})]})},fl="/assets/collaboration-BjYVcuYk.svg",bl=B.memo(function(t){const a=Fe.useUtils(),[o]=xt(al,{onCompleted:()=>{a.deeds.pendingApplicationsCount.invalidate()}}),[s,i]=m.useState(!1),c=N(ja),l=L(),u=gi(),r=Ye(t.page,!!t.isScrollWatcher),{searchState:d}=A(),g=be(j=>Dt(j)?.id===Number(t.hit.user.id)),h=zs(),{openReportDialog:p}=As({onSuccess:(j,T)=>{h.mutate({type:"user",user_id:Number(t.hit.user.id),reason:j},{onSuccess:()=>T()})},question:c.g("sureReportUserProfile")}),v=d.user_id===Number(t.hit.user.id),[f,b]=m.useState(v),S=m.useCallback(async j=>{const{initial_message:T}=j;try{const $=(await o({variables:{deedId:j.deed.id.toString(),initialMessage:T,userId:t.hit.user.id.toString()}})).data.inviteUserToDeedViaVolunteerBank.id,_=await a.deeds.applications.get.fetch({applicationId:Number($)});b(!1),i(_)}catch(z){u()(z)}},[t.hit.user.id,u,o,a]);if(!t.hit)return null;let k=n.jsx(Z,{disabled:!!t.hit.deedApplication,...w("user-hit-reach-out"),"data-testuserid":t.hit.user.id,onClick:()=>b(!0),children:c("reachOut")});t.hit.deedApplication&&(k=n.jsx(gn,{tooltip:c("alreadyApplied"),children:k}));const y=n.jsxs("div",{className:Ce.card,ref:r,children:[n.jsx(Vs,{hideSearchR
1adius:!0,hidePostcode:!0,user:{...t.hit.user,__typename:"User",canEditActivityPublicEnabled:!1,permissions:{__typename:"UserPermissions",delete:!1,edit:!1,read:!1,logBook:{__typename:"UserLogBookPermissions",read:!1},password:{__typename:"UserPasswordPermissions",edit:!1}}},refreshUser:()=>{}}),n.jsx(pl,{user:t.hit.user}),n.jsx("hr",{style:{marginBottom:"16px"}}),n.jsxs(te,{gap:"xs",children:[k,!!l.whitelabel.settings.rich_volunteer_profile_enabled&&n.jsx(Z,{component:We,variant:"subtle",to:pi("userProfile",{userId:Number(t.hit.user.id),organizationId:t.hit.organizationContext?Number(t.hit.organizationContext.id):void 0}),...w(E.hitProfileLink),"data-testuserid":t.hit.user.id,"aria-label":t.hit.user.fullName===hi?void 0:c("viewProfileOf",{full_name:t.hit.user.fullName}),children:c("viewProfile")}),n.jsx(Z,{color:"danger",variant:"subtle",disabled:g,...w("user-hit-report"),"data-testuserid":t.hit.user.id,onClick:p,children:c.g("report")}),t.hit.user.whitelabelMemberships.__typename==="UserWhitelabelMembershipList"&&n.jsx("div",{style:{verticalAlign:"middle",display:"inline-flex"},children:n.jsx(Es,{whitelabels:t.hit.user.whitelabelMemberships.memberships.map(j=>j.whitelabel)??[]})}),t.hit.user.postcode&&n.jsx(gn,{tooltip:c("postcode"),children:n.jsx("span",{className:Ce.postcode,children:t.hit.user.postcode})})]}),n.jsx(fi,{open:f,okButtonLabel:c("reachOut"),okButtonProps:{...w("volunteer-bank-invite-user-to-deed-form-send-application"),form:"volunteer-bank-invite-user-to-deed-form",type:"submit"},header:d?.deed?.image?j=>n.jsx("div",{className:Ce.image,...j,children:n.jsx(Sa,{alt:d?.deed?.title??"",src:d?.deed?.image??""})}):void 0,onCancel:()=>b(!1),title:c("title",{first_names:t.hit.user.firstNames||""}),children:n.jsx("div",{...w("volunteer-bank-invite-user-to-deed-modal"),children:n.jsx(il,{id:"volunteer-bank-invite-user-to-deed-form",user:t.hit.user,initialValues:{deed:d.deed},onSubmit:S})})}),n.jsx(vl,{show:!!s,application:s,onClose:()=>i(!1)})]});return t.display===q.List?n.jsx(In,{children:y}):y}),vl=e=>{const t=N(ja);function a(){bi({zIndex:0,particleCount:100,spread:70,origin:{y:.6}})}return m.useEffect(()=>{e.show&&a()},[e.show]),n.jsx(It,{open:e.show,onClose:e.onClose,title:null,...w("deed-reachout-success-modal"),children:n.jsxs("div",{className:Ce.successReachOutWrapper,...w("volunteer-bank-invite-sent-confirmation"),children:[n.jsx("img",{className:Ce.successReachOutImage,alt:"",role:"presentation",src:fl}),n.jsxs("h3",{children:[t("done")," ",n.jsx("button",{type:"button",onClick:a,children:n.jsx("span",{role:"img","aria-label":t("fireConfetti"),children:"ð"})})]}),e.application&&e.application.user.prefer_contact_by_phone&&e.application.user.phone_number&&n.jsxs(n.Fragment,{children:[n.jsx("div",{children:t("preferPhone",{first_names:e.application.user.first_names||""})}),n.jsx("div",{children:t("phoneNumberIs",{phone_number:e.application.user.phone_number})}),e.application.user.when_to_contact]})]})})},kl=(e,t)=>!!e&&e.deedId===t,yl=(e,t)=>e&&He(e,t)?e:t,xl=()=>{const[e,t]=m.useState(null),a=m.useCallback(o=>{t(s=>yl(s,o))},[]);return{answer:e,reportAnswer:a}},Sl=e=>({...$e(e,"deed","user_id"),page:1,causes:[],activities:[],postcodeGroups:[],availabilitySlots:[],languages:[],skills:""}),_l=Mt(ki),jl=Mt(vi),wd=({isDeedLocked:e,postcodeGroups:t})=>{const a=N(Me),o=N(Nn),s=L(),i=yn(),c=!!s.whitelabel.settings.rich_volunteer_profile_enabled,{innerWidth:l}=Tt(),[u,r]=m.useState(null),{answer:d,reportAnswer:g}=xl(),h=Ct(),p=q.Grid,v=m.useCallback(({searchState:b,setSearchState:S})=>n.jsx(Fn,{children:n.jsxs(Mn,{children:[c&&n.jsx(Go,{answer:d,answerIsCurrent:kl(d,b.deed?.id),deedSelected:!!b.deed,selectedOrganizationId:b.organizationId,onChange:k=>{S(y=>({...y,page:1,organizationId:k}))}}),xn(s.whitelabel)&&n.jsx(U,{label:a("cause"),activeCount:va(b),buttonProps:{...w("volunteer-bank-filter-buttons-cause")},children:n.jsx(Tn,{selected:b.causes,layout:"toolbar"})}),Ft(s.whitelabel)&&n.jsx(U,{label:a.g("activities"),activeCount:ma(b.activities,i),buttonProps:{...w("volunteer-bank-filter-buttons-activities")},children:n.jsx(pn,{selected:b.activities})}),c&&n.jsxs(n.Fragment,{children:[n.jsx(U,{label:o("section_availability"),activeCount:ka(b),buttonProps:{...w(E.availabilityButton)},children:n.jsx(Wo,{selected:b.availabilitySlots??[]})}),n.jsx(U,{label:o("skills_languages_label"),activeCount:ya(b),buttonProps:{...w(E.languagesButton)},children:n.jsx($o,{selected:b.languages??[]})}),n.jsx(U,{label:o("skills_skills_label"),activeCount:xa(b),buttonProps:{...w(E.skillsButton)},children:n.jsx(Ho,{selected:b.skills??""})})]}),n.jsx(ws,{label:fn(b)?`${a.g("postcodeGroup")} (${fn(b)})`:a.g("postcodeGroup"),dropdown:!0,buttonProps:{variant:"default",size:"sm"},onChange:k=>{S(y=>({...y,postcodeGroups:k.map(Number)}))},value:b.postcodeGroups.map(String)}),e&&b.deed?.title?n.jsx("span",{style:{lineHeight:"30px",marginRight:"10px"},children:b.deed.title}):n.jsx(ra,{selected:b.deed,size:"sm"}),u&&n.jsx(gn,{tooltip:a("quotaLeftDescription"),children:n.jsx("span",{style:{alignSelf:"center"},children:a("quotaLeft",{quotaLeft:u})})})]})}),[i,d,e,c,u,o,s.whitelabel,a]),f=m.useCallback(async b=>{const{data:S}=await h.query({fetchPolicy:"network-only",query:_a,variables:{activities:b.activities,causes:b.causes,deedId:b.deed?.id?.toString(),page:b.page,userId:b.user_id?.toString(),postcodeGroups:b.postcodeGroups,availabilitySlots:b.availabilitySlots,languages:b.languages,skills:b.skills,organizationId:b.organizationId?.toString()}});return{commit:()=>{r(S.listVolunteerBankUsers.quota??null),g({deedId:b.deed?.id,actingOrganizations:S.listVolunteerBankUsers.actingOrganizations.map(({id:k,name:y})=>({id:Number(k),name:y})),organizationContext:S.listVolunteerBankUsers.organizationContext?{id:Number(S.listVolunteerBankUsers.organizationContext.id),name:S.listVolunteerBankUsers.organizationContext.name}:null})},results:S.listVolunteerBankUsers.results.map(k=>({id:k.user.id,...k})),hits:S.listVolunteerBankUsers.pageInfo.total,pagination:{page:S.listVolunteerBankUsers.pageInfo.page,pageCount:S.listVolunteerBankUsers.pageInfo.totalPages,pageSize:S.listVolunteerBankUsers.pageInfo.pageSize,rowCount:S.listVolunteerBankUsers.pageInfo.total}}},[h,g]);return n.jsx(Vn,{hitMinWidth:l<600?l-50:600,hitMaxWidth:l<600?l-50:600,defaultDisplay:p,emptyStateString:a("noUsersTitle"),emptyStateDescriptionString:a("noUsersDescription"),title:"",description:"",HitComponent:bl,urlToState:_l,stateToUrl:jl,getToolbar:v,search:f,postcodeGroups:t})};function wa({message:e,testId:t}){return n.jsx(Lt,{h:"100%",mih:240,...e?{role:"status","aria-live":"polite"}:{},...t?w(t):{},children:e?n.jsxs(ie,{align:"center",gap:"sm",children:[n.jsx($n,{}),n.jsx(W,{c:"dimmed",children:e})]}):n.jsx($n,{})})}function rt({title:e,testId:t,children:a}){return n.jsx(Lt,{h:"100%",mih:240,p:"md",children:n.jsx(Bs,{color:"red",title:e,maw:520,...t?w(t):{},children:a})})}const wl={en:"Showing results from page %{page},",nl:"Resultaten van pagina %{page},"},Nl={en:"go to first page of results",nl:"ga naar de eerste pagina met resultaten"},Cl={en:"Next page",nl:"Volgende pagina"},Dl={en:"or",nl:"of"},Il={en:"show previous page",nl:"Bekijk vorige resultaten"},Tl={currentPage:wl,gotoPage1:Nl,nextPage:Cl,or:Dl,previousPage:Il};function Fl(e){const t=Ye(0,!0),a=N(Tl),{setSearchState:o,searchState:s}=A(),i=m.useCallback(()=>{o(d=>({...d,page:d.page+1}))}
1,[o]),c=m.useCallback(d=>{o(g=>({...g,page:d}))},[o]);if(!e.hits||e.hits.length===0)return null;const l=e.hits.length-1,u=e.hits.map((d,g)=>n.jsx(e.HitComponent,{display:e.display,hit:d,location:e.location,page:Math.ceil((g+1)/e.pageSize),isScrollWatcher:!e.paginated&&g===l&&e.hasMore,postcodeGroups:e.postcodeGroups,openInNewTab:e.openInNewTab},`${e.nbHits}-${d.id}`)),r=e.hitMinWidth!==void 0||e.hitMaxWidth!==void 0;return n.jsxs(n.Fragment,{children:[!e.paginated&&n.jsx("div",{ref:t}),e.paginated&&e.isLoading?n.jsx(wa,{}):r?n.jsx("div",{className:Kn.container,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${typeof e.hitMinWidth=="number"?`${e.hitMinWidth}px`:typeof e.hitMinWidth=="string"?e.hitMinWidth:"250px"}, ${typeof e.hitMaxWidth=="number"?`${e.hitMaxWidth}px`:typeof e.hitMaxWidth=="string"?e.hitMaxWidth:"304px"}))`},"aria-live":"polite",children:u}):n.jsx(yi,{type:"container",cols:{base:1,"520px":2,"810px":3,"1090px":4,"1370px":5},spacing:"md",mx:{base:4,xs:8},"aria-live":"polite",children:u}),e.paginated?(e.pageCount??0)>1&&n.jsx(te,{justify:"center",...w(kt.pagination),children:n.jsx(Ws,{total:e.pageCount??1,value:s.page,onChange:c,my:"xl"})}):e.hasMore&&n.jsx(Z,{variant:"subtle",onClick:i,className:Kn.nextButton,children:a("nextPage")})]})}const Ml={en:"Reset your filters, change your search or location to discover more. ",nl:"Reset je filters, wijzig je zoekopdracht of locatie om meer te vinden. "},Ll={en:"Clear filters",nl:"Filters resetten"},Pl={en:"Do you want to suggest %{g:aOrganization} %{g:organization} or activity? Inform us ",nl:"Zijn er %{g:organizations} of activiteiten bij jou in de buurt die ons nog niet kennen? Laat het ons "},zl={en:"here",nl:"hier"},Al={en:"We only show results within %{distance} %{label} of your selected location.",nl:"We laten alleen resultaten binnen %{distance} %{label} van je locatie zien."},Rl={en:" and help Deedmob grow!",nl:" en help Deedmob groeien!"},Vl={en:"Do you want %{g:organizations} to reach out to you? Sign up ",nl:"Wil je dat %{g:organizations} contact met je opnemen? Schrijf je in!"},Ol={en:"here",nl:"hier"},El={changeSearch:Ml,clearFilters:Ll,click:Pl,here:zl,showResults:Al,toSuggest:Rl,volunteerOnboardCta:Vl,volunteerOnboardHere:Ol},Ul=e=>{const t=L(),{distanceIntlLabel:a,kmDistanceToIntlDistance:o}=qe(),s=be(Dt),{resetSearchState:i}=A(),c=N(El),[l]=Pt(),u=t.whitelabel.settings.volunteer_bank_enabled,r=!!s,d=r&&xi(s),g=u&&(!r||!d);return u&&zt(l),n.jsxs("div",{className:Ee.root,children:[n.jsx("div",{className:Ee.searchIconWrapper,children:n.jsx(se,{icon:Wt,className:Ee.searchIcon})}),n.jsx("h2",{children:e.emptyStateString}),n.jsxs("div",{children:[n.jsxs("span",{children:[" ",c("changeSearch")]}),"emptyStateDescriptionString"in e&&e.emptyStateDescriptionString?n.jsx("span",{children:e.emptyStateDescriptionString}):"hasLocation"in e&&e.hasLocation?n.jsx("span",{children:c("showResults",{label:a,distance:String(o(e.searchRadius||s?.search_radius||t.whitelabel.settings.discover_search_radius))})}):null]}),g&&n.jsxs(n.Fragment,{children:[n.jsx("br",{}),n.jsxs("div",{children:[n.jsx("span",{children:c("volunteerOnboardCta")}),n.jsx("span",{children:n.jsx(We,{to:`?${l.toString()}`,children:c("volunteerOnboardHere")})})]})]}),n.jsx("br",{}),!Si(t.whitelabel)&&n.jsxs("div",{children:[n.jsx("span",{children:c("click")}),n.jsx("span",{children:n.jsx("a",{href:"mailto:[email protected]?Subject=Deedmob%20Suggestion",children:c("here")})}),n.jsx("span",{children:c("toSuggest")})]}),n.jsx("div",{className:Ee.clearFiltersWrapper,children:n.jsx(Z,{variant:"default",onClick:i,children:c("clearFilters")})})]})},Bl={en:"Reset filters",nl:"Reset filters"},Wl={reset:Bl};function $l({state:e}){const{resetSearchState:t}=A(),a=N(Wl);return To(e)?n.jsx(Z,{variant:"subtle",size:"compact-sm",onClick:t,...w(he.resetFilters),children:a("reset")}):null}const Hl=B.memo($l,He);function Na(e,t){return e==null&&t==null?!0:e?.type==="location"&&t?.type==="location"?e.location?.address===t.location?.address:e?.type==="postcodes"&&t?.type==="postcodes"?e.postcodes?.join(",")===t.postcodes?.join(","):e?.type===t?.type}const ct=({tooltip:e})=>n.jsxs(un,{width:300,openDelay:0,closeDelay:120,withArrow:!0,arrowSize:10,shadow:"md",styles:{dropdown:{backgroundColor:"#000",color:"#fff",border:"none",fontSize:"var(--mantine-font-size-sm)",lineHeight:"var(--mantine-line-height-xs)",padding:"var(--mantine-spacing-xs) var(--mantine-spacing-sm)"},arrow:{backgroundColor:"#000",border:"none"}},children:[n.jsx(un.Target,{children:n.jsx(K,{component:"span",ml:4,children:n.jsx(se,{icon:ms})})}),n.jsx(un.Dropdown,{children:n.jsx(Hs,{tooltip:e})})]}),Gl=e=>{const{setSearchState:t}=A(),{hierarchy:a}=Ze(),{enabledTags:o,enabledHierarchy:s}=m.useMemo(()=>{const c=ta(a,e.setting,!1);return{enabledHierarchy:c,enabledTags:c.flatMap(l=>l.tags)}},[a,e.setting]);if(o.length===0)return null;const i=e.value??[];return n.jsx(K,{children:s.map(c=>{const l=e.forVolunteers?c.label_volunteer:c.label,u=e.forVolunteers?c.tooltip_volunteer:c.tooltip;return n.jsxs(K,{mb:"xs",children:[!c.is_uncategorized&&n.jsxs(W,{fw:"bold",mb:4,children:[l," ",u&&n.jsx(ct,{tooltip:u})]}),c.tags.map(r=>{const d=e.forVolunteers?r.label_volunteer:r.label,g=e.forVolunteers?r.tooltip_volunteer:r.tooltip,h=i.includes(r.id);return n.jsx("li",{children:n.jsx(xe,{onChange:()=>{t(p=>({...p,page:1,[e.searchProp]:h?i.filter(v=>v!==r.id):[...i,r.id]}))},checked:h,label:n.jsxs(W,{children:[d," ",g&&n.jsx(ct,{tooltip:g})]})})},r.id)})]},c.id)})})},Pn=B.memo(e=>n.jsx(_i,{isInline:!0,help:"SearchTagsSelectorListItems",children:n.jsx(Gl,{...e})}));Pn.displayName="SearchTagsSelectorListItems";const ql=B.memo(function(t){const a=Ye(t.page,!!t.isScrollWatcher),{hover:o}=m.useContext(_e);if(!t.hit)return null;const s=n.jsx(Ks,{...t,containerRef:a,size:t.display===q.List?void 0:"square"});function i(){o(t.hit.id)}function c(){o(null)}return t.display===q.List?n.jsx(In,{children:s}):n.jsx("div",{onMouseEnter:i,onMouseLeave:c,children:s})}),Zl=e=>{const t=N(),{setSearchState:a}=A(),o=Js.map(s=>{const i=e.selected.includes(s);return n.jsx("li",{className:cn.itemRoot,children:n.jsx(At,{value:i,onChange:()=>a(Pa("types",s)),className:"margin-right-10 margin-top-10",children:t.g(s)})},s)});return n.jsx("fieldset",{"aria-label":re(t.g("type")),className:cn.fieldset,children:n.jsx("ul",{className:cn.list,children:o})})},Yl={en:"Maximum search radius reached",nl:"Maximale zoekradius bereikt"},Ql={en:"Minimum search radius reached",nl:"Minimum zoekradius bereikt"},Kl={en:"Show results up to",nl:"Toon resultaten tot"},Jl={en:"%{label} away",nl:"%{label} afstand"}
1,Xl={maxRadius:Yl,minRadius:Ql,radius:Kl,radiusEnd:Jl};function Ca(e){const t=kn(),a=N(Xl),{distanceIntlLabel:o,kmDistanceToIntlDistance:s,intlDistanceToKmDistance:i}=qe(),{setSearchState:c}=A(),l=gs();return n.jsxs("label",{htmlFor:l,className:Y(Jn.label,"deedmobLabel"),children:[a("radius"),n.jsx(ji,{id:l,className:Jn.inlineNumber,value:s(e.value),onChange:u=>{m.startTransition(()=>{if(u==null){c(r=>({...r,page:1,search_radius:en}));return}if(u>wi(t)){mn.warning({duration:3,dismissable:!0,message:a("maxRadius")});return}if(u<en){mn.warning({duration:3,dismissable:!0,message:a("minRadius")}),c(r=>({...r,page:1,search_radius:en}));return}c(r=>({...r,page:1,search_radius:i(u)}))})}}),a("radiusEnd",{label:o})]})}const er={en:"Causes",nl:"Interesses"},nr={en:"Click here for more information",nl:"Klik hier voor meer informatie"},tr={en:"SDGs",nl:"SDGs"},ar={causes:er,moreInfo:nr,sdgs:tr},dt=72,ir=110,sr=({organization:e})=>{const t=N(ar),a=m.useContext(_t),o=L(),s=Ni({organizationSlug:e.slug}),i=jt({obj:e.about,whitelabel:o.whitelabel,currentlyActiveLanguage:o.language,originalContentLanguage:e.detected_primary_language,shouldAttemptTranslateToUserLanguage:a}),c=Zt(t.locale,o.whitelabel),l=e.sdgs&&e.sdgs.length>0?c.filter(u=>e.sdgs.includes(u.value)):null;return n.jsxs("div",{className:ye.contentWrapper,children:[n.jsxs(We,{className:Y("clean-link",ye.headerWrapper),to:s,"aria-label":e.name,children:[n.jsx(Nt,{src:e.image,className:ye.organizationLogo,alt:e.name,width:dt,height:dt,fit:"clip"}),n.jsxs("div",{children:[n.jsx("h2",{className:ye.noMarginNoPadding,children:e.name}),n.jsx("h3",{className:ye.noMarginNoPadding,children:e.type&&t.g(e.type)})]})]}),e.causes&&e.causes.length>0&&n.jsx("div",{"aria-label":t("causes"),children:n.jsx(Os,{causes:e.causes})}),n.jsxs("div",{children:[n.jsx("p",{children:i}),n.jsx(We,{to:s,children:t("moreInfo")})]}),l&&l.length>0&&n.jsx("div",{"aria-label":t("sdgs"),children:l.map((u,r)=>n.jsx(Gs,{size:ir,sdg:u,selected:!1},`${u.label}-${r}`))})]})},or=e=>{const{data:t,error:a,isLoading:o}=Fe.organizations.get.useQuery({by:"id",id:e.organizationId}),s=t&&(t.cover_image||t.image);return n.jsx(It,{open:!0,header:t&&s?i=>n.jsx("div",{className:ye.previewImageWrapper,...i,children:n.jsx(Sa,{alt:t.name,src:s})}):void 0,onClose:e.onClose,children:t?n.jsx(sr,{organization:t}):n.jsx(Xs,{loading:o,error:a})})},lr={minZoom:2,disableDefaultUI:!0,clickableIcons:!1,gestureHandling:"auto",fullscreenControl:!1,zoomControl:!0,mapTypeControl:!1},rr={en:"%{smart_count} %{g:deed} |||| %{smart_count} %{g:deeds}",nl:"%{smart_count} %{g:deed} |||| %{smart_count} %{g:deeds}"},cr={en:"%{smart_count} %{g:organization} |||| %{smart_count} %{g:organizations}",nl:"%{smart_count} %{g:organization} |||| %{smart_count} %{g:organizations}"},dr={en:"Redo search here",nl:"Zoek opnieuw"},ur={en:"Search as I move the map",nl:"Zoek door op de kaart te navigeren"},mr={clusteredCountDeeds:rr,clusteredCountOrganizations:cr,redoSearchHere:dr,searchAsIMoveTheMap:ur},gr={en:'Expand %{g:deed} "%{name}"',nl:'Vouw %{g:deed} " %{name} " uit'},hr={en:'Expand %{g:organization} "%{name}"',nl:'Vouw %{g:organization} " %{name} " uit'},pr={expandDeed:gr,expandOrganization:hr},Da=B.memo(function({mode:t,itemId:a,name:o,image:s,onClick:i,zIndex:c,lat:l,lng:u}){const r=N(pr),d=m.useContext(_e),g=a===d.objectID,h=Sn({isVisible:g}),p=m.useCallback(()=>{d.hover(a)},[d,a]),v=m.useCallback(()=>{d.hover(null)},[d]);return n.jsx(Ci,{lat:l,lng:u,children:n.jsx("button",{className:Y(Xn.marker,g&&Xn.hovered),style:{backgroundImage:`url(${s})`,zIndex:g?h:c},type:"button","aria-label":r(t==="deeds"?"expandDeed":"expandOrganization",{name:o}),onClick:i,onContextMenu:i,onMouseEnter:p,onMouseLeave:v})})});async function fr(e,{dispatch:t,setSearchState:a,setHasMovedMap:o}){try{const s=await t(Di({coordinate:e}));if(!s)return;a(i=>{const c=Na(i.location,{type:"location",location:s});return{...i,page:c?i.page:1,location:{type:"location",location:{...s,coordinates:e,exact:!1}}}}),o(!1)}catch(s){hn(s instanceof Error?s:new Error(String(s)))}}const br={flex:1,position:"relative",height:"100%",width:"100%"},ut=13,vr=2003750834e-2,kr={strokeColor:"#000000",strokeOpacity:.4,strokeWeight:2,fillColor:"#000000",fillOpacity:.6},mt=(e,t,a=1e-4)=>Math.abs(e-t)<=a,yr={lng:4.9,lat:52.378},xr=e=>{const t=Sn({isVisible:!0});return n.jsx(Da,{...e,zIndex:t})};function Ia(e){const t=Sn({isVisible:!0}),a=L(),o=a.whitelabel.settings.postcode_group_mode,[s,i]=m.useState(null),[c,l]=m.useState(void 0),u=typeof e.location?.coordinates?.lat=="number",r=a.whitelabel.map_zoom??7,[d,g]=m.useState(u?ut:r),[h,p]=m.useState(!1),v=m.useRef(null),f=m.useRef(e.location?.coordinates??null),[b,S]=m.useState(!1),k=Ii(),{setSearchState:y}=A(),j=N(mr),T=Ti(e.radius);m.useEffect(()=>{if(s&&window.google&&e.radius&&T!==e.radius&&e.radius<2e3&&e.location?.coordinates){const C=new window.google.maps.Circle({radius:e.radius*1e3,center:e.location.coordinates});s.fitBounds(C.getBounds(),0);const V=s.getZoom();if(!V)throw new Error("No zoom found after fitting bounds -- this should not happen.");V>tt&&g(tt),V<at&&g(at)}},[s,e.radius,e.location,T]),m.useEffect(()=>{e.location&&f.current!==e.location.coordinates&&(v.current=f.current,f.current=e.location.coordinates??null,S(!1),g(ut)),e.location||(g(r),p(!1))},[e.location,r]);const z=u?e.location.coordinates:a.whitelabel.map_center??yr,$=m.useCallback(async()=>{const C=f.current;C&&await fr(C,{dispatch:k,setSearchState:y,setHasMovedMap:S})},[k,y]),_=m.useCallback((C,V,H)=>{C==null||V==null||Number.isNaN(C)||Number.isNaN(V)||v.current&&v.current.lat===C&&v.current.lng===V||(f.current!==null&&S(!0),v.current=f.current,f.current={lat:C,lng:V},H&&$())},[$]),M=m.useCallback(()=>
1{if(!s)return;const C=s.getCenter(),V=s.getZoom(),H=s.getBounds()?.toJSON();if(!C||!V||!H)throw new Error("Missed location data on map change -- this should not happen.");const de={lat:C.lat(),lng:C.lng()};g(V),l([H.west,H.south,H.east,H.north]),!(mt(z.lat,de.lat)&&mt(z.lng,de.lng))&&_(de.lat,de.lng,h)},[z.lat,z.lng,_,h,s]),J=m.useCallback(C=>{i(C)},[]),oe=m.useCallback(C=>{i(null)},[]),ce=m.useCallback(C=>j(e.mode==="deeds"?"clusteredCountDeeds":"clusteredCountOrganizations",{smart_count:C}),[j,e.mode]),ae=e.onItemClick,x=m.useCallback(({id:C,image:V,name:H},{lat:de,lng:Le})=>n.jsx(Da,{mode:e.mode,zIndex:t,itemId:C,name:H,image:V,onClick:()=>ae(C),lat:de,lng:Le}),[t,ae,e.mode]),{points:F,markers:D}=$s({resultsForMap:e.resultsForMap,bounds:c,zoom:d,map:s,mode:e.mode,makeItemMarker:x,onItemClick:ae,clusteredLabelFn:ce}),R=m.useContext(_e).objectID,X=m.useMemo(()=>{const C=R!==null?F.find(H=>H.properties.id===R)??null:null,V=C?n.jsx(xr,{mode:e.mode,itemId:C.properties.id,name:C.properties.name,image:C.properties.image,onClick:()=>ae(C.properties.id),lat:C.geometry.coordinates[1],lng:C.geometry.coordinates[0]},`m-hovered-${C.properties.id}`):null;return V?[...D,V]:D},[D,R,F,ae,e.mode]),ge=m.useMemo(()=>!e.location?.coordinates||!e.radius?null:{center:{lat:-e.location.coordinates.lat,lng:e.location.coordinates.lng-180},radius:vr-e.radius*1e3},[e.location?.coordinates,e.radius]);return n.jsxs("div",{className:dn.mapWrapper,children:[!o&&n.jsx("div",{className:dn.redoSearchButton,children:b&&!h?n.jsx(Z,{onClick:$,size:"sm",leftSection:n.jsx(se,{icon:hs}),children:j("redoSearchHere")}):n.jsx("div",{className:dn.searchAsIMoveTheMap,children:n.jsx(At,{value:h,onChange:p,children:j("searchAsIMoveTheMap")})})}),n.jsxs(Fi,{options:lr,center:z,zoom:d,onIdle:M,onLoad:J,onUnmount:oe,mapContainerStyle:br,children:[X,ge?n.jsx(Mi,{...ge,options:kr}):null]},u?"custom":"default")]})}const Sr=e=>{const[t,a]=m.useState(null),o=m.useCallback(()=>a(null),[]),s=e.searchState.location.type==="location"?e.searchState.location.location:null;return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:Y("section-background",ys.mapContainer),children:n.jsx(Ia,{radius:e.searchState.search_radius,location:s,resultsForMap:e.searchResults&&e.searchResults.resultsForMap,onItemClick:i=>a(i),mode:"organizations"})}),t!==null?n.jsx(or,{onClose:o,organizationId:t}):null]})},_r={en:"Cause",nl:"Interesse"},jr={en:"%{g:organizations | capitalize} in %{location}",nl:"%{g:organizations | capitalize} in %{location}"},wr={en:"%{g:organizations | capitalize} anywhere",nl:"%{g:organizations | capitalize} op alle locaties"},Nr={en:"Find charities and nonprofits that work towards the causes you care about, and discover ways to contribute to their impact via volunteering",nl:"Vind non-profit organisaties die zich richten op de doelen waar jij om geeft en ontdek manieren om bij te dragen aan hun impact via vrijwilligerswerk"},Cr={en:"Find charities and nonprofits in %{city} that work towards the causes you care about, and discover ways to contribute to their impact via volunteering",nl:"Vind non-profit organisaties in %{city} die zich richten op de doelen waar jij om geeft en ontdek manieren om bij te dragen aan hun impact via vrijwilligerswerk"},Dr={en:"Discover organisations in your city",nl:"Ontdek organisaties in jouw stad"},Ir={en:"Discover organisations in %{city}",nl:"Ontdek organisaties in %{city}"},Tr={en:"More Filters",nl:"Meer filters"},Fr={en:"No %{g:organizations} found...",nl:"Geen %{g:organizations} gevonden..."},Mr={en:"SDG",nl:"SDG"},Lr={cause:_r,heading:jr,headingAnywhere:wr,metaDescription:Nr,metaDescriptionWithCity:Cr,metaTitle:Dr,metaTitleWithCity:Ir,moreFilters:Tr,noOrganizations:Fr,sdg:Mr},zn=e=>{const{setSearchState:t}=A(),a=L(),o=N(),s=m.useMemo(()=>Zt(o.locale,a.whitelabel),[o.locale,a.whitelabel]);return n.jsx("div",{style:{maxWidth:"600px"},children:n.jsx(qs,{withLegend:e.withLegend,size:e.layout==="sidebar"?125:140,value:e.selected,onChange:i=>t(c=>({...c,page:1,sdgs:i??[]})),options:s})})};function An({dispatch:e,isMobile:t,showMap:a}){return async o=>{const{location:s,...i}=o,c={...i,...s.type==="postcodes"&&{postcodes:s.postcodes.join(",")},...s.type==="location"&&s.location.coordinates,pageSize:ea},l=t||!a,[u,r]=await Promise.all([e(Hn({...c,hideInDiscover:!0,resultsForMap:!1})),l?{results:[]}:e(Hn({...c,hideInDiscover:!0,resultsForMap:!0}))]);return{results:u.results,resultsForMap:r.results,hits:u.pagination.rowCount,pagination:u.pagination}}}function Ta(e){return Ri(e).isMobile}function Rn({urlString:e,language:t,fallbackLocation:a,discover_search_radius:o,postcodeGroups:s,postcode_group_mode:i,params:c}){const u=new URL(e,"https://-").searchParams,r={location:{type:I.all}},d=u.get("search_radius")&&Number(u.get("search_radius"))?Number(u.get("search_radius")):o;if(i){const v=c.location?Vt(c.location,s):null;v?r.location={type:"postcodes",postcodes:[v.toString()]}:r.location={type:I.all}}else if(c.location===I.all)r.location={type:I.all};else{const v=Ot(c.location)??a;v?r.location={type:"location",location:v}:r.location={type:I.all}}const g={$type:"organization-deed-search",query:u.get("q")||"",page:Math.max(1,Math.floor(Number(u.get("page")))||1),...r,search_radius:d,causes:[],sdgs:Yt(u.get("sdgs")?.split(","))||[],tags:u.get("tags")?.split(",").map(Number)||[],types:(u.get("type")||"").split(",").filter(
1Boolean)},h=!!c.causes&&c.causes.split("+").map(Et),p=[];if(h&&h.length>0&&h[0]){const v=Ut(t);for(const f of h)v.hasOwnProperty(f)&&p.push(v[f]);p.sort(),g.causes=p}return g}const Fa=e=>({...e,page:1,query:"",location:{type:I.all},causes:[],sdgs:[],tags:[],types:[]});function Ma({state:e,language:t,locationSearch:a,postcodeGroups:o}){const s=Vi(t);let i;switch(e.location.type){case"location":i=Pi(e.location.location);break;case"postcodes":i=Li(e.location.postcodes,o);break;default:i=e.location.type}const c=e.causes.length>0?`/${e.causes.map(d=>zi(d,t)).join("+")}`:"",l=`/${s}/${i}/organizations${c}`,u=Ai(new URLSearchParams(a),{page:e.page>1?String(e.page):void 0,search_radius:e.search_radius!=null?e.search_radius.toString():void 0,type:e.types.length>0?e.types.join(","):void 0,sdgs:e.sdgs.length>0?e.sdgs.join(","):void 0,tags:e.tags.length>0?e.tags.join(","):void 0,q:e.query?e.query:void 0}),r=String(u);return r.length>0?`${l}?${r}`:l}const La=()=>{const e=N(Lr),t=L(),a=vn(),o=na(),s=Rt(),i=Te(),{isMobile:c}=_n(),{distanceIntlLabel:l,kmDistanceToIntlDistance:u}=qe(),{hierarchy:r}=Ze(),d=m.useMemo(()=>ta(r,["enabled_for_organizations"],!1),[r]),g=m.useCallback((_,M,J)=>Rn({urlString:_,language:M,fallbackLocation:J,discover_search_radius:t.whitelabel.settings.discover_search_radius,postcode_group_mode:t.whitelabel.settings.postcode_group_mode,postcodeGroups:o,params:s}),[o,t.whitelabel.settings.discover_search_radius,t.whitelabel.settings.postcode_group_mode,s]),h=m.useCallback((_,M)=>Ma({state:_,language:M,locationSearch:i.search,postcodeGroups:o}),[o,i.search]),p=q.Grid,v=m.useCallback(({searchState:_})=>n.jsxs(Fn,{children:[n.jsx(oa,{query:_.query,..._.location.type==="postcodes"?{postcodes:_.location.postcodes,location:null}:_.location.type==="location"?{postcodes:null,location:_.location.location}:{postcodes:null,location:null},postcodeGroups:o}),n.jsxs(Mn,{children:[_.location.type==="location"?n.jsx(U,{label:n.jsxs(n.Fragment,{children:[u(_.search_radius)," ",l]}),buttonProps:{"aria-label":e.g("distance")},children:n.jsx(Ca,{value:_.search_radius})}):null,n.jsx(U,{label:re(e.g("type")),activeCount:ha(_),children:n.jsx(Zl,{selected:_.types})}),xn(t.whitelabel)&&n.jsx(U,{label:e("cause"),activeCount:pa(_),children:n.jsx(Tn,{selected:_.causes,layout:"toolbar"})}),wn(t.whitelabel)&&n.jsx(U,{label:e("sdg"),activeCount:fa(_),children:n.jsx(zn,{layout:"toolbar",selected:_.sdgs})}),d.length>0&&n.jsx(U,{label:e("moreFilters"),activeCount:ba(_),children:n.jsx("fieldset",{className:et.fieldset,"aria-label":e("moreFilters"),children:n.jsx("ul",{className:et.list,children:n.jsx(Pn,{searchProp:"tags",value:_.tags,setting:["enabled_for_organizations"],forVolunteers:!0})})})})]})]}),[t.whitelabel,e,o,u,l,d]),f=m.useCallback(({searchState:_})=>_.location.type==="location"&&_.location.location.city?`${e("heading",{location:_.location.location.city})} ·`:e("headingAnywhere"),[e]),b=m.useCallback(_=>_?e("metaTitleWithCity",{city:_}):e("metaTitle"),[e]),S=m.useCallback(_=>_?e("metaDescriptionWithCity",{city:_}):e("metaDescription"),[e]),[k,y]=m.useState(null),j=m.useMemo(()=>({hover:y,objectID:k}),[k]),T=t.whitelabel.settings.organization_discover_show_map,z=m.useCallback(_=>An({dispatch:a,isMobile:c,showMap:T})(_),[a,c,T]),$=m.useCallback(({searchState:_,displayMode:M,searchResults:J})=>M===q.Grid&&T===!0&&n.jsx(Sr,{searchState:_,searchResults:J}),[T]);return n.jsx(_e.Provider,{value:j,children:n.jsx(Vn,{defaultDisplay:p,emptyStateString:e("noOrganizations"),HitComponent:ql,title:b,description:S,urlToState:g,stateToUrl:h,getHeading:f,getToolbar:v,getRightbar:$,search:z,postcodeGroups:o,paginated:!0,hitMinWidth:200,hitMaxWidth:200})})},Pr=async({trpcUtils:e,store:t,site:a,initialState:o,search:s,pathname:i,params:c,userAgent:l})=>{const u=a.whitelabel.settings.postcode_group_mode?await e.postcodeGroups.list.fetch({whitelabelId:a.whitelabel.organization_id}):null,r=Ge(t.getState()),d={pathname:i,search:s},g=await An({dispatch:t.dispatch,isMobile:Ta(l),showMap:a.whitelabel.settings.organization_discover_show_map})(Rn({urlString:Ie(d),language:a.language,fallbackLocation:r,discover_search_radius:a.whitelabel.settings.discover_search_radius,postcodeGroups:u?.postcodeGroups??[],postcode_group_mode:a.whitelabel.settings.postcode_group_mode,params:c}));o||(o={}),o.searchResults=g};La.preload=Pr;const Nd=Object.freeze(Object.defineProperty({__proto__:null,default:La,orgSearchStateToUrl:Ma,orgSearchUrlToState:Rn,preloadTreatsUaAsMobile:Ta,resetOrgSearchState:Fa,searchFnWrapper:An},Symbol.toStringTag,{value:"Module"})),zr={en:"We couldnât resolve the location in this address, so we didnât run the search. Please try again, or search everywhere instead.",nl:"We konden de locatie in dit adres niet bepalen, dus we hebben niet gezocht. Probeer het opnieuw of zoek overal."},Ar={en:"We couldnât find that location",nl:"We konden die locatie niet vinden"},Rr={en:"Finding your locationâ¦",nl:"Locatie ophalenâ¦"},Vr={en:"Retry",nl:"Opnieuw proberen"},Or={en:"Search everywhere instead",nl:"Zoek in plaats daarvan overal"},Er={en:"Something went wrong while running your search. Please try again.",nl:"Er ging iets mis bij het uitvoeren van je zoekopdracht. Probeer het opnieuw."},Ur={en:"We couldnât load these results",nl:"We konden deze resultaten niet laden"},Br={en:"Retry",nl:"Opnieuw proberen"},Wr={geocodeErrorBody:zr,geocodeErrorTitle:Ar,geocodePending:Rr,geocodeRetry:Vr,geocodeSearchEverywhere:Or,searchErrorBody:Er,searchErrorTitle:Ur,searchRetry:Br};function $r(e){const t=new URLSearchParams(e);return t.delete("page"),Array.from(t.keys()).length>0}function Hr(e){return e.filter((t,a)=>{const o=e.findIndex(s=>s.id===t.id);return a===o})}const Gr=800;function Ie(e){return e.pathname+e.search}function gt(e){return e.type==="location"&&!!e.location.address&&!e.location.coordinates}const qr=()=>{const e=Yi(),[t,a]=m.useState(e.searchResults??null);return m.useEffect(()=>{e.clear?.()},[]),[t,a]},Zr=({urlToState:e,userDefaults:t})=>{const a=jn(),o=Te(),s=be(Ge),[i,c]=m.useState(()=>e(Ie(o),a,s,t)),l=m.useCallback(()=>{c(Yr)},[]);return{searchState:i,setSearchState:c,resetSearchState:l,searchStateContext:m.useMemo(()=>({searchState:i,setSearchState:c,resetSearchState:l}),[i,c,l])}};function Vn(e){const t=jn(),a=N(Wr),o=L(),s=vn(),i=Te(),c=Oi(),[l,u]=qr(),{searchState:r,setSearchState:d,searchStateContext:g}=Zr({urlToState:e.urlToState,userDefaults:e.userDefaults}),[h,p]=m.useState(null),[v,f]=m.useState(Ie(i)),[b,S]=m.useState(""),[k,y]=m.useState(!1),j=m.useRef(Date.now()),T=m.useRef(null),z=m.useRef(!1),[$,_]=m.useState("idle"),[M,J]=m.useState(!1),oe=Ei(),ce=m.useRef(null);m.useEffect(()=>{const P=Ie(i),Q=(ne(r)||ee(r))&>(r.location);if(!b&&P!==v){d(e.urlToState(P,t,null)),f(P);return}if(Q)return;if(!He(h,r)){D().catch(()=>{});return}b&&P===b&&S("")});const ae=m.useCallback(P=>{_("pending"),s(Ui({address:P})).then(Q=>{if(!oe.current||ce.current!==P)return;const ke=Q[0];if(!ke){_("failed");return}_("idle"),d(ue=>{if(!ne(ue)&&!ee(ue))return ue;const Pe=Na(ue.location,{type:"location",location:ke});return{...ue,page:Pe?ue.page:1,location:{type:"location",location:ke}}})}).catch(Q=>
1{oe.current&&(hn(Q instanceof Error?Q:new Error(String(Q))),_("failed"))})},[s,oe,d]),x=(ne(r)||ee(r))&>(r.location)?r.location.location.address:null;m.useEffect(()=>{if(x===null){ce.current=null;return}ce.current!==x&&(ce.current=x,ae(x))},[x]);const F=m.useCallback(()=>{_("idle"),d(P=>!ne(P)&&!ee(P)?P:{...P,page:1,location:{type:I.all}})},[d]);async function D(){const P=r,Q=e.stateToUrl(P,t),ke=$e(h,["page"]),ue=$e(P,["page"]),Pe=h&&h.page!==P.page&&He(ke,ue),Qe=!!h&&h.page-1===P.page,Bn=!!h&&h.page+1===P.page,Ke=Date.now();j.current=Ke;const Va=l&&l.results.length>=l.pagination.pageSize*P.page,Oa=!e.paginated&&Pe&&(Qe||Bn&&Va);S(Q);const ze=Bi(P);if(p(ze),!Oa)try{y(!0),J(!1);const{commit:je,...Je}=await e.search(ze);let Ae=Je.results;if(!oe.current||(y(!1),z.current=!0,Ke!==j.current))return;if(je?.(),!e.paginated&&l&&Pe){if(Qe&&l.results.length>=l.pagination.pageSize*(ze.page+1))return;Ae=Qe?Ae.concat(l.results):Bn?l.results.concat(Je.results):Ae}const Ea=Hr(Ae);u({...Je,results:Ea}),e.paginated&&T.current?.scrollTo({top:0})}catch(je){if(!oe.current||(y(!1),Ke!==j.current))return;hn(je instanceof Error?je:new Error(String(je))),J(!0)}f(Q),p(ze),S(Q),c(Q,{replace:j.current+Gr>=Date.now()})}const R=(ne(r)||ee(r))&&r.location.type==="location"&&(r.location.location.city||r.location.location.country)||"",X=typeof e.title=="function"?e.title(R):e.title;Wi(X),$i(()=>{const P=typeof e.description=="function"?e.description(R,r):e.description;return{"og:title":X,"og:description":P,...e.noindexWhenFiltered&&$r(i.search)?{robots:"noindex,follow"}:{}}}),Hi(()=>o.httpsUrl+e.stateToUrl(r,t));const ge=e.defaultDisplay||q.Grid,C=m.useMemo(()=>({searchState:r,searchResults:l,displayMode:ge,setSearchState:d}),[r,l,ge,d]);if($==="pending")return n.jsx(wa,{message:a("geocodePending"),testId:he.geocodePending});if($==="failed")return n.jsx(rt,{title:a("geocodeErrorTitle"),testId:he.geocodeError,children:n.jsxs(ie,{gap:"md",children:[n.jsx(W,{children:a("geocodeErrorBody")}),n.jsxs(te,{children:[n.jsx(Z,{onClick:()=>{x!==null&&ae(x)},...w(he.geocodeRetry),children:a("geocodeRetry")}),n.jsx(Z,{variant:"default",onClick:F,...w(he.geocodeSearchEverywhere),children:a("geocodeSearchEverywhere")})]})]})});if(M)return n.jsx(rt,{title:a("searchErrorTitle"),testId:he.searchError,children:n.jsxs(ie,{gap:"md",children:[n.jsx(W,{children:a("searchErrorBody")}),n.jsx(te,{children:n.jsx(Z,{onClick:()=>{D().catch(()=>{})},...w(he.searchRetry),children:a("searchRetry")})})]})});if(!l)return null;const V=e.getToolbar?.(C),H=e.getLeftbar?.(C),de=e.getRightbar?.(C),Le=e.getHeading?.(C),Ra=l.pagination.page<l.pagination.pageCount;return n.jsxs(Gi,{value:g,children:[V,n.jsxs("div",{className:Y(me.mainContainer,!V&&me.noToolbar),children:[n.jsxs("div",{className:me.resultListContainer,ref:T,...w("search-results-scroll"),children:[H&&n.jsx("div",{className:me.leftbar,children:H}),n.jsxs("div",{className:Y(me.resultList),...w("search-results"),children:[n.jsxs("div",{className:me.appliedFiltersContainer,children:[n.jsxs("div",{className:me.appliedFilters,children:[Le&&n.jsx(qi,{order:1,size:"md",fw:"bold",children:Le}),n.jsx("span",{"aria-live":"polite",role:"status",children:a.g("results",{n:l.hits||0,smart_count:l.hits||0})}),n.jsx(Hl,{state:r})]}),e.getInnerTopRightContentMobileOnly&&n.jsx("div",{className:Y("hideMobile",me.topRightContent),children:e.getInnerTopRightContentMobileOnly(C)})]}),!k&&!l.results.length&&ge!==q.Map&&n.jsx(Ul,{emptyStateString:e.emptyStateString,emptyStateDescriptionString:e.emptyStateDescriptionString,...ee(r)||ne(r)?{hasLocation:r.location.type==="location",searchRadius:r.search_radius}:{}}),n.jsx(Fl,{hitMinWidth:e.hitMinWidth,hitMaxWidth:e.hitMaxWidth,HitComponent:e.HitComponent,hits:l.results,display:ge,location:(ee(r)||ne(r))&&r.location.type==="location"?r.location.location:null,hasMore:Ra,nbHits:l.hits,pageSize:l.pagination.pageSize,postcodeGroups:e.postcodeGroups,openInNewTab:e.openInNewTab,paginated:e.paginated,pageCount:l.pagination.pageCount,isLoading:k&&z.current}),n.jsx(Zi,{mode:"deeds",align:"center"})]})]}),de]})]})}const Yr=e=>{if(ee(e))return za(e);if(ne(e))return Fa(e);if(wt(e))return Sl(e);throw new Error("Invalid search state when resetting")};function Pa(e,t){return a=>{const o=a[e];return Array.isArray(o)?{...a,page:1,[e]:o.includes(t)?o.filter(s=>s!==t):[...o,t]}:a}}const Qr=e=>{const t=kn(),a=jn(),o=Qi(t,a),s=e.searchState.location.type==="location"?e.searchState.location.location:null;return n.jsx("div",{className:Y("section-background",xs.mapContainer),children:n.jsx(Ia,{radius:e.searchState.search_radius,location:s,resultsForMap:e.searchResults&&e.searchResults.resultsForMap,onItemClick:i=>{const l=e.searchResults.resultsForMap?.find(u=>u[0]===i)?.[4];l&&window.open(Ki({organizationSlug:l,deedId:i,deedTitleOrSlug:null,deedsTranslation:o}),"_blank")},mode:"deeds"})})},ve=({children:e})=>n.jsx(n.Fragment,{children:e});function Kr({layout:e,searchState:t}){const a=L(),o=N(),s=yn();return Ft(a.whitelabel)?e===O.sidebar?n.jsx(ve,{children:n.jsx(pn,{withLegend:!0,selected:t.activities})}):n.jsx(U,{label:o.g("activity"),activeCount:ma(t.activities,s),children:n.jsx(pn,{selected:t.activities})}):null}function Jr({layout:e,searchState:t}){const a=L(),o=N();if(!xn(a.whitelabel))return null;const s=n.jsx(Tn,{selected:t.causes,layout:e});return e===O.sidebar?n.jsx(ve,{children:s}):n.jsx(U,{label:o.g("cause"),activeCount:ua(t),children:s})}function Xr(e){const{setSearchState:t}=A(),a=()=>{t(o=>(o={...o,page:1,[e.toggle]:!o[e.toggle]},e.omitWhen!==void 0&&o[e.toggle]===e.omitWhen&&delete o[e.toggle],o))};return n.jsx(xe,{checked:e.value,onChange:a,className:e.className,label:n.jsx(W,{children:e.label})})}const ht=({moreFilters:e,searchState:t,withLegend:a})=>{const o=N(Se),{enabledBySetting:s}=Ze(),i=L(),c=m.useMemo(()=>[...!i.whitelabel.settings.volunteerings_enabled||i.whitelabel.settings.omit_volunteering_in_search?[]:["enabled_for_volunteering"],...!i.whitelabel.settings.workshops_enabled||i.whitelabel.settings.omit_workshops_in_search?[]:["enabled_for_workshops"],...!i.whitelabel.settings.community_events_enabled||i.whitelabel.settings.omit_community_events_in_search?[]:["enabled_for_community_events"],...!i.whitelabel.p2p_organization_id&&!i.whitelabel.settings.p2p_deeds_enabled||i.whitelabel.settings.p2p_deeds_default_hidden_in_search?[]:["enabled_for_p2p"],"enabled_for_organizations"],[i.whitelabel.settings.volunteerings_enabled,i.whitelabel.settings.workshops_enabled,i.whitelabel.settings.community_events_enabled,i.whitelabel.settings.omit_volunteering_in_search,i.whitelabel.settings.omit_workshops_in_search,i.whitelabel.settings.omit_community_events_in_search,i.whitelabel.settings.p2p_deeds_enabled,i.whitelabel.p2p_organization_id,i.whitelabel.settings.p2p_deeds_default_hidden_in_search]),l=aa(s,c),u=e.length>0?n.jsxs("fieldset",{className:G.fieldset,"aria-label":a?void 0:o("moreFilters"),children:[a?n.jsx("legend",{className:G.legend,children:o("moreFilters")}):null,n.jsx("ul",{className:G.list,children:e.map(r=>n.jsx("li",{children:n.jsx(Xr,{value:!!t[r.value],label:r.label,toggle:r.value,omitWhen:!1})},r.value))})]}):null;return n.jsxs(n.Fragment,{children:[u,l&&n.jsx(K,{mt:"md",children:n.jsxs("fieldset",{className:G.fieldset,children:[n.jsx("legend",{className:G.legend,children:o.g("tags")}
1),n.jsx("ul",{className:G.list,children:n.jsx(Pn,{searchProp:"tags",value:t.tags,setting:c,forVolunteers:!0})})]})})]})};function ec({layout:e,searchState:t,setSearchState:a,getInnerTopRightContentMobileOnly:o}){const s=N(Se),{isMobile:i}=_n(),c=L(),l=Cs({whitelabel:c.whitelabel}),{enabledBySetting:u}=Ze(),r=e===O.sidebar&&wn(c.whitelabel);if(!(l.length>0||aa(u,["enabled_for_volunteering","enabled_for_workshops","enabled_for_community_events","enabled_for_p2p","enabled_for_organizations"])||r))return null;const g=i?o({searchState:t,setSearchState:a}):null;return e===O.sidebar?n.jsxs(ve,{children:[n.jsx(ht,{withLegend:!0,moreFilters:l,searchState:t}),r?n.jsx(ve,{children:n.jsx(zn,{withLegend:!0,selected:t.sdgs,layout:e})}):null,g]}):n.jsxs(U,{label:s("moreFilters"),activeCount:Io({state:t,enabledMoreFilters:l.map(h=>h.value)}),children:[n.jsx(ht,{moreFilters:l,searchState:t}),g]})}function nc({layout:e,searchState:t}){const a=L(),o=N(),{distanceIntlLabel:s,kmDistanceToIntlDistance:i}=qe();if(a.whitelabel.settings.postcode_group_mode)return null;const c=n.jsx(Ca,{value:t.search_radius});return e===O.sidebar?n.jsx(ve,{children:c}):n.jsx(U,{label:n.jsxs(n.Fragment,{children:[i(t.search_radius)," ",s]}),buttonProps:{"aria-label":o.g("distance")},children:c})}function tc({layout:e,searchState:t}){const a=N(),o=L();return e===O.sidebar||!wn(o.whitelabel)?null:n.jsx(U,{label:a.g("sdg"),activeCount:ga(t),children:n.jsx(zn,{selected:t.sdgs,layout:O.toolbar})})}const ac={en:"Afternoons",nl:"'s middags"},ic={en:"(12pm-5pm)",nl:"(12:00-17:00)"},sc={en:"Flexible availability",nl:"Flexibel"},oc={en:"Evenings",nl:"'s avonds"},lc={en:"(after 5pm)",nl:"(na 17:00)"},rc={en:"Mornings",nl:"'s ochtends"},cc={en:"(before 12pm)",nl:"(voor 12:00)"},dc={en:"Any number of hours",nl:"Aantal uur maakt niet uit"},uc={en:"Up to %{hours} hours",nl:"Tot %{hours} uur"},mc={en:"Up to %{hours} hours per week",nl:"Tot %{hours} uur per week"},gc={en:"At least %{hours} hours",nl:"Ten minste %{hours} uur"},hc={en:"%{hours} hours per week or more",nl:"%{hours} uur per week of meer"},pc={en:"How many hours",nl:"Hoeveel uur"},fc={en:"I'm not sure",nl:"Ik weet het niet"},bc={en:"Longer than a day",nl:"Langer dan een dag"},vc={en:"Positions that require some time commitment",nl:"Positie waar enige tijd en inzet voor vereist is"},kc={en:"Preferred time",nl:"Gewenste tijd"},yc={en:"One day",nl:"Een dag"},xc={en:"Activities or tasks only done once in less than a day",nl:"Activiteiten of taken die minder dan een dag duren"},Sc={en:"What kind of %{type} are you interested in?",nl:"In wat voor soort %{type} ben je geïnteresseerd?"},_c={en:"When?",nl:"Wanneer?"},jc={availability_afternoons:ac,availability_afternoons_h:ic,availability_any:sc,availability_evenings:oc,availability_evenings_h:lc,availability_mornings:rc,availability_mornings_h:cc,hours_any:dc,hours_max_once:uc,hours_max_weekly:mc,hours_min_once:gc,hours_min_weekly:hc,howManyHours:pc,imNotSure:fc,long:bc,long_h:vc,requiredAvailability:kc,short:yc,short_h:xc,title:Sc,whenShouldItStart:_c},wc=e=>{const{setSearchState:t}=A(),{sidebarMode:a}=Xt(),[o,s]=e.date.map(Ji);return n.jsx(Xi,{id:e.id,"aria-labelledby":e["aria-labelledby"],type:"range",value:[o??null,s??null],minDate:new Date,maxDate:new Date(new Date().getFullYear()+2,11),styles:{month:a?{width:"100%"}:void 0,monthCell:{textAlign:"center"}},numberOfColumns:a?1:2,onChange:([i,c])=>{const l=i?Gn(i).startOf("day").unix():null,u=c?Gn(c).endOf("day").unix():null;t(r=>({...r,page:1,date:[...l?[l]:[],...u?[u]:[]]}))},allowSingleDateInRange:!0})},Nc=e=>{const t=N(jc),a=N(Se),{searchState:o,setSearchState:s}=A(),i=L(),c=Ht({selected:o.type,site:i,tg:t.g}),l=n.jsx(Ne,{label:t("requiredAvailability"),children:({inputId:h})=>n.jsx(Be,{className:we.availability,name:"availability",id:h,options:[{label:t("availability_any"),value:pe.any},{label:t("availability_mornings"),value:pe.mornings},{label:t("availability_afternoons"),value:pe.afternoons},{label:t("availability_evenings"),value:pe.evenings}],value:e.required_availability||pe.any,onChange:p=>p&&s(v=>({...v,page:1,required_availability:p})),comboboxProps:{withinPortal:!1},required:!0})}),u=e.subtype===le.one_off?qn.once:qn.weekly,r=e.subtype===le.one_off?[2,4,8,16,0]:[2,4,8,16,-16,0],d=h=>h===0?t("hours_any"):h>0?t(`hours_max_${u}`,{hours:h}):t(`hours_min_${u}`,{hours:-h}),g=(()=>
1{if(e.max_hours!==void 0)return e.max_hours;if(e.min_hours!==void 0)return-e.min_hours})();return n.jsxs("fieldset",{"aria-label":a("time"),className:we.fieldset,children:[n.jsx(Ne,{label:t("title",{type:c}),labelClassName:we.noMarginLabel,children:({labelTextId:h})=>n.jsx(Zs,{required:!0,htmlProps:{"aria-labelledby":h},options:[{value:le.one_off,preview:[nn(fe.volunteering,le.one_off)],title:t.g("one_off")},{value:le.project_role,preview:[nn(fe.volunteering,le.project_role)],title:t.g("project_role")},{value:le.organization_role,preview:[nn(fe.volunteering,le.organization_role)],title:t.g("organization_role")}],value:e.subtype||void 0,onChange:p=>{s(v=>({...v,page:1,subtype:p&&p!==e.subtype?p:void 0,min_hours:void 0,max_hours:void 0}))},containerClassName:we.subtype,iconSize:2,size:"small"})}),n.jsx(Ne,{label:t("howManyHours"),children:({inputId:h})=>n.jsx(Be,{className:we.howManyHours,id:h,name:"hours",leftSection:n.jsx(se,{icon:ps,fixedWidth:!0}),placeholder:t("hours_any"),options:r.map(p=>({label:d(p),value:p})),value:g,onChange:p=>{s(v=>({...v,page:1,date:[],max_hours:p>0?p:void 0,min_hours:p<0?-p:void 0}))},comboboxProps:{withinPortal:!1}})}),e.subtype&&es.includes(e.subtype)&&l,n.jsx(Ne,{label:t("whenShouldItStart"),children:({inputId:h,labelTextId:p})=>n.jsx(wc,{id:h,"aria-labelledby":p,date:e.date})})]})};function Cc({layout:e,searchState:t}){const a=N(Se);if(L().whitelabel.settings.hide_commitment_filter)return null;const s=n.jsx(Nc,{subtype:t.subtype,date:t.date,min_hours:t.min_hours,max_hours:t.max_hours,required_availability:t.required_availability});return e===O.sidebar?n.jsx(ve,{children:s}):n.jsx(U,{label:a("time"),activeCount:da(t),children:s})}function Dc(e,t){const a=Qt(t);return{...e,page:1,format:a,type:a.length>0?[]:e.type}}const Ic=e=>{const{setSearchState:t}=A(),a=L(),o=N(Se),{data:s}=Fe.deedFormats.list.useQuery(),i=Gt(a.whitelabel),c=Ys({values:e.selectedFormats,formats:s}),l=c.length>0,u=f=>()=>{t(b=>{const k=b.type.length===0||b.type.includes(f)?b.type.length===0?i.filter(y=>y!==f):b.type.filter(y=>y!==f):Yn([...b.type,f]).length===i.length?[]:Yn([...b.type,f]);return{...b,page:1,type:k}})},r=()=>{t(f=>({...f,page:1,p2p_only:!f.p2p_only}))},d=f=>{t(b=>Dc(b,f))},g=i.map(f=>({group:re(o.g(`deed_${f}_plural`)),items:Qs({type:f,formats:s,tg:o.g,language:a.language,whitelabel:a.whitelabel})})).filter(f=>f.items.length>0),h=qt(s,i),p=i.length>1,v=h>0;return n.jsxs(ie,{gap:"sm",className:nt.menu,children:[p?n.jsx("ul",{className:Y(G.list,nt.typeList),children:i.map(f=>{const b=e.selectedTypes.length===0||e.selectedTypes.includes(f);return n.jsx("li",{children:n.jsx(xe,{checked:b,disabled:l,onChange:u(f),...w(`type-menu-checkbox--${f}`),label:n.jsx(W,{fw:b?"bold":"normal",children:re(o.g(`deed_${f}`))})})},f)})}):null,v?n.jsxs(n.Fragment,{children:[p?n.jsx(Zn,{label:o("orFilterByFormat"),labelPosition:"center"}):null,n.jsx(ns,{w:"100%",data:g,value:c,onChange:d,placeholder:o("selectFormats"),comboboxProps:{withinPortal:!1},searchable:!0,clearable:!0,hidePickedOptions:!0,...w("type-menu-format-select")})]}):null,e.showP2pRow?n.jsxs(n.Fragment,{children:[p||v?n.jsx(Zn,{}):null,n.jsx(xe,{checked:e.p2pOnly,onChange:r,...w("type-menu-checkbox--p2p"),label:n.jsx(W,{fw:e.p2pOnly?"bold":"normal",children:o("p2p_only")})})]}):null]})};function Tc({layout:e,searchState:t}){const a=L(),o=N(),{data:s}=Fe.deedFormats.list.useQuery(),i=Gt(a.whitelabel),c=qt(s,i),l=(!!a.whitelabel.settings.p2p_deeds_enabled||!!a.whitelabel.p2p_organization_id)&&!a.whitelabel.settings.deed_hide_p2p_filter;if(!(i.length>1||c>0||l))return null;const r=n.jsx(Ic,{selectedTypes:t.type,selectedFormats:t.format,p2pOnly:!!t.p2p_only,showP2pRow:l});return e===O.sidebar?n.jsx(ve,{children:n.jsxs(K,{component:"fieldset",className:G.fieldset,w:"100%",mt:"md",mb:"md",children:[n.jsx("legend",{className:G.legend,children:re(o.g("type"))}),r]})}):n.jsx(U,{label:re(o.g("type")),activeCount:ca(t),children:r})}const Fc={en:"Close",nl:"Sluiten"},Mc={en:"Join",nl:"Word lid"},Lc={en:"Want to get contacted about relevant %{g:deeds} based on your profile? Join our <strong>Volunteer pool</strong>
1!",nl:"Mogen organisaties je benaderen met leuke en passende %{g:deeds}? Meld je dan aan voor de <strong>Vrijwilligerspool</strong>!"},Pc={close:Fc,join:Mc,joinVolunteerBank:Lc},zc=30,Ac=({volunteerBankEnabled:e,hasCompletedOnboarding:t,optedIn:a,dismissed:o})=>e&&(!t||!a)&&!o,Rc=e=>String(e)==="0",Vc=()=>{const e=N(Pc),t=L(),[,a]=Pt(),[o,s]=ts([tn.volunteerPoolSignupPrompt]),i=Rc(o[tn.volunteerPoolSignupPrompt]);return be(l=>Ac({volunteerBankEnabled:t.whitelabel.settings.volunteer_bank_enabled,hasCompletedOnboarding:as(l),optedIn:!!l.auth.user?.volunteer_bank_opted_in,dismissed:i}))?n.jsx(Dn,{...w("join-volunteer-bank-dialog"),opened:!0,position:{bottom:10,left:10},withCloseButton:!0,shadow:"xxl",p:"lg",onClose:()=>{const l=new Date;l.setDate(l.getDate()+zc),s(tn.volunteerPoolSignupPrompt,"0",{...is(t.domain,{expiresInAYear:!1}),expires:l})},children:n.jsxs(ie,{gap:"sm",align:"center",children:[n.jsx(W,{dangerouslySetInnerHTML:{__html:`${e("joinVolunteerBank")}`}}),n.jsx(Z,{...w("join-volunteer-bank-discover"),size:"sm",fullWidth:!0,leftSection:n.jsx(se,{icon:fs}),onClick:()=>{a(l=>zt(l),{state:{resetScroll:!1}})},children:e("join")})]})}):null};function bn(e){return e?.split(",").filter(t=>os.includes(t))??[]}function Oc(e,t){const a=e[0]*100+(e[1]||-2)+1,o=t[0]*100+(t[1]||-2)+1;return a===o?0:a>o?1:-1}function Ec(e){return Array.isArray(e)}function On({trpcUtils:e,site:t,isMobile:a}){async function o(s){const{location:i,...c}=s,l=Object.values(fe).filter(M=>t.whitelabel.settings.omit_community_events_in_search&&M===fe.community||t.whitelabel.settings.omit_workshops_in_search&&M===fe.workshop||t.whitelabel.settings.omit_volunteering_in_search&&M===fe.volunteering?!1:c.type.length===0||c.type.includes(M)),{causes:u,sdgs:r,tags:d,format:g,organization_tags:h,activities:p,date:v,type:f,subtype:b,search_radius:S,non_native_speaker:k,...y}=c,j=bs(S),T={...y,...j!==void 0&&{search_radius:j},...b&&{subtype:[b]},...i.type==="postcodes"&&{postcodes:i.postcodes.map(Number).filter(M=>Number.isFinite(M))},...i.type==="location"&&{...i.location.coordinates,country_code:i.location.country_code},...i.type===I.flexible_location&&{flexible_location:!0},...i.type===I.from_home&&{from_home:!0},...k&&{native_speaker:!1},...v&&v.length>0&&{date:v.length===1?[v[0]]:[v[0],v[1]]},type:l,...d&&d.length>0&&{tags:[...d]},...g&&g.length>0&&{format:[...g]},...h&&h.length>0&&{organization_tags:[...h]},...r&&r.length>0&&{sdgs:[...r]},...u&&u.length>0&&{causes:[...u]},...p&&p.length>0&&{activities:p.map(M=>[...M])},pageSize:ea,withOrganization:!0},[z,$]=await Promise.all([e.deeds.search.fetch(T),a?null:e.deeds.search.fetch({...T,resultsForMap:!0})]),_=[];if($)for(const M of $.results)Ec(M)&&_.push(M);return{results:z.results,resultsForMap:_,hits:z.pagination.rowCount,pagination:z.pagination}}return o}function En({urlString:e,language:t,deedsString:a,fallbackLocation:o,userDefaults:s,discover_search_radius:i,postcode_group_mode:c,postcodeGroups:l,params:u}){const d=new URL(e,"https://-").searchParams,g=["search",a],h=d.get("search_radius")&&Number(d.get("search_radius"))?Number(d.get("search_radius")):i;let p;const v=!!u.location&&Vt(u.location,l);switch(u.location){case I.flexible_location:case I.from_home:p={type:u.location};break;case I.all:p=c&&v?{type:"postcodes",postcodes:[v.toString()]}:{type:I.all};break;default:if(c)p=v?{type:"postcodes",postcodes:[v.toString()]}:{type:I.all};else{const S=Ot(u.location)??o;p=S?{type:"location",location:S}:{type:I.all}}}const f={$type:"deed-search",query:d.get("q")||"",page:Math.max(1,Math.floor(Number(d.get("page")))||1),causes:s&&s.causes||[],type:bn(d.get("type")),sdgs:Yt(d.get("sdgs")?.split(","))||[],tags:d.get("tags")?.split(",").map(Number)||[],format:d.get("format")?Qt(d.get("format").split(",").filter(Boolean)):[],organization_tags:d.get("organization_tags")?.split(",").map(Number)||[],activities:s&&s.activities||[],date:(d.get("date")||"").split(",").map(Number).filter(S=>!Number.isNaN(S)&&S>0),location:p,search_radius:h,subtype:Object.values(le).includes(d.get("subtype"))?d.get("subtype"):void 0,orderBy:Bt.includes(d.get("orderBy"))?d.get("orderBy"):void 0};(d.get("availability")||pe.any)!==pe.any&&(f.required_availability=d.get("availability"));const b=!!u.causes&&!g.includes(u.causes)&&u.causes.split("+").map(Et);if(b&&b.length>0&&b[0]){const S=Ut(t),k=ss(t),y=[],j=[];for(const T of b)S.hasOwnProperty(T)?y.push(S[T]):k.hasOwnProperty(T)&&j.push(k[T]);y.sort(),j.sort(Oc),f.causes=y,f.activities=j}return d.get("type")&&(f.type=bn(d.get("type"))),d.get("min_hours")!==null&&(f.min_hours=Number(d.get("min_hours"))),d.get("max_hours")!==null&&(f.max_hours=Number(d.get("max_hours"))),d.get("suitable_for_groups")!==null&&(f.suitable_for_groups=!0),d.get("non_native_speaker")!==null&&(f.non_native_speaker=!0),d.get("new")!==null&&(f.new=!0),d.get("p2p_only")!==null&&(f.p2p_only=!0),d.get("government_certified")!==null&&(f.government_certified=!0),d.get("cost_reimbursement")!==null&&(f.cost_reimbursement=!0),d.get("extra_support")!==null&&(f.extra_support=!0),f}const za=e=>({...$e(e,"min_hours","max_hours","required_availability","suitable_for_groups","non_native_speaker","p2p_only","subtype","new","government_certified","cost_reimbursement","extra_support","orderBy"),page:1,query:"",location:{type:I.all},causes:[],activities:[],date:[],tags:[],format:[],organization_tags:[],type:[],sdgs:[]});function Un(){return{causes:[],activities:[]}}const Aa=({embedLocale:e})=>{const t=L(),a=Te(),o=Rt(),{isMobile:s}=_n(),i=N(Se),c=!!e,{sidebarMode:l,showMap:u}=Xt(),r=l&&!s?O.sidebar:O.toolbar,d=na(),g=Kt(),[h]=m.useState(()=>Un()),p=Fe.useUtils(),v=m.useCallback((x,F,D,R)=>En({urlString:x,language:F,deedsString:t.deedsString,fallbackLocation:D,userDefaults:R,discover_search_radius:t.whitelabel.settings.discover_search_radius,postcode_group_mode:t.whitelabel.settings.postcode_group_mode,postcodeGroups:d,params:o}),[o,t.deedsString,d,t.whitelabel.settings.discover_search_radius,t.whitelabel.settings.postcode_group_mode]),f=m.useCallback((x,F)=>{const D={state:x,language:F,locationSearch:a.search,postcodeGroups:d};return e?it({...D,route:{type:"embed",locale:e}}):it({...D,route:{type:"public",deedsString:t.deedsString}})},[e,t.deedsString,a.search,d]),b=Tt(),[S]=m.useState(b&&b.innerWidth&&b.innerWidth<=1024?q.List:q.Grid),k=m.useCallback(({searchState:x,setSearchState:F})=>{const D=x.orderBy??t.whitelabel.settings.deed_ranking;return n.jsxs(Oe,{position:"bottom-end",withinPortal:!0,trigger:"click",children:[n.jsx(Oe.Target,{children:n.jsxs(Z,{variant:"default",size:"sm",rightSection:n.jsx(se,{icon:$t,size:"sm"}),children:[i("orderBy"),": ",i(D)]})}),n.jsx(Oe.Dropdown,{children:Bt.map(R=>n.jsx(Oe.Item,{onClick:()=>F(X=>({...X,page:1,orderBy:R})),bg:R===D?"var(--mantine-color-primary-light)":void 0,children:i(R)},R))})]})},[t.whitelabel.settings.deed_ranking,i]),y=m.useCallback(({searchState:x})=>{const F=re(Ht({selected:x.type,site:t,tg:i.g})),{location:D}=x;switch(D.type){case I.flexible_location:return i("headingFromFlexibleLocation",{type:F});case I.from_home:return i("headingFromHome",{type:F});case I.all:return i("headingAnywhere",{type:F});case"location":return D.location.city?i("heading",{location:D.location.city,type:F}):i("headingAnywhere",{type:F});case"postcodes":{const R=d.find(X=>X.id.toString()===D.postcodes[0]);return R?i("heading",{location:g(R),type:F}):i("headingAnywhere",{type:F})}default:return i("headingAnywhere",{type:F})}},[i,t,d,g]),j=m.useCallback(({searchState:x,setSearchState:F,layout:D})=>{const R=n.jsx(oa,{enableStaticLocationOptions:!0,...x.location.type==="postcodes"?{postcodes:x.location.postcodes,location:null}:x.location.type==="location"?{postcodes:null,location:x.location.location}:x.location.type===I.flexible_location||x.location.type===I.from_home?{postcodes:null,location:x.location.type}:{postcodes:null,location:null},postcodeGroups:d,query:x.query,layout:D}),X=n.jsxs(Mn,{children:[x.location.type==="location"?n.jsx(nc,{layout:D,searchState:x}):null,n.jsx(Tc,{layout:D,searchState:x}),n.jsx(Cc,{layout:D,searchState:x}),n.jsx(Jr,{layout:D,searchState:x}),n.jsx(tc,{layout:D,searchState:x}),n.jsx(Kr,{layout:D,searchState:x}),n.jsx(ec,{layout:D,getInnerTopRightContentMobileOnly:k,searchState:x,setSearchState:F})]});return D===O.toolbar?n.jsxs(n.Fragment,{children:[R,X]}):n.jsxs(ie,{gap:"xs",children:[R,X]})},[k,d]),T=m.useCallback(({searchState:x,displayMode:F,setSearchState:D})=>r!==O.sidebar||F!==q.Grid?null:j({searchState:x,layout:O.sidebar,setSearchState:D}),[j,r]),z=m.useCallback(({searchState:x,displayMode:F,setSearchState:D})=>r===O.toolbar||F===q.List?n.jsx(Fn,{children:j({searchState:x,layout:O.toolbar,setSearchState:D})}):null,[j,r]),$=m.useCallback(({searchState:x,displayMode:F,searchResults:D})=>F===q.Grid&&u===!0&&x.location.type!==I.flexible_location&&x.location.type!==I.from_home&&n.jsx(Qr,{searchState:x,searchResults:D}),[u]),_=m.useCallback(x=>x?i.g.has("discoverPage_metaTitleWithCity")?i.g("discoverPage_metaTitleWithCity",{city:x}):i("metaTitleWithCity",{city:x}):i.g.has("discoverPage_metaTitle")?i.g("discoverPage_metaTitle"):i("metaTitle"),[i]),M=m.useCallback(x=>x?i.g.has("discoverPage_metaDescriptionWithCity")?i.g("discoverPage_metaDescriptionWithCity",{city:x}):i("metaDescriptionWithCity",{city:x}):i.g.has("discoverPage_metaDescription")?i.g("discoverPage_metaDescription"):i("metaDescription"),[i]),[J,oe]=m.useState(null),ce=m.useMemo(()=>({hover:oe,objectID:J}),[J]),ae=m.useCallback(x=>On({trpcUtils:p,site:t,isMobile:s})(x),[p,s,t]);return n.jsxs(n.Fragment,{children:[n.jsx(_e.Provider,{value:ce,children:n.jsx(Vn,{defaultDisplay:S,emptyStateString:i("noDeeds"),title:_,description:M,urlToState:v,stateToUrl:f,getToolbar:z,getLeftbar:T,getRightbar:$,getHeading:y,getInnerTopRightContentMobileOnly:k,HitComponent:io,search:ae,userDefaults:h,postcodeGroups:d,openInNewTab:c,paginated:!c,noindexWhenFiltered:!c})}),!c&&n.jsx(Vc,{})]})},Uc=async({trpcUtils:e,store:t,site:a,initialState:o,search:s,pathname:i,params:c})=>{const l=a.whitelabel.settings.postcode_group_mode?await e.postcodeGroups.list.fetch({whitelabelId:a.whitelabel.organization_id}):null,u=Ge(t.getState()),d=En({urlString:Ie({pathname:i,search:s}
1),language:a.language,deedsString:a.deedsString,fallbackLocation:u,userDefaults:Un(),discover_search_radius:a.whitelabel.settings.discover_search_radius,postcode_group_mode:a.whitelabel.settings.postcode_group_mode,postcodeGroups:l?.postcodeGroups??[],params:c}),g=await On({trpcUtils:e,site:a,isMobile:!1})(d);o||(o={}),o.searchResults=g};Aa.preload=Uc;const Cd=Object.freeze(Object.defineProperty({__proto__:null,deedSearchUrlToState:En,default:Aa,getUserSearchDefaults:Un,parseDeedTypes:bn,resetDeedSearchState:za,searchFnWrapper:On},Symbol.toStringTag,{value:"Module"}));export{Aa as D,jd as I,Nd as O,wd as U,En as d,Un as g,Cd as i,Ie as r,On as s}; 2//# sourceMappingURL=index-CcOxVejU.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.