import{m as e,n as t,s as n,u as r}from"./apiFetch-C5jBrj9m.js";var i=e();function a(e){let t={};return e.searchTerm&&(t.search_term=e.searchTerm),e.startDate&&(t.start_date=e.startDate),e.endDate&&(t.end_date=e.endDate),e.locationText&&(t.location_text=e.locationText),e.city&&(t.city=e.city),e.country&&(t.country=e.country),e.minPrice!==void 0&&(t.min_price=e.minPrice),e.maxPrice!==void 0&&(t.max_price=e.maxPrice),e.freeOnly&&(t.free_only=!0),e.paidOnly&&(t.paid_only=!0),e.excludeFull&&(t.exclude_full=!0),e.isPrivate&&(t.is_private=!0),e.isPublic&&(t.is_public=!0),e.organizerId&&(t.organizer_id=e.organizerId),e.origin&&(t.origin=e.origin),e.radiusKm&&e.userLatitude!==void 0&&e.userLongitude!==void 0&&(t.lat=e.userLatitude,t.lng=e.userLongitude,t.radius_km=e.radiusKm),t}function o(e,t){let n=new URLSearchParams,r=a(t);for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));t.statuses?.forEach(e=>n.append(`statuses`,e)),t.categoryIds?.forEach(e=>n.append(`category_ids`,e));let i=n.toString();return i?`${e}?${i}`:e}var s=new class{async getEvents(){return t(`${i}/events`)}async getFilteredEvents(e){return t(o(`${i}/events`,e))}async getEventById(e){return t(`${i}/events/${e}`)}async createEvent(e){return t(`${i}/events`,{method:`POST`,body:e})}async updateEvent(e,n){return t(`${i}/events/${e}`,{method:`PUT`,body:n})}async deleteEvent(e){await t(`${i}/events/${e}`,{method:`DELETE`})}async registerToEvent(e,n,r=`player`){await t(`${i}/events/${e}/register`,{method:`POST`,body:{userId:n,role:r}})}async unregisterFromEvent(e,n){await t(`${i}/events/${e}/unregister`,{method:`POST`,body:{userId:n}})}async getEventParticipants(e){return t(`${i}/events/${e}/participants`)}async isUserRegisteredToEvent(e,n){return t(`${i}/events/${e}/participants/${n}/check`)}},c=async(e=!1)=>t(e?`${r.EVENTS.LIST}?refresh=${Date.now()}`:`${i}${r.EVENTS.LIST}`),l=async(e,n=!1)=>{let a=`${i}${r.EVENTS.BY_ID(e)}`;return t(n?`${a}?refresh=${Date.now()}`:a)},u=async e=>t(`${i}${r.EVENTS.CREATE}`,{method:`POST`,body:e,timeout:n.TIMEOUTS.UPLOAD}),d=async(e,a)=>t(`${i}${r.EVENTS.UPDATE(e)}`,{method:`PUT`,body:a,timeout:n.TIMEOUTS.UPLOAD}),f=async e=>t(`${i}/events/${e}/participants`),p=async e=>t(`${i}${r.EVENTS.DELETE(e)}`,{method:`DELETE`}),m=()=>{},h=async e=>t(o(`${i}${r.EVENTS.LIST}`,e));export{c as a,h as c,s as i,d as l,u as n,l as o,p as r,f as s,m as t};