"use strict";var M=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ee=Object.prototype.hasOwnProperty;var Re=(e,t)=>{for(var r in t)M(e,r,{get:t[r],enumerable:!0})},ye=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ke(t))!Ee.call(e,a)&&a!==r&&M(e,a,{get:()=>t[a],enumerable:!(n=Se(t,a))||n.enumerable});return e};var Oe=e=>ye(M({},"__esModule",{value:!0}),e);var Ne={};Re(Ne,{URLPattern:()=>Y});module.exports=Oe(Ne);var k=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,r,n,a,c,l){this.type=t,this.name=r,this.prefix=n,this.value=a,this.suffix=c,this.modifier=l}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Te=/[$_\p{ID_Start}]/u,Ae=/[$_\u200C\u200D\p{ID_Continue}]/u,v=".*";function we(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function D(e,t=!1){let r=[],n=0;for(;n{if(lo("OTHER_MODIFIER")??o("ASTERISK"),p=f=>{let u=o(f);if(u!==void 0)return u;let{type:d,index:T}=r[l];throw new TypeError(`Unexpected ${d} at ${T}, expected ${f}`)},O=()=>{let f="",u;for(;u=o("CHAR")??o("ESCAPED_CHAR");)f+=u;return f},be=f=>f,L=t.encodePart||be,I="",H=f=>{I+=f},$=()=>{I.length&&(a.push(new k(3,"","",L(I),"",3)),I="")},X=(f,u,d,T,Z)=>{let g=3;switch(Z){case"?":g=1;break;case"*":g=0;break;case"+":g=2;break}if(!u&&!d&&g===3){H(f);return}if($(),!u&&!d){if(!f)return;a.push(new k(3,"","",L(f),"",g));return}let m;d?d==="*"?m=v:m=d:m=n;let R=2;m===n?(R=1,m=""):m===v&&(R=0,m="");let S;if(u?S=u:d&&(S=c++),i.has(S))throw new TypeError(`Duplicate name '${S}'.`);i.add(S),a.push(new k(R,S,L(f),m,L(T),g))};for(;l-1)}return l||(n+=`(?=${c}|${a})`),new RegExp(n,B(r))}var b={delimiter:"",prefixes:"",sensitive:!0,strict:!0},J={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Q={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]==="/"?!0:!t||e.length<2?!1:(e[0]=="\\"||e[0]=="{")&&e[1]=="/":!1}function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function Ce(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function _(e){return!e||e.length<2?!1:e[0]==="["||(e[0]==="\\"||e[0]==="{")&&e[1]==="["}var re=["ftp","file","http","https","ws","wss"];function N(e){if(!e)return!0;for(let t of re)if(e.test(t))return!0;return!1}function ne(e,t){if(e=te(e,"#"),t||e==="")return e;let r=new URL("https://example.com");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):""}function se(e,t){if(e=te(e,"?"),t||e==="")return e;let r=new URL("https://example.com");return r.search=e,r.search?r.search.substring(1,r.search.length):""}function ie(e,t){return t||e===""?e:_(e)?K(e):j(e)}function ae(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.password=e,r.password}function oe(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.username=e,r.username}function ce(e,t,r){if(r||e==="")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]=="/";return e=new URL(n?e:"/-"+e,"https://example.com").pathname,n||(e=e.substring(2,e.length)),e}function le(e,t,r){return z(t)===e&&(e=""),r||e===""?e:V(e)}function he(e,t){return e=Ce(e,":"),t||e===""?e:A(e)}function z(e){switch(e){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function A(e){if(e==="")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}function fe(e){if(e==="")return e;let t=new URL("https://example.com");return t.username=e,t.username}function ue(e){if(e==="")return e;let t=new URL("https://example.com");return t.password=e,t.password}function j(e){if(e==="")return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL("https://example.com");return t.hostname=e,t.hostname}function K(e){if(e==="")return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function V(e){if(e===""||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}function pe(e){if(e==="")return e;let t=new URL("https://example.com");return t.pathname=e[0]!=="/"?"/-"+e:e,e[0]!=="/"?t.pathname.substring(2,t.pathname.length):t.pathname}function de(e){return e===""?e:new URL(`data:${e}`).pathname}function ge(e){if(e==="")return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}function me(e){if(e==="")return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}var U=class{#i;#n=[];#t={};#e=0;#s=1;#u=0;#c=0;#p=0;#d=0;#g=!1;constructor(t){this.#i=t}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e0)if(this.#T())this.#p-=1;else continue;if(this.#O()){this.#p+=1;continue}switch(this.#c){case 0:this.#S()&&(this.#t.username="",this.#t.password="",this.#t.hostname="",this.#t.port="",this.#t.pathname="",this.#t.search="",this.#t.hash="",this.#f(1));break;case 1:if(this.#S()){this.#C();let t=7,r=1;this.#g&&(this.#t.pathname="/"),this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r)}break;case 2:this.#x()?this.#f(3):(this.#b()||this.#h()||this.#l())&&this.#f(5);break;case 3:this.#R()?this.#r(4,1):this.#x()&&this.#r(5,1);break;case 4:this.#x()&&this.#r(5,1);break;case 5:this.#A()?this.#d+=1:this.#w()&&(this.#d-=1),this.#y()&&!this.#d?this.#r(6,1):this.#b()?this.#r(7,0):this.#h()?this.#r(8,1):this.#l()&&this.#r(9,1);break;case 6:this.#b()?this.#r(7,0):this.#h()?this.#r(8,1):this.#l()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#l()&&this.#r(9,1);break;case 8:this.#l()&&this.#r(9,1);break;case 9:break;case 10:break}}}#r(t,r){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#o();break;case 2:break;case 3:this.#t.username=this.#o();break;case 4:this.#t.password=this.#o();break;case 5:this.#t.hostname=this.#o();break;case 6:this.#t.port=this.#o();break;case 7:this.#t.pathname=this.#o();break;case 8:this.#t.search=this.#o();break;case 9:this.#t.hash=this.#o();break;case 10:break}this.#k(t,r)}#k(t,r){this.#c=t,this.#u=this.#e+r,this.#e+=r,this.#s=0}#P(){this.#e=this.#u,this.#s=0}#f(t){this.#P(),this.#c=t}#m(t){return t<0&&(t=this.#n.length-t),t=0&&(e.pathname=P(n.pathname.substring(0,a+1),r)+e.pathname)}e.pathname=ce(e.pathname,e.protocol,r)}return typeof t.search=="string"&&(e.search=se(t.search,r)),typeof t.hash=="string"&&(e.hash=ne(t.hash,r)),e}function C(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}function Le(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Ie(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith="";let r=".*",n=`[^${Le(t.delimiter)}]+?`,a=/[$_\u200C\u200D\p{ID_Continue}]/u,c="";for(let l=0;l0?e[l-1]:null,p=l0?p.value[0]:"";o=a.test(O)}else o=!p.hasCustomName();if(!o&&!s.prefix.length&&h&&h.type===3){let O=h.value[h.value.length-1];o=t.prefixes.includes(O)}o&&(c+="{"),c+=C(s.prefix),i&&(c+=`:${s.name}`),s.type===2?c+=`(${s.value})`:s.type===1?i||(c+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||o||s.prefix!=="")?c+="*":c+=`(${r})`),s.type===1&&i&&s.suffix.length&&a.test(s.suffix[0])&&(c+="\\"),c+=C(s.suffix),o&&(c+="}"),s.modifier!==3&&(c+=y(s.modifier))}return c}var Y=class{#i;#n={};#t={};#e={};#s={};constructor(t={},r,n){try{let a;if(typeof r=="string"?a=r:n=r,typeof t=="string"){let i=new U(t);if(i.parse(),t=i.result,a===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=a}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(a)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let c={ignoreCase:n.ignoreCase===!0},l={pathname:E,protocol:E,username:E,password:E,hostname:E,port:E,search:E,hash:E};this.#i=w(l,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port="");let s;for(s of G){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case"protocol":Object.assign(i,b),i.encodePart=A;break;case"username":Object.assign(i,b),i.encodePart=fe;break;case"password":Object.assign(i,b),i.encodePart=ue;break;case"hostname":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case"port":Object.assign(i,b),i.encodePart=V;break;case"pathname":N(this.#n.protocol)?(Object.assign(i,Q,c),i.encodePart=pe):(Object.assign(i,b,c),i.encodePart=de);break;case"search":Object.assign(i,b,c),i.encodePart=ge;break;case"hash":Object.assign(i,b,c),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ie(this.#s[s],i)}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(a){throw new TypeError(`Failed to construct 'URLPattern': ${a.message}`)}}test(t={},r){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&r)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?n=w(n,t,!1):n=w(n,xe(t,r),!1)}catch{return!1}let a;for(a of G)if(!this.#n[a].exec(n[a]))return!1;return!0}exec(t={},r){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&r)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?n=w(n,t,!1):n=w(n,xe(t,r),!1)}catch{return null}let a={};r?a.inputs=[t,r]:a.inputs=[t];let c;for(c of G){let l=this.#n[c].exec(n[c]);if(!l)return null;let s={};for(let[i,o]of this.#t[c].entries())if(typeof o=="string"||typeof o=="number"){let h=l[i+1];s[o]=h}a[c]={input:n[c]??"",groups:s}}return a}static compareComponent(t,r,n){let a=(i,o)=>{for(let h of["type","modifier","prefix","value","suffix"]){if(i[h]{let h=0;for(;h