@asamuzakjp/dom-selector 4.4.2 → 4.4.3

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.
@@ -1,2 +1,2 @@
1
- var O=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var H=(s,t)=>{for(var c in t)O(s,c,{get:t[c],enumerable:!0})},f=(s,t,c,P)=>{if(t&&typeof t=="object"||typeof t=="function")for(let E of u(t))!Y.call(s,E)&&E!==c&&O(s,E,{get:()=>t[E],enumerable:!(P=d(t,E))||P.enumerable});return s};var m=s=>f(O({},"__esModule",{value:!0}),s);var vt={};H(vt,{ALPHA_NUM:()=>$,ANB:()=>M,AN_PLUS_B:()=>w,BIT_01:()=>ot,BIT_02:()=>et,BIT_04:()=>st,BIT_08:()=>rt,BIT_16:()=>Et,BIT_32:()=>nt,BIT_FFFF:()=>_t,BIT_HYPHEN:()=>xt,COMBINATOR:()=>X,COMBO_A:()=>R,COMBO_B:()=>S,COMPLEX_A:()=>C,COMPLEX_B:()=>A,COMPLEX_C:()=>N,COMPLEX_D:()=>D,COMPOUND_A:()=>r,COMPOUND_B:()=>T,COMPOUND_C:()=>L,COMPOUND_D:()=>I,DIGIT:()=>p,DOCUMENT_FRAGMENT_NODE:()=>Lt,DOCUMENT_NODE:()=>Ct,DOCUMENT_POSITION_CONTAINED_BY:()=>At,DOCUMENT_POSITION_CONTAINS:()=>St,DOCUMENT_POSITION_PRECEDING:()=>Nt,DUO:()=>ct,ELEMENT_NODE:()=>Tt,EMPTY:()=>h,HEX:()=>pt,IDENTIFIER:()=>g,LANG_PART:()=>G,LOGICAL_COMPLEX_A:()=>U,LOGICAL_COMPLEX_B:()=>F,LOGICAL_COMPOUND:()=>a,LOGICAL_KEY:()=>e,NESTED_LOGICAL_A:()=>l,NESTED_LOGICAL_B:()=>i,NESTED_LOGICAL_C:()=>B,NOT_SUPPORTED_ERR:()=>b,NTH:()=>W,N_ST:()=>n,N_TH:()=>_,RAW:()=>y,REG_ANCHOR:()=>lt,REG_CHILD_INDEXED:()=>at,REG_DIR:()=>it,REG_FORM:()=>Ut,REG_FORM_CTRL:()=>Bt,REG_FORM_VALID:()=>Ft,REG_INTERACT:()=>dt,REG_LANG:()=>ut,REG_LOGICAL_COMPLEX_A:()=>Yt,REG_LOGICAL_COMPLEX_B:()=>Ht,REG_LOGICAL_COMPOUND:()=>ft,REG_LOGICAL_KEY:()=>mt,REG_LOGICAL_PSEUDO:()=>wt,REG_SHADOW_HOST:()=>Xt,REG_SHADOW_MODE:()=>ht,REG_SHADOW_PSEUDO:()=>gt,REG_TYPE_CHECK:()=>bt,REG_TYPE_DATE:()=>Wt,REG_TYPE_RANGE:()=>yt,REG_TYPE_RESET:()=>Kt,REG_TYPE_SUBMIT:()=>kt,REG_TYPE_TEXT:()=>Zt,SELECTOR:()=>K,SELECTOR_ATTR:()=>k,SELECTOR_CLASS:()=>Z,SELECTOR_ID:()=>v,SELECTOR_LIST:()=>z,SELECTOR_PSEUDO_CLASS:()=>V,SELECTOR_PSEUDO_ELEMENT:()=>j,SELECTOR_TYPE:()=>q,SHOW_ALL:()=>It,SHOW_DOCUMENT:()=>Dt,SHOW_DOCUMENT_FRAGMENT:()=>Pt,SHOW_ELEMENT:()=>Gt,STRING:()=>J,SUB_TYPE:()=>x,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>o,TEXT_NODE:()=>Rt,TYPE_FROM:()=>Ot,TYPE_TO:()=>$t,U_FFFD:()=>tt,WALKER_FILTER:()=>Mt});module.exports=m(vt);const w="AnPlusB",X="Combinator",h="__EMPTY__",g="Identifier",b="NotSupportedError",W="Nth",y="Raw",K="Selector",k="AttributeSelector",Z="ClassSelector",v="IdSelector",z="SelectorList",V="PseudoClassSelector",j="PseudoElementSelector",q="TypeSelector",J="String",Q="SyntaxError",tt="\uFFFD",ot=1,et=2,st=4,rt=8,Et=16,nt=32,_t=65535,xt=45,ct=2,pt=16,Ot=8,$t=-1,Tt=1,Rt=3,Ct=9,Lt=11,Nt=2,St=8,At=16,It=4294967295,Dt=256,Pt=1024,Gt=1,Mt=1281,$="[A-Z\\d]+",G=`(?:-${$})*`,n="(?:first|last|only)-(?:child|of-type)",p="(?:0|[1-9]\\d*)",M=`[+-]?(?:${p}n?|n)|(?:[+-]?${p})?n\\s*[+-]\\s*${p}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${M})\\s*\\)`,e="(?:is|not|where)",x="\\[[^\\]]+\\]|[#.:][\\w-]+",o="\\*|[A-Za-z][\\w-]*",r=`(?:${o}|(?:${o})?(?:${x})+)`,l=`:${e}\\(\\s*${r}(?:\\s*,\\s*${r})*\\s*\\)`,T=`(?:${o}|(?:${o})?(?:${x}|${l})+)`,a=`${e}\\(\\s*${T}(?:\\s*,\\s*${T})*\\s*\\)`,R="\\s?[\\s>~+]\\s?",C=`${r}(?:${R}${r})*`,i=`:${e}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,L=`(?:${o}|(?:${o})?(?:${x}|${i})+)`,N=`${L}(?:${R}${L})*`,U=`${e}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,S="\\s?[~+]\\s?",A=`${r}(?:${S}${r})*`,B=`:${e}\\(\\s*${A}(?:\\s*,\\s*${A})*\\s*\\)`,I=`(?:${o}|(?:${o})?(?:${x}|${B})+)`,D=`${I}(?:${S}${I})*`,F=`${e}\\(\\s*${D}(?:\\s*,\\s*${D})*\\s*\\)`,lt=/^a(?:rea)?$/,at=new RegExp(`:(?!${n}|${_})`),it=/^(?:ltr|rtl)$/,Ut=/^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/,Bt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ft=/^(?:button|form|input|select|textarea)$/,dt=/^(?:details|dialog)$/,ut=new RegExp(`^(?:\\*-)?${$}${G}$`,"i"),Yt=new RegExp(`:(?!${n}|${_}|${U})`),Ht=new RegExp(`:(?!${n}|${_}|${F})`),ft=new RegExp(`:(?!${n}|${_}|${a})`),mt=new RegExp(`:${e}\\(`),wt=/^(?:has|is|not|where)$/,Xt=/^host(?:-context)?$/,ht=/^(?:close|open)$/,gt=/^part|slotted$/,bt=/^(?:checkbox|radio)$/,Wt=/^(?:date(?:time-local)?|month|time|week)$/,yt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Kt=/^(?:button|reset)$/,kt=/^(?: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,COMBINATOR,COMBO_A,COMBO_B,COMPLEX_A,COMPLEX_B,COMPLEX_C,COMPLEX_D,COMPOUND_A,COMPOUND_B,COMPOUND_C,COMPOUND_D,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_A,LOGICAL_COMPLEX_B,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NESTED_LOGICAL_C,NOT_SUPPORTED_ERR,NTH,N_ST,N_TH,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_VALID,REG_INTERACT,REG_LANG,REG_LOGICAL_COMPLEX_A,REG_LOGICAL_COMPLEX_B,REG_LOGICAL_COMPOUND,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,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
1
+ var T=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var f=(s,t)=>{for(var p in t)T(s,p,{get:t[p],enumerable:!0})},X=(s,t,p,M)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of w(t))!H.call(s,n)&&n!==p&&T(s,n,{get:()=>t[n],enumerable:!(M=u(t,n))||M.enumerable});return s};var m=s=>X(T({},"__esModule",{value:!0}),s);var oo={};f(oo,{ALPHA_NUM:()=>R,ANB:()=>a,AN_PLUS_B:()=>g,BIT_01:()=>st,BIT_02:()=>Et,BIT_04:()=>rt,BIT_08:()=>nt,BIT_16:()=>_t,BIT_32:()=>xt,BIT_FFFF:()=>pt,BIT_HYPHEN:()=>ct,COMBINATOR:()=>h,COMBO_A:()=>O,COMBO_B:()=>$,COMPLEX_A:()=>L,COMPLEX_B:()=>A,COMPLEX_C:()=>P,COMPLEX_D:()=>D,COMPOUND:()=>E,COMPOUND_A:()=>N,COMPOUND_B:()=>G,COMPOUND_C:()=>I,COMPOUND_I:()=>S,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>Nt,DOCUMENT_NODE:()=>At,DOCUMENT_POSITION_CONTAINED_BY:()=>St,DOCUMENT_POSITION_CONTAINS:()=>It,DOCUMENT_POSITION_PRECEDING:()=>Gt,DUO:()=>Ot,ELEMENT_NODE:()=>Ct,EMPTY:()=>b,HEX:()=>$t,IDENTIFIER:()=>W,LANG_PART:()=>l,LOGICAL_COMPLEX_A:()=>d,LOGICAL_COMPLEX_B:()=>F,LOGICAL_COMPOUND:()=>Y,LOGICAL_KEY:()=>e,NESTED_LOGICAL_A:()=>i,NESTED_LOGICAL_B:()=>U,NESTED_LOGICAL_C:()=>B,NOT_SUPPORTED_ERR:()=>y,NTH:()=>K,N_ST:()=>_,N_TH:()=>x,RAW:()=>Z,REG_ANCHOR:()=>it,REG_CHILD_INDEXED:()=>Ut,REG_COMPLEX_A:()=>Bt,REG_COMPLEX_B:()=>dt,REG_DIR:()=>Ft,REG_FORM:()=>Yt,REG_FORM_CTRL:()=>ut,REG_FORM_VALID:()=>wt,REG_HEX:()=>Ht,REG_INTERACT:()=>ft,REG_INVALID_SELECTOR:()=>Xt,REG_LANG:()=>mt,REG_LANG_QUOTED:()=>gt,REG_LOGICAL_COMPLEX_A:()=>ht,REG_LOGICAL_COMPLEX_B:()=>bt,REG_LOGICAL_COMPOUND:()=>Wt,REG_LOGICAL_EMPTY:()=>yt,REG_LOGICAL_KEY:()=>Kt,REG_LOGICAL_PSEUDO:()=>Zt,REG_SHADOW_HOST:()=>kt,REG_SHADOW_MODE:()=>zt,REG_SHADOW_PSEUDO:()=>Vt,REG_TYPE_CHECK:()=>vt,REG_TYPE_DATE:()=>Qt,REG_TYPE_RANGE:()=>jt,REG_TYPE_RESET:()=>qt,REG_TYPE_SUBMIT:()=>Jt,REG_TYPE_TEXT:()=>to,SELECTOR:()=>k,SELECTOR_ATTR:()=>z,SELECTOR_CLASS:()=>V,SELECTOR_ID:()=>v,SELECTOR_LIST:()=>Q,SELECTOR_PSEUDO_CLASS:()=>j,SELECTOR_PSEUDO_ELEMENT:()=>q,SELECTOR_TYPE:()=>J,SHOW_ALL:()=>Pt,SHOW_DOCUMENT:()=>Dt,SHOW_DOCUMENT_FRAGMENT:()=>Mt,SHOW_ELEMENT:()=>lt,STRING:()=>tt,SUB_TYPE:()=>r,SYNTAX_ERR:()=>ot,TAG_TYPE:()=>o,TAG_TYPE_I:()=>C,TEXT_NODE:()=>Lt,TYPE_FROM:()=>Tt,TYPE_TO:()=>Rt,U_FFFD:()=>et,WALKER_FILTER:()=>at});module.exports=m(oo);const g="AnPlusB",h="Combinator",b="__EMPTY__",W="Identifier",y="NotSupportedError",K="Nth",Z="Raw",k="Selector",z="AttributeSelector",V="ClassSelector",v="IdSelector",Q="SelectorList",j="PseudoClassSelector",q="PseudoElementSelector",J="TypeSelector",tt="String",ot="SyntaxError",et="\uFFFD",st=1,Et=2,rt=4,nt=8,_t=16,xt=32,pt=65535,ct=45,Ot=2,$t=16,Tt=8,Rt=-1,Ct=1,Lt=3,At=9,Nt=11,Gt=2,It=8,St=16,Pt=4294967295,Dt=256,Mt=1024,lt=1,at=1281,R="[A-Z\\d]+",c="(?:0|[1-9]\\d*)",l=`(?:-${R})*`,_="(?:first|last|only)-(?:child|of-type)",a=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,x=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${a})\\s*\\)`,r="\\[[^\\]]+\\]|[#.:][\\w-]+",o="\\*|[A-Za-z][\\w-]*",C="\\*|[A-Z][\\w-]*",e="(?:is|not|where)",E=`(?:${o}|(?:${o})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",$="\\s?[~+]\\s?",L=`${E}(?:${O}${E})*`,A=`${E}(?:${$}${E})*`,i=`:${e}\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,U=`:${e}\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,B=`:${e}\\(\\s*${A}(?:\\s*,\\s*${A})*\\s*\\)`,N=`(?:${o}|(?:${o})?(?:${r}|${i})+)`,G=`(?:${o}|(?:${o})?(?:${r}|${U})+)`,I=`(?:${o}|(?:${o})?(?:${r}|${B})+)`,S=`(?:${C}|(?:${C})?(?:${r})+)`,P=`${G}(?:${O}${G})*`,D=`${I}(?:${$}${I})*`,d=`${e}\\(\\s*${P}(?:\\s*,\\s*${P})*\\s*\\)`,F=`${e}\\(\\s*${D}(?:\\s*,\\s*${D})*\\s*\\)`,Y=`${e}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,it=/^a(?:rea)?$/,Ut=new RegExp(`:(?!${_}|${x})`),Bt=new RegExp(`${O}${S}`,"i"),dt=new RegExp(`${$}${S}`,"i"),Ft=/^(?:ltr|rtl)$/,Yt=/^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/,ut=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,wt=/^(?:button|form|input|select|textarea)$/,Ht=/^([\da-f]{1,6}\s?)/i,ft=/^(?:details|dialog)$/,Xt=/^$|^\s*>|,\s*$/,mt=new RegExp(`^(?:\\*-)?${R}${l}$`,"i"),gt=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,ht=new RegExp(`:(?!${_}|${x}|${d})`),bt=new RegExp(`:(?!${_}|${x}|${F})`),Wt=new RegExp(`:(?!${_}|${x}|${Y})`),yt=/(:(is|where)\(\s*\))/,Kt=new RegExp(`:${e}\\(`),Zt=/^(?:has|is|not|where)$/,kt=/^host(?:-context)?$/,zt=/^(?:close|open)$/,Vt=/^part|slotted$/,vt=/^(?:checkbox|radio)$/,Qt=/^(?:date(?:time-local)?|month|time|week)$/,jt=/(?:date(?:time-local)?|month|number|range|time|week)$/,qt=/^(?:button|reset)$/,Jt=/^(?:image|submit)$/,to=/^(?: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,COMBINATOR,COMBO_A,COMBO_B,COMPLEX_A,COMPLEX_B,COMPLEX_C,COMPLEX_D,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_C,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_A,LOGICAL_COMPLEX_B,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NESTED_LOGICAL_C,NOT_SUPPORTED_ERR,NTH,N_ST,N_TH,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX_A,REG_COMPLEX_B,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_A,REG_LOGICAL_COMPLEX_B,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});
2
2
  //# sourceMappingURL=constant.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/js/constant.js"],
4
- "sourcesContent": ["/**\n * constant.js\n */\n\n/* string */\nexport const AN_PLUS_B = 'AnPlusB';\nexport const COMBINATOR = 'Combinator';\nexport const EMPTY = '__EMPTY__';\nexport const IDENTIFIER = 'Identifier';\nexport const NOT_SUPPORTED_ERR = 'NotSupportedError';\nexport const NTH = 'Nth';\nexport const RAW = 'Raw';\nexport const SELECTOR = 'Selector';\nexport const SELECTOR_ATTR = 'AttributeSelector';\nexport const SELECTOR_CLASS = 'ClassSelector';\nexport const SELECTOR_ID = 'IdSelector';\nexport const SELECTOR_LIST = 'SelectorList';\nexport const SELECTOR_PSEUDO_CLASS = 'PseudoClassSelector';\nexport const SELECTOR_PSEUDO_ELEMENT = 'PseudoElementSelector';\nexport const SELECTOR_TYPE = 'TypeSelector';\nexport const STRING = 'String';\nexport const SYNTAX_ERR = 'SyntaxError';\nexport const U_FFFD = '\\uFFFD';\n\n/* numeric */\nexport const BIT_01 = 1;\nexport const BIT_02 = 2;\nexport const BIT_04 = 4;\nexport const BIT_08 = 8;\nexport const BIT_16 = 0x10;\nexport const BIT_32 = 0x20;\nexport const BIT_FFFF = 0xFFFF;\nexport const BIT_HYPHEN = 0x2D;\nexport const DUO = 2;\nexport const HEX = 16;\nexport const TYPE_FROM = 8;\nexport const TYPE_TO = -1;\n\n/* Node */\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\nexport const DOCUMENT_POSITION_PRECEDING = 2;\nexport const DOCUMENT_POSITION_CONTAINS = 8;\nexport const DOCUMENT_POSITION_CONTAINED_BY = 0x10;\n\n/* NodeFilter */\nexport const SHOW_ALL = 0xffffffff;\nexport const SHOW_DOCUMENT = 0x100;\nexport const SHOW_DOCUMENT_FRAGMENT = 0x400;\nexport const SHOW_ELEMENT = 1;\nexport const WALKER_FILTER = 0x501;\n\n/* selectors */\nexport const ALPHA_NUM = '[A-Z\\\\d]+';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const N_ST = '(?:first|last|only)-(?:child|of-type)';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const ANB =\n `[+-]?(?:${DIGIT}n?|n)|(?:[+-]?${DIGIT})?n\\\\s*[+-]\\\\s*${DIGIT}`;\n// excludes An+B with selector list, e.g. :nth-child(2n+1 of .foo)\nexport const N_TH =\n `nth-(?:last-)?(?:child|of-type)\\\\(\\\\s*(?:even|odd|${ANB})\\\\s*\\\\)`;\n// excludes :has()\nexport const LOGICAL_KEY = '(?:is|not|where)';\n// attr, id, class, pseudo-class\nexport const SUB_TYPE = '\\\\[[^\\\\]]+\\\\]|[#.:][\\\\w-]+';\n// *, tag\nexport const TAG_TYPE = '\\\\*|[A-Za-z][\\\\w-]*';\nexport const COMPOUND_A = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const NESTED_LOGICAL_A =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPOUND_A}(?:\\\\s*,\\\\s*${COMPOUND_A})*\\\\s*\\\\)`;\nexport const COMPOUND_B =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;\nexport const LOGICAL_COMPOUND =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPOUND_B}(?:\\\\s*,\\\\s*${COMPOUND_B})*\\\\s*\\\\)`;\nexport const COMBO_A = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMPLEX_A = `${COMPOUND_A}(?:${COMBO_A}${COMPOUND_A})*`;\nexport const NESTED_LOGICAL_B =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_A}(?:\\\\s*,\\\\s*${COMPLEX_A})*\\\\s*\\\\)`;\nexport const COMPOUND_C =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;\nexport const COMPLEX_C = `${COMPOUND_C}(?:${COMBO_A}${COMPOUND_C})*`;\nexport const LOGICAL_COMPLEX_A =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_C}(?:\\\\s*,\\\\s*${COMPLEX_C})*\\\\s*\\\\)`;\nexport const COMBO_B = '\\\\s?[~+]\\\\s?';\nexport const COMPLEX_B = `${COMPOUND_A}(?:${COMBO_B}${COMPOUND_A})*`;\nexport const NESTED_LOGICAL_C =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_B}(?:\\\\s*,\\\\s*${COMPLEX_B})*\\\\s*\\\\)`;\nexport const COMPOUND_D =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_C})+)`;\nexport const COMPLEX_D = `${COMPOUND_D}(?:${COMBO_B}${COMPOUND_D})*`;\nexport const LOGICAL_COMPLEX_B =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_D}(?:\\\\s*,\\\\s*${COMPLEX_D})*\\\\s*\\\\)`;\n\n/* regexp */\nexport const REG_ANCHOR = /^a(?:rea)?$/;\nexport const REG_CHILD_INDEXED = new RegExp(`:(?!${N_ST}|${N_TH})`);\nexport const REG_DIR = /^(?:ltr|rtl)$/;\nexport const REG_FORM = /^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/;\nexport const REG_FORM_CTRL =\n /^(?:button|fieldset|input|optgroup|option|select|textarea)$/;\nexport const REG_FORM_VALID = /^(?:button|form|input|select|textarea)$/;\nexport const REG_INTERACT = /^(?:details|dialog)$/;\nexport const REG_LANG = new RegExp(`^(?:\\\\*-)?${ALPHA_NUM}${LANG_PART}$`, 'i');\nexport const REG_LOGICAL_COMPLEX_A =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPLEX_A})`);\nexport const REG_LOGICAL_COMPLEX_B =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPLEX_B})`);\nexport const REG_LOGICAL_COMPOUND =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPOUND})`);\nexport const REG_LOGICAL_KEY = new RegExp(`:${LOGICAL_KEY}\\\\(`);\nexport const REG_LOGICAL_PSEUDO = /^(?:has|is|not|where)$/;\nexport const REG_SHADOW_HOST = /^host(?:-context)?$/;\nexport const REG_SHADOW_MODE = /^(?:close|open)$/;\nexport const REG_SHADOW_PSEUDO = /^part|slotted$/;\nexport const REG_TYPE_CHECK = /^(?:checkbox|radio)$/;\nexport const REG_TYPE_DATE = /^(?:date(?:time-local)?|month|time|week)$/;\nexport const REG_TYPE_RANGE =\n /(?:date(?:time-local)?|month|number|range|time|week)$/;\nexport const REG_TYPE_RESET = /^(?:button|reset)$/;\nexport const REG_TYPE_SUBMIT = /^(?:image|submit)$/;\nexport const REG_TYPE_TEXT = /^(?:email|number|password|search|tel|text|url)$/;\n"],
5
- "mappings": "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",
6
- "names": ["constant_exports", "__export", "ALPHA_NUM", "ANB", "AN_PLUS_B", "BIT_01", "BIT_02", "BIT_04", "BIT_08", "BIT_16", "BIT_32", "BIT_FFFF", "BIT_HYPHEN", "COMBINATOR", "COMBO_A", "COMBO_B", "COMPLEX_A", "COMPLEX_B", "COMPLEX_C", "COMPLEX_D", "COMPOUND_A", "COMPOUND_B", "COMPOUND_C", "COMPOUND_D", "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_A", "LOGICAL_COMPLEX_B", "LOGICAL_COMPOUND", "LOGICAL_KEY", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NESTED_LOGICAL_C", "NOT_SUPPORTED_ERR", "NTH", "N_ST", "N_TH", "RAW", "REG_ANCHOR", "REG_CHILD_INDEXED", "REG_DIR", "REG_FORM", "REG_FORM_CTRL", "REG_FORM_VALID", "REG_INTERACT", "REG_LANG", "REG_LOGICAL_COMPLEX_A", "REG_LOGICAL_COMPLEX_B", "REG_LOGICAL_COMPOUND", "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", "TEXT_NODE", "TYPE_FROM", "TYPE_TO", "U_FFFD", "WALKER_FILTER", "__toCommonJS"]
4
+ "sourcesContent": ["/**\n * constant.js\n */\n\n/* string */\nexport const AN_PLUS_B = 'AnPlusB';\nexport const COMBINATOR = 'Combinator';\nexport const EMPTY = '__EMPTY__';\nexport const IDENTIFIER = 'Identifier';\nexport const NOT_SUPPORTED_ERR = 'NotSupportedError';\nexport const NTH = 'Nth';\nexport const RAW = 'Raw';\nexport const SELECTOR = 'Selector';\nexport const SELECTOR_ATTR = 'AttributeSelector';\nexport const SELECTOR_CLASS = 'ClassSelector';\nexport const SELECTOR_ID = 'IdSelector';\nexport const SELECTOR_LIST = 'SelectorList';\nexport const SELECTOR_PSEUDO_CLASS = 'PseudoClassSelector';\nexport const SELECTOR_PSEUDO_ELEMENT = 'PseudoElementSelector';\nexport const SELECTOR_TYPE = 'TypeSelector';\nexport const STRING = 'String';\nexport const SYNTAX_ERR = 'SyntaxError';\nexport const U_FFFD = '\\uFFFD';\n\n/* numeric */\nexport const BIT_01 = 1;\nexport const BIT_02 = 2;\nexport const BIT_04 = 4;\nexport const BIT_08 = 8;\nexport const BIT_16 = 0x10;\nexport const BIT_32 = 0x20;\nexport const BIT_FFFF = 0xFFFF;\nexport const BIT_HYPHEN = 0x2D;\nexport const DUO = 2;\nexport const HEX = 16;\nexport const TYPE_FROM = 8;\nexport const TYPE_TO = -1;\n\n/* Node */\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\nexport const DOCUMENT_POSITION_PRECEDING = 2;\nexport const DOCUMENT_POSITION_CONTAINS = 8;\nexport const DOCUMENT_POSITION_CONTAINED_BY = 0x10;\n\n/* NodeFilter */\nexport const SHOW_ALL = 0xffffffff;\nexport const SHOW_DOCUMENT = 0x100;\nexport const SHOW_DOCUMENT_FRAGMENT = 0x400;\nexport const SHOW_ELEMENT = 1;\nexport const WALKER_FILTER = 0x501;\n\n/* selectors */\nexport const ALPHA_NUM = '[A-Z\\\\d]+';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const N_ST = '(?:first|last|only)-(?:child|of-type)';\nexport const ANB =\n `[+-]?(?:${DIGIT}n?|n)|(?:[+-]?${DIGIT})?n\\\\s*[+-]\\\\s*${DIGIT}`;\n// N_TH: excludes An+B with selector list, e.g. :nth-child(2n+1 of .foo)\nexport const N_TH =\n `nth-(?:last-)?(?:child|of-type)\\\\(\\\\s*(?:even|odd|${ANB})\\\\s*\\\\)`;\n// SUB_TYPE: attr, id, class, pseudo-class\nexport const SUB_TYPE = '\\\\[[^\\\\]]+\\\\]|[#.:][\\\\w-]+';\n// TAG_TYPE: *, tag\nexport const TAG_TYPE = '\\\\*|[A-Za-z][\\\\w-]*';\nexport const TAG_TYPE_I = '\\\\*|[A-Z][\\\\w-]*';\n// LOGICAL_KEY: excludes :has()\nexport const LOGICAL_KEY = '(?:is|not|where)';\nexport const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const COMBO_A = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMBO_B = '\\\\s?[~+]\\\\s?';\nexport const COMPLEX_A = `${COMPOUND}(?:${COMBO_A}${COMPOUND})*`;\nexport const COMPLEX_B = `${COMPOUND}(?:${COMBO_B}${COMPOUND})*`;\nexport const NESTED_LOGICAL_A =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPOUND}(?:\\\\s*,\\\\s*${COMPOUND})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_B =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_A}(?:\\\\s*,\\\\s*${COMPLEX_A})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_C =\n `:${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_B}(?:\\\\s*,\\\\s*${COMPLEX_B})*\\\\s*\\\\)`;\nexport const COMPOUND_A =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;\nexport const COMPOUND_B =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;\nexport const COMPOUND_C =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_C})+)`;\nexport const COMPOUND_I =\n `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;\nexport const COMPLEX_C = `${COMPOUND_B}(?:${COMBO_A}${COMPOUND_B})*`;\nexport const COMPLEX_D = `${COMPOUND_C}(?:${COMBO_B}${COMPOUND_C})*`;\nexport const LOGICAL_COMPLEX_A =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_C}(?:\\\\s*,\\\\s*${COMPLEX_C})*\\\\s*\\\\)`;\nexport const LOGICAL_COMPLEX_B =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_D}(?:\\\\s*,\\\\s*${COMPLEX_D})*\\\\s*\\\\)`;\nexport const LOGICAL_COMPOUND =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPOUND_A}(?:\\\\s*,\\\\s*${COMPOUND_A})*\\\\s*\\\\)`;\n\n/* regexp */\nexport const REG_ANCHOR = /^a(?:rea)?$/;\nexport const REG_CHILD_INDEXED = new RegExp(`:(?!${N_ST}|${N_TH})`);\nexport const REG_COMPLEX_A = new RegExp(`${COMBO_A}${COMPOUND_I}`, 'i');\nexport const REG_COMPLEX_B = new RegExp(`${COMBO_B}${COMPOUND_I}`, 'i');\nexport const REG_DIR = /^(?:ltr|rtl)$/;\nexport const REG_FORM = /^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/;\nexport const REG_FORM_CTRL =\n /^(?:button|fieldset|input|optgroup|option|select|textarea)$/;\nexport const REG_FORM_VALID = /^(?:button|form|input|select|textarea)$/;\nexport const REG_HEX = /^([\\da-f]{1,6}\\s?)/i;\nexport const REG_INTERACT = /^(?:details|dialog)$/;\nexport const REG_INVALID_SELECTOR = /^$|^\\s*>|,\\s*$/;\nexport const REG_LANG = new RegExp(`^(?:\\\\*-)?${ALPHA_NUM}${LANG_PART}$`, 'i');\nexport const REG_LANG_QUOTED = /(:lang\\(\\s*(\"[A-Za-z\\d\\-*]*\")\\s*\\))/;\nexport const REG_LOGICAL_COMPLEX_A =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPLEX_A})`);\nexport const REG_LOGICAL_COMPLEX_B =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPLEX_B})`);\nexport const REG_LOGICAL_COMPOUND =\n new RegExp(`:(?!${N_ST}|${N_TH}|${LOGICAL_COMPOUND})`);\nexport const REG_LOGICAL_EMPTY = /(:(is|where)\\(\\s*\\))/;\nexport const REG_LOGICAL_KEY = new RegExp(`:${LOGICAL_KEY}\\\\(`);\nexport const REG_LOGICAL_PSEUDO = /^(?:has|is|not|where)$/;\nexport const REG_SHADOW_HOST = /^host(?:-context)?$/;\nexport const REG_SHADOW_MODE = /^(?:close|open)$/;\nexport const REG_SHADOW_PSEUDO = /^part|slotted$/;\nexport const REG_TYPE_CHECK = /^(?:checkbox|radio)$/;\nexport const REG_TYPE_DATE = /^(?:date(?:time-local)?|month|time|week)$/;\nexport const REG_TYPE_RANGE =\n /(?:date(?:time-local)?|month|number|range|time|week)$/;\nexport const REG_TYPE_RESET = /^(?:button|reset)$/;\nexport const REG_TYPE_SUBMIT = /^(?:image|submit)$/;\nexport const REG_TYPE_TEXT = /^(?:email|number|password|search|tel|text|url)$/;\n"],
5
+ "mappings": "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",
6
+ "names": ["constant_exports", "__export", "ALPHA_NUM", "ANB", "AN_PLUS_B", "BIT_01", "BIT_02", "BIT_04", "BIT_08", "BIT_16", "BIT_32", "BIT_FFFF", "BIT_HYPHEN", "COMBINATOR", "COMBO_A", "COMBO_B", "COMPLEX_A", "COMPLEX_B", "COMPLEX_C", "COMPLEX_D", "COMPOUND", "COMPOUND_A", "COMPOUND_B", "COMPOUND_C", "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_A", "LOGICAL_COMPLEX_B", "LOGICAL_COMPOUND", "LOGICAL_KEY", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NESTED_LOGICAL_C", "NOT_SUPPORTED_ERR", "NTH", "N_ST", "N_TH", "RAW", "REG_ANCHOR", "REG_CHILD_INDEXED", "REG_COMPLEX_A", "REG_COMPLEX_B", "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_A", "REG_LOGICAL_COMPLEX_B", "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", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var W=Object.create;var P=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var V=(y,l)=>{for(var e in l)P(y,e,{get:l[e],enumerable:!0})},I=(y,l,e,n)=>{if(l&&typeof l=="object"||typeof l=="function")for(let r of j(l))!q.call(y,r)&&r!==e&&P(y,r,{get:()=>l[r],enumerable:!(n=B(l,r))||n.enumerable});return y};var U=(y,l,e)=>(e=y!=null?W(Y(y)):{},I(l||!y||!y.__esModule?P(e,"default",{value:y,enumerable:!0}):e,y)),X=y=>I(P({},"__esModule",{value:!0}),y);var Q={};V(Q,{Finder:()=>K});module.exports=X(Q);var M=U(require("is-potential-custom-element-name"),1),$=U(require("@asamuzakjp/nwsapi"),1),S=require("./dom-util.js"),O=require("./matcher.js"),k=require("./parser.js"),c=require("./constant.js");const v="next",x="prev",L="all",g="first",C="lineal",R="self";class K{#a;#r;#c;#t;#h;#d;#p;#e;#b;#N;#f;#o;#w;#s;#u;#m;#n;#_;#i;#l;constructor(l){this.#l=l,this.#d=l.document,this.#r=new WeakMap,this.#w=new WeakMap,this.#f=(0,$.default)({document:l.document,DOMException:l.DOMException}),this.#f.configure({LOGERRORS:!1})}_onError(l){if(!this.#N)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===c.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,n={}){const{event:r,noexcept:a,warn:f}=n;return this.#N=!!a,this.#i=!!f,this.#p=this._setEvent(r),this.#e=e,[this.#t,this.#s,this.#n]=(0,S.resolveContent)(e),this.#u=(0,S.isInShadowTree)(e),[this.#a,this.#b]=this._correspond(l),this.#_=new WeakMap,e}_setEvent(l){return l instanceof this.#l.MouseEvent||l instanceof this.#l.KeyboardEvent?l:null}_correspond(l){const e=[];this.#c=!1,this.#h=!1;let n;if(this.#t){const r=this.#r.get(this.#t);if(r&&r.has(`${l}`)){const a=r.get(`${l}`);this.#c=a.complex,this.#h=a.descendant,n=a.ast}}if(n){const r=n.length;for(let a=0;a<r;a++)n[a].collected=!1,n[a].dir=null,n[a].filtered=!1,n[a].find=!1,e[a]=[]}else{let r;try{r=(0,k.parseSelector)(l)}catch(d){this._onError(d)}const{branches:a,complex:f}=(0,k.walkAST)(r,!0);let o=!1,b=0;n=[];for(const[...d]of a){const s=[];let t=d.shift();if(t&&t.type!==c.COMBINATOR){const i=new Set;for(;t;){if(t.type===c.COMBINATOR){const[h]=d;if(h.type===c.COMBINATOR){const u=`Invalid selector ${l}`;throw new DOMException(u,c.SYNTAX_ERR)}const m=t.name;/^[\s>]$/.test(m)&&(o=!0),s.push({combo:t,leaves:(0,k.sortAST)(i)}),i.clear()}else if(t){let{name:h}=t;h&&typeof h=="string"&&(h=(0,k.unescapeSelector)(h),typeof h=="string"&&h!==t.name&&(t.name=h),/[|:]/.test(h)&&(t.namespace=!0)),i.add(t)}if(d.length)t=d.shift();else{s.push({combo:null,leaves:(0,k.sortAST)(i)}),i.clear();break}}}n.push({branch:s,collected:!1,dir:null,filtered:!1,find:!1}),e[b]=[],b++}if(this.#t){let d;this.#r.has(this.#t)?d=this.#r.get(this.#t):d=new Map,d.set(`${l}`,{ast:n,complex:f,descendant:o}),this.#r.set(this.#t,d)}this.#c=f,this.#h=o}return[n,e]}_createTreeWalker(l){let e;return this.#_.has(l)?e=this.#_.get(l):(e=this.#d.createTreeWalker(l,c.WALKER_FILTER),this.#_.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#o=this._createTreeWalker(this.#e),this.#m=!1,this.#o}_traverse(l,e=this.#n){let n=e.currentNode,r;if(n===l)r=n;else if(n.contains(l))for(n=e.nextNode();n;){if(n===l){r=n;break}n=e.nextNode()}else{if(n!==e.root)for(;n&&!(n===e.root||n===l);)n=e.parentNode();if(l?.nodeType===c.ELEMENT_NODE)for(;n;){if(n===l){r=n;break}n=e.nextNode()}else r=n}return r??null}_collectNthChild(l,e,n){const{a:r,b:a,reverse:f,selector:o}=l,{parentNode:b}=e,d=new Set;let s;if(o)if(this.#r.has(o))s=this.#r.get(o);else{const{branches:t}=(0,k.walkAST)(o);s=t,this.#r.set(o,s)}if(b){const t=this.#n;let i=this._traverse(b,t);i=t.firstChild();let h=0;for(;i;)h++,i=t.nextSibling();i=this._traverse(b,t);const m=new Set;if(s)for(i=t.firstChild();i;){let u;for(const p of s)if(u=this._matchLeaves(p,i,n),!u)break;u&&m.add(i),i=t.nextSibling()}if(r===0){if(a>0&&a<=h){if(m.size){i=this._traverse(b,t),f?i=t.lastChild():i=t.firstChild();let u=0;for(;i;){if(m.has(i)){if(u===a-1){d.add(i);break}u++}f?i=t.previousSibling():i=t.nextSibling()}}else if(!o){i=this._traverse(b,t),f?i=t.lastChild():i=t.firstChild();let u=0;for(;i;){if(u===a-1){d.add(i);break}f?i=t.previousSibling():i=t.nextSibling(),u++}}}}else{let u=a-1;if(r>0)for(;u<0;)u+=r;if(u>=0&&u<h){i=this._traverse(b,t),f?i=t.lastChild():i=t.firstChild();let p=0,_=r>0?0:a-1;for(;i&&(i&&u>=0&&u<h);)m.size?m.has(i)&&(_===u&&(d.add(i),u+=r),r>0?_++:_--):p===u&&(o||d.add(i),u+=r),f?i=t.previousSibling():i=t.nextSibling(),p++}}if(f&&d.size>1){const u=[...d];return new Set(u.reverse())}}else if(e===this.#s&&r+a===1)if(s){let t;for(const i of s)if(t=this._matchLeaves(i,e,n),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:n,b:r,reverse:a}=l,{localName:f,parentNode:o,prefix:b}=e,d=new Set;if(o){const s=this.#n;let t=this._traverse(o,s);t=s.firstChild();let i=0;for(;t;)i++,t=s.nextSibling();if(n===0){if(r>0&&r<=i){t=this._traverse(o,s),a?t=s.lastChild():t=s.firstChild();let h=0;for(;t;){const{localName:m,prefix:u}=t;if(m===f&&u===b){if(h===r-1){d.add(t);break}h++}a?t=s.previousSibling():t=s.nextSibling()}}}else{let h=r-1;if(n>0)for(;h<0;)h+=n;if(h>=0&&h<i){t=this._traverse(o,s),a?t=s.lastChild():t=s.firstChild();let m=n>0?0:r-1;for(;t;){const{localName:u,prefix:p}=t;if(u===f&&p===b){if(m===h&&(d.add(t),h+=n),h<0||h>=i)break;n>0?m++:m--}a?t=s.previousSibling():t=s.nextSibling()}}}if(a&&d.size>1){const h=[...d];return new Set(h.reverse())}}else e===this.#s&&n+r===1&&d.add(e);return d}_matchAnPlusB(l,e,n,r){const{nth:{a,b:f,name:o},selector:b}=l,d=new Map;if(o?(o==="even"?(d.set("a",2),d.set("b",0)):o==="odd"&&(d.set("a",2),d.set("b",1)),n.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof f=="string"&&/-?\d+/.test(f)?d.set("b",f*1):d.set("b",0),n.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(n)){b&&d.set("selector",b);const s=Object.fromEntries(d);return this._collectNthChild(s,e,r)}else if(/^nth-(?:last-)?of-type$/.test(n)){const s=Object.fromEntries(d);return this._collectNthOfType(s,e)}return new Set}_matchHasPseudoFunc(l,e,n={}){let r;if(Array.isArray(l)&&l.length){const[a]=l,{type:f}=a;let o;f===c.COMBINATOR?o=l.shift():o={name:" ",type:c.COMBINATOR};const b=[];for(;l.length;){const[t]=l,{type:i}=t;if(i===c.COMBINATOR)break;b.push(l.shift())}const d={combo:o,leaves:b};n.dir=v;const s=this._matchCombinator(d,e,n);if(s.size)if(l.length){for(const t of s)if(r=this._matchHasPseudoFunc(Object.assign([],l),t,n),r)break}else r=!0}return!!r}_matchLogicalPseudoFunc(l,e,n={}){const{astName:r="",branches:a=[],selector:f="",twigBranches:o=[]}=l;let b;if(r==="has")if(f.includes(":has("))b=null;else{let d;for(const s of a)if(d=this._matchHasPseudoFunc(Object.assign([],s),e,n),d)break;d&&(b=e)}else{const d=/^(?:is|where)$/.test(r);n.forgive=d;const s=o.length;let t;for(let i=0;i<s;i++){const h=o[i],m=h.length-1,{leaves:u}=h[m];if(t=this._matchLeaves(u,e,n),t&&m>0){let p=new Set([e]);for(let _=m-1;_>=0;_--){const w=h[_],N=[];n.dir=x;for(const A of p){const E=this._matchCombinator(w,A,n);E.size&&N.push(...E)}if(N.length)_===0?t=!0:p=new Set(N);else{t=!1;break}}}if(t)break}r==="not"?t||(b=e):t&&(b=e)}return b??null}_matchPseudoClassSelector(l,e,n={}){const{children:r,name:a}=l,{localName:f,parentNode:o}=e,{forgive:b,warn:d=this.#i}=n,s=new Set;if(c.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#r.has(l))t=this.#r.get(l);else{const{branches:h}=(0,k.walkAST)(l),m=[],u=[];for(const[...p]of h){for(const A of p){const E=(0,k.generateCSS)(A);m.push(E)}const _=[],w=new Set;let N=p.shift();for(;N;)if(N.type===c.COMBINATOR?(_.push({combo:N,leaves:[...w]}),w.clear()):N&&w.add(N),p.length)N=p.shift();else{_.push({combo:null,leaves:[...w]}),w.clear();break}u.push(_)}t={astName:a,branches:h,twigBranches:u,selector:m.join(",")},this.#r.set(l,t)}const i=this._matchLogicalPseudoFunc(t,e,n);i&&s.add(i)}else if(Array.isArray(r))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=r;return this._matchAnPlusB(t,e,a,n)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&s.add(t);break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;default:if(!b){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,c.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{c.REG_ANCHOR.test(f)&&e.hasAttribute("href")&&s.add(e);break}case"local-link":{if(c.REG_ANCHOR.test(f)&&e.hasAttribute("href")){const{href:t,origin:i,pathname:h}=new URL(this.#t.URL),m=new URL(e.getAttribute("href"),t);m.origin===i&&m.pathname===h&&s.add(e)}break}case"visited":break;case"hover":{const{target:t,type:i}=this.#p??{};(i==="mouseover"||i==="pointerover")&&e.contains(t)&&s.add(e);break}case"active":{const{buttons:t,target:i,type:h}=this.#p??{};(h==="mousedown"||h==="pointerdown")&&t&c.BIT_01&&e.contains(i)&&s.add(e);break}case"target":{const{hash:t}=new URL(this.#t.URL);e.id&&t===`#${e.id}`&&this.#t.contains(e)&&s.add(e);break}case"target-within":{const{hash:t}=new URL(this.#t.URL);if(t){const i=t.replace(/^#/,"");let h=this.#t.getElementById(i);for(;h;){if(h===e){s.add(e);break}h=h.parentNode}}break}case"scope":{this.#e.nodeType===c.ELEMENT_NODE?!this.#u&&e===this.#e&&s.add(e):e===this.#t.documentElement&&s.add(e);break}case"focus":case"focus-visible":{const{target:t,type:i}=this.#p??{};if(e===this.#t.activeElement&&e.tabIndex>=0&&(a==="focus"||i==="keydown"&&e.contains(t))){let h=e,m=!0;for(;h;){if(h.disabled||h.hasAttribute("disabled")||h.hidden||h.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(h);if(m=!(u==="none"||p==="hidden"),!m)break}if(h.parentNode&&h.parentNode.nodeType===c.ELEMENT_NODE)h=h.parentNode;else break}m&&s.add(e)}break}case"focus-within":{let t,i=this.#t.activeElement;if(i.tabIndex>=0)for(;i;){if(i===e){t=!0;break}i=i.parentNode}if(t){let h=e,m=!0;for(;h;){if(h.disabled||h.hasAttribute("disabled")||h.hidden||h.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(h);if(m=!(u==="none"||p==="hidden"),!m)break}if(h.parentNode&&h.parentNode.nodeType===c.ELEMENT_NODE)h=h.parentNode;else break}m&&s.add(e)}break}case"open":{c.REG_INTERACT.test(f)&&e.hasAttribute("open")&&s.add(e);break}case"closed":{c.REG_INTERACT.test(f)&&!e.hasAttribute("open")&&s.add(e);break}case"disabled":{if(c.REG_FORM_CTRL.test(f)||(0,M.default)(f))if(e.disabled||e.hasAttribute("disabled"))s.add(e);else{let t=o;for(;t&&t.localName!=="fieldset";)t=t.parentNode;t&&o.localName!=="legend"&&t.hasAttribute("disabled")&&s.add(e)}break}case"enabled":{(c.REG_FORM_CTRL.test(f)||(0,M.default)(f))&&!(e.disabled&&e.hasAttribute("disabled"))&&s.add(e);break}case"read-only":{switch(f){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,S.isContentEditable)(e)||s.add(e)}break}case"read-write":{switch(f){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||s.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,S.isContentEditable)(e)&&s.add(e)}break}case"placeholder-shown":{let t;f==="textarea"?t=e:f==="input"&&(e.hasAttribute("type")?c.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(t=e):t=e),t&&e.value===""&&e.hasAttribute("placeholder")&&e.getAttribute("placeholder").trim().length&&s.add(e);break}case"checked":{(e.checked&&f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&f==="option")&&s.add(e);break}case"indeterminate":{if(e.indeterminate&&f==="input"&&e.type==="checkbox"||f==="progress"&&!e.hasAttribute("value"))s.add(e);else if(f==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let i=e.parentNode;for(;i&&i.localName!=="form";)i=i.parentNode;i||(i=this.#t.documentElement);const h=i.getElementsByTagName("input"),m=h.length;let u;for(let p=0;p<m;p++){const _=h[p];if(_.getAttribute("type")==="radio"&&(t?_.getAttribute("name")===t&&(u=!!_.checked):_.hasAttribute("name")||(u=!!_.checked),u))break}u||s.add(e)}break}case"default":{if(f==="button"&&!(e.hasAttribute("type")&&c.REG_TYPE_RESET.test(e.getAttribute("type")))||f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const i=this.#n;let h=this._traverse(t,i);for(h=i.firstChild();h&&t.contains(h);){const m=h.localName;let u;if(m==="button"?u=!(h.hasAttribute("type")&&c.REG_TYPE_RESET.test(h.getAttribute("type"))):m==="input"&&(u=h.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(h.getAttribute("type"))),u){h===e&&s.add(e);break}h=i.nextNode()}}}else if(f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))s.add(e);else if(f==="option"){let t=o,i=!1;for(;t&&t.localName!=="datalist";){if(t.localName==="select"){(t.multiple||t.hasAttribute("multiple"))&&(i=!0);break}t=t.parentNode}if(i)(e.selected||e.hasAttribute("selected"))&&s.add(e);else{const h=new Set,m=this.#n;let u=this._traverse(o,m);for(u=m.firstChild();u;){if(u.selected||u.hasAttribute("selected")){h.add(u);break}u=m.nextSibling()}h.size&&h.has(e)&&s.add(e)}}break}case"valid":{if(c.REG_FORM_VALID.test(f))e.checkValidity()&&s.add(e);else if(f==="fieldset"){const t=this.#n;let i=this._traverse(e,t);i=t.firstChild();let h;for(;i&&e.contains(i)&&!(c.REG_FORM_VALID.test(i.localName)&&(h=i.checkValidity(),!h));)i=t.nextNode();h&&s.add(e)}break}case"invalid":{if(c.REG_FORM_VALID.test(f))e.checkValidity()||s.add(e);else if(f==="fieldset"){const t=this.#n;let i=this._traverse(e,t);i=t.firstChild();let h;for(;i&&e.contains(i)&&!(c.REG_FORM_VALID.test(i.localName)&&(h=i.checkValidity(),!h));)i=t.nextNode();h||s.add(e)}break}case"in-range":{f==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&s.add(e);break}case"out-of-range":{f==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&s.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(f))t=e;else if(f==="input")if(e.hasAttribute("type")){const i=e.getAttribute("type");(i==="file"||c.REG_TYPE_CHECK.test(i)||c.REG_TYPE_DATE.test(i)||c.REG_TYPE_TEXT.test(i))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&s.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(f))t=e;else if(f==="input")if(e.hasAttribute("type")){const i=e.getAttribute("type");(i==="file"||c.REG_TYPE_CHECK.test(i)||c.REG_TYPE_DATE.test(i)||c.REG_TYPE_TEXT.test(i))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&s.add(e);break}case"root":{e===this.#t.documentElement&&s.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#d.createTreeWalker(e,c.SHOW_ALL);let i=t.firstChild(),h;for(;i&&(h=i.nodeType!==c.ELEMENT_NODE&&i.nodeType!==c.TEXT_NODE,!!h);)i=t.nextSibling();h&&s.add(e)}else s.add(e);break}case"first-child":{(o&&e===o.firstElementChild||e===this.#s)&&s.add(e);break}case"last-child":{(o&&e===o.lastElementChild||e===this.#s)&&s.add(e);break}case"only-child":{(o&&e===o.firstElementChild&&e===o.lastElementChild||e===this.#s)&&s.add(e);break}case"first-of-type":{if(o){const[t]=this._collectNthOfType({a:0,b:1},e);t&&s.add(t)}else e===this.#s&&s.add(e);break}case"last-of-type":{if(o){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&s.add(t)}else e===this.#s&&s.add(e);break}case"only-of-type":{if(o){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[i]=this._collectNthOfType({a:0,b:1,reverse:!0},e);i===e&&s.add(e)}}else e===this.#s&&s.add(e);break}case"defined":{const t=e.getAttribute("is");t?(0,M.default)(t)&&this.#l.customElements.get(t)&&s.add(e):(0,M.default)(f)?this.#l.customElements.get(f)&&s.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&s.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&s.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,c.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,c.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}}else if(!b){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,c.SYNTAX_ERR)}}return s}_matchShadowHostPseudoClass(l,e){const{children:n,name:r}=l;let a;if(Array.isArray(n)){const{branches:f}=(0,k.walkAST)(n[0]),[o]=f,[...b]=o,{host:d}=e;if(r==="host"){let s;for(const t of b){const{type:i}=t;if(i===c.COMBINATOR){const m=`Invalid selector ${(0,k.generateCSS)(l)}`;throw new DOMException(m,c.SYNTAX_ERR)}if(s=this._matchSelector(t,d).has(d),!s)break}s&&(a=e)}else if(r==="host-context"){let s=d,t;for(;s;){for(const i of b){const{type:h}=i;if(h===c.COMBINATOR){const u=`Invalid selector ${(0,k.generateCSS)(l)}`;throw new DOMException(u,c.SYNTAX_ERR)}if(t=this._matchSelector(i,s).has(s),!t)break}if(t)break;s=s.parentNode}t&&(a=e)}}else if(r==="host")a=e;else{const f=`Invalid selector :${r}`;throw new DOMException(f,c.SYNTAX_ERR)}return a??null}_matchSelector(l,e,n){const{type:r}=l,a=new Set;if(l.name===c.EMPTY)return a;const f=(0,k.unescapeSelector)(l.name);if(typeof f=="string"&&f!==l.name&&(l.name=f),e.nodeType===c.ELEMENT_NODE)switch(r){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(f,n);break}case c.SELECTOR_ID:{e.id===f&&a.add(e);break}case c.SELECTOR_CLASS:{e.classList.contains(f)&&a.add(e);break}case c.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,n);default:{const o=O.matcher.matchSelector(l,e,n);o&&a.add(o)}}else if(this.#u&&r===c.SELECTOR_PSEUDO_CLASS&&e.nodeType===c.DOCUMENT_FRAGMENT_NODE){if(f!=="has"&&c.REG_LOGICAL_PSEUDO.test(f))return this._matchPseudoClassSelector(l,e,n);if(c.REG_SHADOW_HOST.test(f)){const o=this._matchShadowHostPseudoClass(l,e,n);o&&a.add(o)}}return a}_matchLeaves(l,e,n){const{attributes:r,localName:a,nodeType:f}=e;let o=this.#w.get(l),b;if(o&&o.has(e)){const{attr:d,matched:s}=o.get(e);r?.length===d&&(b=s)}if(typeof b!="boolean"){let d;f===c.ELEMENT_NODE&&c.REG_FORM.test(a)?d=!1:d=!0;for(const s of l){const{name:t,type:i}=s;if(i===c.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),b=this._matchSelector(s,e,n).has(e),!b)break}d&&(o||(o=new WeakMap),o.set(e,{attr:r?.length,matched:b}),this.#w.set(l,o))}return!!b}_matchHTMLCollection(l,e={}){const{compound:n,filterLeaves:r}=e,a=new Set,f=l.length;if(f)if(n)for(let o=0;o<f;o++){const b=l[o];this._matchLeaves(r,b,e)&&a.add(b)}else{const o=[].slice.call(l);return new Set(o)}return a}_findDescendantNodes(l,e,n){const[r,...a]=l,f=a.length>0,{type:o}=r,b=(0,k.unescapeSelector)(r.name);typeof b=="string"&&b!==r.name&&(r.name=b);let d=new Set,s=!1;if(this.#u)s=!0;else switch(o){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,n);break}case c.SELECTOR_ID:{if(this.#s.nodeType===c.ELEMENT_NODE)s=!0;else{const t=this.#s.getElementById(b);t&&t!==e&&e.contains(t)&&(f?this._matchLeaves(a,t,n)&&d.add(t):d.add(t))}break}case c.SELECTOR_CLASS:{const t=e.getElementsByClassName(b);d=this._matchHTMLCollection(t,{compound:f,filterLeaves:a});break}case c.SELECTOR_TYPE:{if(this.#t.contentType==="text/html"&&!/[*|]/.test(b)){const t=e.getElementsByTagName(b);d=this._matchHTMLCollection(t,{compound:f,filterLeaves:a})}else s=!0;break}default:s=!0}return{nodes:d,pending:s}}_matchCombinator(l,e,n={}){const{combo:r,leaves:a}=l,{name:f}=r,{parentNode:o}=e,{dir:b}=n,d=new Set;if(b===v)switch(f){case"+":{const s=e.nextElementSibling;s&&this._matchLeaves(a,s,n)&&d.add(s);break}case"~":{if(o){const s=this._createTreeWalker(o);let t=this._traverse(e,s);for(t=s.nextSibling();t;)this._matchLeaves(a,t,n)&&d.add(t),t=s.nextSibling()}break}case">":{const s=this._createTreeWalker(e);let t=this._traverse(e,s);for(t=s.firstChild();t;)this._matchLeaves(a,t,n)&&d.add(t),t=s.nextSibling();break}case" ":default:{const{nodes:s,pending:t}=this._findDescendantNodes(a,e);if(s.size)return s;if(t){const i=this._createTreeWalker(e);let h=this._traverse(e,i);for(h=i.nextNode();h&&e.contains(h);)this._matchLeaves(a,h,n)&&d.add(h),h=i.nextNode()}}}else switch(f){case"+":{const s=e.previousElementSibling;s&&this._matchLeaves(a,s,n)&&d.add(s);break}case"~":{if(o){const s=this._createTreeWalker(o);let t=this._traverse(o,s);for(t=s.firstChild();t&&t!==e;)this._matchLeaves(a,t,n)&&d.add(t),t=s.nextSibling()}break}case">":{o&&this._matchLeaves(a,o,n)&&d.add(o);break}case" ":default:{const s=[];let t=o;for(;t;)this._matchLeaves(a,t,n)&&s.push(t),t=t.parentNode;if(s.length)return new Set(s.reverse())}}return d}_findNode(l,e){const{node:n}=e;let r=this._traverse(n,this.#o),a;if(r)for(r.nodeType!==c.ELEMENT_NODE?r=this.#o.nextNode():r===n&&r!==this.#s&&(r=this.#o.nextNode());r;){if(this._matchLeaves(l,r,{warn:this.#i})){a=r;break}r=this.#o.nextNode()}return a??null}_matchSelf(l){const e=[],n=this._matchLeaves(l,this.#e,{warn:this.#i});let r=!1;return n&&(e.push(this.#e),r=!0),[e,r]}_findLineal(l,e={}){const{complex:n}=e,r=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),f=!1;if(a&&(r.push(this.#e),f=!0),!a||n){let o=this.#e.parentNode;for(;o&&(a=this._matchLeaves(l,o,{warn:this.#i}),a&&(r.push(o),f=!0),o.parentNode);)o=o.parentNode}return[r,f]}_findFirst(l){const e=[],n=this._findNode(l,{node:this.#e});let r=!1;return n&&(e.push(n),r=!0),[e,r]}_findFromHTMLCollection(l,e={}){const{complex:n,compound:r,filterLeaves:a,targetType:f}=e;let o=[],b=!1,d=!1;const s=l.length;if(s)if(this.#e.nodeType===c.ELEMENT_NODE)for(let t=0;t<s;t++){const i=l[t];if(i!==this.#e&&(this.#e.contains(i)||i.contains(this.#e))){if(r){if(this._matchLeaves(a,i,{warn:this.#i})&&(o.push(i),b=!0,f===g))break}else if(o.push(i),b=!0,f===g)break}}else if(n)if(r)for(let t=0;t<s;t++){const i=l[t];if(this._matchLeaves(a,i,{warn:this.#i})&&(o.push(i),b=!0,f===g))break}else o=[].slice.call(l),b=!0,d=!0;else if(r)for(let t=0;t<s;t++){const i=l[t];if(this._matchLeaves(a,i,{warn:this.#i})&&(o.push(i),b=!0,f===g))break}else o=[].slice.call(l),b=!0,d=!0;return[o,b,d]}_findEntryNodes(l,e,n){const{leaves:r}=l,[a,...f]=r,o=f.length>0,{name:b,type:d}=a;let s=[],t=!1,i=!1,h=!1;switch(d){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,{warn:this.#i});break}case c.SELECTOR_ID:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:n});else if(e===g&&this.#s.nodeType!==c.ELEMENT_NODE){const m=this.#s.getElementById(b);m&&(o?this._matchLeaves(f,m,{warn:this.#i})&&(s.push(m),i=!0):(s.push(m),i=!0))}else e===g?[s,i]=this._findFirst(r):h=!0;break}case c.SELECTOR_CLASS:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:n});else if(this.#s.nodeType===c.DOCUMENT_NODE){const m=this.#s.getElementsByClassName(b);m.length&&([s,i,t]=this._findFromHTMLCollection(m,{complex:n,compound:o,filterLeaves:f,targetType:e}))}else e===g?[s,i]=this._findFirst(r):h=!0;break}case c.SELECTOR_TYPE:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:n});else if(this.#t.contentType==="text/html"&&this.#s.nodeType===c.DOCUMENT_NODE&&!/[*|]/.test(b)){const m=this.#s.getElementsByTagName(b);m.length&&([s,i,t]=this._findFromHTMLCollection(m,{complex:n,compound:o,filterLeaves:f,targetType:e}))}else e===g?[s,i]=this._findFirst(r):h=!0;break}default:if(e!==C&&c.REG_SHADOW_HOST.test(b)){if(this.#u&&this.#e.nodeType===c.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(a,this.#e);m&&(s.push(m),i=!0)}}else e===R?[s,i]=this._matchSelf(r):e===C?[s,i]=this._findLineal(r,{complex:n}):e===g?[s,i]=this._findFirst(r):h=!0}return{collected:t,compound:o,filtered:i,nodes:s,pending:h}}_collectNodes(l){const e=this.#a.values();if(l===L||l===g){const n=new Set;let r=0;for(const{branch:a}of e){const f=a.length,o=f>1,b=a[0];let d,s;if(o){const{combo:p,leaves:[{name:_,type:w}]}=b,N=a[f-1],{leaves:[{name:A,type:E}]}=N;if(E===c.SELECTOR_PSEUDO_ELEMENT||E===c.SELECTOR_ID)d=x,s=N;else if(w===c.SELECTOR_PSEUDO_ELEMENT||w===c.SELECTOR_ID)d=v,s=b;else if(l===L)if(_==="*"&&w===c.SELECTOR_TYPE)d=x,s=N;else if(A==="*"&&E===c.SELECTOR_TYPE)d=v,s=b;else if(f===2){const{name:T}=p;/^[+~]$/.test(T)?(d=x,s=N):(d=v,s=b)}else d=v,s=b;else if(A==="*"&&E===c.SELECTOR_TYPE)d=v,s=b;else if(_==="*"&&w===c.SELECTOR_TYPE)d=x,s=N;else{let T;for(const{combo:D,leaves:[G]}of a){const{name:z,type:F}=G;if(F===c.SELECTOR_PSEUDO_CLASS&&z==="dir"){T=!1;break}if(!T&&D){const{name:H}=D;/^[+~]$/.test(H)&&(T=!0)}}T?(d=v,s=b):(d=x,s=N)}}else d=x,s=b;const{collected:t,compound:i,filtered:h,nodes:m,pending:u}=this._findEntryNodes(s,l,o);m.length?(this.#a[r].find=!0,this.#b[r]=m):u&&n.add(new Map([["index",r],["twig",s]])),this.#a[r].collected=t,this.#a[r].dir=d,this.#a[r].filtered=h||!i,r++}if(n.size){let a,f;this.#e!==this.#s&&this.#e.nodeType===c.ELEMENT_NODE?(a=this.#e,f=this.#o):(a=this.#s,f=this.#n);let o=this._traverse(a,f);for(;o;){let b=!1;if(this.#e.nodeType===c.ELEMENT_NODE?o===this.#e?b=!0:b=this.#e.contains(o):b=!0,b)for(const d of n){const{leaves:s}=d.get("twig");if(this._matchLeaves(s,o,{warn:this.#i})){const i=d.get("index");this.#a[i].filtered=!0,this.#a[i].find=!0,this.#b[i].push(o)}}o!==f.currentNode&&(o=this._traverse(o,f)),o=f.nextNode()}}}else{let n=0;for(const{branch:r}of e){const a=r[r.length-1],f=r.length>1,{compound:o,filtered:b,nodes:d}=this._findEntryNodes(a,l,f);d.length&&(this.#a[n].find=!0,this.#b[n]=d),this.#a[n].dir=x,this.#a[n].filtered=b||!o,n++}}return[this.#a,this.#b]}_getCombinedNodes(l,e,n){const r=[];for(const a of e){const f=this._matchCombinator(l,a,{dir:n,warn:this.#i});f.size&&r.push(...f)}return r.length?new Set(r):new Set}_matchNodeNext(l,e,n){const{combo:r,index:a}=n,{combo:f,leaves:o}=l[a],b={combo:r,leaves:o},d=this._getCombinedNodes(b,e,v);let s;if(d.size)if(a===l.length-1){const[t]=(0,S.sortNodes)(d);s=t}else s=this._matchNodeNext(l,d,{combo:f,index:a+1});return s??null}_matchNodePrev(l,e,n){const{index:r}=n,a=l[r],f=new Set([e]),o=this._getCombinedNodes(a,f,x);let b;if(o.size){if(r===0)b=e;else for(const d of o)if(this._matchNodePrev(l,d,{index:r-1}))return e}return b??null}_find(l){(l===L||l===g)&&this._prepareQuerySelectorWalker();const[[...e],n]=this._collectNodes(l),r=e.length;let a=new Set;for(let f=0;f<r;f++){const{branch:o,collected:b,dir:d,find:s}=e[f],t=o.length;if(t&&s){const i=n[f],h=i.length,m=t-1;if(m===0)if((l===L||l===g)&&this.#e.nodeType===c.ELEMENT_NODE)for(let u=0;u<h;u++){const p=i[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,...i]),this.#m=!0}else a=new Set(i);else{const[u]=i;a.add(u)}else if(l===L)if(d===v){let{combo:u}=o[0];for(const p of i){let _=new Set([p]);for(let w=1;w<t;w++){const{combo:N,leaves:A}=o[w],E={combo:u,leaves:A};if(_=this._getCombinedNodes(E,_,d),_.size)if(w===m)if(a.size){const T=[...a];a=new Set([...T,..._]),this.#m=!0}else a=_;else u=N;else break}}}else for(const u of i){let p=new Set([u]);for(let _=m-1;_>=0;_--){const w=o[_];if(p=this._getCombinedNodes(w,p,d),p.size)_===0&&(a.add(u),t>1&&a.size>1&&(this.#m=!0));else break}}else if(l===g&&d===v){const{combo:u}=o[0];let p;for(const _ of i)if(p=this._matchNodeNext(o,new Set([_]),{combo:u,index:1}),p){a.add(p);break}if(!p&&!b){const{leaves:_}=o[0],[w]=i;let N=this._findNode(_,{node:w});for(;N;){if(p=this._matchNodeNext(o,new Set([N]),{combo:u,index:1}),p){a.add(p);break}N=this._findNode(_,{node:N})}}}else{let u;for(const p of i)if(u=this._matchNodePrev(o,p,{index:m-1}),u){a.add(p);break}if(!u&&!b&&l===g){const{leaves:p}=o[m],[_]=i;let w=this._findNode(p,{node:_});for(;w;){if(u=this._matchNodePrev(o,w,{index:m-1}),u){a.add(w);break}w=this._findNode(p,{node:w})}}}}}return a}matches(l,e,n){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const a=`Unexpected node ${e?.nodeName}`;throw new TypeError(a)}(0,k.filterSelector)(l,{complex:this.#c,descendant:!0})?r=this.#f.match(l,e):(this._setup(l,e,n),r=this._find(R).size)}catch(a){this._onError(a)}return!!r}closest(l,e,n){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const a=`Unexpected node ${e?.nodeName}`;throw new TypeError(a)}if((0,k.filterSelector)(l,{complex:this.#c,descendant:!0}))r=this.#f.closest(l,e);else{this._setup(l,e,n);const a=this._find(C);if(a.size){let f=this.#e;for(;f;){if(a.has(f)){r=f;break}f=f.parentNode}}}}catch(a){this._onError(a)}return r??null}querySelector(l,e,n){let r;try{if(this._setup(l,e,n),this.#d===this.#t&&!this.#h&&(0,k.filterSelector)(l,{complex:this.#c,descendant:!1}))r=this.#f.first(l,e);else{const a=this._find(g);a.delete(this.#e),a.size&&([r]=(0,S.sortNodes)(a))}}catch(a){this._onError(a)}return r??null}querySelectorAll(l,e,n){let r;try{if(this._setup(l,e,n),this.#d===this.#t&&!this.#h&&(0,k.filterSelector)(l,{complex:this.#c,descendant:!1}))r=this.#f.select(l,e);else{const a=this._find(L);a.delete(this.#e),a.size&&(this.#m?r=(0,S.sortNodes)(a):r=[...a])}}catch(a){this._onError(a)}return r??[]}}0&&(module.exports={Finder});
1
+ var W=Object.create;var D=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var V=(y,a)=>{for(var e in a)D(y,e,{get:a[e],enumerable:!0})},I=(y,a,e,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of j(a))!q.call(y,r)&&r!==e&&D(y,r,{get:()=>a[r],enumerable:!(f=B(a,r))||f.enumerable});return y};var U=(y,a,e)=>(e=y!=null?W(Y(y)):{},I(a||!y||!y.__esModule?D(e,"default",{value:y,enumerable:!0}):e,y)),X=y=>I(D({},"__esModule",{value:!0}),y);var Q={};V(Q,{Finder:()=>K});module.exports=X(Q);var M=U(require("is-potential-custom-element-name"),1),$=U(require("@asamuzakjp/nwsapi"),1),E=require("./dom-util.js"),O=require("./matcher.js"),k=require("./parser.js"),c=require("./constant.js");const S="next",x="prev",L="all",g="first",C="lineal",R="self";class K{#l;#r;#s;#p;#o;#b;#e;#h;#w;#n;#f;#_;#t;#d;#u;#c;#m;#i;#a;constructor(a){this.#a=a,this.#o=a.document,this.#r=new WeakMap,this.#_=new WeakMap}_onError(a){if(!this.#w)if(a instanceof DOMException||a instanceof this.#a.DOMException)if(a.name===c.NOT_SUPPORTED_ERR)this.#i&&console.warn(a.message);else throw new this.#a.DOMException(a.message,a.name);else throw a}_setup(a,e,f={}){const{event:r,noexcept:l,warn:o}=f;return this.#w=!!l,this.#i=!!o,this.#b=this._setEvent(r),this.#e=e,[this.#s,this.#t,this.#c]=(0,E.resolveContent)(e),this.#d=(0,E.isInShadowTree)(e),[this.#l,this.#h]=this._correspond(a),this.#m=new WeakMap,e}_initNwsapi(a){return this.#n=(0,$.default)({DOMException:this.#a.DOMException,document:a}),this.#n.configure({LOGERRORS:!1}),this.#n}_setEvent(a){return a instanceof this.#a.MouseEvent||a instanceof this.#a.KeyboardEvent?a:null}_correspond(a){const e=[];this.#p=!1;let f;if(this.#s){const r=this.#r.get(this.#s);if(r&&r.has(`${a}`)){const l=r.get(`${a}`);this.#p=l.descendant,f=l.ast}}if(f){const r=f.length;for(let l=0;l<r;l++)f[l].collected=!1,f[l].dir=null,f[l].filtered=!1,f[l].find=!1,e[l]=[]}else{let r;try{r=(0,k.parseSelector)(a)}catch(u){this._onError(u)}const l=(0,k.walkAST)(r);let o=!1,n=0;f=[];for(const[...u]of l){const h=[];let s=u.shift();if(s&&s.type!==c.COMBINATOR){const t=new Set;for(;s;){if(s.type===c.COMBINATOR){const[i]=u;if(i.type===c.COMBINATOR){const m=`Invalid selector ${a}`;throw new DOMException(m,c.SYNTAX_ERR)}const d=s.name;/^[\s>]$/.test(d)&&(o=!0),h.push({combo:s,leaves:(0,k.sortAST)(t)}),t.clear()}else if(s){let{name:i}=s;i&&typeof i=="string"&&(i=(0,k.unescapeSelector)(i),typeof i=="string"&&i!==s.name&&(s.name=i),/[|:]/.test(i)&&(s.namespace=!0)),t.add(s)}if(u.length)s=u.shift();else{h.push({combo:null,leaves:(0,k.sortAST)(t)}),t.clear();break}}}f.push({branch:h,collected:!1,dir:null,filtered:!1,find:!1}),e[n]=[],n++}if(this.#s){let u;this.#r.has(this.#s)?u=this.#r.get(this.#s):u=new Map,u.set(`${a}`,{ast:f,descendant:o}),this.#r.set(this.#s,u)}this.#p=o}return[f,e]}_createTreeWalker(a){let e;return this.#m.has(a)?e=this.#m.get(a):(e=this.#o.createTreeWalker(a,c.WALKER_FILTER),this.#m.set(a,e)),e}_prepareQuerySelectorWalker(){return this.#f=this._createTreeWalker(this.#e),this.#u=!1,this.#f}_traverse(a,e=this.#c){let f=e.currentNode,r;if(f===a)r=f;else if(f.contains(a))for(f=e.nextNode();f;){if(f===a){r=f;break}f=e.nextNode()}else{if(f!==e.root)for(;f&&!(f===e.root||f===a);)f=e.parentNode();if(a?.nodeType===c.ELEMENT_NODE)for(;f;){if(f===a){r=f;break}f=e.nextNode()}else r=f}return r??null}_collectNthChild(a,e,f){const{a:r,b:l,reverse:o,selector:n}=a,{parentNode:u}=e,h=new Set;let s;if(n&&(this.#r.has(n)?s=this.#r.get(n):(s=(0,k.walkAST)(n),this.#r.set(n,s))),u){const t=this.#c;let i=this._traverse(u,t);i=t.firstChild();let d=0;for(;i;)d++,i=t.nextSibling();i=this._traverse(u,t);const m=new Set;if(s)for(i=t.firstChild();i;){let b;for(const p of s)if(b=this._matchLeaves(p,i,f),!b)break;b&&m.add(i),i=t.nextSibling()}if(r===0){if(l>0&&l<=d){if(m.size){i=this._traverse(u,t),o?i=t.lastChild():i=t.firstChild();let b=0;for(;i;){if(m.has(i)){if(b===l-1){h.add(i);break}b++}o?i=t.previousSibling():i=t.nextSibling()}}else if(!n){i=this._traverse(u,t),o?i=t.lastChild():i=t.firstChild();let b=0;for(;i;){if(b===l-1){h.add(i);break}o?i=t.previousSibling():i=t.nextSibling(),b++}}}}else{let b=l-1;if(r>0)for(;b<0;)b+=r;if(b>=0&&b<d){i=this._traverse(u,t),o?i=t.lastChild():i=t.firstChild();let p=0,_=r>0?0:l-1;for(;i&&(i&&b>=0&&b<d);)m.size?m.has(i)&&(_===b&&(h.add(i),b+=r),r>0?_++:_--):p===b&&(n||h.add(i),b+=r),o?i=t.previousSibling():i=t.nextSibling(),p++}}if(o&&h.size>1){const b=[...h];return new Set(b.reverse())}}else if(e===this.#t&&r+l===1)if(s){let t;for(const i of s)if(t=this._matchLeaves(i,e,f),t)break;t&&h.add(e)}else h.add(e);return h}_collectNthOfType(a,e){const{a:f,b:r,reverse:l}=a,{localName:o,parentNode:n,prefix:u}=e,h=new Set;if(n){const s=this.#c;let t=this._traverse(n,s);t=s.firstChild();let i=0;for(;t;)i++,t=s.nextSibling();if(f===0){if(r>0&&r<=i){t=this._traverse(n,s),l?t=s.lastChild():t=s.firstChild();let d=0;for(;t;){const{localName:m,prefix:b}=t;if(m===o&&b===u){if(d===r-1){h.add(t);break}d++}l?t=s.previousSibling():t=s.nextSibling()}}}else{let d=r-1;if(f>0)for(;d<0;)d+=f;if(d>=0&&d<i){t=this._traverse(n,s),l?t=s.lastChild():t=s.firstChild();let m=f>0?0:r-1;for(;t;){const{localName:b,prefix:p}=t;if(b===o&&p===u){if(m===d&&(h.add(t),d+=f),d<0||d>=i)break;f>0?m++:m--}l?t=s.previousSibling():t=s.nextSibling()}}}if(l&&h.size>1){const d=[...h];return new Set(d.reverse())}}else e===this.#t&&f+r===1&&h.add(e);return h}_matchAnPlusB(a,e,f,r){const{nth:{a:l,b:o,name:n},selector:u}=a,h=new Map;if(n?(n==="even"?(h.set("a",2),h.set("b",0)):n==="odd"&&(h.set("a",2),h.set("b",1)),f.indexOf("last")>-1&&h.set("reverse",!0)):(typeof l=="string"&&/-?\d+/.test(l)?h.set("a",l*1):h.set("a",0),typeof o=="string"&&/-?\d+/.test(o)?h.set("b",o*1):h.set("b",0),f.indexOf("last")>-1&&h.set("reverse",!0)),/^nth-(?:last-)?child$/.test(f)){u&&h.set("selector",u);const s=Object.fromEntries(h);return this._collectNthChild(s,e,r)}else if(/^nth-(?:last-)?of-type$/.test(f)){const s=Object.fromEntries(h);return this._collectNthOfType(s,e)}return new Set}_matchHasPseudoFunc(a,e,f={}){let r;if(Array.isArray(a)&&a.length){const[l]=a,{type:o}=l;let n;o===c.COMBINATOR?n=a.shift():n={name:" ",type:c.COMBINATOR};const u=[];for(;a.length;){const[t]=a,{type:i}=t;if(i===c.COMBINATOR)break;u.push(a.shift())}const h={combo:n,leaves:u};f.dir=S;const s=this._matchCombinator(h,e,f);if(s.size)if(a.length){for(const t of s)if(r=this._matchHasPseudoFunc(Object.assign([],a),t,f),r)break}else r=!0}return!!r}_matchLogicalPseudoFunc(a,e,f={}){const{astName:r="",branches:l=[],selector:o="",twigBranches:n=[]}=a;let u;if(r==="has")if(o.includes(":has("))u=null;else{let h;for(const s of l)if(h=this._matchHasPseudoFunc(Object.assign([],s),e,f),h)break;h&&(u=e)}else{const h=/^(?:is|where)$/.test(r);f.forgive=h;const s=n.length;let t;for(let i=0;i<s;i++){const d=n[i],m=d.length-1,{leaves:b}=d[m];if(t=this._matchLeaves(b,e,f),t&&m>0){let p=new Set([e]);for(let _=m-1;_>=0;_--){const w=d[_],N=[];f.dir=x;for(const A of p){const v=this._matchCombinator(w,A,f);v.size&&N.push(...v)}if(N.length)_===0?t=!0:p=new Set(N);else{t=!1;break}}}if(t)break}r==="not"?t||(u=e):t&&(u=e)}return u??null}_matchPseudoClassSelector(a,e,f={}){const{children:r,name:l}=a,{localName:o,parentNode:n}=e,{forgive:u,warn:h=this.#i}=f,s=new Set;if(c.REG_LOGICAL_PSEUDO.test(l)){let t;if(this.#r.has(a))t=this.#r.get(a);else{const d=(0,k.walkAST)(a),m=[],b=[];for(const[...p]of d){for(const A of p){const v=(0,k.generateCSS)(A);m.push(v)}const _=[],w=new Set;let N=p.shift();for(;N;)if(N.type===c.COMBINATOR?(_.push({combo:N,leaves:[...w]}),w.clear()):N&&w.add(N),p.length)N=p.shift();else{_.push({combo:null,leaves:[...w]}),w.clear();break}b.push(_)}t={astName:l,branches:d,twigBranches:b,selector:m.join(",")},this.#r.set(a,t)}const i=this._matchLogicalPseudoFunc(t,e,f);i&&s.add(i)}else if(Array.isArray(r))if(/^nth-(?:last-)?(?:child|of-type)$/.test(l)){const[t]=r;return this._matchAnPlusB(t,e,l,f)}else switch(l){case"dir":case"lang":{const t=O.matcher.matchSelector(a,e);t&&s.add(t);break}case"current":case"nth-col":case"nth-last-col":{if(h){const t=`Unsupported pseudo-class :${l}()`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;default:if(!u){const t=`Unknown pseudo-class :${l}()`;throw new DOMException(t,c.SYNTAX_ERR)}}else switch(l){case"any-link":case"link":{c.REG_ANCHOR.test(o)&&e.hasAttribute("href")&&s.add(e);break}case"local-link":{if(c.REG_ANCHOR.test(o)&&e.hasAttribute("href")){const{href:t,origin:i,pathname:d}=new URL(this.#s.URL),m=new URL(e.getAttribute("href"),t);m.origin===i&&m.pathname===d&&s.add(e)}break}case"visited":break;case"hover":{const{target:t,type:i}=this.#b??{};(i==="mouseover"||i==="pointerover")&&e.contains(t)&&s.add(e);break}case"active":{const{buttons:t,target:i,type:d}=this.#b??{};(d==="mousedown"||d==="pointerdown")&&t&c.BIT_01&&e.contains(i)&&s.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&s.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const i=t.replace(/^#/,"");let d=this.#s.getElementById(i);for(;d;){if(d===e){s.add(e);break}d=d.parentNode}}break}case"scope":{this.#e.nodeType===c.ELEMENT_NODE?!this.#d&&e===this.#e&&s.add(e):e===this.#s.documentElement&&s.add(e);break}case"focus":case"focus-visible":{const{target:t,type:i}=this.#b??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(l==="focus"||i==="keydown"&&e.contains(t))){let d=e,m=!0;for(;d;){if(d.disabled||d.hasAttribute("disabled")||d.hidden||d.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#a.getComputedStyle(d);if(m=!(b==="none"||p==="hidden"),!m)break}if(d.parentNode&&d.parentNode.nodeType===c.ELEMENT_NODE)d=d.parentNode;else break}m&&s.add(e)}break}case"focus-within":{let t,i=this.#s.activeElement;if(i.tabIndex>=0)for(;i;){if(i===e){t=!0;break}i=i.parentNode}if(t){let d=e,m=!0;for(;d;){if(d.disabled||d.hasAttribute("disabled")||d.hidden||d.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#a.getComputedStyle(d);if(m=!(b==="none"||p==="hidden"),!m)break}if(d.parentNode&&d.parentNode.nodeType===c.ELEMENT_NODE)d=d.parentNode;else break}m&&s.add(e)}break}case"open":{c.REG_INTERACT.test(o)&&e.hasAttribute("open")&&s.add(e);break}case"closed":{c.REG_INTERACT.test(o)&&!e.hasAttribute("open")&&s.add(e);break}case"disabled":{if(c.REG_FORM_CTRL.test(o)||(0,M.default)(o))if(e.disabled||e.hasAttribute("disabled"))s.add(e);else{let t=n;for(;t&&t.localName!=="fieldset";)t=t.parentNode;t&&n.localName!=="legend"&&t.hasAttribute("disabled")&&s.add(e)}break}case"enabled":{(c.REG_FORM_CTRL.test(o)||(0,M.default)(o))&&!(e.disabled&&e.hasAttribute("disabled"))&&s.add(e);break}case"read-only":{switch(o){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,E.isContentEditable)(e)||s.add(e)}break}case"read-write":{switch(o){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||s.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,E.isContentEditable)(e)&&s.add(e)}break}case"placeholder-shown":{let t;o==="textarea"?t=e:o==="input"&&(e.hasAttribute("type")?c.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(t=e):t=e),t&&e.value===""&&e.hasAttribute("placeholder")&&e.getAttribute("placeholder").trim().length&&s.add(e);break}case"checked":{(e.checked&&o==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&o==="option")&&s.add(e);break}case"indeterminate":{if(e.indeterminate&&o==="input"&&e.type==="checkbox"||o==="progress"&&!e.hasAttribute("value"))s.add(e);else if(o==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let i=e.parentNode;for(;i&&i.localName!=="form";)i=i.parentNode;i||(i=this.#s.documentElement);const d=i.getElementsByTagName("input"),m=d.length;let b;for(let p=0;p<m;p++){const _=d[p];if(_.getAttribute("type")==="radio"&&(t?_.getAttribute("name")===t&&(b=!!_.checked):_.hasAttribute("name")||(b=!!_.checked),b))break}b||s.add(e)}break}case"default":{if(o==="button"&&!(e.hasAttribute("type")&&c.REG_TYPE_RESET.test(e.getAttribute("type")))||o==="input"&&e.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const i=this.#c;let d=this._traverse(t,i);for(d=i.firstChild();d&&t.contains(d);){const m=d.localName;let b;if(m==="button"?b=!(d.hasAttribute("type")&&c.REG_TYPE_RESET.test(d.getAttribute("type"))):m==="input"&&(b=d.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(d.getAttribute("type"))),b){d===e&&s.add(e);break}d=i.nextNode()}}}else if(o==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))s.add(e);else if(o==="option"){let t=n,i=!1;for(;t&&t.localName!=="datalist";){if(t.localName==="select"){(t.multiple||t.hasAttribute("multiple"))&&(i=!0);break}t=t.parentNode}if(i)(e.selected||e.hasAttribute("selected"))&&s.add(e);else{const d=new Set,m=this.#c;let b=this._traverse(n,m);for(b=m.firstChild();b;){if(b.selected||b.hasAttribute("selected")){d.add(b);break}b=m.nextSibling()}d.size&&d.has(e)&&s.add(e)}}break}case"valid":{if(c.REG_FORM_VALID.test(o))e.checkValidity()&&s.add(e);else if(o==="fieldset"){const t=this.#c;let i=this._traverse(e,t);i=t.firstChild();let d;for(;i&&e.contains(i)&&!(c.REG_FORM_VALID.test(i.localName)&&(d=i.checkValidity(),!d));)i=t.nextNode();d&&s.add(e)}break}case"invalid":{if(c.REG_FORM_VALID.test(o))e.checkValidity()||s.add(e);else if(o==="fieldset"){const t=this.#c;let i=this._traverse(e,t);i=t.firstChild();let d;for(;i&&e.contains(i)&&!(c.REG_FORM_VALID.test(i.localName)&&(d=i.checkValidity(),!d));)i=t.nextNode();d||s.add(e)}break}case"in-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&s.add(e);break}case"out-of-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&s.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const i=e.getAttribute("type");(i==="file"||c.REG_TYPE_CHECK.test(i)||c.REG_TYPE_DATE.test(i)||c.REG_TYPE_TEXT.test(i))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&s.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const i=e.getAttribute("type");(i==="file"||c.REG_TYPE_CHECK.test(i)||c.REG_TYPE_DATE.test(i)||c.REG_TYPE_TEXT.test(i))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&s.add(e);break}case"root":{e===this.#s.documentElement&&s.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#o.createTreeWalker(e,c.SHOW_ALL);let i=t.firstChild(),d;for(;i&&(d=i.nodeType!==c.ELEMENT_NODE&&i.nodeType!==c.TEXT_NODE,!!d);)i=t.nextSibling();d&&s.add(e)}else s.add(e);break}case"first-child":{(n&&e===n.firstElementChild||e===this.#t)&&s.add(e);break}case"last-child":{(n&&e===n.lastElementChild||e===this.#t)&&s.add(e);break}case"only-child":{(n&&e===n.firstElementChild&&e===n.lastElementChild||e===this.#t)&&s.add(e);break}case"first-of-type":{if(n){const[t]=this._collectNthOfType({a:0,b:1},e);t&&s.add(t)}else e===this.#t&&s.add(e);break}case"last-of-type":{if(n){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&s.add(t)}else e===this.#t&&s.add(e);break}case"only-of-type":{if(n){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[i]=this._collectNthOfType({a:0,b:1,reverse:!0},e);i===e&&s.add(e)}}else e===this.#t&&s.add(e);break}case"defined":{const t=e.getAttribute("is");t?(0,M.default)(t)&&this.#a.customElements.get(t)&&s.add(e):(0,M.default)(o)?this.#a.customElements.get(o)&&s.add(e):(e instanceof this.#a.HTMLElement||e instanceof this.#a.SVGElement)&&s.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#a.getComputedStyle(e);t!=="none"&&s.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(h){const t=`Unsupported pseudo-element ::${l}`;throw new DOMException(t,c.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(h){const t=`Unsupported pseudo-class :${l}`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}default:if(l.startsWith("-webkit-")){if(h){const t=`Unsupported pseudo-class :${l}`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}}else if(!u){const t=`Unknown pseudo-class :${l}`;throw new DOMException(t,c.SYNTAX_ERR)}}return s}_matchShadowHostPseudoClass(a,e){const{children:f,name:r}=a;let l;if(Array.isArray(f)){const[o]=(0,k.walkAST)(f[0]),[...n]=o,{host:u}=e;if(r==="host"){let h;for(const s of n){const{type:t}=s;if(t===c.COMBINATOR){const d=`Invalid selector ${(0,k.generateCSS)(a)}`;throw new DOMException(d,c.SYNTAX_ERR)}if(h=this._matchSelector(s,u).has(u),!h)break}h&&(l=e)}else if(r==="host-context"){let h=u,s;for(;h;){for(const t of n){const{type:i}=t;if(i===c.COMBINATOR){const m=`Invalid selector ${(0,k.generateCSS)(a)}`;throw new DOMException(m,c.SYNTAX_ERR)}if(s=this._matchSelector(t,h).has(h),!s)break}if(s)break;h=h.parentNode}s&&(l=e)}}else if(r==="host")l=e;else{const o=`Invalid selector :${r}`;throw new DOMException(o,c.SYNTAX_ERR)}return l??null}_matchSelector(a,e,f){const{type:r}=a,l=new Set;if(a.name===c.EMPTY)return l;const o=(0,k.unescapeSelector)(a.name);if(typeof o=="string"&&o!==a.name&&(a.name=o),e.nodeType===c.ELEMENT_NODE)switch(r){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(o,f);break}case c.SELECTOR_ID:{e.id===o&&l.add(e);break}case c.SELECTOR_CLASS:{e.classList.contains(o)&&l.add(e);break}case c.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(a,e,f);default:{const n=O.matcher.matchSelector(a,e,f);n&&l.add(n)}}else if(this.#d&&r===c.SELECTOR_PSEUDO_CLASS&&e.nodeType===c.DOCUMENT_FRAGMENT_NODE){if(o!=="has"&&c.REG_LOGICAL_PSEUDO.test(o))return this._matchPseudoClassSelector(a,e,f);if(c.REG_SHADOW_HOST.test(o)){const n=this._matchShadowHostPseudoClass(a,e,f);n&&l.add(n)}}return l}_matchLeaves(a,e,f){const{attributes:r,localName:l,nodeType:o}=e;let n=this.#_.get(a),u;if(n&&n.has(e)){const{attr:h,matched:s}=n.get(e);r?.length===h&&(u=s)}if(typeof u!="boolean"){let h;o===c.ELEMENT_NODE&&c.REG_FORM.test(l)?h=!1:h=!0;for(const s of a){const{name:t,type:i}=s;if(i===c.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(h=!1),u=this._matchSelector(s,e,f).has(e),!u)break}h&&(n||(n=new WeakMap),n.set(e,{attr:r?.length,matched:u}),this.#_.set(a,n))}return!!u}_matchHTMLCollection(a,e={}){const{compound:f,filterLeaves:r}=e,l=new Set,o=a.length;if(o)if(f)for(let n=0;n<o;n++){const u=a[n];this._matchLeaves(r,u,e)&&l.add(u)}else{const n=[].slice.call(a);return new Set(n)}return l}_findDescendantNodes(a,e,f){const[r,...l]=a,o=l.length>0,{type:n}=r,u=(0,k.unescapeSelector)(r.name);typeof u=="string"&&u!==r.name&&(r.name=u);let h=new Set,s=!1;if(this.#d)s=!0;else switch(n){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,f);break}case c.SELECTOR_ID:{if(this.#t.nodeType===c.ELEMENT_NODE)s=!0;else{const t=this.#t.getElementById(u);t&&t!==e&&e.contains(t)&&(o?this._matchLeaves(l,t,f)&&h.add(t):h.add(t))}break}case c.SELECTOR_CLASS:{const t=e.getElementsByClassName(u);h=this._matchHTMLCollection(t,{compound:o,filterLeaves:l});break}case c.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);h=this._matchHTMLCollection(t,{compound:o,filterLeaves:l})}else s=!0;break}default:s=!0}return{nodes:h,pending:s}}_matchCombinator(a,e,f={}){const{combo:r,leaves:l}=a,{name:o}=r,{parentNode:n}=e,{dir:u}=f,h=new Set;if(u===S)switch(o){case"+":{const s=e.nextElementSibling;s&&this._matchLeaves(l,s,f)&&h.add(s);break}case"~":{if(n){const s=this._createTreeWalker(n);let t=this._traverse(e,s);for(t=s.nextSibling();t;)this._matchLeaves(l,t,f)&&h.add(t),t=s.nextSibling()}break}case">":{const s=this._createTreeWalker(e);let t=this._traverse(e,s);for(t=s.firstChild();t;)this._matchLeaves(l,t,f)&&h.add(t),t=s.nextSibling();break}case" ":default:{const{nodes:s,pending:t}=this._findDescendantNodes(l,e);if(s.size)return s;if(t){const i=this._createTreeWalker(e);let d=this._traverse(e,i);for(d=i.nextNode();d&&e.contains(d);)this._matchLeaves(l,d,f)&&h.add(d),d=i.nextNode()}}}else switch(o){case"+":{const s=e.previousElementSibling;s&&this._matchLeaves(l,s,f)&&h.add(s);break}case"~":{if(n){const s=this._createTreeWalker(n);let t=this._traverse(n,s);for(t=s.firstChild();t&&t!==e;)this._matchLeaves(l,t,f)&&h.add(t),t=s.nextSibling()}break}case">":{n&&this._matchLeaves(l,n,f)&&h.add(n);break}case" ":default:{const s=[];let t=n;for(;t;)this._matchLeaves(l,t,f)&&s.push(t),t=t.parentNode;if(s.length)return new Set(s.reverse())}}return h}_findNode(a,e){const{node:f}=e;let r=this._traverse(f,this.#f),l;if(r)for(r.nodeType!==c.ELEMENT_NODE?r=this.#f.nextNode():r===f&&r!==this.#t&&(r=this.#f.nextNode());r;){if(this._matchLeaves(a,r,{warn:this.#i})){l=r;break}r=this.#f.nextNode()}return l??null}_matchSelf(a){const e=[],f=this._matchLeaves(a,this.#e,{warn:this.#i});let r=!1;return f&&(e.push(this.#e),r=!0),[e,r]}_findLineal(a,e={}){const{complex:f}=e,r=[];let l=this._matchLeaves(a,this.#e,{warn:this.#i}),o=!1;if(l&&(r.push(this.#e),o=!0),!l||f){let n=this.#e.parentNode;for(;n&&(l=this._matchLeaves(a,n,{warn:this.#i}),l&&(r.push(n),o=!0),n.parentNode);)n=n.parentNode}return[r,o]}_findFirst(a){const e=[],f=this._findNode(a,{node:this.#e});let r=!1;return f&&(e.push(f),r=!0),[e,r]}_findFromHTMLCollection(a,e={}){const{complex:f,compound:r,filterLeaves:l,targetType:o}=e;let n=[],u=!1,h=!1;const s=a.length;if(s)if(this.#e.nodeType===c.ELEMENT_NODE)for(let t=0;t<s;t++){const i=a[t];if(i!==this.#e&&(this.#e.contains(i)||i.contains(this.#e))){if(r){if(this._matchLeaves(l,i,{warn:this.#i})&&(n.push(i),u=!0,o===g))break}else if(n.push(i),u=!0,o===g)break}}else if(f)if(r)for(let t=0;t<s;t++){const i=a[t];if(this._matchLeaves(l,i,{warn:this.#i})&&(n.push(i),u=!0,o===g))break}else n=[].slice.call(a),u=!0,h=!0;else if(r)for(let t=0;t<s;t++){const i=a[t];if(this._matchLeaves(l,i,{warn:this.#i})&&(n.push(i),u=!0,o===g))break}else n=[].slice.call(a),u=!0,h=!0;return[n,u,h]}_findEntryNodes(a,e,f){const{leaves:r}=a,[l,...o]=r,n=o.length>0,{name:u,type:h}=l;let s=[],t=!1,i=!1,d=!1;switch(h){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,{warn:this.#i});break}case c.SELECTOR_ID:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:f});else if(e===g&&this.#t.nodeType!==c.ELEMENT_NODE){const m=this.#t.getElementById(u);m&&(n?this._matchLeaves(o,m,{warn:this.#i})&&(s.push(m),i=!0):(s.push(m),i=!0))}else e===g?[s,i]=this._findFirst(r):d=!0;break}case c.SELECTOR_CLASS:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:f});else if(this.#t.nodeType===c.DOCUMENT_NODE){const m=this.#t.getElementsByClassName(u);m.length&&([s,i,t]=this._findFromHTMLCollection(m,{complex:f,compound:n,filterLeaves:o,targetType:e}))}else e===g?[s,i]=this._findFirst(r):d=!0;break}case c.SELECTOR_TYPE:{if(e===R)[s,i]=this._matchSelf(r);else if(e===C)[s,i]=this._findLineal(r,{complex:f});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===c.DOCUMENT_NODE&&!/[*|]/.test(u)){const m=this.#t.getElementsByTagName(u);m.length&&([s,i,t]=this._findFromHTMLCollection(m,{complex:f,compound:n,filterLeaves:o,targetType:e}))}else e===g?[s,i]=this._findFirst(r):d=!0;break}default:if(e!==C&&c.REG_SHADOW_HOST.test(u)){if(this.#d&&this.#e.nodeType===c.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(l,this.#e);m&&(s.push(m),i=!0)}}else e===R?[s,i]=this._matchSelf(r):e===C?[s,i]=this._findLineal(r,{complex:f}):e===g?[s,i]=this._findFirst(r):d=!0}return{collected:t,compound:n,filtered:i,nodes:s,pending:d}}_collectNodes(a){const e=this.#l.values();if(a===L||a===g){const f=new Set;let r=0;for(const{branch:l}of e){const o=l.length,n=o>1,u=l[0];let h,s;if(n){const{combo:p,leaves:[{name:_,type:w}]}=u,N=l[o-1],{leaves:[{name:A,type:v}]}=N;if(v===c.SELECTOR_PSEUDO_ELEMENT||v===c.SELECTOR_ID)h=x,s=N;else if(w===c.SELECTOR_PSEUDO_ELEMENT||w===c.SELECTOR_ID)h=S,s=u;else if(a===L)if(_==="*"&&w===c.SELECTOR_TYPE)h=x,s=N;else if(A==="*"&&v===c.SELECTOR_TYPE)h=S,s=u;else if(o===2){const{name:T}=p;/^[+~]$/.test(T)?(h=x,s=N):(h=S,s=u)}else h=S,s=u;else if(A==="*"&&v===c.SELECTOR_TYPE)h=S,s=u;else if(_==="*"&&w===c.SELECTOR_TYPE)h=x,s=N;else{let T;for(const{combo:P,leaves:[G]}of l){const{name:z,type:F}=G;if(F===c.SELECTOR_PSEUDO_CLASS&&z==="dir"){T=!1;break}if(!T&&P){const{name:H}=P;/^[+~]$/.test(H)&&(T=!0)}}T?(h=S,s=u):(h=x,s=N)}}else h=x,s=u;const{collected:t,compound:i,filtered:d,nodes:m,pending:b}=this._findEntryNodes(s,a,n);m.length?(this.#l[r].find=!0,this.#h[r]=m):b&&f.add(new Map([["index",r],["twig",s]])),this.#l[r].collected=t,this.#l[r].dir=h,this.#l[r].filtered=d||!i,r++}if(f.size){let l,o;this.#e!==this.#t&&this.#e.nodeType===c.ELEMENT_NODE?(l=this.#e,o=this.#f):(l=this.#t,o=this.#c);let n=this._traverse(l,o);for(;n;){let u=!1;if(this.#e.nodeType===c.ELEMENT_NODE?n===this.#e?u=!0:u=this.#e.contains(n):u=!0,u)for(const h of f){const{leaves:s}=h.get("twig");if(this._matchLeaves(s,n,{warn:this.#i})){const i=h.get("index");this.#l[i].filtered=!0,this.#l[i].find=!0,this.#h[i].push(n)}}n!==o.currentNode&&(n=this._traverse(n,o)),n=o.nextNode()}}}else{let f=0;for(const{branch:r}of e){const l=r[r.length-1],o=r.length>1,{compound:n,filtered:u,nodes:h}=this._findEntryNodes(l,a,o);h.length&&(this.#l[f].find=!0,this.#h[f]=h),this.#l[f].dir=x,this.#l[f].filtered=u||!n,f++}}return[this.#l,this.#h]}_getCombinedNodes(a,e,f){const r=[];for(const l of e){const o=this._matchCombinator(a,l,{dir:f,warn:this.#i});o.size&&r.push(...o)}return r.length?new Set(r):new Set}_matchNodeNext(a,e,f){const{combo:r,index:l}=f,{combo:o,leaves:n}=a[l],u={combo:r,leaves:n},h=this._getCombinedNodes(u,e,S);let s;if(h.size)if(l===a.length-1){const[t]=(0,E.sortNodes)(h);s=t}else s=this._matchNodeNext(a,h,{combo:o,index:l+1});return s??null}_matchNodePrev(a,e,f){const{index:r}=f,l=a[r],o=new Set([e]),n=this._getCombinedNodes(l,o,x);let u;if(n.size){if(r===0)u=e;else for(const h of n)if(this._matchNodePrev(a,h,{index:r-1}))return e}return u??null}_find(a){(a===L||a===g)&&this._prepareQuerySelectorWalker();const[[...e],f]=this._collectNodes(a),r=e.length;let l=new Set;for(let o=0;o<r;o++){const{branch:n,collected:u,dir:h,find:s}=e[o],t=n.length;if(t&&s){const i=f[o],d=i.length,m=t-1;if(m===0)if((a===L||a===g)&&this.#e.nodeType===c.ELEMENT_NODE)for(let b=0;b<d;b++){const p=i[b];if(p!==this.#e&&this.#e.contains(p)&&(l.add(p),a!==L))break}else if(a===L)if(l.size){const b=[...l];l=new Set([...b,...i]),this.#u=!0}else l=new Set(i);else{const[b]=i;l.add(b)}else if(a===L)if(h===S){let{combo:b}=n[0];for(const p of i){let _=new Set([p]);for(let w=1;w<t;w++){const{combo:N,leaves:A}=n[w],v={combo:b,leaves:A};if(_=this._getCombinedNodes(v,_,h),_.size)if(w===m)if(l.size){const T=[...l];l=new Set([...T,..._]),this.#u=!0}else l=_;else b=N;else break}}}else for(const b of i){let p=new Set([b]);for(let _=m-1;_>=0;_--){const w=n[_];if(p=this._getCombinedNodes(w,p,h),p.size)_===0&&(l.add(b),t>1&&l.size>1&&(this.#u=!0));else break}}else if(a===g&&h===S){const{combo:b}=n[0];let p;for(const _ of i)if(p=this._matchNodeNext(n,new Set([_]),{combo:b,index:1}),p){l.add(p);break}if(!p&&!u){const{leaves:_}=n[0],[w]=i;let N=this._findNode(_,{node:w});for(;N;){if(p=this._matchNodeNext(n,new Set([N]),{combo:b,index:1}),p){l.add(p);break}N=this._findNode(_,{node:N})}}}else{let b;for(const p of i)if(b=this._matchNodePrev(n,p,{index:m-1}),b){l.add(p);break}if(!b&&!u&&a===g){const{leaves:p}=n[m],[_]=i;let w=this._findNode(p,{node:_});for(;w;){if(b=this._matchNodePrev(n,w,{index:m-1}),b){l.add(w);break}w=this._findNode(p,{node:w})}}}}}return l}matches(a,e,f){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const n=`Unexpected node ${e?.nodeName}`;throw new TypeError(n)}const l=e.ownerDocument;if(l===this.#o&&l.contentType==="text/html"&&(0,k.filterSelector)(a,{complex:c.REG_COMPLEX_A.test(a),descendant:!0}))return this.#n||this._initNwsapi(l),this.#n.match(a,e);this._setup(a,e,f),r=this._find(R).size}catch(l){this._onError(l)}return!!r}closest(a,e,f){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const n=`Unexpected node ${e?.nodeName}`;throw new TypeError(n)}const l=e.ownerDocument;if(l===this.#o&&l.contentType==="text/html"&&(0,k.filterSelector)(a,{complex:c.REG_COMPLEX_A.test(a),descendant:!0}))return this.#n||this._initNwsapi(l),this.#n.closest(a,e);this._setup(a,e,f);const o=this._find(C);if(o.size){let n=this.#e;for(;n;){if(o.has(n)){r=n;break}n=n.parentNode}}}catch(l){this._onError(l)}return r??null}querySelector(a,e,f){let r;try{(0,E.verifyNode)(e);let l;if(e.nodeType===c.DOCUMENT_NODE?l=e:l=e.ownerDocument,l===this.#o&&l.contentType==="text/html"&&(0,k.filterSelector)(a,{complex:c.REG_COMPLEX_B.test(a),descendant:!1}))return this.#n||this._initNwsapi(l),this.#n.first(a,e);this._setup(a,e,f);const o=this._find(g);o.delete(this.#e),o.size&&([r]=(0,E.sortNodes)(o))}catch(l){this._onError(l)}return r??null}querySelectorAll(a,e,f){let r;try{(0,E.verifyNode)(e);let l;if(e.nodeType===c.DOCUMENT_NODE?l=e:l=e.ownerDocument,l===this.#o&&l.contentType==="text/html"&&(0,k.filterSelector)(a,{complex:c.REG_COMPLEX_B.test(a),descendant:!1}))return this.#n||this._initNwsapi(l),this.#n.select(a,e);this._setup(a,e,f);const o=this._find(L);o.delete(this.#e),o.size&&(this.#u?r=(0,E.sortNodes)(o):r=[...o])}catch(l){this._onError(l)}return r??[]}}0&&(module.exports={Finder});
2
2
  //# sourceMappingURL=finder.js.map