Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asamuzakjp/dom-selector

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asamuzakjp/dom-selector - npm Package Compare versions

Comparing version 4.6.3 to 4.6.4

2

dist/cjs/js/constant.js

@@ -1,2 +0,2 @@

var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var n in t)T(o,n,{get:t[n],enumerable:!0})},u=(o,t,n,I)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!d.call(o,s)&&s!==n&&T(o,s,{get:()=>t[s],enumerable:!(I=F(t,s))||I.enumerable});return o};var H=o=>u(T({},"__esModule",{value:!0}),o);var Vt={};Y(Vt,{ALPHA_NUM:()=>R,ANB:()=>D,AN_PLUS_B:()=>B,BIT_01:()=>q,BIT_02:()=>J,BIT_04:()=>tt,BIT_08:()=>ot,BIT_16:()=>et,BIT_32:()=>st,BIT_FFFF:()=>rt,BIT_HYPHEN:()=>Et,CHILD_IDX:()=>A,COMBINATOR:()=>m,COMBO:()=>O,COMPLEX:()=>L,COMPLEX_L:()=>N,COMPOUND:()=>E,COMPOUND_A:()=>C,COMPOUND_B:()=>S,COMPOUND_I:()=>l,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>Rt,DOCUMENT_NODE:()=>Tt,DOCUMENT_POSITION_CONTAINED_BY:()=>Ct,DOCUMENT_POSITION_CONTAINS:()=>Lt,DOCUMENT_POSITION_PRECEDING:()=>$t,DUO:()=>nt,ELEMENT_NODE:()=>xt,EMPTY:()=>w,HEX:()=>ct,IDENTIFIER:()=>g,LANG_PART:()=>G,LOGICAL_COMPLEX:()=>a,LOGICAL_COMPOUND:()=>M,LOGICAL_KEY:()=>x,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>i,NOT_SUPPORTED_ERR:()=>h,NTH:()=>X,N_TH:()=>_,PSEUDO_CLASSES:()=>p,RAW:()=>b,REG_ANCHOR:()=>Dt,REG_CHILD_INDEXED:()=>Pt,REG_COMPLEX:()=>it,REG_DIR:()=>lt,REG_FORM:()=>at,REG_FORM_CTRL:()=>Mt,REG_FORM_GROUP:()=>Ft,REG_FORM_VALID:()=>Ut,REG_HEX:()=>dt,REG_INTERACT:()=>Yt,REG_INVALID_SELECTOR:()=>ut,REG_LANG:()=>Ht,REG_LANG_QUOTED:()=>Bt,REG_LOGICAL_COMPLEX:()=>mt,REG_LOGICAL_COMPOUND:()=>wt,REG_LOGICAL_EMPTY:()=>gt,REG_LOGICAL_KEY:()=>ht,REG_LOGICAL_PSEUDO:()=>Xt,REG_SHADOW_HOST:()=>bt,REG_SHADOW_MODE:()=>ft,REG_SHADOW_PSEUDO:()=>Wt,REG_TYPE_CHECK:()=>yt,REG_TYPE_DATE:()=>kt,REG_TYPE_RANGE:()=>Kt,REG_TYPE_RESET:()=>Zt,REG_TYPE_SUBMIT:()=>vt,REG_TYPE_TEXT:()=>zt,SELECTOR:()=>f,SELECTOR_ATTR:()=>W,SELECTOR_CLASS:()=>y,SELECTOR_ID:()=>k,SELECTOR_LIST:()=>K,SELECTOR_PSEUDO_CLASS:()=>Z,SELECTOR_PSEUDO_ELEMENT:()=>v,SELECTOR_TYPE:()=>z,SHOW_ALL:()=>St,SHOW_DOCUMENT:()=>Nt,SHOW_DOCUMENT_FRAGMENT:()=>It,SHOW_ELEMENT:()=>At,STRING:()=>V,SUB_TYPE:()=>r,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>e,TAG_TYPE_I:()=>$,TEXT_NODE:()=>Ot,TYPE_FROM:()=>pt,TYPE_TO:()=>_t,U_FFFD:()=>j,WALKER_FILTER:()=>Gt});module.exports=H(Vt);const B="AnPlusB",m="Combinator",w="__EMPTY__",g="Identifier",h="NotSupportedError",X="Nth",b="Raw",f="Selector",W="AttributeSelector",y="ClassSelector",k="IdSelector",K="SelectorList",Z="PseudoClassSelector",v="PseudoElementSelector",z="TypeSelector",V="String",Q="SyntaxError",j="\uFFFD",q=1,J=2,tt=4,ot=8,et=16,st=32,rt=65535,Et=45,nt=2,ct=16,pt=8,_t=-1,xt=1,Ot=3,Tt=9,Rt=11,$t=2,Lt=8,Ct=16,St=4294967295,Nt=256,It=1024,At=1,Gt=1281,R="[A-Z\\d]+",A="(?:first|last|only)-(?:child|of-type)",c="(?:0|[1-9]\\d*)",G=`(?:-${R})*`,p=`(?:any-)?link|${A}|checked|empty|indeterminate|root|target|visited`,D=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${D})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",$="\\*|[A-Z][\\w-]*",x="(?:is|not)",E=`(?:${e}|(?:${e})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",L=`${E}(?:${O}${E})*`,P=`:is\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,i=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,C=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,S=`(?:${e}|(?:${e})?(?:${r}|${i})+)`,l=`(?:${$}|(?:${$})?(?:${r})+)`,N=`${S}(?:${O}${S})*`,a=`${x}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,M=`${x}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,Dt=/^a(?:rea)?$/,Pt=new RegExp(`:(?!${p}|${_})`),it=new RegExp(`${O}${l}`,"i"),lt=/^(?:ltr|rtl)$/,at=/^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/,Mt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ft=/^(?:fieldset|optgroup|select)$/,Ut=/^(?:button|form|input|select|textarea)$/,dt=/^([\da-f]{1,6}\s?)/i,Yt=/^(?:details|dialog)$/,ut=/^$|^\s*>|,\s*$/,Ht=new RegExp(`^(?:\\*-)?${R}${G}$`,"i"),Bt=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,mt=new RegExp(`:(?!${p}|${_}|${a})`),wt=new RegExp(`:(?!${p}|${_}|${M})`),gt=/(:(is|where)\(\s*\))/,ht=new RegExp(`:${x}\\(`),Xt=/^(?:has|is|not|where)$/,bt=/^host(?:-context)?$/,ft=/^(?:close|open)$/,Wt=/^part|slotted$/,yt=/^(?:checkbox|radio)$/,kt=/^(?:date(?:time-local)?|month|time|week)$/,Kt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Zt=/^(?:button|reset)$/,vt=/^(?:image|submit)$/,zt=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_GROUP,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var n in t)T(o,n,{get:t[n],enumerable:!0})},H=(o,t,n,I)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!d.call(o,s)&&s!==n&&T(o,s,{get:()=>t[s],enumerable:!(I=F(t,s))||I.enumerable});return o};var u=o=>H(T({},"__esModule",{value:!0}),o);var zt={};Y(zt,{ALPHA_NUM:()=>R,ANB:()=>G,AN_PLUS_B:()=>B,BIT_01:()=>q,BIT_02:()=>J,BIT_04:()=>tt,BIT_08:()=>ot,BIT_16:()=>et,BIT_32:()=>st,BIT_FFFF:()=>rt,BIT_HYPHEN:()=>Et,CHILD_IDX:()=>A,COMBINATOR:()=>m,COMBO:()=>O,COMPLEX:()=>L,COMPLEX_L:()=>N,COMPOUND:()=>E,COMPOUND_A:()=>C,COMPOUND_B:()=>S,COMPOUND_I:()=>l,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>Rt,DOCUMENT_NODE:()=>Tt,DOCUMENT_POSITION_CONTAINED_BY:()=>Ct,DOCUMENT_POSITION_CONTAINS:()=>Lt,DOCUMENT_POSITION_PRECEDING:()=>$t,DUO:()=>nt,ELEMENT_NODE:()=>pt,EMPTY:()=>w,HEX:()=>ct,IDENTIFIER:()=>g,LANG_PART:()=>D,LOGICAL_COMPLEX:()=>a,LOGICAL_COMPOUND:()=>M,LOGICAL_KEY:()=>p,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>i,NOT_SUPPORTED_ERR:()=>h,NTH:()=>X,N_TH:()=>_,PSEUDO_CLASSES:()=>x,RAW:()=>b,REG_ANCHOR:()=>Gt,REG_CHILD_INDEXED:()=>Pt,REG_COMPLEX:()=>it,REG_DIR:()=>lt,REG_FORM:()=>at,REG_FORM_CTRL:()=>Mt,REG_FORM_VALID:()=>Ft,REG_HEX:()=>Ut,REG_INTERACT:()=>dt,REG_INVALID_SELECTOR:()=>Yt,REG_LANG:()=>Ht,REG_LANG_QUOTED:()=>ut,REG_LOGICAL_COMPLEX:()=>Bt,REG_LOGICAL_COMPOUND:()=>mt,REG_LOGICAL_EMPTY:()=>wt,REG_LOGICAL_KEY:()=>gt,REG_LOGICAL_PSEUDO:()=>ht,REG_SHADOW_HOST:()=>Xt,REG_SHADOW_MODE:()=>bt,REG_SHADOW_PSEUDO:()=>ft,REG_TYPE_CHECK:()=>Wt,REG_TYPE_DATE:()=>yt,REG_TYPE_RANGE:()=>kt,REG_TYPE_RESET:()=>Kt,REG_TYPE_SUBMIT:()=>Zt,REG_TYPE_TEXT:()=>vt,SELECTOR:()=>f,SELECTOR_ATTR:()=>W,SELECTOR_CLASS:()=>y,SELECTOR_ID:()=>k,SELECTOR_LIST:()=>K,SELECTOR_PSEUDO_CLASS:()=>Z,SELECTOR_PSEUDO_ELEMENT:()=>v,SELECTOR_TYPE:()=>z,SHOW_ALL:()=>St,SHOW_DOCUMENT:()=>Nt,SHOW_DOCUMENT_FRAGMENT:()=>It,SHOW_ELEMENT:()=>At,STRING:()=>V,SUB_TYPE:()=>r,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>e,TAG_TYPE_I:()=>$,TEXT_NODE:()=>Ot,TYPE_FROM:()=>xt,TYPE_TO:()=>_t,U_FFFD:()=>j,WALKER_FILTER:()=>Dt});module.exports=u(zt);const B="AnPlusB",m="Combinator",w="__EMPTY__",g="Identifier",h="NotSupportedError",X="Nth",b="Raw",f="Selector",W="AttributeSelector",y="ClassSelector",k="IdSelector",K="SelectorList",Z="PseudoClassSelector",v="PseudoElementSelector",z="TypeSelector",V="String",Q="SyntaxError",j="\uFFFD",q=1,J=2,tt=4,ot=8,et=16,st=32,rt=65535,Et=45,nt=2,ct=16,xt=8,_t=-1,pt=1,Ot=3,Tt=9,Rt=11,$t=2,Lt=8,Ct=16,St=4294967295,Nt=256,It=1024,At=1,Dt=1281,R="[A-Z\\d]+",A="(?:first|last|only)-(?:child|of-type)",c="(?:0|[1-9]\\d*)",D=`(?:-${R})*`,x=`(?:any-)?link|${A}|checked|empty|indeterminate|root|target|visited`,G=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${G})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",$="\\*|[A-Z][\\w-]*",p="(?:is|not)",E=`(?:${e}|(?:${e})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",L=`${E}(?:${O}${E})*`,P=`:is\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,i=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,C=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,S=`(?:${e}|(?:${e})?(?:${r}|${i})+)`,l=`(?:${$}|(?:${$})?(?:${r})+)`,N=`${S}(?:${O}${S})*`,a=`${p}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,M=`${p}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,Gt=/^a(?:rea)?$/,Pt=new RegExp(`:(?!${x}|${_})`),it=new RegExp(`${O}${l}`,"i"),lt=/^(?:ltr|rtl)$/,at=/^(?:button|fieldset|form|input|select|textarea)$/,Mt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ft=/^(?:button|form|input|select|textarea)$/,Ut=/^([\da-f]{1,6}\s?)/i,dt=/^(?:details|dialog)$/,Yt=/^$|^\s*>|,\s*$/,Ht=new RegExp(`^(?:\\*-)?${R}${D}$`,"i"),ut=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,Bt=new RegExp(`:(?!${x}|${_}|${a})`),mt=new RegExp(`:(?!${x}|${_}|${M})`),wt=/(:(is|where)\(\s*\))/,gt=new RegExp(`:${p}\\(`),ht=/^(?:has|is|not|where)$/,Xt=/^host(?:-context)?$/,bt=/^(?:close|open)$/,ft=/^part|slotted$/,Wt=/^(?:checkbox|radio)$/,yt=/^(?:date(?:time-local)?|month|time|week)$/,kt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Kt=/^(?:button|reset)$/,Zt=/^(?:image|submit)$/,vt=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
//# sourceMappingURL=constant.js.map

@@ -1,2 +0,2 @@

var z=Object.create;var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(g,l)=>{for(var e in l)M(g,e,{get:l[e],enumerable:!0})},D=(g,l,e,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of W(l))!j.call(g,c)&&c!==e&&M(g,c,{get:()=>l[c],enumerable:!(h=H(l,c))||h.enumerable});return g};var Y=(g,l,e)=>(e=g!=null?z(B(g)):{},D(l||!g||!g.__esModule?M(e,"default",{value:g,enumerable:!0}):e,g)),V=g=>D(M({},"__esModule",{value:!0}),g);var K={};q(K,{Finder:()=>X});module.exports=V(K);var I=Y(require("@asamuzakjp/nwsapi"),1),_=require("./dom-util.js"),O=require("./matcher.js"),y=require("./parser.js"),n=require("./constant.js");const x="next",S="prev",L="all",E="first",C="lineal",R="self";class X{#a;#c;#s;#o;#w;#r;#b;#e;#f;#k;#h;#m;#_;#t;#d;#u;#n;#p;#i;#l;constructor(l,e){this.#l=l,this.#r=e??l.document,this.#c=new WeakMap,this.#o=new WeakMap,this.#_=new WeakMap,this.#h=this._initNwsapi(l,e)}_onError(l){if(!this.#k)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===n.NOT_SUPPORTED_ERR)this.#i&&console.warn(l.message);else throw new this.#l.DOMException(l.message,l.name);else throw l}_setup(l,e,h={}){const{event:c,noexcept:a,warn:o}=h;return this.#k=!!a,this.#i=!!o,this.#b=this._setEvent(c),this.#e=e,[this.#s,this.#t,this.#n]=(0,_.resolveContent)(e),this.#d=(0,_.isInShadowTree)(e),[this.#a,this.#f]=this._correspond(l),this.#p=new WeakMap,e}_initNwsapi(){const l=(0,I.default)({DOMException:this.#l.DOMException,document:this.#r});return l.configure({LOGERRORS:!1}),l}_setEvent(l){return l instanceof this.#l.KeyboardEvent||l instanceof this.#l.MouseEvent?l:null}_correspond(l){const e=[];this.#w=!1;let h;if(this.#o.has(this.#s)){const c=this.#o.get(this.#s);if(c&&c.has(`${l}`)){const a=c.get(`${l}`);this.#w=a.descendant,h=a.ast}}if(h){const c=h.length;for(let a=0;a<c;a++)h[a].collected=!1,h[a].dir=null,h[a].filtered=!1,h[a].find=!1,e[a]=[]}else{let c;try{c=(0,y.parseSelector)(l)}catch(f){this._onError(f)}const{branches:a,info:{hasHasPseudoFunc:o,hasHyphenSepAttr:r,hasNthChildOfSelector:b,hasPseudoFunc:d}}=(0,y.walkAST)(c);let i;o||r||b&&d?i=!1:i=!0;let t=!1,s=0;h=[];for(const[...f]of a){const m=[];let u=f.shift();if(u&&u.type!==n.COMBINATOR){const p=new Set;for(;u;){if(u.type===n.COMBINATOR){const[w]=f;if(w.type===n.COMBINATOR){const N=`Invalid selector ${l}`;throw new DOMException(N,n.SYNTAX_ERR)}const k=u.name;/^[\s>]$/.test(k)&&(t=!0),m.push({combo:u,leaves:(0,y.sortAST)(p)}),p.clear()}else if(u){let{name:w}=u;w&&typeof w=="string"&&(w=(0,y.unescapeSelector)(w),typeof w=="string"&&w!==u.name&&(u.name=w),/[|:]/.test(w)&&(u.namespace=!0)),p.add(u)}if(f.length)u=f.shift();else{m.push({combo:null,leaves:(0,y.sortAST)(p)}),p.clear();break}}}h.push({branch:m,collected:!1,dir:null,filtered:!1,find:!1}),e[s]=[],s++}if(i){let f;this.#o.has(this.#s)?f=this.#o.get(this.#s):f=new Map,f.set(`${l}`,{ast:h,descendant:t}),this.#o.set(this.#s,f)}this.#w=t}return[h,e]}_createTreeWalker(l){let e;return this.#p.has(l)?e=this.#p.get(l):(e=this.#r.createTreeWalker(l,n.WALKER_FILTER),this.#p.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#u=!1,this.#m}_collectNthChild(l,e,h){const{a:c,b:a,reverse:o,selector:r}=l,{parentNode:b}=e,d=new Set;let i;if(r)if(this.#c.has(r))i=this.#c.get(r);else{const{branches:t}=(0,y.walkAST)(r);i=t,this.#c.set(r,i)}if(b){const t=this.#n;let s=(0,_.traverseNode)(b,t);s=t.firstChild();let f=0;for(;s;)f++,s=t.nextSibling();const m=new Set;if(i)for(s=(0,_.traverseNode)(b,t),s=t.firstChild();s;){const{display:u,visibility:p}=this.#l.getComputedStyle(s);if(u!=="none"&&p!=="hidden"){let w;for(const k of i)if(w=this._matchLeaves(k,s,h),!w)break;w&&m.add(s)}s=t.nextSibling()}if(c===0){if(a>0&&a<=f){if(m.size){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(m.has(s)){if(u===a-1){d.add(s);break}u++}o?s=t.previousSibling():s=t.nextSibling()}}else if(!r){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(u===a-1){d.add(s);break}o?s=t.previousSibling():s=t.nextSibling(),u++}}}}else{let u=a-1;if(c>0)for(;u<0;)u+=c;if(u>=0&&u<f){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let p=0,w=c>0?0:a-1;for(;s&&(s&&u>=0&&u<f);)m.size?m.has(s)&&(w===u&&(d.add(s),u+=c),c>0?w++:w--):p===u&&(r||d.add(s),u+=c),o?s=t.previousSibling():s=t.nextSibling(),p++}}if(o&&d.size>1){const u=[...d];return new Set(u.reverse())}}else if(e===this.#t&&c+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:h,b:c,reverse:a}=l,{localName:o,parentNode:r,prefix:b}=e,d=new Set;if(r){const i=this.#n;let t=(0,_.traverseNode)(r,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(c>0&&c<=s){t=(0,_.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let f=0;for(;t;){const{localName:m,prefix:u}=t;if(m===o&&u===b){if(f===c-1){d.add(t);break}f++}a?t=i.previousSibling():t=i.nextSibling()}}}else{let f=c-1;if(h>0)for(;f<0;)f+=h;if(f>=0&&f<s){t=(0,_.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let m=h>0?0:c-1;for(;t;){const{localName:u,prefix:p}=t;if(u===o&&p===b){if(m===f&&(d.add(t),f+=h),f<0||f>=s)break;h>0?m++:m--}a?t=i.previousSibling():t=i.nextSibling()}}}if(a&&d.size>1){const f=[...d];return new Set(f.reverse())}}else e===this.#t&&h+c===1&&d.add(e);return d}_matchAnPlusB(l,e,h,c){const{nth:{a,b:o,name:r},selector:b}=l,d=new Map;if(r?(r==="even"?(d.set("a",2),d.set("b",0)):r==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof o=="string"&&/-?\d+/.test(o)?d.set("b",o*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){b&&d.set("selector",b);const i=Object.fromEntries(d);return this._collectNthChild(i,e,c)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(l,e,h={}){let c;if(Array.isArray(l)&&l.length){const a=l.map(s=>s),[o]=a,{type:r}=o;let b;r===n.COMBINATOR?b=a.shift():b={name:" ",type:n.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:f}=s;if(f===n.COMBINATOR)break;d.push(a.shift())}const i={combo:b,leaves:d};h.dir=x;const t=this._matchCombinator(i,e,h);if(t.size)if(a.length){for(const s of t)if(c=this._matchHasPseudoFunc(a,s,h),c)break}else c=!0}return!!c}_matchLogicalPseudoFunc(l,e,h={}){const{astName:c="",branches:a=[],selector:o="",twigBranches:r=[]}=l;let b;if(c==="has")if(o.includes(":has("))b=null;else{let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(b=e)}else{const d=/^(?:is|where)$/.test(c);h.forgive=d;const i=r.length;let t;for(let s=0;s<i;s++){const f=r[s],m=f.length-1,{leaves:u}=f[m];if(t=this._matchLeaves(u,e,h),t&&m>0){let p=new Set([e]);for(let w=m-1;w>=0;w--){const k=f[w],N=[];h.dir=S;for(const A of p){const v=this._matchCombinator(k,A,h);v.size&&N.push(...v)}if(N.length)w===0?t=!0:p=new Set(N);else{t=!1;break}}}if(t)break}c==="not"?t||(b=e):t&&(b=e)}return b??null}_matchPseudoClassSelector(l,e,h={}){const{children:c,name:a}=l,{localName:o,parentNode:r}=e,{forgive:b,warn:d=this.#i}=h,i=new Set;if(n.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#c.has(l))t=this.#c.get(l);else{const{branches:f}=(0,y.walkAST)(l),m=[],u=[];for(const[...p]of f){for(const A of p){const v=(0,y.generateCSS)(A);m.push(v)}const w=[],k=new Set;let N=p.shift();for(;N;)if(N.type===n.COMBINATOR?(w.push({combo:N,leaves:[...k]}),k.clear()):N&&k.add(N),p.length)N=p.shift();else{w.push({combo:null,leaves:[...k]}),k.clear();break}u.push(w)}t={astName:a,branches:f,twigBranches:u,selector:m.join(",")},this.#c.set(l,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(c))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=c;return this._matchAnPlusB(t,e,a,h)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&i.add(t);break}case"state":{if((0,_.isCustomElement)(e)){const[{value:t}]=c;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(!b){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{n.REG_ANCHOR.test(o)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(n.REG_ANCHOR.test(o)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:f}=new URL(this.#s.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===f&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#b??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:f}=this.#b??{};(f==="mousedown"||f==="pointerdown")&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let f=this.#s.getElementById(s);for(;f;){if(f===e){i.add(e);break}f=f.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#d&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#b??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(a==="focus"||s==="keydown"&&e.contains(t))){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(f);if(m=!(u==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(f);if(m=!(u==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"open":{n.REG_INTERACT.test(o)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{n.REG_INTERACT.test(o)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(n.REG_FORM_CTRL.test(o)||(0,_.isCustomElement)(e,{formAssociated:!0}))if(e.disabled||e.hasAttribute("disabled"))i.add(e);else{let t=r;for(;t;){if(n.REG_FORM_GROUP.test(t.localName))if(t.localName==="fieldset"){if(t.disabled&&t.hasAttribute("disabled"))break}else break;t=t.parentNode}t&&r.localName!=="legend"&&(t.disabled||t.hasAttribute("disabled"))&&i.add(e)}break}case"enabled":{(n.REG_FORM_CTRL.test(o)||(0,_.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled"))&&i.add(e);break}case"read-only":{switch(o){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(o){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)&&i.add(e)}break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;o==="textarea"?s=e:o==="input"&&(e.hasAttribute("type")?n.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&o==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&o==="input"&&e.type==="checkbox"||o==="progress"&&!e.hasAttribute("value"))i.add(e);else if(o==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#s.documentElement);const f=s.getElementsByTagName("input"),m=f.length;let u;for(let p=0;p<m;p++){const w=f[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(u=!!w.checked):w.hasAttribute("name")||(u=!!w.checked),u))break}u||i.add(e)}break}case"default":{if(o==="button"&&!(e.hasAttribute("type")&&n.REG_TYPE_RESET.test(e.getAttribute("type")))||o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#n;let f=(0,_.traverseNode)(t,s);for(f=s.firstChild();f&&t.contains(f);){const m=f.localName;let u;if(m==="button"?u=!(f.hasAttribute("type")&&n.REG_TYPE_RESET.test(f.getAttribute("type"))):m==="input"&&(u=f.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(f.getAttribute("type"))),u){f===e&&i.add(e);break}f=s.nextNode()}}}else if(o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))i.add(e);else if(o==="option"){let t=r,s=!1;for(;t&&t.localName!=="datalist";){if(t.localName==="select"){(t.multiple||t.hasAttribute("multiple"))&&(s=!0);break}t=t.parentNode}if(s)(e.selected||e.hasAttribute("selected"))&&i.add(e);else{const f=new Set,m=this.#n;let u=(0,_.traverseNode)(r,m);for(u=m.firstChild();u;){if(u.selected||u.hasAttribute("selected")){f.add(u);break}u=m.nextSibling()}f.size&&f.has(e)&&i.add(e)}}break}case"valid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(o==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f&&i.add(e)}break}case"invalid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(o==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f||i.add(e)}break}case"in-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#r.createTreeWalker(e,n.SHOW_ALL);let s=t.firstChild(),f;for(;s&&(f=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!f);)s=t.nextSibling();f&&i.add(e)}else i.add(e);break}case"first-child":{(r&&e===r.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(r&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(r&&e===r.firstElementChild&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||o.includes("-")?(0,_.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"autofill":case"blank":case"buffering":case"current":case"fullscreen":case"future":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}}else if(!b){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,n.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(l,e){const{children:h,name:c}=l;let a;if(Array.isArray(h)){const{branches:o}=(0,y.walkAST)(h[0]),[r]=o,[...b]=r,{host:d}=e;if(c==="host"){let i;for(const t of b){const{type:s}=t;if(s===n.COMBINATOR){const m=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(m,n.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(a=e)}else if(c==="host-context"){let i=d,t;for(;i;){for(const s of b){const{type:f}=s;if(f===n.COMBINATOR){const u=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(u,n.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(a=e)}}else if(c==="host")a=e;else{const o=`Invalid selector :${c}`;throw new DOMException(o,n.SYNTAX_ERR)}return a??null}_matchSelector(l,e,h){const{type:c}=l,a=new Set;if(l.name===n.EMPTY)return a;const o=(0,y.unescapeSelector)(l.name);if(typeof o=="string"&&o!==l.name&&(l.name=o),e.nodeType===n.ELEMENT_NODE)switch(c){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(o,h);break}case n.SELECTOR_ID:{e.id===o&&a.add(e);break}case n.SELECTOR_CLASS:{e.classList.contains(o)&&a.add(e);break}case n.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,h);default:{const r=O.matcher.matchSelector(l,e,h);r&&a.add(r)}}else if(this.#d&&c===n.SELECTOR_PSEUDO_CLASS&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(o!=="has"&&n.REG_LOGICAL_PSEUDO.test(o))return this._matchPseudoClassSelector(l,e,h);if(n.REG_SHADOW_HOST.test(o)){const r=this._matchShadowHostPseudoClass(l,e,h);r&&a.add(r)}}return a}_matchLeaves(l,e,h){const{attributes:c,localName:a,nodeType:o}=e;let r=this.#_.get(l),b;if(r&&r.has(e)){const{attr:d,matched:i}=r.get(e);c?.length===d&&(b=i)}if(typeof b!="boolean"){let d;o===n.ELEMENT_NODE&&n.REG_FORM.test(a)?d=!1:d=!0;for(const i of l){const{name:t,type:s}=i;if(s===n.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),b=this._matchSelector(i,e,h).has(e),!b)break}d&&(r||(r=new WeakMap),r.set(e,{attr:c?.length,matched:b}),this.#_.set(l,r))}return!!b}_matchHTMLCollection(l,e={}){const{compound:h,filterLeaves:c}=e,a=new Set,o=l.length;if(o)if(h)for(let r=0;r<o;r++){const b=l[r];this._matchLeaves(c,b,e)&&a.add(b)}else{const r=[].slice.call(l);return new Set(r)}return a}_findDescendantNodes(l,e,h){const[c,...a]=l,o=a.length>0,{type:r}=c,b=(0,y.unescapeSelector)(c.name);typeof b=="string"&&b!==c.name&&(c.name=b);let d=new Set,i=!1;if(this.#d)i=!0;else switch(r){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,h);break}case n.SELECTOR_ID:{if(this.#t.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(b);t&&t!==e&&e.contains(t)&&(o?this._matchLeaves(a,t,h)&&d.add(t):d.add(t))}break}case n.SELECTOR_CLASS:{const t=e.getElementsByClassName(b);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a});break}case n.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(b)){const t=e.getElementsByTagName(b);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(l,e,h={}){const{combo:c,leaves:a}=l,{name:o}=c,{parentNode:r}=e,{dir:b}=h,d=new Set;if(b===x)switch(o){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,_.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,_.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(a,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let f=(0,_.traverseNode)(e,s);for(f=s.nextNode();f&&e.contains(f);)this._matchLeaves(a,f,h)&&d.add(f),f=s.nextNode()}}}else switch(o){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,_.traverseNode)(r,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{r&&this._matchLeaves(a,r,h)&&d.add(r);break}case" ":default:{const i=[];let t=r;for(;t;)this._matchLeaves(a,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(l,e){const{node:h}=e,c=this.#m;let a=(0,_.traverseNode)(h,c),o;if(a)for((a.nodeType!==n.ELEMENT_NODE||a===h&&a!==this.#t)&&(a=c.nextNode());a;){if(this._matchLeaves(l,a,{warn:this.#i})){o=a;break}a=c.nextNode()}return o??null}_matchSelf(l){const e=[],h=this._matchLeaves(l,this.#e,{warn:this.#i});let c=!1;return h&&(e.push(this.#e),c=!0),[e,c]}_findLineal(l,e={}){const{complex:h}=e,c=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),o=!1;if(a&&(c.push(this.#e),o=!0),!a||h){let r=this.#e.parentNode;for(;r&&(a=this._matchLeaves(l,r,{warn:this.#i}),a&&(c.push(r),o=!0),r.parentNode);)r=r.parentNode}return[c,o]}_findFirst(l){const e=[],h=this._findNode(l,{node:this.#e});let c=!1;return h&&(e.push(h),c=!0),[e,c]}_findFromHTMLCollection(l,e={}){const{complex:h,compound:c,filterLeaves:a,targetType:o}=e;let r=[],b=!1,d=!1;const i=l.length;if(i)if(this.#e.nodeType===n.ELEMENT_NODE)for(let t=0;t<i;t++){const s=l[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(c){if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else if(r.push(s),b=!0,o===E)break}}else if(h)if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else r=[].slice.call(l),b=!0,d=!0;else if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else r=[].slice.call(l),b=!0,d=!0;return[r,b,d]}_findEntryNodes(l,e,h){const{leaves:c}=l,[a,...o]=c,r=o.length>0,{name:b,type:d}=a;let i=[],t=!1,s=!1,f=!1;switch(d){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,{warn:this.#i});break}case n.SELECTOR_ID:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(e===E&&this.#t.nodeType!==n.ELEMENT_NODE){const m=this.#t.getElementById(b);m&&(r?this._matchLeaves(o,m,{warn:this.#i})&&(i.push(m),s=!0):(i.push(m),s=!0))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_CLASS:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#t.nodeType===n.DOCUMENT_NODE){const m=this.#t.getElementsByClassName(b);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_TYPE:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===n.DOCUMENT_NODE&&!/[*|]/.test(b)){const m=this.#t.getElementsByTagName(b);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}default:if(e!==C&&n.REG_SHADOW_HOST.test(b)){if(this.#d&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(a,this.#e);m&&(i.push(m),s=!0)}}else e===R?[i,s]=this._matchSelf(c):e===C?[i,s]=this._findLineal(c,{complex:h}):e===E?[i,s]=this._findFirst(c):f=!0}return{collected:t,compound:r,filtered:s,nodes:i,pending:f}}_collectNodes(l){const e=this.#a.values();if(l===L||l===E){const h=new Set;let c=0;for(const{branch:a}of e){const o=a.length,r=o>1,b=a[0];let d,i;if(r){const{combo:p,leaves:[{name:w,type:k}]}=b,N=a[o-1],{leaves:[{name:A,type:v}]}=N;if(v===n.SELECTOR_PSEUDO_ELEMENT||v===n.SELECTOR_ID)d=S,i=N;else if(k===n.SELECTOR_PSEUDO_ELEMENT||k===n.SELECTOR_ID)d=x,i=b;else if(l===L)if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=N;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=b;else if(o===2){const{name:T}=p;/^[+~]$/.test(T)?(d=S,i=N):(d=x,i=b)}else d=x,i=b;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=b;else if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=N;else{let T;for(const{combo:P,leaves:[U]}of a){const{name:$,type:G}=U;if(G===n.SELECTOR_PSEUDO_CLASS&&$==="dir"){T=!1;break}if(!T&&P){const{name:F}=P;/^[+~]$/.test(F)&&(T=!0)}}T?(d=x,i=b):(d=S,i=N)}}else d=S,i=b;const{collected:t,compound:s,filtered:f,nodes:m,pending:u}=this._findEntryNodes(i,l,r);m.length?(this.#a[c].find=!0,this.#f[c]=m):u&&h.add(new Map([["index",c],["twig",i]])),this.#a[c].collected=t,this.#a[c].dir=d,this.#a[c].filtered=f||!s,c++}if(h.size){let a,o;this.#e!==this.#t&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,o=this.#m):(a=this.#t,o=this.#n);let r=(0,_.traverseNode)(a,o);for(;r;){let b=!1;if(this.#e.nodeType===n.ELEMENT_NODE?r===this.#e?b=!0:b=this.#e.contains(r):b=!0,b)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,r,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#f[s].push(r)}}r!==o.currentNode&&(r=(0,_.traverseNode)(r,o)),r=o.nextNode()}}}else{let h=0;for(const{branch:c}of e){const a=c[c.length-1],o=c.length>1,{compound:r,filtered:b,nodes:d}=this._findEntryNodes(a,l,o);d.length&&(this.#a[h].find=!0,this.#f[h]=d),this.#a[h].dir=S,this.#a[h].filtered=b||!r,h++}}return[this.#a,this.#f]}_getCombinedNodes(l,e,h){const c=[];for(const a of e){const o=this._matchCombinator(l,a,{dir:h,warn:this.#i});o.size&&c.push(...o)}return c.length?new Set(c):new Set}_matchNodeNext(l,e,h){const{combo:c,index:a}=h,{combo:o,leaves:r}=l[a],b={combo:c,leaves:r},d=this._getCombinedNodes(b,e,x);let i;if(d.size)if(a===l.length-1){const[t]=(0,_.sortNodes)(d);i=t}else i=this._matchNodeNext(l,d,{combo:o,index:a+1});return i??null}_matchNodePrev(l,e,h){const{index:c}=h,a=l[c],o=new Set([e]),r=this._getCombinedNodes(a,o,S);let b;if(r.size){if(c===0)b=e;else for(const d of r)if(this._matchNodePrev(l,d,{index:c-1}))return e}return b??null}_find(l){(l===L||l===E)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(l),c=e.length;let a=new Set;for(let o=0;o<c;o++){const{branch:r,collected:b,dir:d,find:i}=e[o],t=r.length;if(t&&i){const s=h[o],f=s.length,m=t-1;if(m===0)if((l===L||l===E)&&this.#e.nodeType===n.ELEMENT_NODE)for(let u=0;u<f;u++){const p=s[u];if(p!==this.#e&&this.#e.contains(p)&&(a.add(p),l!==L))break}else if(l===L)if(a.size){const u=[...a];a=new Set([...u,...s]),this.#u=!0}else a=new Set(s);else{const[u]=s;a.add(u)}else if(l===L)if(d===x){let{combo:u}=r[0];for(const p of s){let w=new Set([p]);for(let k=1;k<t;k++){const{combo:N,leaves:A}=r[k],v={combo:u,leaves:A};if(w=this._getCombinedNodes(v,w,d),w.size)if(k===m)if(a.size){const T=[...a];a=new Set([...T,...w]),this.#u=!0}else a=w;else u=N;else break}}}else for(const u of s){let p=new Set([u]);for(let w=m-1;w>=0;w--){const k=r[w];if(p=this._getCombinedNodes(k,p,d),p.size)w===0&&(a.add(u),t>1&&a.size>1&&(this.#u=!0));else break}}else if(l===E&&d===x){const{combo:u}=r[0];let p;for(const w of s)if(p=this._matchNodeNext(r,new Set([w]),{combo:u,index:1}),p){a.add(p);break}if(!p&&!b){const{leaves:w}=r[0],[k]=s;let N=this._findNode(w,{node:k});for(;N;){if(p=this._matchNodeNext(r,new Set([N]),{combo:u,index:1}),p){a.add(p);break}N=this._findNode(w,{node:N})}}}else{let u;for(const p of s)if(u=this._matchNodePrev(r,p,{index:m-1}),u){a.add(p);break}if(!u&&!b&&l===E){const{leaves:p}=r[m],[w]=s;let k=this._findNode(p,{node:w});for(;k;){if(u=this._matchNodePrev(r,k,{index:m-1}),u){a.add(k);break}k=this._findNode(p,{node:k})}}}}}return a}matches(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.match(l,e)}this._setup(l,e,h),c=this._find(R).size}catch(a){this._onError(a)}return!!c}closest(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.closest(l,e)}this._setup(l,e,h);const o=this._find(C);if(o.size){let r=this.#e;for(;r;){if(o.has(r)){c=r;break}r=r.parentNode}}}catch(a){this._onError(a)}return c??null}querySelector(l,e,h){let c;try{(0,_.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!1}))return this.#h.first(l,e);this._setup(l,e,h);const o=this._find(E);o.delete(this.#e),o.size&&([c]=(0,_.sortNodes)(o))}catch(a){this._onError(a)}return c??null}querySelectorAll(l,e,h){let c;try{(0,_.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!0,qsa:!0}))return this.#h.select(l,e);this._setup(l,e,h);const o=this._find(L);o.delete(this.#e),o.size&&(this.#u?c=(0,_.sortNodes)(o):c=[...o])}catch(a){this._onError(a)}return c??[]}}0&&(module.exports={Finder});
var z=Object.create;var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(g,l)=>{for(var e in l)M(g,e,{get:l[e],enumerable:!0})},P=(g,l,e,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of W(l))!j.call(g,c)&&c!==e&&M(g,c,{get:()=>l[c],enumerable:!(h=H(l,c))||h.enumerable});return g};var Y=(g,l,e)=>(e=g!=null?z(B(g)):{},P(l||!g||!g.__esModule?M(e,"default",{value:g,enumerable:!0}):e,g)),V=g=>P(M({},"__esModule",{value:!0}),g);var K={};q(K,{Finder:()=>X});module.exports=V(K);var I=Y(require("@asamuzakjp/nwsapi"),1),N=require("./dom-util.js"),O=require("./matcher.js"),y=require("./parser.js"),n=require("./constant.js");const x="next",S="prev",L="all",E="first",C="lineal",R="self";class X{#a;#c;#s;#o;#w;#n;#b;#e;#f;#k;#h;#m;#N;#t;#d;#u;#r;#p;#i;#l;constructor(l,e){this.#l=l,this.#n=e??l.document,this.#c=new WeakMap,this.#o=new WeakMap,this.#N=new WeakMap,this.#h=this._initNwsapi(l,e)}_onError(l){if(!this.#k)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===n.NOT_SUPPORTED_ERR)this.#i&&console.warn(l.message);else throw new this.#l.DOMException(l.message,l.name);else throw l}_setup(l,e,h={}){const{event:c,noexcept:a,warn:o}=h;return this.#k=!!a,this.#i=!!o,this.#b=this._setEvent(c),this.#e=e,[this.#s,this.#t,this.#r]=(0,N.resolveContent)(e),this.#d=(0,N.isInShadowTree)(e),[this.#a,this.#f]=this._correspond(l),this.#p=new WeakMap,e}_initNwsapi(){const l=(0,I.default)({DOMException:this.#l.DOMException,document:this.#n});return l.configure({LOGERRORS:!1}),l}_setEvent(l){return l instanceof this.#l.KeyboardEvent||l instanceof this.#l.MouseEvent?l:null}_correspond(l){const e=[];this.#w=!1;let h;if(this.#o.has(this.#s)){const c=this.#o.get(this.#s);if(c&&c.has(`${l}`)){const a=c.get(`${l}`);this.#w=a.descendant,h=a.ast}}if(h){const c=h.length;for(let a=0;a<c;a++)h[a].collected=!1,h[a].dir=null,h[a].filtered=!1,h[a].find=!1,e[a]=[]}else{let c;try{c=(0,y.parseSelector)(l)}catch(f){this._onError(f)}const{branches:a,info:{hasDefinedPseudo:o,hasHasPseudoFunc:r,hasNthChildOfSelector:u,hasPseudoFunc:d}}=(0,y.walkAST)(c);let i;o||r||u&&d?i=!1:i=!0;let t=!1,s=0;h=[];for(const[...f]of a){const m=[];let b=f.shift();if(b&&b.type!==n.COMBINATOR){const p=new Set;for(;b;){if(b.type===n.COMBINATOR){const[w]=f;if(w.type===n.COMBINATOR){const _=`Invalid selector ${l}`;throw new DOMException(_,n.SYNTAX_ERR)}const k=b.name;/^[\s>]$/.test(k)&&(t=!0),m.push({combo:b,leaves:(0,y.sortAST)(p)}),p.clear()}else if(b){let{name:w}=b;w&&typeof w=="string"&&(w=(0,y.unescapeSelector)(w),typeof w=="string"&&w!==b.name&&(b.name=w),/[|:]/.test(w)&&(b.namespace=!0)),p.add(b)}if(f.length)b=f.shift();else{m.push({combo:null,leaves:(0,y.sortAST)(p)}),p.clear();break}}}h.push({branch:m,collected:!1,dir:null,filtered:!1,find:!1}),e[s]=[],s++}if(i){let f;this.#o.has(this.#s)?f=this.#o.get(this.#s):f=new Map,f.set(`${l}`,{ast:h,descendant:t}),this.#o.set(this.#s,f)}this.#w=t}return[h,e]}_createTreeWalker(l){let e;return this.#p.has(l)?e=this.#p.get(l):(e=this.#n.createTreeWalker(l,n.WALKER_FILTER),this.#p.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#u=!1,this.#m}_collectNthChild(l,e,h){const{a:c,b:a,reverse:o,selector:r}=l,{parentNode:u}=e,d=new Set;let i;if(r)if(this.#c.has(r))i=this.#c.get(r);else{const{branches:t}=(0,y.walkAST)(r);i=t,this.#c.set(r,i)}if(u){const t=this.#r;let s=(0,N.traverseNode)(u,t);s=t.firstChild();let f=0;for(;s;)f++,s=t.nextSibling();const m=new Set;if(i)for(s=(0,N.traverseNode)(u,t),s=t.firstChild();s;){const{display:b,visibility:p}=this.#l.getComputedStyle(s);if(b!=="none"&&p!=="hidden"){let w;for(const k of i)if(w=this._matchLeaves(k,s,h),!w)break;w&&m.add(s)}s=t.nextSibling()}if(c===0){if(a>0&&a<=f){if(m.size){s=(0,N.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){if(m.has(s)){if(b===a-1){d.add(s);break}b++}o?s=t.previousSibling():s=t.nextSibling()}}else if(!r){s=(0,N.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){if(b===a-1){d.add(s);break}o?s=t.previousSibling():s=t.nextSibling(),b++}}}}else{let b=a-1;if(c>0)for(;b<0;)b+=c;if(b>=0&&b<f){s=(0,N.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let p=0,w=c>0?0:a-1;for(;s&&(s&&b>=0&&b<f);)m.size?m.has(s)&&(w===b&&(d.add(s),b+=c),c>0?w++:w--):p===b&&(r||d.add(s),b+=c),o?s=t.previousSibling():s=t.nextSibling(),p++}}if(o&&d.size>1){const b=[...d];return new Set(b.reverse())}}else if(e===this.#t&&c+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:h,b:c,reverse:a}=l,{localName:o,parentNode:r,prefix:u}=e,d=new Set;if(r){const i=this.#r;let t=(0,N.traverseNode)(r,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(c>0&&c<=s){t=(0,N.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let f=0;for(;t;){const{localName:m,prefix:b}=t;if(m===o&&b===u){if(f===c-1){d.add(t);break}f++}a?t=i.previousSibling():t=i.nextSibling()}}}else{let f=c-1;if(h>0)for(;f<0;)f+=h;if(f>=0&&f<s){t=(0,N.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let m=h>0?0:c-1;for(;t;){const{localName:b,prefix:p}=t;if(b===o&&p===u){if(m===f&&(d.add(t),f+=h),f<0||f>=s)break;h>0?m++:m--}a?t=i.previousSibling():t=i.nextSibling()}}}if(a&&d.size>1){const f=[...d];return new Set(f.reverse())}}else e===this.#t&&h+c===1&&d.add(e);return d}_matchAnPlusB(l,e,h,c){const{nth:{a,b:o,name:r},selector:u}=l,d=new Map;if(r?(r==="even"?(d.set("a",2),d.set("b",0)):r==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof o=="string"&&/-?\d+/.test(o)?d.set("b",o*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){u&&d.set("selector",u);const i=Object.fromEntries(d);return this._collectNthChild(i,e,c)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(l,e,h={}){let c;if(Array.isArray(l)&&l.length){const a=l.map(s=>s),[o]=a,{type:r}=o;let u;r===n.COMBINATOR?u=a.shift():u={name:" ",type:n.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:f}=s;if(f===n.COMBINATOR)break;d.push(a.shift())}const i={combo:u,leaves:d};h.dir=x;const t=this._matchCombinator(i,e,h);if(t.size)if(a.length){for(const s of t)if(c=this._matchHasPseudoFunc(a,s,h),c)break}else c=!0}return!!c}_matchLogicalPseudoFunc(l,e,h={}){const{astName:c="",branches:a=[],selector:o="",twigBranches:r=[]}=l;let u;if(c==="has")if(o.includes(":has("))u=null;else{let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(u=e)}else{const d=/^(?:is|where)$/.test(c);h.forgive=d;const i=r.length;let t;for(let s=0;s<i;s++){const f=r[s],m=f.length-1,{leaves:b}=f[m];if(t=this._matchLeaves(b,e,h),t&&m>0){let p=new Set([e]);for(let w=m-1;w>=0;w--){const k=f[w],_=[];h.dir=S;for(const A of p){const v=this._matchCombinator(k,A,h);v.size&&_.push(...v)}if(_.length)w===0?t=!0:p=new Set(_);else{t=!1;break}}}if(t)break}c==="not"?t||(u=e):t&&(u=e)}return u??null}_matchPseudoClassSelector(l,e,h={}){const{children:c,name:a}=l,{localName:o,parentNode:r}=e,{forgive:u,warn:d=this.#i}=h,i=new Set;if(n.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#c.has(l))t=this.#c.get(l);else{const{branches:f}=(0,y.walkAST)(l),m=[],b=[];for(const[...p]of f){for(const A of p){const v=(0,y.generateCSS)(A);m.push(v)}const w=[],k=new Set;let _=p.shift();for(;_;)if(_.type===n.COMBINATOR?(w.push({combo:_,leaves:[...k]}),k.clear()):_&&k.add(_),p.length)_=p.shift();else{w.push({combo:null,leaves:[...k]}),k.clear();break}b.push(w)}t={astName:a,branches:f,twigBranches:b,selector:m.join(",")},this.#c.set(l,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(c))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=c;return this._matchAnPlusB(t,e,a,h)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&i.add(t);break}case"state":{if((0,N.isCustomElement)(e)){const[{value:t}]=c;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(!u){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{n.REG_ANCHOR.test(o)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(n.REG_ANCHOR.test(o)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:f}=new URL(this.#s.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===f&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#b??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:f}=this.#b??{};(f==="mousedown"||f==="pointerdown")&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let f=this.#s.getElementById(s);for(;f;){if(f===e){i.add(e);break}f=f.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#d&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#b??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(a==="focus"||s==="keydown"&&e.contains(t))){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#l.getComputedStyle(f);if(m=!(b==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#l.getComputedStyle(f);if(m=!(b==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"open":{n.REG_INTERACT.test(o)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{n.REG_INTERACT.test(o)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(n.REG_FORM_CTRL.test(o)||(0,N.isCustomElement)(e,{formAssociated:!0})){if(e.disabled||e.hasAttribute("disabled"))i.add(e);else if(e.localName==="option")r.localName==="optgroup"&&(r.disabled||r.hasAttribute("disabled"))&&i.add(e);else if(e.localName!=="optgroup"){let t,s=r;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const f=this.#r;let m=(0,N.traverseNode)(s,f);for(m=f.firstChild();m&&m.localName!=="legend";)m=f.nextSibling();m&&m.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===n.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t&&i.add(e)}}break}case"enabled":{if((n.REG_FORM_CTRL.test(o)||(0,N.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled"))){if(e.localName==="option")(r.localName!=="optgroup"||!(r.disabled||r.hasAttribute("disabled")))&&i.add(e);else if(e.localName!=="optgroup"){let t,s=r;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const f=this.#r;let m=(0,N.traverseNode)(s,f);for(m=f.firstChild();m&&m.localName!=="legend";)m=f.nextSibling();m&&m.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===n.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t||i.add(e)}}break}case"read-only":{switch(o){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,N.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(o){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,N.isContentEditable)(e)&&i.add(e)}break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;o==="textarea"?s=e:o==="input"&&(e.hasAttribute("type")?n.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&o==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&o==="input"&&e.type==="checkbox"||o==="progress"&&!e.hasAttribute("value"))i.add(e);else if(o==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#s.documentElement);const f=s.getElementsByTagName("input"),m=f.length;let b;for(let p=0;p<m;p++){const w=f[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(b=!!w.checked):w.hasAttribute("name")||(b=!!w.checked),b))break}b||i.add(e)}break}case"default":{if(o==="button"&&!(e.hasAttribute("type")&&n.REG_TYPE_RESET.test(e.getAttribute("type")))||o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#r;let f=(0,N.traverseNode)(t,s);for(f=s.firstChild();f&&t.contains(f);){const m=f.localName;let b;if(m==="button"?b=!(f.hasAttribute("type")&&n.REG_TYPE_RESET.test(f.getAttribute("type"))):m==="input"&&(b=f.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(f.getAttribute("type"))),b){f===e&&i.add(e);break}f=s.nextNode()}}}else(o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))&&e.hasAttribute("checked")||o==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(o==="fieldset"){const t=this.#r;let s=(0,N.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f&&i.add(e)}break}case"invalid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(o==="fieldset"){const t=this.#r;let s=(0,N.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f||i.add(e)}break}case"in-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#n.createTreeWalker(e,n.SHOW_ALL);let s=t.firstChild(),f;for(;s&&(f=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!f);)s=t.nextSibling();f&&i.add(e)}else i.add(e);break}case"first-child":{(r&&e===r.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(r&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(r&&e===r.firstElementChild&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||o.includes("-")?(0,N.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"autofill":case"blank":case"buffering":case"current":case"fullscreen":case"future":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}}else if(!u){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,n.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(l,e){const{children:h,name:c}=l;let a;if(Array.isArray(h)){const{branches:o}=(0,y.walkAST)(h[0]),[r]=o,[...u]=r,{host:d}=e;if(c==="host"){let i;for(const t of u){const{type:s}=t;if(s===n.COMBINATOR){const m=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(m,n.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(a=e)}else if(c==="host-context"){let i=d,t;for(;i;){for(const s of u){const{type:f}=s;if(f===n.COMBINATOR){const b=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(b,n.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(a=e)}}else if(c==="host")a=e;else{const o=`Invalid selector :${c}`;throw new DOMException(o,n.SYNTAX_ERR)}return a??null}_matchSelector(l,e,h){const{type:c}=l,a=new Set;if(l.name===n.EMPTY)return a;const o=(0,y.unescapeSelector)(l.name);if(typeof o=="string"&&o!==l.name&&(l.name=o),e.nodeType===n.ELEMENT_NODE)switch(c){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(o,h);break}case n.SELECTOR_ID:{e.id===o&&a.add(e);break}case n.SELECTOR_CLASS:{e.classList.contains(o)&&a.add(e);break}case n.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,h);default:{const r=O.matcher.matchSelector(l,e,h);r&&a.add(r)}}else if(this.#d&&c===n.SELECTOR_PSEUDO_CLASS&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(o!=="has"&&n.REG_LOGICAL_PSEUDO.test(o))return this._matchPseudoClassSelector(l,e,h);if(n.REG_SHADOW_HOST.test(o)){const r=this._matchShadowHostPseudoClass(l,e,h);r&&a.add(r)}}return a}_matchLeaves(l,e,h){const{attributes:c,localName:a,nodeType:o}=e;let r=this.#N.get(l),u;if(r&&r.has(e)){const{attr:d,matched:i}=r.get(e);c?.length===d&&(u=i)}if(typeof u!="boolean"){let d;o===n.ELEMENT_NODE&&n.REG_FORM.test(a)?d=!1:d=!0;for(const i of l){const{name:t,type:s}=i;if(s===n.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),u=this._matchSelector(i,e,h).has(e),!u)break}d&&(r||(r=new WeakMap),r.set(e,{attr:c?.length,matched:u}),this.#N.set(l,r))}return!!u}_matchHTMLCollection(l,e={}){const{compound:h,filterLeaves:c}=e,a=new Set,o=l.length;if(o)if(h)for(let r=0;r<o;r++){const u=l[r];this._matchLeaves(c,u,e)&&a.add(u)}else{const r=[].slice.call(l);return new Set(r)}return a}_findDescendantNodes(l,e,h){const[c,...a]=l,o=a.length>0,{type:r}=c,u=(0,y.unescapeSelector)(c.name);typeof u=="string"&&u!==c.name&&(c.name=u);let d=new Set,i=!1;if(this.#d)i=!0;else switch(r){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,h);break}case n.SELECTOR_ID:{if(this.#t.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(u);t&&t!==e&&e.contains(t)&&(o?this._matchLeaves(a,t,h)&&d.add(t):d.add(t))}break}case n.SELECTOR_CLASS:{const t=e.getElementsByClassName(u);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a});break}case n.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(l,e,h={}){const{combo:c,leaves:a}=l,{name:o}=c,{parentNode:r}=e,{dir:u}=h,d=new Set;if(u===x)switch(o){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,N.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,N.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(a,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let f=(0,N.traverseNode)(e,s);for(f=s.nextNode();f&&e.contains(f);)this._matchLeaves(a,f,h)&&d.add(f),f=s.nextNode()}}}else switch(o){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,N.traverseNode)(r,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{r&&this._matchLeaves(a,r,h)&&d.add(r);break}case" ":default:{const i=[];let t=r;for(;t;)this._matchLeaves(a,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(l,e){const{node:h}=e,c=this.#m;let a=(0,N.traverseNode)(h,c),o;if(a)for((a.nodeType!==n.ELEMENT_NODE||a===h&&a!==this.#t)&&(a=c.nextNode());a;){if(this._matchLeaves(l,a,{warn:this.#i})){o=a;break}a=c.nextNode()}return o??null}_matchSelf(l){const e=[],h=this._matchLeaves(l,this.#e,{warn:this.#i});let c=!1;return h&&(e.push(this.#e),c=!0),[e,c]}_findLineal(l,e={}){const{complex:h}=e,c=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),o=!1;if(a&&(c.push(this.#e),o=!0),!a||h){let r=this.#e.parentNode;for(;r&&(a=this._matchLeaves(l,r,{warn:this.#i}),a&&(c.push(r),o=!0),r.parentNode);)r=r.parentNode}return[c,o]}_findFirst(l){const e=[],h=this._findNode(l,{node:this.#e});let c=!1;return h&&(e.push(h),c=!0),[e,c]}_findFromHTMLCollection(l,e={}){const{complex:h,compound:c,filterLeaves:a,targetType:o}=e;let r=[],u=!1,d=!1;const i=l.length;if(i)if(this.#e.nodeType===n.ELEMENT_NODE)for(let t=0;t<i;t++){const s=l[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(c){if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else if(r.push(s),u=!0,o===E)break}}else if(h)if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else r=[].slice.call(l),u=!0,d=!0;else if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else r=[].slice.call(l),u=!0,d=!0;return[r,u,d]}_findEntryNodes(l,e,h){const{leaves:c}=l,[a,...o]=c,r=o.length>0,{name:u,type:d}=a;let i=[],t=!1,s=!1,f=!1;switch(d){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,{warn:this.#i});break}case n.SELECTOR_ID:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(e===E&&this.#t.nodeType!==n.ELEMENT_NODE){const m=this.#t.getElementById(u);m&&(r?this._matchLeaves(o,m,{warn:this.#i})&&(i.push(m),s=!0):(i.push(m),s=!0))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_CLASS:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#t.nodeType===n.DOCUMENT_NODE){const m=this.#t.getElementsByClassName(u);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_TYPE:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===n.DOCUMENT_NODE&&!/[*|]/.test(u)){const m=this.#t.getElementsByTagName(u);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}default:if(e!==C&&n.REG_SHADOW_HOST.test(u)){if(this.#d&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(a,this.#e);m&&(i.push(m),s=!0)}}else e===R?[i,s]=this._matchSelf(c):e===C?[i,s]=this._findLineal(c,{complex:h}):e===E?[i,s]=this._findFirst(c):f=!0}return{collected:t,compound:r,filtered:s,nodes:i,pending:f}}_collectNodes(l){const e=this.#a.values();if(l===L||l===E){const h=new Set;let c=0;for(const{branch:a}of e){const o=a.length,r=o>1,u=a[0];let d,i;if(r){const{combo:p,leaves:[{name:w,type:k}]}=u,_=a[o-1],{leaves:[{name:A,type:v}]}=_;if(v===n.SELECTOR_PSEUDO_ELEMENT||v===n.SELECTOR_ID)d=S,i=_;else if(k===n.SELECTOR_PSEUDO_ELEMENT||k===n.SELECTOR_ID)d=x,i=u;else if(l===L)if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=_;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=u;else if(o===2){const{name:T}=p;/^[+~]$/.test(T)?(d=S,i=_):(d=x,i=u)}else d=x,i=u;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=u;else if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=_;else{let T;for(const{combo:D,leaves:[U]}of a){const{name:$,type:F}=U;if(F===n.SELECTOR_PSEUDO_CLASS&&$==="dir"){T=!1;break}if(!T&&D){const{name:G}=D;/^[+~]$/.test(G)&&(T=!0)}}T?(d=x,i=u):(d=S,i=_)}}else d=S,i=u;const{collected:t,compound:s,filtered:f,nodes:m,pending:b}=this._findEntryNodes(i,l,r);m.length?(this.#a[c].find=!0,this.#f[c]=m):b&&h.add(new Map([["index",c],["twig",i]])),this.#a[c].collected=t,this.#a[c].dir=d,this.#a[c].filtered=f||!s,c++}if(h.size){let a,o;this.#e!==this.#t&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,o=this.#m):(a=this.#t,o=this.#r);let r=(0,N.traverseNode)(a,o);for(;r;){let u=!1;if(this.#e.nodeType===n.ELEMENT_NODE?r===this.#e?u=!0:u=this.#e.contains(r):u=!0,u)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,r,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#f[s].push(r)}}r!==o.currentNode&&(r=(0,N.traverseNode)(r,o)),r=o.nextNode()}}}else{let h=0;for(const{branch:c}of e){const a=c[c.length-1],o=c.length>1,{compound:r,filtered:u,nodes:d}=this._findEntryNodes(a,l,o);d.length&&(this.#a[h].find=!0,this.#f[h]=d),this.#a[h].dir=S,this.#a[h].filtered=u||!r,h++}}return[this.#a,this.#f]}_getCombinedNodes(l,e,h){const c=[];for(const a of e){const o=this._matchCombinator(l,a,{dir:h,warn:this.#i});o.size&&c.push(...o)}return c.length?new Set(c):new Set}_matchNodeNext(l,e,h){const{combo:c,index:a}=h,{combo:o,leaves:r}=l[a],u={combo:c,leaves:r},d=this._getCombinedNodes(u,e,x);let i;if(d.size)if(a===l.length-1){const[t]=(0,N.sortNodes)(d);i=t}else i=this._matchNodeNext(l,d,{combo:o,index:a+1});return i??null}_matchNodePrev(l,e,h){const{index:c}=h,a=l[c],o=new Set([e]),r=this._getCombinedNodes(a,o,S);let u;if(r.size){if(c===0)u=e;else for(const d of r)if(this._matchNodePrev(l,d,{index:c-1}))return e}return u??null}_find(l){(l===L||l===E)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(l),c=e.length;let a=new Set;for(let o=0;o<c;o++){const{branch:r,collected:u,dir:d,find:i}=e[o],t=r.length;if(t&&i){const s=h[o],f=s.length,m=t-1;if(m===0)if((l===L||l===E)&&this.#e.nodeType===n.ELEMENT_NODE)for(let b=0;b<f;b++){const p=s[b];if(p!==this.#e&&this.#e.contains(p)&&(a.add(p),l!==L))break}else if(l===L)if(a.size){const b=[...a];a=new Set([...b,...s]),this.#u=!0}else a=new Set(s);else{const[b]=s;a.add(b)}else if(l===L)if(d===x){let{combo:b}=r[0];for(const p of s){let w=new Set([p]);for(let k=1;k<t;k++){const{combo:_,leaves:A}=r[k],v={combo:b,leaves:A};if(w=this._getCombinedNodes(v,w,d),w.size)if(k===m)if(a.size){const T=[...a];a=new Set([...T,...w]),this.#u=!0}else a=w;else b=_;else break}}}else for(const b of s){let p=new Set([b]);for(let w=m-1;w>=0;w--){const k=r[w];if(p=this._getCombinedNodes(k,p,d),p.size)w===0&&(a.add(b),t>1&&a.size>1&&(this.#u=!0));else break}}else if(l===E&&d===x){const{combo:b}=r[0];let p;for(const w of s)if(p=this._matchNodeNext(r,new Set([w]),{combo:b,index:1}),p){a.add(p);break}if(!p&&!u){const{leaves:w}=r[0],[k]=s;let _=this._findNode(w,{node:k});for(;_;){if(p=this._matchNodeNext(r,new Set([_]),{combo:b,index:1}),p){a.add(p);break}_=this._findNode(w,{node:_})}}}else{let b;for(const p of s)if(b=this._matchNodePrev(r,p,{index:m-1}),b){a.add(p);break}if(!b&&!u&&l===E){const{leaves:p}=r[m],[w]=s;let k=this._findNode(p,{node:w});for(;k;){if(b=this._matchNodePrev(r,k,{index:m-1}),b){a.add(k);break}k=this._findNode(p,{node:k})}}}}}return a}matches(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#n&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.match(l,e)}this._setup(l,e,h),c=this._find(R).size}catch(a){this._onError(a)}return!!c}closest(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#n&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.closest(l,e)}this._setup(l,e,h);const o=this._find(C);if(o.size){let r=this.#e;for(;r;){if(o.has(r)){c=r;break}r=r.parentNode}}}catch(a){this._onError(a)}return c??null}querySelector(l,e,h){let c;try{(0,N.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#n&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!1}))return this.#h.first(l,e);this._setup(l,e,h);const o=this._find(E);o.delete(this.#e),o.size&&([c]=(0,N.sortNodes)(o))}catch(a){this._onError(a)}return c??null}querySelectorAll(l,e,h){let c;try{(0,N.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#n&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!0,qsa:!0}))return this.#h.select(l,e);this._setup(l,e,h);const o=this._find(L);o.delete(this.#e),o.size&&(this.#u?c=(0,N.sortNodes)(o):c=[...o])}catch(a){this._onError(a)}return c??[]}}0&&(module.exports={Finder});
//# sourceMappingURL=finder.js.map

@@ -1,3 +0,3 @@

var d=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var I=(s,t)=>{for(var r in t)d(s,r,{get:t[r],enumerable:!0})},L=(s,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!S.call(s,n)&&n!==r&&d(s,n,{get:()=>t[n],enumerable:!(i=_(t,n))||i.enumerable});return s};var T=s=>L(d({},"__esModule",{value:!0}),s);var A={};I(A,{filterSelector:()=>C,generateCSS:()=>O.generate,parseAstName:()=>w,parseSelector:()=>E,preprocess:()=>g,sortAST:()=>m,unescapeSelector:()=>y,walkAST:()=>$});module.exports=T(A);var h=require("css-tree"),e=require("./constant.js"),O=require("css-tree");const y=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const t=s.split("\\"),r=t.length;for(let i=1;i<r;i++){let n=t[i];if(n===""&&i===r-1)n=e.U_FFFD;else{const f=e.REG_HEX.exec(n);if(f){const[,a]=f;let l;try{const o=parseInt("D800",e.HEX),p=parseInt("DFFF",e.HEX),u=parseInt(a,e.HEX);u===0||u>=o&&u<=p?l=e.U_FFFD:l=String.fromCodePoint(u)}catch{l=e.U_FFFD}let c="";n.length>a.length&&(c=n.substring(a.length)),n=`${l}${c}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}t[i]=n}s=t.join("")}return s},g=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[t]=s;if(typeof t=="string"){let r=0;for(;r>=0&&(r=t.indexOf("#",r),!(r<0));){const i=t.substring(0,r+1);let n=t.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);const f=n.codePointAt(0);if(f===e.BIT_HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR)}else if(f>e.BIT_FFFF){const a=`\\${f.toString(e.HEX)} `;n.length===e.DUO?n=a:n=`${a}${n.substring(e.DUO)}`}t=`${i}${n}`,r++}t=t.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,e.U_FFFD)}else if(t==null)t=Object.prototype.toString.call(t).slice(e.TYPE_FROM,e.TYPE_TO).toLowerCase();else if(Array.isArray(t))t=t.join(",");else if(Object.prototype.hasOwnProperty.call(t,"toString"))t=t.toString();else throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);return t},E=s=>{if(s=g(s),e.REG_INVALID_SELECTOR.test(s))throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);let t;try{const r=(0,h.parse)(s,{context:"selectorList",parseCustomProperty:!0});t=(0,h.toPlainObject)(r)}catch(r){const{message:i}=r;if(i==="Identifier is expected"&&e.REG_LANG_QUOTED.test(s)){const[,n,f]=e.REG_LANG_QUOTED.exec(s),a=f.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let l=n.replace(f,a);l===":lang()"&&(l=`:lang(${e.EMPTY})`),t=E(s.replace(n,l))}else if(/^(?:Identifier|Selector) is expected$/.test(i)&&e.REG_LOGICAL_EMPTY.test(s)){const[,n,f]=e.REG_LOGICAL_EMPTY.exec(s);t=E(s.replace(n,`:${f}(${e.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(i)&&!s.endsWith("]")){const n=s.lastIndexOf("["),f=s.substring(n);f.includes('"')?f.match(/"/g).length%2?t=E(`${s}"]`):t=E(`${s}]`):t=E(`${s}]`)}else if(i==='")" is expected'&&!s.endsWith(")"))t=E(`${s})`);else throw new DOMException(i,e.SYNTAX_ERR)}return t},$=(s={})=>{const t=new Set,r=new Map;return(0,h.walk)(s,{enter:n=>{n.type===e.SELECTOR?t.add(n.children):n.type===e.SELECTOR_PSEUDO_CLASS?(r.set("hasPseudo",!0),e.REG_LOGICAL_PSEUDO.test(n.name)&&(r.set("hasPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0))):n.type===e.SELECTOR_PSEUDO_ELEMENT?(r.set("hasPseudo",!0),e.REG_SHADOW_PSEUDO.test(n.name)&&r.set("hasPseudoFunc",!0)):n.type===e.SELECTOR_ATTR&&n.matcher==="|="?r.set("hasHyphenSepAttr",!0):n.type===e.NTH&&n.selector&&r.set("hasNthChildOfSelector",!0)}}),r.get("hasPseudoFunc")&&(0,h.findAll)(s,(n,f,a)=>{if(a){if(n.type===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)for(const{children:p}of o)t.has(p)&&t.delete(p)}else if(n.type===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)t.has(o)&&t.delete(o)}else if(n.type===e.NTH&&n.selector){const l=a.filter(c=>{const{selector:o,type:p}=c;return p===e.NTH&&o});for(const{selector:c}of l){const{children:o}=c;for(const{children:p}of o)t.has(p)&&t.delete(p)}}}}),{branches:[...t],info:Object.fromEntries(r)}},m=s=>{const t=[...s];if(t.length>1){const r=new Map([[e.SELECTOR_PSEUDO_ELEMENT,e.BIT_01],[e.SELECTOR_ID,e.BIT_02],[e.SELECTOR_CLASS,e.BIT_04],[e.SELECTOR_TYPE,e.BIT_08],[e.SELECTOR_ATTR,e.BIT_16],[e.SELECTOR_PSEUDO_CLASS,e.BIT_32]]);t.sort((i,n)=>{const{type:f}=i,{type:a}=n,l=r.get(f),c=r.get(a);let o;return l===c?o=0:l>c?o=1:o=-1,o})}return t},w=s=>{let t,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[t,r]=s.split("|"):(t="*",r=s);else throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);return{prefix:t,localName:r}},C=(s,t={})=>{if(!s||typeof s!="string")return!1;if(s.includes("[")){const r=s.lastIndexOf("[");if(s.substring(r).lastIndexOf("]")<0)return!1}if(/\||::|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]/.test(s))return!1;if(s.includes(":")){let r;if(e.REG_LOGICAL_KEY.test(s)){if(e.REG_LOGICAL_EMPTY.test(s))return!1;const{complex:i,descendant:n,qsa:f}=t;i&&n||f?r=e.REG_LOGICAL_COMPLEX:r=e.REG_LOGICAL_COMPOUND}else r=e.REG_CHILD_INDEXED;if(r.test(s))return!1}return!0};0&&(module.exports={filterSelector,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
var h=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var I=(s,t)=>{for(var r in t)h(s,r,{get:t[r],enumerable:!0})},L=(s,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!S.call(s,n)&&n!==r&&h(s,n,{get:()=>t[n],enumerable:!(i=_(t,n))||i.enumerable});return s};var T=s=>L(h({},"__esModule",{value:!0}),s);var D={};I(D,{filterSelector:()=>C,generateCSS:()=>O.generate,parseAstName:()=>w,parseSelector:()=>u,preprocess:()=>g,sortAST:()=>y,unescapeSelector:()=>$,walkAST:()=>m});module.exports=T(D);var d=require("css-tree"),e=require("./constant.js"),O=require("css-tree");const $=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const t=s.split("\\"),r=t.length;for(let i=1;i<r;i++){let n=t[i];if(n===""&&i===r-1)n=e.U_FFFD;else{const f=e.REG_HEX.exec(n);if(f){const[,a]=f;let l;try{const o=parseInt("D800",e.HEX),p=parseInt("DFFF",e.HEX),E=parseInt(a,e.HEX);E===0||E>=o&&E<=p?l=e.U_FFFD:l=String.fromCodePoint(E)}catch{l=e.U_FFFD}let c="";n.length>a.length&&(c=n.substring(a.length)),n=`${l}${c}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}t[i]=n}s=t.join("")}return s},g=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[t]=s;if(typeof t=="string"){let r=0;for(;r>=0&&(r=t.indexOf("#",r),!(r<0));){const i=t.substring(0,r+1);let n=t.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);const f=n.codePointAt(0);if(f===e.BIT_HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR)}else if(f>e.BIT_FFFF){const a=`\\${f.toString(e.HEX)} `;n.length===e.DUO?n=a:n=`${a}${n.substring(e.DUO)}`}t=`${i}${n}`,r++}t=t.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,e.U_FFFD)}else if(t==null)t=Object.prototype.toString.call(t).slice(e.TYPE_FROM,e.TYPE_TO).toLowerCase();else if(Array.isArray(t))t=t.join(",");else if(Object.prototype.hasOwnProperty.call(t,"toString"))t=t.toString();else throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);return t},u=s=>{if(s=g(s),e.REG_INVALID_SELECTOR.test(s))throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);let t;try{const r=(0,d.parse)(s,{context:"selectorList",parseCustomProperty:!0});t=(0,d.toPlainObject)(r)}catch(r){const{message:i}=r;if(i==="Identifier is expected"&&e.REG_LANG_QUOTED.test(s)){const[,n,f]=e.REG_LANG_QUOTED.exec(s),a=f.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let l=n.replace(f,a);l===":lang()"&&(l=`:lang(${e.EMPTY})`),t=u(s.replace(n,l))}else if(/^(?:Identifier|Selector) is expected$/.test(i)&&e.REG_LOGICAL_EMPTY.test(s)){const[,n,f]=e.REG_LOGICAL_EMPTY.exec(s);t=u(s.replace(n,`:${f}(${e.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(i)&&!s.endsWith("]")){const n=s.lastIndexOf("["),f=s.substring(n);f.includes('"')?f.match(/"/g).length%2?t=u(`${s}"]`):t=u(`${s}]`):t=u(`${s}]`)}else if(i==='")" is expected'&&!s.endsWith(")"))t=u(`${s})`);else throw new DOMException(i,e.SYNTAX_ERR)}return t},m=(s={})=>{const t=new Set,r=new Map;return(0,d.walk)(s,{enter:n=>{n.type===e.SELECTOR?t.add(n.children):n.type===e.SELECTOR_PSEUDO_CLASS?e.REG_LOGICAL_PSEUDO.test(n.name)?(r.set("hasPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0)):n.name==="defined"&&r.set("hasDefinedPseudo",!0):n.type===e.SELECTOR_PSEUDO_ELEMENT?e.REG_SHADOW_PSEUDO.test(n.name)&&r.set("hasPseudoFunc",!0):n.type===e.NTH&&n.selector&&r.set("hasNthChildOfSelector",!0)}}),r.get("hasPseudoFunc")&&(0,d.findAll)(s,(n,f,a)=>{if(a){if(n.type===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)for(const{children:p}of o)t.has(p)&&t.delete(p)}else if(n.type===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)t.has(o)&&t.delete(o)}else if(n.type===e.NTH&&n.selector){const l=a.filter(c=>{const{selector:o,type:p}=c;return p===e.NTH&&o});for(const{selector:c}of l){const{children:o}=c;for(const{children:p}of o)t.has(p)&&t.delete(p)}}}}),{branches:[...t],info:Object.fromEntries(r)}},y=s=>{const t=[...s];if(t.length>1){const r=new Map([[e.SELECTOR_PSEUDO_ELEMENT,e.BIT_01],[e.SELECTOR_ID,e.BIT_02],[e.SELECTOR_CLASS,e.BIT_04],[e.SELECTOR_TYPE,e.BIT_08],[e.SELECTOR_ATTR,e.BIT_16],[e.SELECTOR_PSEUDO_CLASS,e.BIT_32]]);t.sort((i,n)=>{const{type:f}=i,{type:a}=n,l=r.get(f),c=r.get(a);let o;return l===c?o=0:l>c?o=1:o=-1,o})}return t},w=s=>{let t,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[t,r]=s.split("|"):(t="*",r=s);else throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);return{prefix:t,localName:r}},C=(s,t={})=>{if(!s||typeof s!="string")return!1;if(s.includes("[")){const r=s.lastIndexOf("[");if(s.substring(r).lastIndexOf("]")<0)return!1}if(/\||::|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]/.test(s))return!1;if(s.includes(":")){let r;if(e.REG_LOGICAL_KEY.test(s)){if(e.REG_LOGICAL_EMPTY.test(s))return!1;const{complex:i,descendant:n,qsa:f}=t;i&&n||f?r=e.REG_LOGICAL_COMPLEX:r=e.REG_LOGICAL_COMPOUND}else r=e.REG_CHILD_INDEXED;if(r.test(s))return!1}return!0};0&&(module.exports={filterSelector,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
//# sourceMappingURL=parser.js.map

@@ -41,3 +41,3 @@ {

"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-jsdoc": "^48.8.1",
"eslint-plugin-regexp": "^2.6.0",

@@ -64,3 +64,3 @@ "eslint-plugin-unicorn": "^54.0.0",

},
"version": "4.6.3"
"version": "4.6.4"
}

@@ -98,6 +98,5 @@ /**

export const REG_DIR = /^(?:ltr|rtl)$/;
export const REG_FORM = /^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/;
export const REG_FORM = /^(?:button|fieldset|form|input|select|textarea)$/;
export const REG_FORM_CTRL =
/^(?:button|fieldset|input|optgroup|option|select|textarea)$/;
export const REG_FORM_GROUP = /^(?:fieldset|optgroup|select)$/;
export const REG_FORM_VALID = /^(?:button|form|input|select|textarea)$/;

@@ -104,0 +103,0 @@ export const REG_HEX = /^([\da-f]{1,6}\s?)/i;

@@ -193,3 +193,2 @@ /**

} else if (node.type === SELECTOR_PSEUDO_CLASS) {
info.set('hasPseudo', true);
if (REG_LOGICAL_PSEUDO.test(node.name)) {

@@ -200,10 +199,9 @@ info.set('hasPseudoFunc', true);

}
} else if (node.name === 'defined') {
info.set('hasDefinedPseudo', true);
}
} else if (node.type === SELECTOR_PSEUDO_ELEMENT) {
info.set('hasPseudo', true);
if (REG_SHADOW_PSEUDO.test(node.name)) {
info.set('hasPseudoFunc', true);
}
} else if (node.type === SELECTOR_ATTR && node.matcher === '|=') {
info.set('hasHyphenSepAttr', true);
} else if (node.type === NTH && node.selector) {

@@ -210,0 +208,0 @@ info.set('hasNthChildOfSelector', true);

@@ -71,3 +71,2 @@ export const AN_PLUS_B: "AnPlusB";

export const REG_FORM_CTRL: RegExp;
export const REG_FORM_GROUP: RegExp;
export const REG_FORM_VALID: RegExp;

@@ -74,0 +73,0 @@ export const REG_HEX: RegExp;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc