class QueryString{parse(n){const o={};if(!n)return o;const e=n.startsWith("?")?n.substring(1).split("&"):n.split("&");for(const n of e){const[e,t]=n.split("=");if(e&&t){const n=decodeURIComponent(e),s=decodeURIComponent(t);if(n in o)Array.isArray(o[n])?o[n].push(s):o[n]=[o[n],s];else{const e=[",","|"].find((n=>s.includes(n)));o[n]=e?s.split(e):s}}}return o}stringify(n,o={encode:!0,sort:!0}){const e=[];for(const[t,s]of Object.entries(n))if(Object.prototype.hasOwnProperty.call(n,t)){const n=o.encode?encodeURIComponent(t):t;if(Array.isArray(s)){for(const t of s)if(t){const s=o.encode?encodeURIComponent(t):t;e.push(`${n}=${s}`)}}else if(s){const t=o.encode?encodeURIComponent(s):s;e.push(`${n}=${t}`)}}return o.sort&&e.sort(),e.join("&")}}const queryString=new QueryString;export{queryString};
//# sourceMappingURL=queryString.js.map