!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return function(){var t={98:function(t,e,r){"use strict";var n,o=r(844).default,a=r(235).default;Object.defineProperty(e,"__esModule",{value:!0}),e.regexEscape=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"u",r=s(e),n=Object.values(r),o=function(t){return t.replace(new RegExp("[".concat(n.join(""),"]"),a(new Set([].concat(a(e),a("g")))).join("")),(function(t){return r[t]}))};return new u.RegexFragment(o(t))},e.exact=function(t,e){return(0,u.regex)(e)(n||(n=o(["",""])),t)},e.regexLength=function(t){return t.replace(/\\(?:\w\{[^}]+\}|u[0-9a-f]{4}|x[0-9a-f]{2}|[0-8]{3}|c[A-Z]|.)/gi,".").length},e.getContextAgnosticMap=void 0;var u=r(438),c=Array.from({length:128},(function(t,e){return String.fromCodePoint(e)})),i=new Map,s=function(t){var e=i.get(t);if(e)return e;var r=Object.fromEntries(function(t){var e=new Set(t);return e.delete("i"),t=a(e).join(""),c.map((function(e){var r="\\x".concat(e.codePointAt(0).toString(16).padStart(2,"0")),n=r,o=r,a=r;try{var u=new RegExp("[".concat(e,"]"),t);new RegExp("[".concat(e).concat(e,"]"),t),new RegExp("[".concat(e).concat(e,"\0]"),t),u.test(e)&&!c.filter((function(t){return t!==e})).some((function(t){return u.test(t)}))?n=e:(new RegExp("[\\".concat(e,"]"),t),n="\\".concat(e))}catch(r){try{new RegExp("[\\".concat(e,"]"),t),n="\\".concat(e)}catch(t){}}try{var i=new RegExp("^".concat(e,"$"),t);i.test(e)&&!c.filter((function(t){return t!==e})).some((function(t){return i.test(t)}))?o=e:(new RegExp("\\".concat(e),t),o="\\".concat(e))}catch(r){try{new RegExp("\\".concat(e),t),o="\\".concat(e)}catch(t){}}if(n!==o)try{new RegExp("\\".concat(e),t),new RegExp("\\".concat(e),t),a="\\".concat(e)}catch(t){}else a=[n,o].sort((function(t,e){return e.length-t.length}))[0];return{ch:e,agnostic:a,inClass:n,outsideClass:o}})).filter((function(t){return t.inClass!==t.ch||t.outsideClass!==t.ch}))}(t).map((function(t){return[t.ch,t.agnostic]})));return i.set(t,r),r};e.getContextAgnosticMap=s},403:function(t,e,r){"use strict";Object.defineProperty(e,"Sz",{enumerable:!0,get:function(){return n.regex}}),Object.defineProperty(e,"pH",{enumerable:!0,get:function(){return n.RegexFragment}}),Object.defineProperty(e,"PB",{enumerable:!0,get:function(){return o.regexEscape}});var n=r(438),o=r(98),a=r(761),u=r(690)},690:function(t,e,r){"use strict";var n=r(235).default;Object.defineProperty(e,"__esModule",{value:!0}),e.proxy=void 0;var o=r(438),a=new Proxy(o.regex,{get:function(t,e){return t("_"===e?"":e)},apply:function(t,e,r){return t.apply(void 0,n(r))}});e.proxy=a},438:function(t,e,r){"use strict";var n=r(488).default,o=r(235).default,a=r(218).default,u=r(608).default,c=r(590).default,i=r(680).default,s=r(929).default;Object.defineProperty(e,"__esModule",{value:!0}),e.regex=function(){for(var t=arguments.length,e=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};return function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),u=1;ut.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:{},a=r.rawHost,u=r.rawPathAndQuery,c=o.defaultScheme,i=void 0===c?"https":c,s=o.subdomain,f=void 0===s?"":s,x=o.pathAndQueryReplacer,h=void 0===x?"":x,y=o.rootDomain,v=void 0===y?"example.com":y,g=o.strict,m=void 0===g||g,b="*"===r.scheme?i:r.scheme;n="file"===b?"":"*"===a?[f,v].filter(Boolean).join("."):a.replace(/^\*./,f?"".concat(f,"."):"");var w=(m?u:"/*").replace(/\*/g,"-".concat(h,"-")).replace((0,l.Sz)("g")(t||(t=p()(["-+(",")"])),d),"$1").replace((0,l.Sz)("g")(e||(e=p()(["(",")-+"])),d),"$1").replace(/\/+/g,"/");try{return new URL("".concat(b,"://").concat(n).concat(w))}catch(t){return null}}var h,y,v,g=r(488),m=r.n(g),b="",w=(0,l.Sz)()(h||(h=p()(["\n\t^\n\t\t(*|w+) # scheme\n\t\t://\n\t\t(\n\t\t\t* | # Any host\n\t\t\t[^/#]* # Only the given host (optional only if scheme is file)\n\t\t)\n\t\t(/[^\r\n#]*) # path\n\t$\n"],["\n\t^\n\t\t(\\*|\\w+) # scheme\n\t\t://\n\t\t(\n\t\t\t\\* | # Any host\n\t\t\t[^/\\#]* # Only the given host (optional only if scheme is file)\n\t\t)\n\t\t(/[^\\r\\n\\#]*) # path\n\t$\n"])));function _(t){if(t===b)return{pattern:t,scheme:"*",rawHost:"*",rawPathAndQuery:"/*"};var e=t.match(w);if(!e)return null;var r=m()(e,4);return{pattern:t,scheme:r[1],rawHost:r[2],rawPathAndQuery:r[3]}}var j,O,S,M=function(t){try{return encodeURI(decodeURI(t))}catch(t){return t}};function E(t){return function(e){var r;try{var n=e instanceof URL?e.href:e;r=new URL(n);var o=M(r.pathname),a=M(r.search);if(o instanceof Error||a instanceof Error)return!1;r.pathname=o,r.href.endsWith("?")||(r.search=a)}catch(t){return!1}return t(r)}}function P(t,e){var r,n=e.supportedSchemes,o=e.schemeStarMatchesWs,a=e.strict;if(t===b)return E((function(t){return(0,l.Sz)()(j||(j=p()(["\n\t\t\t\t^\n\t\t\t\t\t(?:",")\n\t\t\t\t\t:\n\t\t\t\t$\n\t\t\t"])),n).test(t.protocol)}));var u=null===(r=t.match(/^(urn|data):/))||void 0===r?void 0:r[1];if(u)return new TypeError('browser-extension-url-match does not currently support scheme "'.concat(u,'"'));var c=_(t);if(!c){try{var i=new URL(t);if(i.hash||i.href.endsWith("#"))return new TypeError('Pattern cannot contain a hash: "'.concat(t,'" contains hash "').concat(i.hash||"#",'"'));if(!t.slice(i.origin.length).startsWith("/"))return new TypeError('Pattern "'.concat(t,'" does not contain a path. Use "').concat(t,'/*" to match any paths with that origin or "').concat(t,'/" to match that URL alone'))}catch(t){}return new TypeError('Pattern "'.concat(t,'" is invalid'))}var s=c.scheme,f=c.rawPathAndQuery;if("*"!==s&&!n.includes(s))return new TypeError('Scheme "'.concat(s,'" is not supported'));var d=(0,l.Sz)()(O||(O=p()(["",":"])),"*"===s?new l.pH(["https?",o&&"wss?"].filter(Boolean).join("|")):s),h=function(t){var e=t.pattern,r=t.scheme,n=t.rawHost;if(!n&&"file"!==r)return new TypeError('Host is optional only if the scheme is "file".');var o=n.includes("*");if(o){var a=n.split("*.");if(n.length>1&&(2!==a.length||a[0]||!a[1]))return new TypeError('Host can contain only one wildcard at the start, in the form "*."')}var u=x(t,{subdomain:""});if(!u)return new TypeError('Pattern "'.concat(e,'" cannot be used to construct a valid URL.'));var c=u.host;if(/:\d+$/.test(c))return new TypeError('Host "'.concat(n,'" cannot include a port number. All ports are matched by default.'));if(/[^.a-z0-9\-]/.test(c))return new TypeError('Host "'.concat(n,'" contains invalid characters.'));var i=o?"*."+c:c;return"*"===n?/.+/:i.startsWith("*.")?(0,l.Sz)()(y||(y=p()(["\n\t\t\t^\n\t\t\t\t(?:[^.]+.)* # any number of dot-terminated segments\n\t\t\t\t"," # rest after leading *.\n\t\t\t$\n\t\t"],["\n\t\t\t^\n\t\t\t\t(?:[^.]+\\.)* # any number of dot-terminated segments\n\t\t\t\t"," # rest after leading *.\n\t\t\t$\n\t\t"])),i.slice(2)):(0,l.Sz)()(v||(v=p()(["^","$"])),i)}(c);if(h instanceof Error)return h;var g=a?M(f):"/*";if(g instanceof Error)return g;var m=(0,l.Sz)()(S||(S=p()(["^","$"])),new l.pH(g.split("*").map((function(t){return(0,l.PB)(t)})).join(".*")));return E((function(t){var e=t.pathname+(t.href.endsWith("?")?"?":t.search);return d.test(t.protocol)&&h.test(t.hostname)&&m.test(e)}))}function A(){if(!this.valid)throw new TypeError(this.error.message);return this}function R(t){return function(e){var r=c()(c()({},s),t),n=P(e,r);return n instanceof Error?{valid:!1,error:n,assertValid:A}:{valid:!0,match:n,get examples(){return function(t,e){var r=_(t),n=e.supportedSchemes,o=e.strict,u=["","www","foo.bar"],c=["example.com"],i=["","foo","/bar/baz/"],s=n.flatMap((function(t){return u.flatMap((function(e){return c.flatMap((function(n){return i.flatMap((function(a){return x(r,{defaultScheme:t,subdomain:e,rootDomain:n,pathAndQueryReplacer:a,strict:o})}))}))}))}));return a()(new Set(s.filter(Boolean).map((function(t){return t.href}))))}(e,r).filter((function(t){return n(t)})).slice(0,100)},patterns:[e],config:r,assertValid:A}}}function T(t){return t.every((function(t){return t.valid}))}function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof t?[t]:a()(new Set(t));if(1===r.length)return R(e)(r[0]);var n=r.map(R(e));if(T(n))return{valid:!0,get examples(){return a()(new Set(n.flatMap((function(t){return t.examples}))))},match:function(t){return n.some((function(e){return e.match(t)}))},patterns:r,config:e,assertValid:A};var o=n.find((function(t){return!t.valid}));return{valid:!1,error:o.error,assertValid:A}}}(),n}()}));