1try{let t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e8d51d47-143e-40ce-82ed-b1db17f7e5d1",t._sentryDebugIdIdentifier="sentry-dbid-e8d51d47-143e-40ce-82ed-b1db17f7e5d1")}catch(l){}import{c as t}from"./Cg6F11O5.js";import{bm as e}from"./DQ2-L7T_.js";const s=e("ClubStore",{state:()=>({clubs:[],popularClubs:[],clubDetails:new Map,lastFetched:{clubs:null,popularClubs:null},isLoading:{clubs:!1,popularClubs:!1}}),getters:{getClubBySlug:t=>e=>t.clubDetails.get(e)||t.clubs.find(t=>t.slug===e)||t.popularClubs.find(t=>t.slug===e),getCachedClubs:t=>{const e=Date.now()-3e5;return t.lastFetched.clubs&&t.lastFetched.clubs>e?t.clubs:null},getCachedPopularClubs:t=>{const e=Date.now()-6e5;return t.lastFetched.popularClubs&&t.lastFetched.popularClubs>e?t.popularClubs:null},totalClubs:t=>t.clubs.length,totalPopularClubs:t=>t.popularClubs.length,cacheSize:t=>t.clubDetails.size},actions:{async fetch(e){if(this.getCachedClubs&&!e?.forceRefresh)return this.clubs;this.isLoading.clubs=!0;try{const{clubs:s}=await t.fetch(e);return this.clubs=s,this.lastFetched.clubs=Date.now(),s.forEach(t=>{this.clubDetails.set(t.slug,{...t,cachedAt:Date.now()})}),s}catch(s){throw s}finally{this.isLoading.clubs=!1}},async popular(e=!1){if(this.getCachedPopularClubs&&!e)return this.popularClubs;this.isLoading.popularClubs=!0;try{const{clubs:e}=await t.popular();return this.popularClubs=e,this.lastFetched.popularClubs=Date.now(),e.forEach(t=>{this.clubDetails.set(t.slug,{...t,isPopular:!0,cachedAt:Date.now()})}),e}catch(s){throw s}finally{this.isLoading.popularClubs=!1}},async fetchClubDetails(e,s=!1){const l=this.clubDetails.get(e),a=Date.now()-36e5;if(l&&l.cachedAt>a&&!s)return l;try{const{club:s}=await t.detail(e),a={...s,cachedAt:Date.now(),lastViewed:Date.now(),viewCount:(l?.viewCount||0)+1};return this.clubDetails.set(e,a),a}catch(u){throw u}},clearStaleCache(){const t=Date.now()-36e5;for(const[e,s]of this.clubDetails.entries())s.cachedAt<t&&this.clubDetails.delete(e)},async preloadPopularClubs(){0===this.popularClubs.length&&await this.popular()},searchClubs(t){const e=[...this.clubs,...this.popularClubs,...Array.from(this.clubDetails.values())].reduce((t,e)=>(t.find(t=>t.slug===e.slug)||t.push(e),t),[]);if(!t)return e;const s=t.toLowerCase();return e.filter(t=>t.name?.toLowerCase().includes(s)||t.venue?.name?.toLowerCase().includes(s)||t.tournaments?.some(t=>t.name?.toLowerCase().includes(s)))},incrementClubViews(t){const e=this.clubDetails.get(t);e&&(e.viewCount=(e.viewCount||0)+1,e.lastViewed=Date.now(),this.clubDetails.set(t,e))},getPerformanceMetrics(){return{totalCached:this.clubDetails.size,totalClubs:this.clubs.length,totalPopular:this.popularClubs.length,cacheHitRate:this.cacheSize>0?this.cacheSize/(this.totalClubs+this.totalPopularClubs):0,lastUpdated:{clubs:this.lastFetched.clubs,popularClubs:this.lastFetched.popularClubs}}},setBootstrapData(t,e){this.clubs=t.all||[],this.popularClubs=t.popular||[],this.lastFetched.clubs=e,this.lastFetched.popularClubs=e,this.clubs.forEach(t=>{this.clubDetails.set(t.slug,{...t,cachedAt:e})}),this.popularClubs.forEach(t=>{this.clubDetails.set(t.slug,{...t,isPopular:!0,cachedAt:e})})}}});export{s as u}; 2//# sourceMappingURL=C88wCSMO.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.