@shgysk8zer0/polyfills 0.4.13 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/all.min.js +1 -1
- package/all.min.js.map +1 -1
- package/assets/url-pattern.js +1 -1
- package/browser.min.js +1 -1
- package/browser.min.js.map +1 -1
- package/node.min.js.map +1 -1
- package/package.json +2 -1
package/assets/url-pattern.js
CHANGED
|
@@ -8,7 +8,7 @@ var hasRequiredUrlpattern;
|
|
|
8
8
|
function requireUrlpattern () {
|
|
9
9
|
if (hasRequiredUrlpattern) return urlpattern;
|
|
10
10
|
hasRequiredUrlpattern = 1;
|
|
11
|
-
var U=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var a=(e,t)=>U(e,"name",{value:t,configurable:!0});var ke=(e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:!0});},Te=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ee(t))!Oe.call(e,o)&&o!==r&&U(e,o,{get:()=>t[o],enumerable:!(n=Re(t,o))||n.enumerable});return e};var Ae=e=>Te(U({},"__esModule",{value:!0}),e);var He={};ke(He,{URLPattern:()=>M});urlpattern=Ae(He);var P=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,r,n,o,l,f){this.type=t,this.name=r,this.prefix=n,this.value=o,this.suffix=l,this.modifier=f;}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};a(P,"Part");var ye=/[$_\p{ID_Start}]/u,we=/[$_\u200C\u200D\p{ID_Continue}]/u,F=".*";function Ce(e,t){return (t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}a(Ce,"isASCII");function W(e,t=!1){let r=[],n=0;for(;n<e.length;){let o=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:"INVALID_CHAR",index:n,value:e[n++]});},"ErrorOrInvalid");if(o==="*"){r.push({type:"ASTERISK",index:n,value:e[n++]});continue}if(o==="+"||o==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});continue}if(o==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(o==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(o==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(o===":"){let f="",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&ye.test(i)||s!==n+1&&we.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:f}),n=s;continue}if(o==="("){let f=1,s="",i=n+1,c=!1;if(e[i]==="?"){l(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!Ce(e[i],!1)){l(`Invalid character '${e[i]}' at ${i}.`),c=!0;break}if(e[i]==="\\"){s+=e[i++]+e[i++];continue}if(e[i]===")"){if(f--,f===0){i++;break}}else if(e[i]==="("&&(f++,e[i+1]!=="?")){l(`Capturing groups are not allowed at ${i}`),c=!0;break}s+=e[i++];}if(c)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:s}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]});}return r.push({type:"END",index:n,value:""}),r}a(W,"lexer");function _(e,t={}){let r=W(e);t.delimiter??="/#?",t.prefixes??="./";let n=`[^${x(t.delimiter)}]+?`,o=[],l=0,f=0,i=new Set,c=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},"tryConsume"),h=a(()=>c("OTHER_MODIFIER")??c("ASTERISK"),"tryConsumeModifier"),p=a(u=>{let d=c(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},"mustConsume"),A=a(()=>{let u="",d;for(;d=c("CHAR")??c("ESCAPED_CHAR");)u+=d;return u},"consumeText"),be=a(u=>u,"DefaultEncodePart"),N=t.encodePart||be,H="",v=a(u=>{H+=u;},"appendToPendingFixedValue"),D=a(()=>{H.length&&(o.push(new P(3,"","",N(H),"",3)),H="");},"maybeAddPartFromPendingFixedValue"),Z=a((u,d,g,y,B)=>{let m=3;switch(B){case"?":m=1;break;case"*":m=0;break;case"+":m=2;break}if(!d&&!g&&m===3){v(u);return}if(D(),!d&&!g){if(!u)return;o.push(new P(3,"","",N(u),"",m));return}let S;g?g==="*"?S=F:S=g:S=n;let k=2;S===n?(k=1,S=""):S===F&&(k=0,S="");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),o.push(new P(k,E,N(u),S,N(y),m));},"addPart");for(;f<r.length;){let u=c("CHAR"),d=c("NAME"),g=c("REGEX");if(!d&&!g&&(g=c("ASTERISK")),d||g){let m=u??"";t.prefixes.indexOf(m)===-1&&(v(m),m=""),D();let S=h();Z(m,d,g,"",S);continue}let y=u??c("ESCAPED_CHAR");if(y){v(y);continue}if(c("OPEN")){let m=A(),S=c("NAME"),k=c("REGEX");!S&&!k&&(k=c("ASTERISK"));let E=A();p("CLOSE");let Pe=h();Z(m,S,k,E,Pe);continue}D(),p("END");}return o}a(_,"parse");function x(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}a(x,"escapeString");function q(e){return e&&e.ignoreCase?"ui":"u"}a(q,"flags");function J(e,t,r){return z(_(e,r),t,r)}a(J,"stringToRegexp");function T(e){switch(e){case 0:return "*";case 1:return "?";case 2:return "+";case 3:return ""}}a(T,"modifierToString");function z(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,c=s.value;if(s.type===1?c=i:s.type===0&&(c=F),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${c})${T(s.modifier)}`:n+=`((?:${c})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${c})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${c})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${c}))*)${x(s.suffix)})`,s.modifier===0&&(n+="?");}let o=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,q(r));r.strict||(n+=`(?:${l}(?=${o}))?`);let f=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1);}return f||(n+=`(?=${l}|${o})`),new RegExp(n,q(r))}a(z,"partsToRegexp");var b={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Q={delimiter:".",prefixes:"",sensitive:!0,strict:!0},ee={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function te(e,t){return e.length?e[0]==="/"?!0:!t||e.length<2?!1:(e[0]=="\\"||e[0]=="{")&&e[1]=="/":!1}a(te,"isAbsolutePathname");function re(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(re,"maybeStripPrefix");function Le(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(Le,"maybeStripSuffix");function j(e){return !e||e.length<2?!1:e[0]==="["||(e[0]==="\\"||e[0]==="{")&&e[1]==="["}a(j,"treatAsIPv6Hostname");var ne=["ftp","file","http","https","ws","wss"];function $(e){if(!e)return !0;for(let t of ne)if(e.test(t))return !0;return !1}a($,"isSpecialScheme");function se(e,t){if(e=re(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):""}a(se,"canonicalizeHash");function ie(e,t){if(e=re(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):""}a(ie,"canonicalizeSearch");function ae(e,t){return t||e===""?e:j(e)?V(e):G(e)}a(ae,"canonicalizeHostname");function oe(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.password=e,r.password}a(oe,"canonicalizePassword");function ce(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.username=e,r.username}a(ce,"canonicalizeUsername");function le(e,t,r){if(r||e==="")return e;if(t&&!ne.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}a(le,"canonicalizePathname");function fe(e,t,r){return K(t)===e&&(e=""),r||e===""?e:Y(e)}a(fe,"canonicalizePort");function he(e,t){return e=Le(e,":"),t||e===""?e:w(e)}a(he,"canonicalizeProtocol");function K(e){switch(e){case"ws":case"http":return "80";case"wws":case"https":return "443";case"ftp":return "21";default:return ""}}a(K,"defaultPortForProtocol");function w(e){if(e==="")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,"protocolEncodeCallback");function ue(e){if(e==="")return e;let t=new URL("https://example.com");return t.username=e,t.username}a(ue,"usernameEncodeCallback");function de(e){if(e==="")return e;let t=new URL("https://example.com");return t.password=e,t.password}a(de,"passwordEncodeCallback");function G(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}a(G,"hostnameEncodeCallback");function V(e){if(e==="")return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(V,"ipv6HostnameEncodeCallback");function Y(e){if(e===""||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(Y,"portEncodeCallback");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}a(pe,"standardURLPathnameEncodeCallback");function ge(e){return e===""?e:new URL(`data:${e}`).pathname}a(ge,"pathURLPathnameEncodeCallback");function me(e){if(e==="")return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}a(me,"searchEncodeCallback");function Se(e){if(e==="")return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}a(Se,"hashEncodeCallback");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t;}get result(){return this.#t}parse(){for(this.#n=W(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type==="END"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r);}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="");}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?"/":""),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??="")),this.#R(t,r);}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0;}#b(){this.#e=this.#l,this.#s=0;}#u(t){this.#b(),this.#o=t;}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")}#P(){return this.#a(this.#e,":")}#E(){return this.#a(this.#e+1,"/")&&this.#a(this.#e+2,"/")}#S(){return this.#a(this.#e,"@")}#O(){return this.#a(this.#e,":")}#k(){return this.#a(this.#e,":")}#x(){return this.#a(this.#e,"/")}#h(){if(this.#a(this.#e,"?"))return !0;if(this.#n[this.#e].value!=="?")return !1;let t=this.#m(this.#e-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#f(){return this.#a(this.#e,"#")}#T(){return this.#n[this.#e].type=="OPEN"}#A(){return this.#n[this.#e].type=="CLOSE"}#y(){return this.#a(this.#e,"[")}#w(){return this.#a(this.#e,"]")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=J(this.#c(),void 0,t);this.#g=$(r);}};a(C,"Parser");var X=["protocol","username","password","hostname","port","pathname","search","hash"],O="*";function xe(e,t){if(typeof e!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);return {protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}a(xe,"extractValues");function R(e,t){return t?I(e):e}a(R,"processBaseURLString");function L(e,t,r){let n;if(typeof t.baseURL=="string")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r));}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol=="string"&&(e.protocol=he(t.protocol,r)),typeof t.username=="string"&&(e.username=ce(t.username,r)),typeof t.password=="string"&&(e.password=oe(t.password,r)),typeof t.hostname=="string"&&(e.hostname=ae(t.hostname,r)),typeof t.port=="string"&&(e.port=fe(t.port,e.protocol,r)),typeof t.pathname=="string"){if(e.pathname=t.pathname,n&&!te(e.pathname,r)){let o=n.pathname.lastIndexOf("/");o>=0&&(e.pathname=R(n.pathname.substring(0,o+1),r)+e.pathname);}e.pathname=le(e.pathname,e.protocol,r);}return typeof t.search=="string"&&(e.search=ie(t.search,r)),typeof t.hash=="string"&&(e.hash=se(t.hash,r)),e}a(L,"applyInit");function I(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}a(I,"escapePatternString");function Ie(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}a(Ie,"escapeRegexpString");function Ne(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith="";let r=".*",n=`[^${Ie(t.delimiter)}]+?`,o=/[$_\u200C\u200D\p{ID_Continue}]/u,l="";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),c=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!c&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:"";c=o.test(A);}else c=!p.hasCustomName();if(!c&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];c=t.prefixes.includes(A);}c&&(l+="{"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||c||s.prefix!=="")?l+="*":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&o.test(s.suffix[0])&&(l+="\\"),l+=I(s.suffix),c&&(l+="}"),s.modifier!==3&&(l+=T(s.modifier));}return l}a(Ne,"partsToPattern");var M=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let o;if(typeof r=="string"?o=r:n=r,typeof t=="string"){let i=new C(t);if(i.parse(),t=i.result,o===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=o;}else {if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(o)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),K(this.#i.protocol)===this.#i.port&&(this.#i.port="");let s;for(s of X){if(!(s in this.#i))continue;let i={},c=this.#i[s];switch(this.#t[s]=[],s){case"protocol":Object.assign(i,b),i.encodePart=w;break;case"username":Object.assign(i,b),i.encodePart=ue;break;case"password":Object.assign(i,b),i.encodePart=de;break;case"hostname":Object.assign(i,Q),j(c)?i.encodePart=V:i.encodePart=G;break;case"port":Object.assign(i,b),i.encodePart=Y;break;case"pathname":$(this.#n.protocol)?(Object.assign(i,ee,l),i.encodePart=pe):(Object.assign(i,b,l),i.encodePart=ge);break;case"search":Object.assign(i,b,l),i.encodePart=me;break;case"hash":Object.assign(i,b,l),i.encodePart=Se;break}try{this.#s[s]=_(c,i),this.#n[s]=z(this.#s[s],this.#t[s],i),this.#e[s]=Ne(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2);}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(o){throw new TypeError(`Failed to construct 'URLPattern': ${o.message}`)}}get[Symbol.toStringTag](){return "URLPattern"}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=L(n,t,!1):n=L(n,xe(t,r),!1);}catch{return !1}let o;for(o of X)if(!this.#n[o].exec(n[o]))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=L(n,t,!1):n=L(n,xe(t,r),!1);}catch{return null}let o={};r?o.inputs=[t,r]:o.inputs=[t];let l;for(l of X){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,c]of this.#t[l].entries())if(typeof c=="string"||typeof c=="number"){let h=f[i+1];s[c]=h;}o[l]={input:n[l]??"",groups:s};}return o}static compareComponent(t,r,n){let o=a((i,c)=>{for(let h of ["type","modifier","prefix","value","suffix"]){if(i[h]<c[h])return -1;if(i[h]===c[h])continue;return 1}return 0},"comparePart"),l=new P(3,"","","","",3),f=new P(0,"","","","",3),s=a((i,c)=>{let h=0;for(;h<Math.min(i.length,c.length);++h){let p=o(i[h],c[h]);if(p)return p}return i.length===c.length?0:o(i[h]??l,c[h]??l)},"comparePartList");return !r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(M,"URLPattern");
|
|
11
|
+
var U=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var a=(e,t)=>U(e,"name",{value:t,configurable:true});var ke=(e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:true});},Te=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ee(t))!Oe.call(e,o)&&o!==r&&U(e,o,{get:()=>t[o],enumerable:!(n=Re(t,o))||n.enumerable});return e};var Ae=e=>Te(U({},"__esModule",{value:true}),e);var He={};ke(He,{URLPattern:()=>M});urlpattern=Ae(He);var P=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,r,n,o,l,f){this.type=t,this.name=r,this.prefix=n,this.value=o,this.suffix=l,this.modifier=f;}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};a(P,"Part");var ye=/[$_\p{ID_Start}]/u,we=/[$_\u200C\u200D\p{ID_Continue}]/u,F=".*";function Ce(e,t){return (t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}a(Ce,"isASCII");function W(e,t=false){let r=[],n=0;for(;n<e.length;){let o=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:"INVALID_CHAR",index:n,value:e[n++]});},"ErrorOrInvalid");if(o==="*"){r.push({type:"ASTERISK",index:n,value:e[n++]});continue}if(o==="+"||o==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});continue}if(o==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(o==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(o==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(o===":"){let f="",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&ye.test(i)||s!==n+1&&we.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:f}),n=s;continue}if(o==="("){let f=1,s="",i=n+1,c=false;if(e[i]==="?"){l(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!Ce(e[i],false)){l(`Invalid character '${e[i]}' at ${i}.`),c=true;break}if(e[i]==="\\"){s+=e[i++]+e[i++];continue}if(e[i]===")"){if(f--,f===0){i++;break}}else if(e[i]==="("&&(f++,e[i+1]!=="?")){l(`Capturing groups are not allowed at ${i}`),c=true;break}s+=e[i++];}if(c)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:s}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]});}return r.push({type:"END",index:n,value:""}),r}a(W,"lexer");function _(e,t={}){let r=W(e);t.delimiter??="/#?",t.prefixes??="./";let n=`[^${x(t.delimiter)}]+?`,o=[],l=0,f=0,i=new Set,c=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},"tryConsume"),h=a(()=>c("OTHER_MODIFIER")??c("ASTERISK"),"tryConsumeModifier"),p=a(u=>{let d=c(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},"mustConsume"),A=a(()=>{let u="",d;for(;d=c("CHAR")??c("ESCAPED_CHAR");)u+=d;return u},"consumeText"),be=a(u=>u,"DefaultEncodePart"),N=t.encodePart||be,H="",v=a(u=>{H+=u;},"appendToPendingFixedValue"),D=a(()=>{H.length&&(o.push(new P(3,"","",N(H),"",3)),H="");},"maybeAddPartFromPendingFixedValue"),Z=a((u,d,g,y,B)=>{let m=3;switch(B){case "?":m=1;break;case "*":m=0;break;case "+":m=2;break}if(!d&&!g&&m===3){v(u);return}if(D(),!d&&!g){if(!u)return;o.push(new P(3,"","",N(u),"",m));return}let S;g?g==="*"?S=F:S=g:S=n;let k=2;S===n?(k=1,S=""):S===F&&(k=0,S="");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),o.push(new P(k,E,N(u),S,N(y),m));},"addPart");for(;f<r.length;){let u=c("CHAR"),d=c("NAME"),g=c("REGEX");if(!d&&!g&&(g=c("ASTERISK")),d||g){let m=u??"";t.prefixes.indexOf(m)===-1&&(v(m),m=""),D();let S=h();Z(m,d,g,"",S);continue}let y=u??c("ESCAPED_CHAR");if(y){v(y);continue}if(c("OPEN")){let m=A(),S=c("NAME"),k=c("REGEX");!S&&!k&&(k=c("ASTERISK"));let E=A();p("CLOSE");let Pe=h();Z(m,S,k,E,Pe);continue}D(),p("END");}return o}a(_,"parse");function x(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}a(x,"escapeString");function q(e){return e&&e.ignoreCase?"ui":"u"}a(q,"flags");function J(e,t,r){return z(_(e,r),t,r)}a(J,"stringToRegexp");function T(e){switch(e){case 0:return "*";case 1:return "?";case 2:return "+";case 3:return ""}}a(T,"modifierToString");function z(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=false,r.strict??=false,r.end??=true,r.start??=true,r.endsWith="";let n=r.start?"^":"";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,c=s.value;if(s.type===1?c=i:s.type===0&&(c=F),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${c})${T(s.modifier)}`:n+=`((?:${c})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${c})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${c})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${c}))*)${x(s.suffix)})`,s.modifier===0&&(n+="?");}let o=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,q(r));r.strict||(n+=`(?:${l}(?=${o}))?`);let f=false;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1);}return f||(n+=`(?=${l}|${o})`),new RegExp(n,q(r))}a(z,"partsToRegexp");var b={delimiter:"",prefixes:"",sensitive:true,strict:true},Q={delimiter:".",prefixes:"",sensitive:true,strict:true},ee={delimiter:"/",prefixes:"/",sensitive:true,strict:true};function te(e,t){return e.length?e[0]==="/"?true:!t||e.length<2?false:(e[0]=="\\"||e[0]=="{")&&e[1]=="/":false}a(te,"isAbsolutePathname");function re(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(re,"maybeStripPrefix");function Le(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(Le,"maybeStripSuffix");function j(e){return !e||e.length<2?false:e[0]==="["||(e[0]==="\\"||e[0]==="{")&&e[1]==="["}a(j,"treatAsIPv6Hostname");var ne=["ftp","file","http","https","ws","wss"];function $(e){if(!e)return true;for(let t of ne)if(e.test(t))return true;return false}a($,"isSpecialScheme");function se(e,t){if(e=re(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):""}a(se,"canonicalizeHash");function ie(e,t){if(e=re(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):""}a(ie,"canonicalizeSearch");function ae(e,t){return t||e===""?e:j(e)?V(e):G(e)}a(ae,"canonicalizeHostname");function oe(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.password=e,r.password}a(oe,"canonicalizePassword");function ce(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.username=e,r.username}a(ce,"canonicalizeUsername");function le(e,t,r){if(r||e==="")return e;if(t&&!ne.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}a(le,"canonicalizePathname");function fe(e,t,r){return K(t)===e&&(e=""),r||e===""?e:Y(e)}a(fe,"canonicalizePort");function he(e,t){return e=Le(e,":"),t||e===""?e:w(e)}a(he,"canonicalizeProtocol");function K(e){switch(e){case "ws":case "http":return "80";case "wws":case "https":return "443";case "ftp":return "21";default:return ""}}a(K,"defaultPortForProtocol");function w(e){if(e==="")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,"protocolEncodeCallback");function ue(e){if(e==="")return e;let t=new URL("https://example.com");return t.username=e,t.username}a(ue,"usernameEncodeCallback");function de(e){if(e==="")return e;let t=new URL("https://example.com");return t.password=e,t.password}a(de,"passwordEncodeCallback");function G(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}a(G,"hostnameEncodeCallback");function V(e){if(e==="")return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(V,"ipv6HostnameEncodeCallback");function Y(e){if(e===""||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(Y,"portEncodeCallback");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}a(pe,"standardURLPathnameEncodeCallback");function ge(e){return e===""?e:new URL(`data:${e}`).pathname}a(ge,"pathURLPathnameEncodeCallback");function me(e){if(e==="")return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}a(me,"searchEncodeCallback");function Se(e){if(e==="")return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}a(Se,"hashEncodeCallback");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=false;constructor(t){this.#i=t;}get result(){return this.#t}parse(){for(this.#n=W(this.#i,true);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type==="END"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r);}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="");}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?"/":""),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??="")),this.#R(t,r);}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0;}#b(){this.#e=this.#l,this.#s=0;}#u(t){this.#b(),this.#o=t;}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")}#P(){return this.#a(this.#e,":")}#E(){return this.#a(this.#e+1,"/")&&this.#a(this.#e+2,"/")}#S(){return this.#a(this.#e,"@")}#O(){return this.#a(this.#e,":")}#k(){return this.#a(this.#e,":")}#x(){return this.#a(this.#e,"/")}#h(){if(this.#a(this.#e,"?"))return true;if(this.#n[this.#e].value!=="?")return false;let t=this.#m(this.#e-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#f(){return this.#a(this.#e,"#")}#T(){return this.#n[this.#e].type=="OPEN"}#A(){return this.#n[this.#e].type=="CLOSE"}#y(){return this.#a(this.#e,"[")}#w(){return this.#a(this.#e,"]")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=J(this.#c(),void 0,t);this.#g=$(r);}};a(C,"Parser");var X=["protocol","username","password","hostname","port","pathname","search","hash"],O="*";function xe(e,t){if(typeof e!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);return {protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}a(xe,"extractValues");function R(e,t){return t?I(e):e}a(R,"processBaseURLString");function L(e,t,r){let n;if(typeof t.baseURL=="string")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r));}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol=="string"&&(e.protocol=he(t.protocol,r)),typeof t.username=="string"&&(e.username=ce(t.username,r)),typeof t.password=="string"&&(e.password=oe(t.password,r)),typeof t.hostname=="string"&&(e.hostname=ae(t.hostname,r)),typeof t.port=="string"&&(e.port=fe(t.port,e.protocol,r)),typeof t.pathname=="string"){if(e.pathname=t.pathname,n&&!te(e.pathname,r)){let o=n.pathname.lastIndexOf("/");o>=0&&(e.pathname=R(n.pathname.substring(0,o+1),r)+e.pathname);}e.pathname=le(e.pathname,e.protocol,r);}return typeof t.search=="string"&&(e.search=ie(t.search,r)),typeof t.hash=="string"&&(e.hash=se(t.hash,r)),e}a(L,"applyInit");function I(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}a(I,"escapePatternString");function Ie(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}a(Ie,"escapeRegexpString");function Ne(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=false,t.strict??=false,t.end??=true,t.start??=true,t.endsWith="";let r=".*",n=`[^${Ie(t.delimiter)}]+?`,o=/[$_\u200C\u200D\p{ID_Continue}]/u,l="";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),c=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!c&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:"";c=o.test(A);}else c=!p.hasCustomName();if(!c&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];c=t.prefixes.includes(A);}c&&(l+="{"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||c||s.prefix!=="")?l+="*":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&o.test(s.suffix[0])&&(l+="\\"),l+=I(s.suffix),c&&(l+="}"),s.modifier!==3&&(l+=T(s.modifier));}return l}a(Ne,"partsToPattern");var M=class{#i;#n={};#t={};#e={};#s={};#l=false;constructor(t={},r,n){try{let o;if(typeof r=="string"?o=r:n=r,typeof t=="string"){let i=new C(t);if(i.parse(),t=i.result,o===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=o;}else {if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(o)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),K(this.#i.protocol)===this.#i.port&&(this.#i.port="");let s;for(s of X){if(!(s in this.#i))continue;let i={},c=this.#i[s];switch(this.#t[s]=[],s){case "protocol":Object.assign(i,b),i.encodePart=w;break;case "username":Object.assign(i,b),i.encodePart=ue;break;case "password":Object.assign(i,b),i.encodePart=de;break;case "hostname":Object.assign(i,Q),j(c)?i.encodePart=V:i.encodePart=G;break;case "port":Object.assign(i,b),i.encodePart=Y;break;case "pathname":$(this.#n.protocol)?(Object.assign(i,ee,l),i.encodePart=pe):(Object.assign(i,b,l),i.encodePart=ge);break;case "search":Object.assign(i,b,l),i.encodePart=me;break;case "hash":Object.assign(i,b,l),i.encodePart=Se;break}try{this.#s[s]=_(c,i),this.#n[s]=z(this.#s[s],this.#t[s],i),this.#e[s]=Ne(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2);}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(o){throw new TypeError(`Failed to construct 'URLPattern': ${o.message}`)}}get[Symbol.toStringTag](){return "URLPattern"}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 false;try{typeof t=="object"?n=L(n,t,!1):n=L(n,xe(t,r),!1);}catch{return false}let o;for(o of X)if(!this.#n[o].exec(n[o]))return false;return true}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=L(n,t,!1):n=L(n,xe(t,r),!1);}catch{return null}let o={};r?o.inputs=[t,r]:o.inputs=[t];let l;for(l of X){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,c]of this.#t[l].entries())if(typeof c=="string"||typeof c=="number"){let h=f[i+1];s[c]=h;}o[l]={input:n[l]??"",groups:s};}return o}static compareComponent(t,r,n){let o=a((i,c)=>{for(let h of ["type","modifier","prefix","value","suffix"]){if(i[h]<c[h])return -1;if(i[h]===c[h])continue;return 1}return 0},"comparePart"),l=new P(3,"","","","",3),f=new P(0,"","","","",3),s=a((i,c)=>{let h=0;for(;h<Math.min(i.length,c.length);++h){let p=o(i[h],c[h]);if(p)return p}return i.length===c.length?0:o(i[h]??l,c[h]??l)},"comparePartList");return !r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(M,"URLPattern");
|
|
12
12
|
return urlpattern;
|
|
13
13
|
}
|
|
14
14
|
|
package/browser.min.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/("HTMLElement"in globalThis&&!("trustedTypes"in globalThis)||"HTMLElement"in globalThis&&globalThis.trustedTypes[Symbol.for("polyfilled")]&&globalThis.trustedTypes[Symbol.for("enforced")])&&function(){function e(){return"trustedTypes"in globalThis}function t(){return e()&&!Object.is(trustedTypes.defaultPolicy,null)}function r(r){if(function(t){return e()&&trustedTypes.isHTML(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createHTML(r);throw new TypeError("Attempting to set HTML and no default policy is available.")}function n(r){if(function(t){return e()&&trustedTypes.isScript(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScript(r);throw new TypeError("Attempting to create script and no default policy is available.")}function o(r){if(function(t){return e()&&trustedTypes.isScriptURL(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScriptURL(r);throw new TypeError("Attempting to create script URL and no default policy is available.")}function i(t,r,n){return e()?trustedTypes.getAttributeType(t,r,n):null}try{const{write:e,writeln:t,execCommand:n}=Object.getOwnPropertyDescriptors(Document.prototype);Object.defineProperties(Document.prototype,{write:{value:function(t){e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable},writeln:{value:function(e){t.value.call(this,r(e))},enumerable:t.enumerable,configurable:t.configurable,writable:t.writable},execCommand:{value:function(e,t,o){return["insertHTML"].includes(e)?n.value.call(this,e,t,r(o)):n.value.call(this,e,t,o)},enumerable:n.enumerable,configurable:n.configurable}})}catch(e){console.error(e)}if("ServiceWorkerContainer"in globalThis)try{const e=Object.getOwnPropertyDescriptor(ServiceWorkerContainer.prototype,"register");Object.defineProperty(ServiceWorkerContainer.prototype,"register",{value:function(t,r){return e.value.call(this,o(t),r)},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const e=Object.getOwnPropertyDescriptor(Range.prototype,"createContextualFragment");Object.defineProperty(Range.prototype,"createContextualFragment",{value:function(t){return e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const{parseFromString:e}=Object.getOwnPropertyDescriptors(DOMParser.prototype);Object.defineProperties(DOMParser.prototype,{parseFromString:{value:function(t,n){return"text/html"===n?e.value.call(this,r(t),n):e.value.call(this,t,n)},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable}})}catch(e){console.error(e)}try{const{src:e,text:t}=Object.getOwnPropertyDescriptors(HTMLScriptElement.prototype);Object.defineProperties(HTMLScriptElement.prototype,{text:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,n(e))},enumerable:t.enumerable,configurable:t.configurable},src:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable}})}catch(e){console.error(e)}try{const{setAttribute:e,setAttributeNS:t,innerHTML:a,outerHTML:s,insertAdjacentHTML:l}=Object.getOwnPropertyDescriptors(Element.prototype);Object.defineProperties(Element.prototype,{setAttribute:{value:function(t,a){switch(i(this.tagName,t)){case"TrustedHTML":e.value.call(this,t,r(a));break;case"TrustedScript":e.value.call(this,t,n(a));break;case"TrustedScriptURL":e.value.call(this,t,o(a));break;default:e.value.call(this,t,a)}},enumerable:e.enumerable,configurable:e.configurable},setAttributeNS:{value:function(e,a,s){switch(i(this.tagName,a,e)){case"TrustedHTML":t.value.call(this,e,a,r(s));break;case"TrustedScript":t.value.call(this,e,a,n(s));break;case"TrustedScriptURL":t.value.call(this,e,a,o(s));break;default:t.value.call(this,e,a,s)}},enumerable:t.enumerable,configurable:t.configurable},innerHTML:{get:function(){return a.get.call(this)},set:function(e){a.set.call(this,r(e))},enumerable:a.enumerable,configurable:a.configurable},outerHTML:{get:function(){return s.get.call(this)},set:function(e){s.set.call(this,r(e))},enumerable:s.enumerable,configurable:s.configurable},insertAdjacentHTML:{value:function(e,t){l.value.call(this,e,r(t))},enumerable:l.enumerable,configurable:l.configurable}})}catch(e){console.error(e)}try{const{srcdoc:e,src:t}=Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype);Object.defineProperties(HTMLIFrameElement.prototype,{srcdoc:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable},src:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{data:e,codeBase:t}=Object.getOwnPropertyDescriptors(HTMLObjectElement.prototype);Object.defineProperties(HTMLObjectElement.prototype,{data:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable},codeBase:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{eval:e,setTimeout:t,setInterval:r}=globalThis;globalThis.eval=function(t){return e(n(t).toString())},globalThis.setTimeout=function(e,r,...o){return"string"==typeof e?t(n(e),r,...o):t(e,r,...o)},globalThis.setInterval=function(e,t,...o){return"string"==typeof e?r(n(e),t,...o):r(e,t,...o)};try{const e=globalThis.Function;globalThis.Function=function(...t){if(0===t.length)return e();{const r=n(t.pop());return e(...t,r.toString())}},globalThis.Function.prototype=e.prototype,e.prototype.constructor=globalThis.Function}catch(e){console.error(e)}}catch(e){console.error(e)}}();const ee={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const r=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),r=new AbortController,n=r.signal,o=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=o,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:n})=>{r.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{n.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(n.href)),100)}),{once:!0,signal:n}),t.addEventListener("error",(({target:e})=>{r.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:n}),t}));this instanceof Document?this.head.append(...r):this.append(...r)}}},te=Symbol("shadow:hosts");function re(e){if(e instanceof HTMLTemplateElement&&e.parentElement instanceof HTMLElement){e.parentElement.attachShadow({mode:e.getAttribute("shadowrootmode"),clonable:e.hasAttribute("shadowrootclonable"),delegatesFocus:e.hasAttribute("shadowrootdelegatesfocus"),serializable:e.hasAttribute("shadowrootserializable")}).append(e.content),e.remove()}}function ne(e,{serializableShadowRoots:t=!1,shadowRoots:r=[],[te]:n=[]}={}){return Array.from(e.childNodes,(e=>{if(e.nodeType===Node.ELEMENT_NODE){const[o,i]=function(e){const t=e.cloneNode().outerHTML,r=t.indexOf("/")-1;return r>0?[t.substring(0,r),t.substring(r)]:[t,""]}(e);return o+e.getHTML({serializableShadowRoots:t,shadowRoots:r,[te]:n})+i}return e.textContent})).join("")}function oe(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n=[]}={}){if(e.serializable){const o=`<template shadowrootmode="${e.mode}"`,i=[];e.clonable&&i.push(' shadowrootclonable=""'),e.serializable&&i.push(' shadowrootserializable=""'),e.delegatesFocus&&i.push(' shadowrootdelegatesfocus=""');return(0===i.length?o+">":o+" "+i.join("")+">")+ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})+"</template>"}return ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})}function ie(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();r.append(...t.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),this.replaceChildren(r)}function ae({serializableShadowRoots:e=!1,shadowRoots:t=[],[te]:r=[]}={}){switch(e&&0===r.length&&0!==t.length&&r.push(...t.map((e=>e.host))),this.nodeType){case Node.ELEMENT_NODE:if(e&&this.shadowRoot instanceof ShadowRoot&&(this.shadowRoot.serializable||t.includes(this.shadowRoot)))return this.shadowRoot.getHTML({serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r});if(e&&r.includes(this)){return oe(t.find((e=>e.host.isSameNode(this))),{serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r})}return this.innerHTML;case Node.DOCUMENT_FRAGMENT_NODE:return this instanceof ShadowRoot?e&&(this.serializable||t.includes(this))?oe(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):"";default:throw new TypeError("'getHTML' called on an object that does not implement interface Element.")}}function se(e){for(;e.cssRules.length>0;)e.deleteRule(0)}c(Document.prototype,"adoptedStyleSheets",ee),l(Document,"parseHTMLUnsafe",(function(e){const t=new DOMParser,r=document.implementation.createHTMLDocument(),n=t.parseFromString(e,"text/html");return r.head.append(...n.head.childNodes),r.body.append(...n.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),r})),"ShadowRoot"in globalThis&&(c(ShadowRoot.prototype,"adoptedStyleSheets",ee),l(ShadowRoot.prototype,"setHTMLUnsafe",ie),l(ShadowRoot.prototype,"getHTML",ae));try{new CSSStyleSheet}catch{const dt=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const r=function(e="",{disabled:t=!1,media:r}={}){const n=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);return"string"==typeof r&&n.media.appendMedium(r),n.disabled=t,n}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return r.deleteRule(0),r},globalThis.CSSStyleSheet.prototype=dt.prototype,dt.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),r=new AbortController,{resolve:n,reject:o,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{se(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),n(this),r.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:r.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),r.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:r.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);se(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const le={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},ce="http://www.w3.org/1999/xhtml",ue="http://www.w3.org/1999/xlink",pe=new Set(("HTMLElement"in globalThis?Object.keys(HTMLElement.prototype):[]).filter((e=>e.startsWith("on"))));
|
|
27
27
|
/**
|
|
28
28
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
29
|
-
*/function he(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function fe({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),fe({elements:t},r);if(Array.isArray(e))return e.map((e=>he(e,r)));throw new TypeError("`elements` expected to be an array.")}function de(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function me({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),me({attributes:t},r);if(Array.isArray(e))return e.map((e=>de(e,r)));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),me({attributes:Object.entries(e).map((([e,t])=>({name:e,elements:t})))},r);throw new TypeError("`attributes` expected to be an array.")}function ge({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function be({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(me({attributes:e,allowAttributes:t},r),(({namespace:e})=>e??"")))}function ye({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(fe({elements:e,allowElements:t},r),(({namespace:e})=>e)))}function we(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?we(e.get()):Object.freeze({elements:ye(e,t),attributes:be(e,r),comments:ge(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const ve=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map((e=>de(e)))),Te=Object.freeze(["html","head","link","meta","body","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map((e=>he(e,ce)))),Ee=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","invoketarget","invokeaction","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map((e=>de(e))).concat(ve)),Se=Object.freeze({comments:!0,elements:Te,attributes:Ee,dataAttributes:!0}),Ae=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor","use"].map((e=>he(e,"http://www.w3.org/2000/svg")))),xe=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clipPathUnits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","href","hreflang","horiz-adv-x","horiz-origin-x","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","ping","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rel","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tabindex","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:ue},{name:"arcrole",namespaec:ue},{name:"href",namespace:ue},{name:"role",namespace:ue},{name:"show",namespace:ue},{name:"title",namespace:ue},{name:"type",namespace:ue},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map((e=>de(e))).concat(ve)),Me=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map((e=>he(e,"http://www.w3.org/1998/Math/MathML")))),Le=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map((e=>de(e))).concat(ve));
|
|
29
|
+
*/function he(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function fe({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),fe({elements:t},r);if(Array.isArray(e))return e.map((e=>he(e,r)));throw new TypeError("`elements` expected to be an array.")}function de(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function me({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),me({attributes:t},r);if(Array.isArray(e))return e.map((e=>de(e,r)));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),me({attributes:Object.entries(e).map((([e,t])=>({name:e,elements:t})))},r);throw new TypeError("`attributes` expected to be an array.")}function ge({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function be({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(me({attributes:e,allowAttributes:t},r),(({namespace:e})=>e??"")))}function ye({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(fe({elements:e,allowElements:t},r),(({namespace:e})=>e)))}function we(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?we(e.get()):Object.freeze({elements:ye(e,t),attributes:be(e,r),comments:ge(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const ve=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map((e=>de(e)))),Te=Object.freeze(["html","head","link","meta","body","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map((e=>he(e,ce)))),Ee=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","command","commandfor","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","invoketarget","invokeaction","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map((e=>de(e))).concat(ve)),Se=Object.freeze({comments:!0,elements:Te,attributes:Ee,dataAttributes:!0}),Ae=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor","use"].map((e=>he(e,"http://www.w3.org/2000/svg")))),xe=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clipPathUnits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","href","hreflang","horiz-adv-x","horiz-origin-x","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","ping","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rel","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tabindex","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:ue},{name:"arcrole",namespaec:ue},{name:"href",namespace:ue},{name:"role",namespace:ue},{name:"show",namespace:ue},{name:"title",namespace:ue},{name:"type",namespace:ue},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map((e=>de(e))).concat(ve)),Me=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map((e=>he(e,"http://www.w3.org/1998/Math/MathML")))),Le=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map((e=>de(e))).concat(ve));
|
|
30
30
|
/**
|
|
31
31
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
32
32
|
* @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
|