var e=()=>({}),t=e=>e===!0?`1`:e===!1?`0`:e.toString(),n=(e,r,i)=>{Object.entries(e).forEach(([e,a])=>{if(a===void 0)return;let o=`${r}[${e}]`;Array.isArray(a)?a.forEach(e=>i.append(`${o}[]`,t(e))):typeof a==`object`&&a?n(a,o,i):[`string`,`number`,`boolean`].includes(typeof a)&&i.set(o,t(a))})},r=e=>{if(!e||!e.query&&!e.mergeQuery)return``;let r=e.query??e.mergeQuery,i=e.mergeQuery!==void 0,a=new URLSearchParams(i&&typeof window<`u`?window.location.search:``);for(let e in r){let i=r[e];if(i==null){a.delete(e);continue}Array.isArray(i)?(a.has(`${e}[]`)&&a.delete(`${e}[]`),i.forEach(t=>{a.append(`${e}[]`,t.toString())})):typeof i==`object`?(a.forEach((t,n)=>{n.startsWith(`${e}[`)&&a.delete(n)}),n(i,e,a)):a.set(e,t(i))}let o=a.toString();return o.length>0?`?${o}`:``},i=t=>{let n={...t??{}},r=e();for(let e in r)n[e]===void 0&&r[e]!==void 0&&(n[e]=r[e]);return n};export{r as n,i as t};