var e=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,t=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,n=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function r(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){i(e);return}return t}function i(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function a(i,a={}){if(typeof i!=`string`)return i;if(i[0]===`"`&&i[i.length-1]===`"`&&i.indexOf(`\\`)===-1)return i.slice(1,-1);let o=i.trim();if(o.length<=9)switch(o.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!n.test(i)){if(a.strict)throw SyntaxError(`[destr] Invalid JSON`);return i}try{if(e.test(i)||t.test(i)){if(a.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(i,r)}return JSON.parse(i)}catch(e){if(a.strict)throw e;return i}}String.fromCharCode;var o=/#/g,s=/&/g,c=/\//g,l=/=/g,u=/\?/g,d=/\+/g,f=/%5e/gi,p=/%60/gi,m=/%7c/gi,h=/%20/gi,g=/%2f/gi,_=/%252f/gi;function v(e){return encodeURI(``+e).replace(m,`|`)}function y(e){return v(typeof e==`string`?e:JSON.stringify(e)).replace(d,`%2B`).replace(h,`+`).replace(o,`%23`).replace(s,`%26`).replace(p,"`").replace(f,`^`).replace(c,`%2F`)}function b(e){return y(e).replace(l,`%3D`)}function x(e){return v(e).replace(o,`%23`).replace(u,`%3F`).replace(_,`%2F`).replace(s,`%26`).replace(d,`%2B`)}function S(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function C(e){return S(e.replace(g,`%252F`))}function w(e){return S(e.replace(d,` `))}function T(e){return S(e.replace(d,` `))}function E(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=w(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=T(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function D(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${b(e)}=${y(t)}`).join(`&`):`${b(e)}=${y(t)}`:b(e)}function O(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>D(t,e[t])).filter(Boolean).join(`&`)}var k=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,A=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,j=/^([/\\]\s*){2,}[^/\\]/,M=/^[\s\0]*(blob|data|javascript|vbscript):$/i,N=/\/$|\/\?|\/#/,P=/^\.?\//;function F(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?k.test(e):A.test(e)||(t.acceptRelative?j.test(e):!1)}function I(e){return!!e&&M.test(e)}function L(e=``,t){return t?N.test(e):e.endsWith(`/`)}function R(e=``,t){if(!t)return(L(e)?e.slice(0,-1):e)||`/`;if(!L(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function z(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(L(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function B(e,t){if(U(t)||F(e))return e;let n=R(t);if(e.startsWith(n)){let t=e[n.length];if(!t||t===`/`||t===`?`)return e}return G(n,e)}function V(e,t){if(U(t))return e;let n=R(t);if(!e.startsWith(n))return e;let r=e[n.length];if(r&&r!==`/`&&r!==`?`)return e;let i=e.slice(n.length);return i[0]===`/`?i:`/`+i}function H(e,t){let n=Y(e);return n.search=O({...E(n.search),...t}),Z(n)}function U(e){return!e||e===`/`}function W(e){return e&&e!==`/`}function G(e,...t){let n=e||``;for(let e of t.filter(e=>W(e)))if(n){let t=e.replace(P,``);n=z(n)+t}else n=e;return n}function K(...e){let t=/\/(?!\/)/,n=e.filter(Boolean),r=[],i=0;for(let e of n)if(!(!e||e===`/`)){for(let[n,a]of e.split(t).entries())if(!(!a||a===`.`)){if(a===`..`){if(r.length===1&&F(r[0]))continue;r.pop(),i--;continue}if(n===1&&r[r.length-1]?.endsWith(`:/`)){r[r.length-1]+=`/`+a;continue}r.push(a),i++}}let a=r.join(`/`);return i>=0?n[0]?.startsWith(`/`)&&!a.startsWith(`/`)?a=`/`+a:n[0]?.startsWith(`./`)&&!a.startsWith(`./`)&&(a=`./`+a):a=`../`.repeat(-1*i)+a,n[n.length-1]?.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function q(e,t){return S(R(e))===S(R(t))}var J=Symbol.for(`ufo:protocolRelative`);function Y(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!F(e,{acceptRelative:!0}))return t?Y(t+e):X(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=X(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[J]:!r}}function X(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function Z(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[J]?(e.protocol||``)+`//`:``)+i+a+t+n+r}export{I as a,E as c,H as d,z as f,a as h,q as i,Y as l,R as m,x as n,K as o,V as p,F as r,G as s,C as t,B as u};