1import{Bt as W,Ot as J,at as B,en as f,rn as Q}from"./tiptap.DLKU8C5B.js";import{a as U,s as $}from"./vendor.nOZoUbXC.js";import{t as T}from"./sentry.CkfQQhZw.js";import{C as j,d as _,x as k}from"./str.BnFylV8F.js";import{j as F,p as z}from"./enum.D0ZEvZZE.js";import{i as X,l as K,r as N}from"./util.Bcd7gKMR.js";import{y as L}from"./types.F_NRll-y.js";import{d as O,f as Y}from"./methodsAuth.d1RsgpRI.js";import{X as E}from"./useMyProfile.KhumMPL7.js";import{u as H}from"./profile.D4eMMk1M.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"61fde56f08b5451b2e5d17e0bd2c31263d84c2c6"};var v=new n.Error().stack;v&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[v]="8fb58be3-7c9c-4bb3-8991-f13538419e72",n._sentryDebugIdIdentifier="sentry-dbid-8fb58be3-7c9c-4bb3-8991-f13538419e72")}catch{}})();var V=30,a={AI:"ai-connector",ChapterLeads:"chapter-leads",DCA:"dca",DCB:"dcb",DCTeam:"dc-team",Guests:"guests",Inactive:"inactive",RecentlyActive:"recently-active",RecentlyJoined:"recently-joined"},ce={[a.RecentlyActive]:"Recently Active",[a.RecentlyJoined]:"Recently Joined",[a.ChapterLeads]:"Chapter Leads",[a.AI]:"AI Connector",[a.DCB]:"DC BLACK",[a.DCTeam]:"DC Team"},R={All:"all",Sponsor:L.Sponsor,VIP:L.VIP,Volunteer:L.Volunteer},fe={[R.All]:"All",[R.VIP]:"VIP",[R.Volunteer]:"Volunteer",[R.Sponsor]:"Sponsor"},Z=$("dcMembers",()=>{const n=f(null),v=f(null),o=f(null),p=f(null),b=f(!1),i=f(null),g=f(a.RecentlyActive),P=f(R.All),D=B(()=>i.value?p.value===null:n.value===null),y=B(()=>{let e=null;return g.value===a.AI&&!i.value?e=o.value:g.value===a.Guests&&!i.value?e=v.value:i.value?e=p.value:e=n.value,e===null?null:g.value===a.Guests&&P.value!==R.All?e.filter(s=>s.guest?.guestType===P.value):e}),S=B(()=>y.value!==null&&y.value.length>V),c=B(()=>{const e=y.value;if(e===null)return null;let s=e.map(l=>{if(l.fields?.PrimaryBusinessName||l.fields?.Website){let u="";l.fields.PrimaryBusinessName&&(u+=`<strong>${l.fields.PrimaryBusinessName}</strong><br>`),l.fields.Website&&(u+=`<a class="text-link" href="${k(l.fields.Website)}" rel="noopener" target="_blank">${j(l.fields.Website)}</a><br>`),H(l.fields?.AnnualRevenuePrivacy,l.fields?.AnnualRevenue)&&(u+=` <span class="italic">${l.fields?.AnnualRevenue}</span><br>`),l.fields?.PrimaryBusinessIndustry&&(u+=` <span class="italic">${l.fields.PrimaryBusinessIndustry}</span><br>`),l.fields?.PrimaryBusinessDescription&&(u+=` ${l.fields.PrimaryBusinessDescription}<br>`),u&&(l.extraNote=u)}return l});return b.value||(s=s.slice(0,V)),s}),d=()=>{W(g,async e=>{await A(e)},{immediate:!0}),J(I)},h=Q(null),A=async e=>{I(),n.value=null,v.value=null;const{db:s,collection:l,limit:u,onSnapshot:G,orderBy:M,query:m,where:w}=await N();let t=m(l(s,"profiles"));if(e!==a.AI&&e!==a.Inactive&&e!==a.Guests&&(t=m(t,w("flags.isInactive","==",!1))),e===a.RecentlyJoined)t=m(t,M("joinedAt","desc"));else if(e===a.RecentlyActive)t=m(t,M("lastActiveAt","desc"));else if(e===a.ChapterLeads)t=m(t,w("flags.isAmbassador","==",!0));else if(e===a.DCTeam)t=m(t,w("flags.isAdmin","==",!0));else if(e===a.DCA)t=m(t,w("flags.isAccel","==",!0));else if(e===a.DCB)t=m(t,w("flags.isBlack","==",!0));else if(e===a.Inactive)t=m(t,w("flags.isInactive","==",!0),M("lastActiveAt","desc"));else if(e===a.Guests)t=m(t,w("flags.isGuest","==",!0),M("createdAt","desc"));else if(e===a.AI){const C=await O("",50);return C.success?(o.value=C.profiles||[],!0):(o.value=[],!1)}t=m(t,u(200));const q=e===a.Guests?v:n;return h.value=G(t,C=>q.value=K(C,F.User),C=>T(C)),!0},I=()=>{h.value&&(h.value(),h.value=null)};return{searchQuery:i,selectedFilter:g,selectedGuestSubtype:P,showMore:b,filteredProfiles:c,hasMore:S,loading:D,bindProfiles:A,unbindProfiles:I,watchProfiles:d,profileSearch:async e=>{if(!e)return;p.value=null;const s=await Y(e);if(!s.success||!s.profiles){s.message&&T(s.message,`Failed to get matching profiles in search for [${e}]`);return}p.value=s.profiles,E("profile_search",{query:e})}}}),x=async(n,v=20,o=!1,p=!1)=>{if(!n)return[];const b=n.split(/\s+/).map(r=>
1_(r)).filter(Boolean);let i=Array.from(new Set(b));if(i.length>=4){const r=new Set(z);i=i.filter(e=>!r.has(e))}if(i=i.slice(0,30),i.length===0)return[];const{db:g,collection:P,limit:D,query:y,where:S}=await N();let c=y(P(g,"search"),S("slugs","array-contains-any",i));p||(c=y(c,S(o?"flags.isMentionable":"flags.isSearchable","==",!0))),o===!0&&(c=y(c,S("flags.isProfile","==",!0))),c=y(c,D(200));const d=await X(c,F.Search),h=_(n),A=d.map(r=>{const e=r.slugs||[],s=r.name.split(/\s+/).map(_);let l=0;return _(r.name)===h&&(l+=1e3),i.forEach(u=>{s.length>0&&s.forEach(G=>{G===u&&(l+=100)}),e.includes(u)&&(l+=u.length)}),{nameParts:s,profile:r,profileSlugs:e,score:l}}),I=A.some(({nameParts:r,profileSlugs:e})=>i.every(s=>r.includes(s)||e.includes(s)))?A.filter(({nameParts:r,profileSlugs:e})=>i.every(s=>r.includes(s)||e.includes(s))):A;return I.sort((r,e)=>e.score-r.score),I.map(r=>r.profile).slice(0,v)||[]},de=$("search",()=>{const n=Z(),v=f(!1),o=f(null),p=f(null),b=f(!1),i=B(()=>o.value===null),g=async(d,h=20,A=!1,I=!1)=>{if(!d)return[];p.value=d;const r=await x(d,h,A,I);return r.length===0?(o.value=[],[]):(o.value=r,r)},{push:P}=U(),D=async d=>{d&&(await P({name:"members"}),c(),n.searchQuery=d,await n.profileSearch(d))},y=()=>{o.value=null,p.value=null,n.searchQuery=null},S=()=>{b.value=!0,E("search_modal_open")},c=()=>{b.value=!1,E("search_modal_close")};return{isOpen:b,searchQuery:p,showMore:v,predictions:o,predictionsLoading:i,clearPredictions:y,loadPredictions:g,profileSearch:D,closeModal:c,openModal:S}});export{fe as a,R as i,de as n,a as o,ce as r,Z as s,x as t}; 2 3//# sourceMappingURL=useSearch.CSrl3Ycd.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.