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,t)=>{let n=new Set;e.forEach((e,r)=>{(r===t||r.startsWith(`${t}[`))&&n.add(r)}),n.forEach(t=>e.delete(t))},i=e=>{if(!e||!e.query&&!e.mergeQuery)return``;let i=e.query??e.mergeQuery,a=e.mergeQuery!==void 0,o=new URLSearchParams(a&&typeof window<`u`?window.location.search:``);for(let e in i){let s=i[e];a&&r(o,e),s!=null&&(Array.isArray(s)?s.forEach(t=>{o.append(`${e}[]`,t.toString())}):typeof s==`object`?n(s,e,o):o.set(e,t(s)))}let s=o.toString();return s.length>0?`?${s}`:``},a=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{i as n,a as t};