function t(t){let e="";const n=Object.entries(t);let o;for(;o=n.shift();){let[t,r]=o;if(Array.isArray(r)||r&&r.constructor===Object){const e=Object.entries(r).reverse();for(const[o,r]of e)n.unshift([`${t}[${o}]`,r])}else void 0!==r&&(null===r&&(r=""),e+="&"+[t,r].map(encodeURIComponent).join("="))}return e.substr(1)}function e(t){return(function(t){let e;try{e=new URL(t,"http://example.com").search.substring(1)}catch(t){}if(e)return e}(t)||"").replace(/\+/g,"%20").split("&").reduce(((t,e)=>{const[n,o=""]=e.split("=").filter(Boolean).map(decodeURIComponent);return n&&function(t,e,n){const o=e.length,r=o-1;for(let c=0;c<o;c++){let o=e[c];!o&&Array.isArray(t)&&(o=t.length.toString());const l=!isNaN(Number(e[c+1]));t[o]=c===r?n:t[o]||(l?[]:{}),Array.isArray(t[o])&&!l&&(t[o]={...t[o]}),t=t[o]}}(t,n.replace(/\]/g,"").split("["),o),t}),{})}function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if(!o||!Object.keys(o).length)return n;let r=n;const c=n.indexOf("?");return-1!==c&&(o=Object.assign(e(n),o),r=r.substr(0,c)),r+"?"+t(o)}export{n as a,t as b,e as g}