import{nn as e,on as t,rn as n}from"./DRAiiyBy.mjs";import{r}from"./2BB3TurZ.mjs";import"./Ajls1usU.mjs";import"./DOa9RD2F.mjs";import{c as i,s as a}from"./2rg_Hy9V.mjs";import{t as o}from"./CRqwqRD6.mjs";function s(e,t){let n={...e};for(let e=0;e{let t=new URLSearchParams(e);return Object.fromEntries(t.entries())},l=e=>new URLSearchParams(e).toString(),u={parse:c,stringify:l,generate:({pageQuery:e,search:t})=>{let n=Object.fromEntries(Array.from((e||new URLSearchParams(window.location.search)).entries()));return`?${l(Object.fromEntries(Object.entries({...n,...t}).filter(([,e])=>e!==void 0)))}`}},d=t({}),f=e([i,a],([e,t])=>t?.to?{...e,...t.to}:e),p=`modal`,m={string:e=>e,number:e=>Number(e),boolean:e=>e===`true`,array:e=>e.split(`,`)},h=e=>!e.isAuthenticated,g=e=>e.isAuthenticated;function _(e,...t){let n=u.generate({search:{...t[0],[p]:e}}),i=`${window.location.pathname}${n}`.replace(`//`,`/`);return r(i,{...t[1],noScroll:!0})}var v=()=>{let e=n(d),t=Object.values(e).map(e=>e.removeSearchParams||[]);return o(t)};function y(e,...t){return u.generate({pageQuery:n(i).url.searchParams,search:{...t[0],[p]:e}})}var b=(e,t)=>{let i=u.parse(location.search),a=i[p];if(e?a===e:a){let o=a||e;if(!o)return;let c=n(d)[o];if(!c&&!t)return;let l=c?c.removeSearchParams||v():t,f=[...o===void 0||i.modal===o?[p]:[],...l],m=u.stringify(s(i,f)),h=m?`?${m}`:``,g=`${window.location.pathname}${h}`;if(`${window.location.pathname}${window.location.search}`!==g)return r(g,{noScroll:!0})}},x=e=>{let{searchParams:t,pathname:i}=e.url,a=u.parse(t.toString()),o=a.modal,c=n(d);if(o){let t=o,n=c?.[t]?.removeSearchParams||v(),l=[...t===void 0||a.modal===t?[p]:[],...n],d=u.stringify(s(a,l)),f=`${i}${d?`?${d}`:``}`;if(`${i}${e.url.search}`!==f)return r(f,{noScroll:!0})}};export{f as a,g as c,u as d,s as f,y as i,_ as l,b as n,m as o,x as r,p as s,h as t,d as u};