@asamuzakjp/dom-selector 6.3.5 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -26
- package/dist/cjs/index.cjs +9 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +10 -0
- package/package.json +37 -25
- package/src/index.js +4 -2
- package/src/js/constant.js +14 -6
- package/src/js/parser.js +1 -1
- package/src/js/utility.js +184 -10
- package/types/js/constant.d.ts +11 -4
- package/types/js/utility.d.ts +3 -0
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/js/constant.js +0 -2
- package/dist/cjs/js/constant.js.map +0 -7
- package/dist/cjs/js/finder.js +0 -2
- package/dist/cjs/js/finder.js.map +0 -7
- package/dist/cjs/js/matcher.js +0 -2
- package/dist/cjs/js/matcher.js.map +0 -7
- package/dist/cjs/js/parser.js +0 -3
- package/dist/cjs/js/parser.js.map +0 -7
- package/dist/cjs/js/utility.js +0 -2
- package/dist/cjs/js/utility.js.map +0 -7
- package/dist/cjs/package.json +0 -3
package/README.md
CHANGED
|
@@ -291,47 +291,47 @@ See [benchmark](https://github.com/asamuzaK/domSelector/actions/workflows/benchm
|
|
|
291
291
|
|
|
292
292
|
|Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
|
|
293
293
|
|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|
|
294
|
-
|simple selector:<br>`matches('.content')`|
|
|
295
|
-
|compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|109,
|
|
296
|
-
|compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|
|
|
297
|
-
|compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|
|
|
298
|
-
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|70,
|
|
299
|
-
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|
|
|
300
|
-
|complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|
|
|
301
|
-
|nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|
|
|
294
|
+
|simple selector:<br>`matches('.content')`|115,054 ops/sec ±2.48%|356,979 ops/sec ±2.34%|8,556 ops/sec ±0.90%|118,715 ops/sec ±0.17%|happydom is the fastest and 3.0 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|
|
295
|
+
|compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|109,730 ops/sec ±0.63%|323,008 ops/sec ±18.02%|8,419 ops/sec ±0.66%|86,074 ops/sec ±0.97%|happydom is the fastest and 3.8 times faster than patched-jsdom. jsdom is 1.3 times faster than patched-jsdom.|
|
|
296
|
+
|compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|353,239 ops/sec ±2.73%|F|43,662 ops/sec ±1.86%|happydom is the fastest and 8.1 times faster than patched-jsdom.|
|
|
297
|
+
|compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|101,636 ops/sec ±1.59%|351,747 ops/sec ±0.59%|8,082 ops/sec ±0.61%|83,928 ops/sec ±0.66%|happydom is the fastest and 4.2 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
|
|
298
|
+
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|70,482 ops/sec ±0.38%|F|5,261 ops/sec ±0.72%|61,745 ops/sec ±0.56%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
|
|
299
|
+
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|31,671 ops/sec ±1.14%|F|5,288 ops/sec ±0.43%|42,614 ops/sec ±2.51%|patched-jsdom is the fastest. patched-jsdom is 1.3 times faster than jsdom.|
|
|
300
|
+
|complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|100,293 ops/sec ±0.67%|F|5,593 ops/sec ±0.40%|78,292 ops/sec ±26.38%|jsdom is the fastest and 1.3 times faster than patched-jsdom.|
|
|
301
|
+
|nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|299,143 ops/sec ±28.61%|5,538 ops/sec ±0.44%|84,061 ops/sec ±0.71%|happydom is the fastest and 3.6 times faster than patched-jsdom.|
|
|
302
302
|
|
|
303
303
|
### closest()
|
|
304
304
|
|
|
305
305
|
|Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
|
|
306
306
|
|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|
|
307
|
-
|simple selector:<br>`closest('.container')`|
|
|
308
|
-
|compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|
|
|
309
|
-
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|65,
|
|
310
|
-
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|
|
|
311
|
-
|complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|
|
|
312
|
-
|nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,
|
|
307
|
+
|simple selector:<br>`closest('.container')`|96,990 ops/sec ±0.60%|326,924 ops/sec ±0.52%|8,453 ops/sec ±0.65%|90,555 ops/sec ±1.70%|happydom is the fastest and 3.6 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|
|
308
|
+
|compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|63,821 ops/sec ±0.74%|F|7,942 ops/sec ±0.47%|54,674 ops/sec ±0.83%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
|
|
309
|
+
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|65,863 ops/sec ±0.65%|F|5,336 ops/sec ±0.55%|57,088 ops/sec ±0.76%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
|
|
310
|
+
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|23,941 ops/sec ±1.24%|F|5,182 ops/sec ±1.02%|36,066 ops/sec ±0.48%|patched-jsdom is the fastest. patched-jsdom is 1.5 times faster than jsdom.|
|
|
311
|
+
|complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|76,340 ops/sec ±0.36%|235,292 ops/sec ±34.48%|5,533 ops/sec ±0.53%|68,793 ops/sec ±0.78%|happydom is the fastest and 3.4 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|
|
312
|
+
|nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,777 ops/sec ±0.65%|71,028 ops/sec ±0.55%|patched-jsdom is the fastest.|
|
|
313
313
|
|
|
314
314
|
### querySelector()
|
|
315
315
|
|
|
316
316
|
|Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
|
|
317
317
|
|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|
|
318
|
-
|simple selector:<br>`querySelector('.content')`|
|
|
319
|
-
|compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,
|
|
320
|
-
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|
|
|
321
|
-
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|
|
|
322
|
-
|complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,
|
|
323
|
-
|nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|
|
|
318
|
+
|simple selector:<br>`querySelector('.content')`|21,898 ops/sec ±1.84%|265,006 ops/sec ±42.03%|9,921 ops/sec ±0.56%|81,017 ops/sec ±1.27%|happydom is the fastest and 3.3 times faster than patched-jsdom. patched-jsdom is 3.7 times faster than jsdom.|
|
|
319
|
+
|compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,676 ops/sec ±0.71%|327,427 ops/sec ±1.06%|9,507 ops/sec ±0.76%|37,303 ops/sec ±0.95%|happydom is the fastest and 8.8 times faster than patched-jsdom. patched-jsdom is 4.3 times faster than jsdom.|
|
|
320
|
+
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|197 ops/sec ±0.84%|F|1,230 ops/sec ±0.91%|616 ops/sec ±1.22%|linkedom is the fastest and 2.0 times faster than patched-jsdom. patched-jsdom is 3.1 times faster than jsdom.|
|
|
321
|
+
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|57.15 ops/sec ±2.55%|F|1,452 ops/sec ±0.62%|453 ops/sec ±0.95%|linkedom is the fastest and 3.2 times faster than patched-jsdom. patched-jsdom is 7.9 times faster than jsdom.|
|
|
322
|
+
|complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,045 ops/sec ±1.16%|F|9,229 ops/sec ±0.76%|74,154 ops/sec ±0.83%|patched-jsdom is the fastest. patched-jsdom is 24.4 times faster than jsdom.|
|
|
323
|
+
|nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|323,503 ops/sec ±0.95%|9,383 ops/sec ±0.63%|68,866 ops/sec ±0.70%|happydom is the fastest and 4.7 times faster than patched-jsdom.|
|
|
324
324
|
|
|
325
325
|
### querySelectorAll()
|
|
326
326
|
|
|
327
327
|
|Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
|
|
328
328
|
|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|
|
329
|
-
|simple selector:<br>`querySelectorAll('.content')`|
|
|
330
|
-
|compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|
|
|
331
|
-
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|
|
|
332
|
-
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|
|
|
333
|
-
|complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|
|
|
334
|
-
|nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|
|
|
329
|
+
|simple selector:<br>`querySelectorAll('.content')`|973 ops/sec ±49.13%|477 ops/sec ±43.91%|1,134 ops/sec ±0.38%|1,221 ops/sec ±0.69%|patched-jsdom is the fastest. patched-jsdom is 1.3 times faster than jsdom.|
|
|
330
|
+
|compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|681 ops/sec ±0.58%|572 ops/sec ±3.54%|1,124 ops/sec ±0.80%|640 ops/sec ±0.62%|linkedom is the fastest and 1.8 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|
|
331
|
+
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|198 ops/sec ±0.92%|F|386 ops/sec ±0.74%|206 ops/sec ±0.70%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|
|
332
|
+
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|56.19 ops/sec ±1.54%|F|419 ops/sec ±0.47%|183 ops/sec ±0.57%|linkedom is the fastest and 2.3 times faster than patched-jsdom. patched-jsdom is 3.2 times faster than jsdom.|
|
|
333
|
+
|complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|276 ops/sec ±0.97%|F|468 ops/sec ±0.74%|811 ops/sec ±1.18%|patched-jsdom is the fastest. patched-jsdom is 2.9 times faster than jsdom.|
|
|
334
|
+
|nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|523 ops/sec ±5.90%|1,160 ops/sec ±1.16%|1,321 ops/sec ±0.52%|patched-jsdom is the fastest.|
|
|
335
335
|
|
|
336
336
|
|
|
337
337
|
## Acknowledgments
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var ut=Object.create;var ie=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var Et=(c,t)=>{for(var e in t)ie(c,e,{get:t[e],enumerable:!0})},Re=(c,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of pt(t))!bt.call(c,s)&&s!==e&&ie(c,s,{get:()=>t[s],enumerable:!(n=dt(t,s))||n.enumerable});return c};var xe=(c,t,e)=>(e=c!=null?ut(mt(c)):{},Re(t||!c||!c.__esModule?ie(e,"default",{value:c,enumerable:!0}):e,c)),wt=c=>Re(ie({},"__esModule",{value:!0}),c);var zt={};Et(zt,{DOMSelector:()=>Ie});module.exports=wt(zt);var U=require("css-tree");var Ze=xe(require("@asamuzakjp/nwsapi"),1),Qe=xe(require("bidi-js"),1),ke=require("css-tree"),ge=xe(require("is-potential-custom-element-name"),1);var B="AttributeSelector",j="ClassSelector",v="Combinator",We="Identifier",R="IdSelector",A="NotSupportedError",ne="Nth";var k="PseudoClassSelector",O="PseudoElementSelector";var He="Selector";var Ye="String",N="SyntaxError",L="all",S="first",$="lineal",D="self",F="TypeSelector";var ae="[A-Z\\d]+",xt="(?:first|last|only)-(?:child|of-type)",ye="(?:0|[1-9]\\d*)",G=`(?:-${ae})*`,V=`(?:any-)?link|${xt}|checked|empty|indeterminate|read-(?:only|write)|root|target`,yt=`[+-]?(?:${ye}n?|n)|(?:[+-]?${ye})?n\\s*[+-]\\s*${ye}`,X=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${yt})\\s*\\)`,oe="\\[[^|\\]]+\\]|[#.:][\\w-]+",Nt="\\[[^|\\]]+\\]|[#.][\\w-]+",Ke="(?:[A-Za-z][\\w-]*|[#.][\\w-]+)",I="\\*|[A-Za-z][\\w-]*",Pe="\\*|[A-Z][\\w-]*",re=`(?:${I}|(?:${I})?(?:${oe})+)`,Tt=`(?:${I}|(?:${I})?(?:${Nt})+)`,le="\\s?[\\s>~+]\\s?",Ue=`${re}(?:${le}${re})*`,ze="\\s?[\\s>]\\s?",_t=`:is\\(\\s*${re}(?:\\s*,\\s*${re})*\\s*\\)`,gt=`:is\\(\\s*${Ue}(?:\\s*,\\s*${Ue})*\\s*\\)`,Me=`(?:${I}|(?:${I})?(?:${oe}|${_t})+)`,Fe=`(?:${I}|(?:${I})?(?:${oe}|${gt})+)`,q=`(?:${Pe}|(?:${Pe})?(?:${oe})+)`,Ge=`${Fe}(?:${le}${Fe})*`,Be=`(?:is|not)\\(\\s*${Ge}(?:\\s*,\\s*${Ge})*\\s*\\)`,Ne=`(?:is|not)\\(\\s*${Me}(?:\\s*,\\s*${Me})*\\s*\\)`,je=`has\\([\\s>~+]?\\s*${Tt}\\s*\\)`,ce=Object.freeze(["button","input","select","textarea"]),Ve=Object.freeze(["button","reset","submit"]),Te=Object.freeze(["date","datetime-local","month","time","week"]),Z=Object.freeze(["email","password","search","tel","text","url"]),Q=Object.freeze([...Te,...Z,"number"]),jt=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),P=Object.freeze(["has","is","not","where"]),Xe=Object.freeze(["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","ScrollLock","Shift","Super","Symbol","SymbolLock"]),qe=Object.freeze(["enabled","disabled","valid","invalid","in-range","out-of-range","checked","indeterminate","read-only","read-write","open","closed","placeholder-shown"]),fe=Object.freeze(["host","host-context"]);var At=new RegExp(`:(?!${V}|${X}|${Be})`),Lt=new RegExp(`:(?!${V}|${X}|${Ne})`),$t=new RegExp(`:(?!${V}|${X}|${Ne}|${je})`),vt=new RegExp(`:(?!${V}|${X})`),T=c=>Object.prototype.toString.call(c).slice(8,-1);var Je=c=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);let t,e,n;switch(c.nodeType){case 9:{t=c,e=c;break}case 11:{let{host:s,mode:a,ownerDocument:r}=c;t=r,e=c,n=s&&(a==="close"||a==="open");break}case 1:{t=c.ownerDocument;let s=c;for(;s;){let{host:a,mode:r,nodeType:f,parentNode:u}=s;if(f===11){n=a&&(r==="close"||r==="open");break}else if(u)s=u;else break}e=s;break}default:throw new TypeError(`Unexpected node ${c.nodeName}`)}return[t,e,!!n]},g=(c,t,e=!1)=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);if(!t)return null;let n=t.currentNode;if(n===c)return n;if(e||n.contains(c)){for(n=t.nextNode();n&&n!==c;)n=t.nextNode();return n}else{if(n!==t.root){let s;for(;n;){if(n===c){s=!0;break}else if(n===t.root||n.contains(c))break;n=t.parentNode()}if(s)return n}if(c.nodeType===1){let s;for(;n;){if(n===c){s=!0;break}n=t.nextNode()}if(s)return n}}return null},ue=(c,t={})=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);if(c.nodeType!==1)return!1;let{localName:e,ownerDocument:n}=c,{formAssociated:s}=t,a=n.defaultView,r,f=c.getAttribute("is");return f?r=(0,ge.default)(f)&&a.customElements.get(f):r=(0,ge.default)(e)&&a.customElements.get(e),r?s?!!r.formAssociated:!0:!1},_e=c=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);if(typeof c.assignedNodes!="function")return null;let t=c.assignedNodes();if(t.length){let e;for(let n of t)if(e=n.textContent.trim(),e)break;return e}return c.textContent.trim()},he=c=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);if(c.nodeType!==1)return null;let{dir:t,localName:e,parentNode:n}=c,{getEmbeddingLevels:s}=(0,Qe.default)();if(t==="ltr"||t==="rtl")return t;if(t==="auto"){let a;switch(e){case"input":{let r=[...Ve,...Z,"hidden"];if(!c.type||r.includes(c.type))a=c.value;else if(["checkbox","color","date","image","number","range","radio","time"].includes(c.type))return"ltr";break}case"slot":{a=_e(c);break}case"textarea":{a=c.value;break}default:{let r=[].slice.call(c.childNodes);for(let f of r){let{dir:u,localName:h,nodeType:o,textContent:i}=f;if(o===3?a=i.trim():o===1&&!["bdi","script","style","textarea"].includes(h)&&(!u||u!=="ltr"&&u!=="rtl")&&(h==="slot"?a=_e(f):a=i.trim()),a)break}}}if(a){let{paragraphs:[{level:r}]}=s(a);if(r%2===1)return"rtl"}else if(n){let{nodeType:r}=n;if(r===1)return he(n)}}else{if(e==="input"&&c.type==="tel")return"ltr";if(e==="bdi"){let a=c.textContent.trim();if(a){let{paragraphs:[{level:r}]}=s(a);if(r%2===1)return"rtl"}}else if(n){if(e==="slot"){let r=_e(c);if(r){let{paragraphs:[{level:f}]}=s(r);return f%2===1?"rtl":"ltr"}}let{nodeType:a}=n;if(a===1)return he(n)}}return"ltr"},ee=c=>{if(!c?.nodeType)throw new TypeError(`Unexpected type ${T(c)}`);if(c.nodeType!==1)return!1;if(typeof c.isContentEditable=="boolean")return c.isContentEditable;if(c.ownerDocument.designMode==="on")return!0;{let t;switch(c.hasAttribute("contenteditable")?t=c.getAttribute("contenteditable"):t="inherit",t){case"":case"true":return!0;case"plaintext-only":return!0;case"false":return!1;default:return c?.parentNode?.nodeType===1?ee(c.parentNode):!1}}},Oe=c=>{if(c?.nodeType!==1)return!1;let t=c.ownerDocument.defaultView,{display:e,visibility:n}=t.getComputedStyle(c);return e!=="none"&&n==="visible"},Ce=c=>{if(c?.nodeType!==1)return!1;let{localName:t,type:e}=c;switch(t){case"input":return!!(!e||Q.includes(e));case"textarea":return!0;default:return ee(c)}},de=c=>{if(c?.nodeType!==1||!c.isConnected)return!1;let t=c.ownerDocument.defaultView;if(c instanceof t.HTMLElement){if(Number.isInteger(parseInt(c.getAttribute("tabindex")))||ee(c))return!0;let{localName:e,parentNode:n}=c;switch(e){case"a":return!!(c.href||c.hasAttribute("href"));case"iframe":return!0;case"input":return!(c.disabled||c.hasAttribute("disabled")||c.hidden||c.hasAttribute("hidden"));case"summary":{if(n.localName==="details"){let s=n.firstElementChild,a=!1;for(;s;){if(s.localName==="summary"){a=s===c;break}s=s.nextElementSibling}return a}return!1}default:if(["button","select","textarea"].includes(e)&&!(c.disabled||c.hasAttribute("disabled")))return!0}}else if(c instanceof t.SVGElement){if(Number.isInteger(parseInt(c.getAttributeNS(null,"tabindex")))){let e=["clipPath","defs","desc","linearGradient","marker","mask","metadata","pattern","radialGradient","script","style","symbol","title"],n="http://www.w3.org/2000/svg",s,a=c;for(;a.namespaceURI===n&&(s=e.includes(a.localName),!s);)if(a?.parentNode?.namespaceURI===n)a=a.parentNode;else break;return!s}if(c.localName==="a"&&(c.href||c.hasAttributeNS(null,"href")))return!0}return!1};var Dt=(c,t)=>{if(typeof c!="string")throw new TypeError(`Unexpected type ${T(c)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${T(t)}`);if(!c||t.nodeType!==1)return null;let{attributes:e}=t,n;for(let s of e){let{name:a,namespaceURI:r,prefix:f,value:u}=s;if(a===`xmlns:${c}`?n=u:f===c&&(n=r),n)break}return n??null},et=(c="",t={})=>{if(!c||typeof c!="string"||t?.nodeType!==1)return!1;if(t.lookupNamespaceURI(c))return!0;let e=t.ownerDocument.documentElement,n=t,s;for(;n&&(s=Dt(c,n),!(s||n===e));)n=n.parentNode;return!!s},It=(c,t)=>{if(c?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${T(t)}`)}else throw new TypeError(`Unexpected type ${T(c)}`);if(c.nodeType!==1||t.nodeType!==1)return!1;let e=t.compareDocumentPosition(c);return!!(e&2||e&8)},pe=(c=[])=>{let t=[...c];return t.length>1&&t.sort((e,n)=>{let s;return It(n,e)?s=1:s=-1,s}),t};var tt=(c,t)=>{if(!c?.DOMException)throw new TypeError(`Unexpected global object ${T(c)}`);t?.nodeType!==9&&(t=c.document);let e=(0,Ze.default)({document:t,DOMException:c.DOMException});return e.configure({LOGERRORS:!1}),e},te=(c,t={})=>{if(!c||typeof c!="string")return!1;let{complex:e,compound:n,descend:s,simple:a,target:r}=t;if(a||n)return!1;if(c.includes("[")){let f=c.lastIndexOf("[");if(c.substring(f).indexOf("]")<0)return!1}return/[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)/.test(c)?!1:c.includes(":")?s?!1:(r===D||r===$)&&/:has\(/.test(c)?!$t.test(c):/:(?:is|not)\(/.test(c)?e?!At.test(c):!Lt.test(c):!vt.test(c):!0};var _=require("css-tree"),it=/(?<=:(?:dir|has|host(?:-context)?|is|lang|not|nth-(?:last-)?(?:child|of-type)|where))\(\s+\)/g,Ae=/^part|slotted$/,be="\uFFFD",M=(c="")=>{if(typeof c=="string"&&c.indexOf("\\",0)>=0){let t=c.split("\\"),e=t.length;for(let n=1;n<e;n++){let s=t[n];if(s===""&&n===e-1)s=be;else{let a=/^([\da-f]{1,6}\s?)/i.exec(s);if(a){let[,r]=a,f;try{let h=parseInt("D800",16),o=parseInt("DFFF",16),i=parseInt(r,16);i===0||i>=h&&i<=o?f=be:f=String.fromCodePoint(i)}catch{f=be}let u="";s.length>r.length&&(u=s.substring(r.length)),s=`${f}${u}`}else/^[\n\r\f]/.test(s)&&(s="\\"+s)}t[n]=s}c=t.join("")}return c},Ht=(...c)=>{if(!c.length)throw new TypeError("1 argument required, but only 0 present.");let[t]=c;if(typeof t=="string"){let e=0;for(;e>=0&&(e=t.indexOf("#",e),!(e<0));){let n=t.substring(0,e+1),s=t.substring(e+1);if(/^\d$/.test(s.substring(0,1)))throw new DOMException(`Invalid selector ${t}`,N);let a=s.codePointAt(0);if(a===45){if(/^\d$/.test(s.substring(1,2)))throw new DOMException(`Invalid selector ${t}`,N)}else if(a>65535){let r=`\\${a.toString(16)} `;s.length===2?s=r:s=`${r}${s.substring(2)}`}t=`${n}${s}`,e++}t=t.replace(/\f|\r\n?/g,`
|
|
2
|
+
`).replace(/[\0\uD800-\uDFFF]|\\$/g,be)}else if(t==null)t=T(t).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}`,N);return t.replace(/\x26/g,":scope")},W=c=>{if(c=Ht(c),/^$|^\s*>|,\s*$/.test(c))throw new DOMException(`Invalid selector ${c}`,N);let t;try{let e=(0,U.parse)(c,{context:"selectorList",parseCustomProperty:!0});t=(0,U.toPlainObject)(e)}catch(e){let{message:n}=e;if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(n)&&!c.endsWith("]")){let s=c.lastIndexOf("["),a=c.substring(s);a.includes('"')?a.match(/"/g).length%2?t=W(`${c}"]`):t=W(`${c}]`):t=W(`${c}]`)}else if(n==='")" is expected')if(it.test(c))t=W(`${c.replaceAll(it,"()")}`);else if(!c.endsWith(")"))t=W(`${c})`);else throw new DOMException(n,N);else throw new DOMException(n,N)}return t},z=(c={})=>{let t=new Set,e=new Map;return(0,U.walk)(c,{enter:s=>{switch(s.type){case He:{t.add(s.children);break}case k:{P.includes(s.name)?(e.set("hasNestedSelector",!0),e.set("hasLogicalPseudoFunc",!0),s.name==="has"&&e.set("hasHasPseudoFunc",!0)):qe.includes(s.name)?e.set("hasStatePseudoClass",!0):fe.includes(s.name)&&Array.isArray(s.children)&&s.children.length&&e.set("hasNestedSelector",!0);break}case O:{Ae.test(s.name)&&e.set("hasNestedSelector",!0);break}case ne:{s.selector&&(e.set("hasNestedSelector",!0),e.set("hasNthChildOfSelector",!0));break}default:}}}),e.get("hasNestedSelector")&&(0,U.findAll)(c,(s,a,r)=>{if(r){if(s.type===k&&P.includes(s.name)){let f=r.filter(u=>{let{name:h,type:o}=u;return o===k&&P.includes(h)});for(let{children:u}of f)for(let{children:h}of u)for(let{children:o}of h)t.has(o)&&t.delete(o)}else if(s.type===k&&fe.includes(s.name)&&Array.isArray(s.children)&&s.children.length){let f=r.filter(u=>{let{children:h,name:o,type:i}=u;return i===k&&fe.includes(o)&&Array.isArray(h)&&h.length});for(let{children:u}of f)for(let{children:h}of u)t.has(h)&&t.delete(h)}else if(s.type===O&&Ae.test(s.name)){let f=r.filter(u=>{let{name:h,type:o}=u;return o===O&&Ae.test(h)});for(let{children:u}of f)for(let{children:h}of u)t.has(h)&&t.delete(h)}else if(s.type===ne&&s.selector){let f=r.filter(u=>{let{selector:h,type:o}=u;return o===ne&&h});for(let{selector:u}of f){let{children:h}=u;for(let{children:o}of h)t.has(o)&&t.delete(o)}}}}),{branches:[...t],info:Object.fromEntries(e)}},$e=c=>{let t=[...c];if(t.length>1){let e=new Map([[O,1],[R,2],[j,4],[F,8],[B,16],[k,32]]);t.sort((n,s)=>{let{type:a}=n,{type:r}=s,f=e.get(a),u=e.get(r),h;return f===u?h=0:f>u?h=1:h=-1,h})}return t},ve=c=>{let t,e;if(c&&typeof c=="string")c.indexOf("|")>-1?[t,e]=c.split("|"):(t="*",e=c);else throw new DOMException(`Invalid selector ${c}`,N);return{prefix:t,localName:e}};var Ee=(c,t,e={})=>{let{forgive:n,warn:s}=e;if(t===O)switch(c){case"after":case"backdrop":case"before":case"cue":case"cue-region":case"first-letter":case"first-line":case"file-selector-button":case"marker":case"placeholder":case"selection":case"target-text":{if(s)throw new DOMException(`Unsupported pseudo-element ::${c}`,A);break}case"part":case"slotted":{if(s)throw new DOMException(`Unsupported pseudo-element ::${c}()`,A);break}default:if(c.startsWith("-webkit-")){if(s)throw new DOMException(`Unsupported pseudo-element ::${c}`,A)}else if(!n)throw new DOMException(`Unknown pseudo-element ::${c}`,N)}else throw new TypeError(`Unexpected ast type ${T(t)}`)},rt=(c,t)=>{let{name:e}=c;if(!e){let s;throw e===""?s="(empty String)":s=T(e),new TypeError(`Unexpected ast type ${s}`)}let n=he(t);return e===n},nt=(c,t)=>{let{name:e,type:n,value:s}=c,a;if(n===Ye&&s?a=s:n===We&&e&&(a=M(e)),a==="*")if(t.hasAttribute("lang")){if(t.getAttribute("lang"))return!0}else{let r=t.parentNode,f;for(;r&&r.nodeType===1;){if(r.hasAttribute("lang")){r.getAttribute("lang")&&(f=!0);break}r=r.parentNode}return!!f}else if(a&&new RegExp(`^(?:\\*-)?${ae}${G}$`,"i").test(a)){let f;if(a.indexOf("-")>-1){let[u,h,...o]=a.split("-"),i;u==="*"?i=`${ae}${G}`:i=`${u}${G}`;let l=`-${h}${G}`,d=o.length,m="";if(d)for(let p=0;p<d;p++)m+=`-${o[p]}${G}`;f=new RegExp(`^${i}${l}${m}$`,"i")}else f=new RegExp(`^${a}${G}$`,"i");if(t.hasAttribute("lang"))return f.test(t.getAttribute("lang"));{let u=t.parentNode,h;for(;u&&u.nodeType===1;){if(u.hasAttribute("lang")){h=f.test(u.getAttribute("lang"));break}u=u.parentNode}return!!h}}return!1},at=(c,t)=>{let{flags:e,matcher:n,name:s,value:a}=c;if(typeof e=="string"&&!/^[is]$/i.test(e)){let f=(0,_.generate)(c);throw new DOMException(`Invalid selector ${f}`,N)}let{attributes:r}=t;if(r?.length){let f=t.ownerDocument.contentType,u;f==="text/html"?typeof e=="string"&&/^s$/i.test(e)?u=!1:u=!0:typeof e=="string"&&/^i$/i.test(e)?u=!0:u=!1;let h=M(s.name);u&&(h=h.toLowerCase());let o=new Set;if(h.indexOf("|")>-1){let{prefix:i,localName:l}=ve(h);for(let d of r){let{name:m,value:p}=d;switch(u&&(m=m.toLowerCase(),p=p.toLowerCase()),i){case"":{l===m&&o.add(p);break}case"*":{m.indexOf(":")>-1?m.endsWith(`:${l}`)&&o.add(p):l===m&&o.add(p);break}default:if(m.indexOf(":")>-1){let[E,b]=m.split(":");if(E==="xml"&&b==="lang")continue;i===E&&l===b&&et(i,t)&&o.add(p)}}}}else for(let{name:i,value:l}of r)if(u&&(i=i.toLowerCase(),l=l.toLowerCase()),i.indexOf(":")>-1){let[d,m]=i.split(":");if(d==="xml"&&m==="lang")continue;h===m&&o.add(l)}else h===i&&o.add(l);if(o.size){let{name:i,value:l}=a??{},d;switch(i?u?d=i.toLowerCase():d=i:l?u?d=l.toLowerCase():d=l:l===""&&(d=l),n){case"=":return typeof d=="string"&&o.has(d);case"~=":{if(d&&typeof d=="string"){let m;for(let p of o)if(new Set(p.split(/\s+/)).has(d)){m=!0;break}return!!m}return!1}case"|=":{if(d&&typeof d=="string"){let m;for(let p of o)if(p===d||p.startsWith(`${d}-`)){m=p;break}return!!m}return!1}case"^=":{if(d&&typeof d=="string"){let m;for(let p of o)if(p.startsWith(`${d}`)){m=p;break}return!!m}return!1}case"$=":{if(d&&typeof d=="string"){let m;for(let p of o)if(p.endsWith(`${d}`)){m=p;break}return!!m}return!1}case"*=":{if(d&&typeof d=="string"){let m;for(let p of o)if(p.includes(`${d}`)){m=p;break}return!!m}return!1}case null:default:return!0}}}return!1},ot=(c,t,e={})=>{let n=M(c.name),{localName:s,namespaceURI:a,prefix:r}=t,{forgive:f}=e,{prefix:u,localName:h}=ve(n,t);t.ownerDocument.contentType==="text/html"&&/[A-Z][\\w-]*/i.test(s)&&(u=u.toLowerCase(),h=h.toLowerCase());let o,i;switch(s.indexOf(":")>-1?[o,i]=s.split(":"):(o=r||"",i=s),u){case"":return!o&&!a&&(h==="*"||h===i);case"*":return h==="*"||h===i;default:{let l=t.lookupNamespaceURI(u),d=t.lookupNamespaceURI(o);if(l===d&&u===o)return h==="*"||h===i;if(!f&&!l)throw new DOMException(`Undeclared namespace ${u}`,N);return!1}}};var H="next",Y="prev",we=class{#i;#n;#s;#t;#h;#c;#p;#f;#m;#l;#e;#d;#y;#b;#w;#r;#N;#u;#x;#E;#a;#o;constructor(t){this.#o=t,this.#n=new WeakMap,this.#h=new WeakMap,this.#m=new WeakMap,this.#w=new WeakMap,this.#c=null,this.#p=null,this.#l=null,this._registerEventListeners()}onError(t,e){if(!(e?.noexcept??this.#y))if(t instanceof DOMException||t instanceof this.#o.DOMException)if(t.name===A)this.#a&&console.warn(t.message);else throw new this.#o.DOMException(t.message,t.name);else throw t.name in this.#o?new this.#o[t.name](t.message):t}setup(t,e,n={}){let{noexcept:s,warn:a}=n;return this.#y=!!s,this.#a=!!a,this.#e=e,[this.#t,this.#r,this.#u]=Je(e),this.#N=t,[this.#i,this.#d]=this._correspond(t),this.#m=new WeakMap,this.#E=new WeakMap,this.#x=null,this}_registerEventListeners(){let t={capture:!0,passive:!0},e=[],n=["focus","focusin"];for(let r of n)e.push(this.#o.addEventListener(r,f=>{this.#p=f},t));let s=["keydown","keyup"];for(let r of s)e.push(this.#o.addEventListener(r,f=>{let{key:u}=f;Xe.includes(u)||(this.#c=f)},t));let a=["mouseover","mousedown","mouseup","click","mouseout"];for(let r of a)e.push(this.#o.addEventListener(r,f=>{this.#c=f},t));return e}_correspond(t){let e=[];this.#s=!1,this.#f=!1;let n;if(this.#h.has(this.#t)){let s=this.#h.get(this.#t);if(s&&s.has(`${t}`)){let a=s.get(`${t}`);n=a.ast,this.#s=a.descendant,this.#f=a.invalidate}}if(n){let s=n.length;for(let a=0;a<s;a++)n[a].dir=null,n[a].filtered=!1,n[a].find=!1,e[a]=[]}else{let s;try{s=W(t)}catch(p){this.onError(p)}let{branches:a,info:r}=z(s),{hasHasPseudoFunc:f,hasLogicalPseudoFunc:u,hasNthChildOfSelector:h,hasStatePseudoClass:o}=r,i=f||o||!!(u&&h),l=!1,d=0;n=[];for(let[...p]of a){let E=[],b=p.shift();if(b&&b.type!==v){let w=new Set;for(;b;){let y=b.name;if(b.type===v){let[C]=p;if(C.type===v)throw new DOMException(`Invalid selector ${t}`,N);y==="+"||y==="~"?i=!0:l=!0,E.push({combo:b,leaves:$e(w)}),w.clear()}else b&&(y&&typeof y=="string"&&(y=M(y),typeof y=="string"&&y!==b.name&&(b.name=y),/[|:]/.test(y)&&(b.namespace=!0)),w.add(b));if(p.length)b=p.shift();else{E.push({combo:null,leaves:$e(w)}),w.clear();break}}}n.push({branch:E,dir:null,filtered:!1,find:!1}),e[d]=[],d++}let m;this.#h.has(this.#t)?m=this.#h.get(this.#t):m=new Map,m.set(`${t}`,{ast:n,descendant:l,invalidate:i}),this.#h.set(this.#t,m),this.#s=l,this.#f=i}return[n,e]}_createTreeWalker(t,e={}){let{force:n=!1,whatToShow:s=1281}=e,a;return n?a=this.#t.createTreeWalker(t,s):this.#E.has(t)?a=this.#E.get(t):(a=this.#t.createTreeWalker(t,s),this.#E.set(t,a)),a}_prepareQuerySelectorWalker(){return this.#b=this._createTreeWalker(this.#e),this.#b}_collectNthChild(t,e,n){let{a:s,b:a,reverse:r,selector:f}=t,{parentNode:u}=e,h=new Set,o;if(f){if(this.#n.has(f))o=this.#n.get(f);else{let{branches:l}=z(f);o=l,this.#f||this.#n.set(f,o)}let{branches:i}=z(f);o=i}if(u){let i=this._createTreeWalker(u,{force:!0}),l=i.firstChild(),d=new Set,m=0;if(o)for(;l;){if(Oe(l)){let p;for(let E of o)if(p=this._matchLeaves(E,l,n),!p)break;p&&d.add(l)}m++,l=i.nextSibling()}else for(;l;)m++,l=i.nextSibling();if(s===0){if(a>0&&a<=m){if(d.size){l=g(u,i),r?l=i.lastChild():l=i.firstChild();let p=0;for(;l;){if(d.has(l)){if(p===a-1){h.add(l);break}p++}r?l=i.previousSibling():l=i.nextSibling()}}else if(!f){l=g(u,i),r?l=i.lastChild():l=i.firstChild();let p=0;for(;l;){if(p===a-1){h.add(l);break}r?l=i.previousSibling():l=i.nextSibling(),p++}}}}else{let p=a-1;if(s>0)for(;p<0;)p+=s;if(p>=0&&p<m){l=g(u,i),r?l=i.lastChild():l=i.firstChild();let E=0,b=s>0?0:a-1;for(;l&&(l&&p>=0&&p<m);)d.size?d.has(l)&&(b===p&&(h.add(l),p+=s),s>0?b++:b--):E===p&&(f||h.add(l),p+=s),r?l=i.previousSibling():l=i.nextSibling(),E++}}if(r&&h.size>1){let p=[...h];return new Set(p.reverse())}}else if(e===this.#r&&s+a===1)if(o){let i;for(let l of o)if(i=this._matchLeaves(l,e,n),i)break;i&&h.add(e)}else h.add(e);return h}_collectNthOfType(t,e){let{a:n,b:s,reverse:a}=t,{localName:r,namespaceURI:f,parentNode:u,prefix:h}=e,o=new Set;if(u){let i=this._createTreeWalker(u),l=g(u,i);l=i.firstChild();let d=0;for(;l;)d++,l=i.nextSibling();if(n===0){if(s>0&&s<=d){l=g(u,i),a?l=i.lastChild():l=i.firstChild();let m=0;for(;l;){let{localName:p,namespaceURI:E,prefix:b}=l;if(p===r&&b===h&&E===f){if(m===s-1){o.add(l);break}m++}a?l=i.previousSibling():l=i.nextSibling()}}}else{let m=s-1;if(n>0)for(;m<0;)m+=n;if(m>=0&&m<d){l=g(u,i),a?l=i.lastChild():l=i.firstChild();let p=n>0?0:s-1;for(;l;){let{localName:E,namespaceURI:b,prefix:w}=l;if(E===r&&w===h&&b===f){if(p===m&&(o.add(l),m+=n),m<0||m>=d)break;n>0?p++:p--}a?l=i.previousSibling():l=i.nextSibling()}}}if(a&&o.size>1){let m=[...o];return new Set(m.reverse())}}else e===this.#r&&n+s===1&&o.add(e);return o}_matchAnPlusB(t,e,n,s){let{nth:{a,b:r,name:f},selector:u}=t,h=new Map;if(f?(f==="even"?(h.set("a",2),h.set("b",0)):f==="odd"&&(h.set("a",2),h.set("b",1)),n.indexOf("last")>-1&&h.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?h.set("a",a*1):h.set("a",0),typeof r=="string"&&/-?\d+/.test(r)?h.set("b",r*1):h.set("b",0),n.indexOf("last")>-1&&h.set("reverse",!0)),n==="nth-child"||n==="nth-last-child"){u&&h.set("selector",u);let o=Object.fromEntries(h);return this._collectNthChild(o,e,s)}else if(n==="nth-of-type"||n==="nth-last-of-type"){let o=Object.fromEntries(h);return this._collectNthOfType(o,e)}return new Set}_matchHasPseudoFunc(t,e,n){if(Array.isArray(t)&&t.length){let s=[...t],[a]=s,{type:r}=a,f;r===v?f=s.shift():f={name:" ",type:v};let u=[];for(;s.length;){let[i]=s,{type:l}=i;if(l===v)break;u.push(s.shift())}let h={combo:f,leaves:u};n.dir=H;let o=this._matchCombinator(h,e,n);if(o.size){if(s.length){let i=!1;for(let l of o)if(i=this._matchHasPseudoFunc(s,l,n),i)break;return i}return!0}}return!1}_matchLogicalPseudoFunc(t,e,n){let{astName:s,branches:a,twigBranches:r}=t,f=(n.isShadowRoot||this.#u)&&e.nodeType===11;if(s==="has"){let u;for(let h of a)if(u=this._matchHasPseudoFunc(h,e,n),u)break;if(u)if(f){if(this.#x)return e}else return e}else{if(f){let o;for(let i of a)if(i.length>1){o=!0;break}else if(s==="not"){let[{type:l}]=i;if(l!==k){o=!0;break}}if(o)return null}n.forgive=s==="is"||s==="where";let u=r.length,h;for(let o=0;o<u;o++){let i=r[o],l=i.length-1,{leaves:d}=i[l];if(h=this._matchLeaves(d,e,n),h&&l>0){let m=new Set([e]);for(let p=l-1;p>=0;p--){let E=i[p],b=[];n.dir=Y;for(let w of m){let y=this._matchCombinator(E,w,n);y.size&&b.push(...y)}if(b.length)p===0?h=!0:m=new Set(b);else{h=!1;break}}}if(h)break}if(s==="not")return h?null:e;if(h)return e}return null}_matchPseudoClassSelector(t,e,n){let{children:s,name:a}=t,{localName:r,parentNode:f}=e,{forgive:u,warn:h=this.#a}=n,o=new Set;if(Array.isArray(s)&&P.includes(a)){if(!s.length&&a!=="is"&&a!=="where"){let d=(0,_.generate)(t);throw new DOMException(`Invalid selector ${d}`,N)}let i;if(this.#n.has(t))i=this.#n.get(t);else{let{branches:d}=z(t);if(a==="has"){let m;for(let p of s){let E=(0,_.find)(p,b=>P.includes(b.name)&&(0,_.find)(b,w=>w.name==="has")?b:null);if(E){let b=E.name;if(b==="is"||b==="where"){m=!0;break}else{let w=(0,_.generate)(t);throw new DOMException(`Invalid selector ${w}`,N)}}}if(m)return o;i={astName:a,branches:d}}else{let m=[];for(let[...p]of d){let E=[],b=new Set,w=p.shift();for(;w;)if(w.type===v?(E.push({combo:w,leaves:[...b]}),b.clear()):w&&b.add(w),p.length)w=p.shift();else{E.push({combo:null,leaves:[...b]}),b.clear();break}m.push(E)}i={astName:a,branches:d,twigBranches:m},this.#f||this.#n.set(t,i)}}let l=this._matchLogicalPseudoFunc(i,e,n);l&&o.add(l)}else if(Array.isArray(s))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){if(s.length!==1){let d=(0,_.generate)(t);throw new DOMException(`Invalid selector ${d}`,N)}let[i]=s;return this._matchAnPlusB(i,e,a,n)}else switch(a){case"dir":{if(s.length!==1){let d=(0,_.generate)(t);throw new DOMException(`Invalid selector ${d}`,N)}let[i]=s;rt(i,e)&&o.add(e);break}case"lang":{if(!s.length){let l=(0,_.generate)(t);throw new DOMException(`Invalid selector ${l}`,N)}let i;for(let l of s)if(i=nt(l,e),i)break;i&&o.add(e);break}case"state":{if(ue(e)){let[{value:i}]=s;if(i)if(e[i])o.add(e);else for(let l in e){let d=e[l];if(d instanceof this.#o.ElementInternals){d?.states?.has(i)&&o.add(e);break}}}break}case"current":case"nth-col":case"nth-last-col":{if(h)throw new DOMException(`Unsupported pseudo-class :${a}()`,A);break}case"host":case"host-context":break;case"contains":{if(h)throw new DOMException(`Unknown pseudo-class :${a}()`,A);break}default:if(!u)throw new DOMException(`Unknown pseudo-class :${a}()`,N)}else switch(a){case"any-link":case"link":{(r==="a"||r==="area")&&e.hasAttribute("href")&&o.add(e);break}case"local-link":{if((r==="a"||r==="area")&&e.hasAttribute("href")){let{href:i,origin:l,pathname:d}=new URL(this.#t.URL),m=new URL(e.getAttribute("href"),i);m.origin===l&&m.pathname===d&&o.add(e)}break}case"visited":break;case"hover":{let{target:i,type:l}=this.#c??{};/^(?:click|mouse(?:down|over|up))$/.test(l)&&e.contains(i)&&o.add(e);break}case"active":{let{buttons:i,target:l,type:d}=this.#c??{};d==="mousedown"&&i&1&&e.contains(l)&&o.add(e);break}case"target":{let{hash:i}=new URL(this.#t.URL);e.id&&i===`#${e.id}`&&this.#t.contains(e)&&o.add(e);break}case"target-within":{let{hash:i}=new URL(this.#t.URL);if(i){let l=i.replace(/^#/,""),d=this.#t.getElementById(l);for(;d;){if(d===e){o.add(e);break}d=d.parentNode}}break}case"scope":{this.#e.nodeType===1?!this.#u&&e===this.#e&&o.add(e):e===this.#t.documentElement&&o.add(e);break}case"focus":{e===this.#t.activeElement&&de(e)&&o.add(e);break}case"focus-visible":{if(e===this.#t.activeElement&&de(e)){let i;if(Ce(e))i=!0;else if(this.#p){let{relatedTarget:l,target:d}=this.#p;if(d===e)if(Ce(l))i=!0;else if(this.#c){let{key:m,target:p,type:E}=this.#c;p===l?(this.#l===null||d===this.#l)&&(i=!0):m==="Tab"?(E==="keydown"&&p!==e||E==="keyup"&&p===e)&&(p===d?(this.#l===null||p===this.#l&&l===null)&&(i=!0):i=!0):m&&(E==="keydown"||E==="keyup")&&p===e&&(i=!0)}else(l===null||l===this.#l)&&(i=!0)}i?(this.#l=e,o.add(e)):this.#l===e&&(this.#l=null)}break}case"focus-within":{let i,l=this.#t.activeElement;if(de(l))for(;l;){if(l===e){i=!0;break}l=l.parentNode}i&&o.add(e);break}case"open":case"closed":{(r==="details"||r==="dialog")&&(e.hasAttribute("open")?a==="open"&&o.add(e):a==="closed"&&o.add(e));break}case"disabled":case"enabled":{if([...ce,"fieldset","optgroup","option"].includes(r)||ue(e,{formAssociated:!0})){let l;if(e.disabled||e.hasAttribute("disabled"))l=!0;else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&(l=!0);else if(e.localName!=="optgroup"){let d=f;for(;d;)if(d.localName==="fieldset"&&(d.disabled||d.hasAttribute("disabled"))){let m=d.firstElementChild;for(;m&&m.localName!=="legend";)m=m.nextElementSibling;m&&m.contains(e)||(l=!0);break}else{if(d.localName==="form")break;if(d.parentNode?.nodeType===1){if(d.parentNode.localName==="form")break;d=d.parentNode}else break}}l?a==="disabled"&&o.add(e):a==="enabled"&&o.add(e)}break}case"read-only":case"read-write":{let i,l;switch(r){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?i=!0:l=!0;break}case"input":{(!e.type||Q.includes(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?i=!0:l=!0);break}default:ee(e)?l=!0:i=!0}i?a==="read-only"&&o.add(e):a==="read-write"&&l&&o.add(e);break}case"placeholder-shown":{let i;if(e.placeholder?i=e.placeholder:e.hasAttribute("placeholder")&&(i=e.getAttribute("placeholder")),typeof i=="string"&&!/[\r\n]/.test(i)){let l;r==="textarea"?l=e:r==="input"&&(e.hasAttribute("type")?[...Z,"number"].includes(e.getAttribute("type"))&&(l=e):l=e),l&&e.value===""&&o.add(e)}break}case"checked":{let i=e.getAttribute("type");(e.checked&&r==="input"&&(i==="checkbox"||i==="radio")||e.selected&&r==="option")&&o.add(e);break}case"indeterminate":{if(e.indeterminate&&r==="input"&&e.type==="checkbox"||r==="progress"&&!e.hasAttribute("value"))o.add(e);else if(r==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){let i=e.name,l=e.parentNode;for(;l&&l.localName!=="form";)l=l.parentNode;l||(l=this.#t.documentElement);let d=this._createTreeWalker(l),m=g(l,d);m=d.firstChild();let p;for(;m&&!(m.localName==="input"&&m.getAttribute("type")==="radio"&&(m.hasAttribute("name")?m.getAttribute("name")===i&&(p=!!m.checked):p=!!m.checked,p));)m=d.nextNode();p||o.add(e)}break}case"default":{let i=["checkbox","radio"],l=["button","reset"],d=["image","submit"],m=e.getAttribute("type");if(r==="button"&&!(e.hasAttribute("type")&&l.includes(m))||r==="input"&&e.hasAttribute("type")&&d.includes(m)){let p=e.parentNode;for(;p&&p.localName!=="form";)p=p.parentNode;if(p){let E=this._createTreeWalker(p),b=g(p,E);for(b=E.firstChild();b;){let w=b.localName,y=b.getAttribute("type"),C;if(w==="button"?C=!(b.hasAttribute("type")&&l.includes(y)):w==="input"&&(C=b.hasAttribute("type")&&d.includes(y)),C){b===e&&o.add(e);break}b=E.nextNode()}}}else(r==="input"&&e.hasAttribute("type")&&i.includes(m)&&e.hasAttribute("checked")||r==="option"&&e.hasAttribute("selected"))&&o.add(e);break}case"valid":case"invalid":{let i=[...ce,"form"];if(i.includes(r)){let l;e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&(l=!0):l=!0),l?a==="valid"&&o.add(e):a==="invalid"&&o.add(e)}else if(r==="fieldset"){let l=this._createTreeWalker(e),d=g(e,l);d=l.firstChild();let m;if(!d)m=!0;else for(;d&&!(i.includes(d.localName)&&(d.checkValidity()?d.maxLength>=0?m=d.maxLength>=d.value.length:m=!0:m=!1,!m));)d=l.nextNode();m?a==="valid"&&o.add(e):a==="invalid"&&o.add(e)}break}case"in-range":case"out-of-range":{let i=[...Te,"number","range"],l=e.getAttribute("type");if(r==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&i.includes(l)){let d=e.validity.rangeUnderflow||e.validity.rangeOverflow;(a==="out-of-range"&&d||a==="in-range"&&!d&&(e.hasAttribute("min")||e.hasAttribute("max")||l==="range"))&&o.add(e)}break}case"required":case"optional":{let i;if(r==="select"||r==="textarea")i=e;else if(r==="input")if(e.hasAttribute("type")){let l=[...Q,"checkbox","file","radio"],d=e.getAttribute("type");l.includes(d)&&(i=e)}else i=e;i&&(e.required||e.hasAttribute("required")?a==="required"&&o.add(e):a==="optional"&&o.add(e));break}case"root":{e===this.#t.documentElement&&o.add(e);break}case"empty":{if(e.hasChildNodes()){let i=this._createTreeWalker(e,{force:!0,whatToShow:4294967295}),l=i.firstChild(),d;for(;l&&(d=l.nodeType!==1&&l.nodeType!==3,!!d);)l=i.nextSibling();d&&o.add(e)}else o.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#r)&&o.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#r)&&o.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#r)&&o.add(e);break}case"first-of-type":{if(f){let[i]=this._collectNthOfType({a:0,b:1},e);i&&o.add(i)}else e===this.#r&&o.add(e);break}case"last-of-type":{if(f){let[i]=this._collectNthOfType({a:0,b:1,reverse:!0},e);i&&o.add(i)}else e===this.#r&&o.add(e);break}case"only-of-type":{if(f){let[i]=this._collectNthOfType({a:0,b:1},e);if(i===e){let[l]=this._collectNthOfType({a:0,b:1,reverse:!0},e);l===e&&o.add(e)}}else e===this.#r&&o.add(e);break}case"defined":{e.hasAttribute("is")||r.includes("-")?ue(e)&&o.add(e):(e instanceof this.#o.HTMLElement||e instanceof this.#o.SVGElement)&&o.add(e);break}case"popover-open":{e.popover&&Oe(e)&&o.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(h)throw new DOMException(`Unsupported pseudo-element ::${a}`,A);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)throw new DOMException(`Unsupported pseudo-class :${a}`,A);break}default:if(a.startsWith("-webkit-")){if(h)throw new DOMException(`Unsupported pseudo-class :${a}`,A)}else if(!u)throw new DOMException(`Unknown pseudo-class :${a}`,N)}return o}_matchShadowHostPseudoClass(t,e){let{children:n,name:s}=t;if(Array.isArray(n)){if(n.length!==1){let h=(0,_.generate)(t);throw new DOMException(`Invalid selector ${h}`,N)}let{branches:a}=z(n[0]),[r]=a,[...f]=r,{host:u}=e;if(s==="host"){let h;for(let o of f){let{type:i}=o;if(i===v){let l=(0,_.generate)(t);throw new DOMException(`Invalid selector ${l}`,N)}if(h=this._matchSelector(o,u).has(u),!h)break}return h?e:null}else if(s==="host-context"){let h=u,o;for(;h;){for(let i of f){let{type:l}=i;if(l===v){let d=(0,_.generate)(t);throw new DOMException(`Invalid selector ${d}`,N)}if(o=this._matchSelector(i,h).has(h),!o)break}if(o)break;h=h.parentNode}return o?e:null}throw new DOMException(`Invalid selector :${s}`,N)}else{if(s==="host")return e;throw new DOMException(`Invalid selector :${s}`,N)}}_matchSelector(t,e,n={}){let{type:s}=t,a=M(t.name),r=new Set;if(e.nodeType===1)switch(s){case B:{at(t,e)&&r.add(e);break}case R:{e.id===a&&r.add(e);break}case j:{e.classList.contains(a)&&r.add(e);break}case k:return this._matchPseudoClassSelector(t,e,n);case F:{ot(t,e,n)&&r.add(e);break}case O:default:Ee(a,s,n)}else if(this.#u&&s===k&&e.nodeType===11){if(P.includes(a))return n.isShadowRoot=!0,this._matchPseudoClassSelector(t,e,n);if(a==="host"||a==="host-context"){let f=this._matchShadowHostPseudoClass(t,e,n);f&&(this.#x=!0,r.add(f))}}return r}_matchLeaves(t,e,n){let s;if(this.#f?s=this.#m.get(t):s=this.#w.get(t),s&&s.has(e)){let{matched:a}=s.get(e);return a}else{let a=!0,r=[...ce,"fieldset","form"],f=["any-link","defined","dir","link"];e.nodeType===1&&r.includes(e.localName)&&(a=!1);let u;for(let h of t){switch(h.type){case B:case R:{a=!1;break}case k:{f.includes(h.name)&&(a=!1);break}default:}if(u=this._matchSelector(h,e,n).has(e),!u)break}return a&&(s||(s=new WeakMap),s.set(e,{matched:u}),this.#f?this.#m.set(t,s):this.#w.set(t,s)),u}}_findDescendantNodes(t,e,n){let[s,...a]=t,r=a.length>0,{type:f}=s,u=M(s.name),h=new Set,o=!1;if(this.#u||e.nodeType!==1)o=!0;else switch(f){case O:{Ee(u,f,n);break}case R:{if(this.#r.nodeType===1)o=!0;else{let i=this.#r.getElementById(u);i&&i!==e&&e.contains(i)&&(r?this._matchLeaves(a,i,n)&&h.add(i):h.add(i))}break}default:o=!0}if(o){let i=this._createTreeWalker(e),l=g(e,i);for(l=i.firstChild();l;)this._matchLeaves(t,l,n)&&h.add(l),l=i.nextNode()}return h}_matchCombinator(t,e,n){let{combo:s,leaves:a}=t,{name:r}=s,{parentNode:f}=e,{dir:u}=n,h=new Set;if(u===H)switch(r){case"+":{let o=e.nextElementSibling;o&&this._matchLeaves(a,o,n)&&h.add(o);break}case"~":{if(f){let o=e.nextElementSibling;for(;o;)this._matchLeaves(a,o,n)&&h.add(o),o=o.nextElementSibling}break}case">":{let o=e.firstElementChild;for(;o;)this._matchLeaves(a,o,n)&&h.add(o),o=o.nextElementSibling;break}case" ":default:{let o=this._findDescendantNodes(a,e,n);if(o.size)return o}}else switch(r){case"+":{let o=e.previousElementSibling;o&&this._matchLeaves(a,o,n)&&h.add(o);break}case"~":{if(f){let o=f.firstElementChild;for(;o&&o!==e;)this._matchLeaves(a,o,n)&&h.add(o),o=o.nextElementSibling}break}case">":{f&&this._matchLeaves(a,f,n)&&h.add(f);break}case" ":default:{let o=[],i=f;for(;i;)this._matchLeaves(a,i,n)&&o.push(i),i=i.parentNode;if(o.length)return new Set(o.reverse())}}return h}_findWalker(t,e,n={}){let{force:s,targetType:a}=n,r=this.#b,f=[],u=g(e,r,!!s);if(u)for((u.nodeType!==1||u===e&&u!==this.#r)&&(u=r.nextNode());u&&!(this._matchLeaves(t,u,{warn:this.#a})&&(f.push(u),a!==L));)u=r.nextNode();return f}_matchSelf(t){let e=[],n=!1;return this._matchLeaves(t,this.#e,{warn:this.#a})&&(e.push(this.#e),n=!0),[e,n]}_findLineal(t,e){let{complex:n}=e,s=[],a=!1,r=this._matchLeaves(t,this.#e,{warn:this.#a});if(r&&(s.push(this.#e),a=!0),!r||n){let f=this.#e.parentNode;for(;f&&(r=this._matchLeaves(t,f,{warn:this.#a}),r&&(s.push(f),a=!0),f.parentNode);)f=f.parentNode}return[s,a]}_findEntryNodes(t,e,n){let{leaves:s}=t,[a,...r]=s,f=r.length>0,{name:u,type:h}=a,o=[],i=!1,l=!1;switch(h){case O:{Ee(u,h,{warn:this.#a});break}case R:{if(e===D)[o,i]=this._matchSelf(s);else if(e===$)[o,i]=this._findLineal(s,{complex:n});else if(e===S&&this.#r.nodeType!==1){let d=this.#r.getElementById(u);d&&(f?this._matchLeaves(r,d,{warn:this.#a})&&(o.push(d),i=!0):(o.push(d),i=!0))}else o=this._findWalker(s,this.#e,{targetType:e}),o.length&&(i=!0);break}case j:{e===D?[o,i]=this._matchSelf(s):e===$?[o,i]=this._findLineal(s,{complex:n}):(o=this._findWalker(s,this.#e,{targetType:e}),o.length&&(i=!0));break}case F:{e===D?[o,i]=this._matchSelf(s):e===$?[o,i]=this._findLineal(s,{complex:n}):(o=this._findWalker(s,this.#e,{targetType:e}),o.length&&(i=!0));break}default:if(e!==$&&(u==="host"||u==="host-context")){let d;if(this.#u&&this.#e.nodeType===11?d=this._matchShadowHostPseudoClass(a,this.#e):f&&this.#e.nodeType===1&&(d=this._matchShadowHostPseudoClass(a,this.#e.shadowRoot)),d){let m;if(f){for(let p of r)if(/^host(?:-context)?$/.test(p.name)?m=this._matchShadowHostPseudoClass(p,d)===d:p.name==="has"?m=this._matchPseudoClassSelector(p,d,{}).has(d):m=!1,!m)break}else m=!0;m&&(o.push(d),i=!0)}}else e===D?[o,i]=this._matchSelf(s):e===$?[o,i]=this._findLineal(s,{complex:n}):e===S?(o=this._findWalker(s,this.#e,{targetType:e}),o.length&&(i=!0)):l=!0}return{compound:f,filtered:i,nodes:o,pending:l}}_collectNodes(t){let e=this.#i.values();if(t===L||t===S){let n=new Set,s=0;for(let{branch:a}of e){let r=a.length,f=r>1,u=a[0],h,o;if(f){let{combo:p,leaves:[{name:E,type:b}]}=u,w=a[r-1],{leaves:[{name:y,type:C}]}=w;if(h=H,o=u,this.#N.includes(":scope")||C===O||C===R)h=Y,o=w;else if(E==="*"&&b===F)h=Y,o=w;else if(y==="*"&&C===F)h=H,o=u;else if(r===2){let{name:se}=p;(se==="+"||se==="~")&&(h=Y,o=w)}}else h=Y,o=u;let{compound:i,filtered:l,nodes:d,pending:m}=this._findEntryNodes(o,t,f);d.length?(this.#i[s].find=!0,this.#d[s]=d):m&&n.add(new Map([["index",s],["twig",o]])),this.#i[s].dir=h,this.#i[s].filtered=l||!i,s++}if(n.size){let a,r;this.#e!==this.#r&&this.#e.nodeType===1?(a=this.#e,r=this.#b):(a=this.#r,r=this._createTreeWalker(a));let f=g(a,r);for(;f;){let u=!1;if(this.#e.nodeType===1?f===this.#e?u=!0:u=this.#e.contains(f):u=!0,u)for(let h of n){let{leaves:o}=h.get("twig");if(this._matchLeaves(o,f,{warn:this.#a})){let l=h.get("index");this.#i[l].filtered=!0,this.#i[l].find=!0,this.#d[l].push(f)}}f!==r.currentNode&&(f=g(f,r)),f=r.nextNode()}}}else{let n=0;for(let{branch:s}of e){let a=s[s.length-1],r=s.length>1,{compound:f,filtered:u,nodes:h}=this._findEntryNodes(a,t,r);h.length&&(this.#i[n].find=!0,this.#d[n]=h),this.#i[n].dir=Y,this.#i[n].filtered=u||!f,n++}}return[this.#i,this.#d]}_getCombinedNodes(t,e,n){let s=[];for(let a of e){let r=this._matchCombinator(t,a,{dir:n,warn:this.#a});r.size&&s.push(...r)}return s.length?new Set(s):new Set}_matchNodeNext(t,e,n){let{combo:s,index:a}=n,{combo:r,leaves:f}=t[a],u={combo:s,leaves:f},h=this._getCombinedNodes(u,e,H);if(h.size)if(a===t.length-1){let[o]=pe(h);return o}else return this._matchNodeNext(t,h,{combo:r,index:a+1});return null}_matchNodePrev(t,e,n){let{index:s}=n,a=t[s],r=new Set([e]),f=this._getCombinedNodes(a,r,Y);if(f.size){if(s===0)return e;{let u;for(let h of f)if(u=this._matchNodePrev(t,h,{index:s-1}),u)break;if(u)return e}}return null}find(t){(t===L||t===S)&&this._prepareQuerySelectorWalker();let[[...e],n]=this._collectNodes(t),s=e.length,a,r=new Set;for(let f=0;f<s;f++){let{branch:u,dir:h,find:o}=e[f],i=u.length;if(i&&o){let l=n[f],d=l.length,m=i-1;if(m===0)if((t===L||t===S)&&this.#e.nodeType===1)for(let p=0;p<d;p++){let E=l[p];if(E!==this.#e&&this.#e.contains(E)&&(r.add(E),t===S))break}else if(t===L)if(r.size){let p=[...r];r=new Set([...p,...l]),a=!0}else r=new Set(l);else{let[p]=l;r.add(p)}else if(t===L)if(h===H){let{combo:p}=u[0],E=p;for(let b of l){let w=new Set([b]);for(let y=1;y<i;y++){let{combo:C,leaves:se}=u[y],ft={combo:E,leaves:se};if(w=this._getCombinedNodes(ft,w,h),w.size)if(y===m)if(r.size){let ht=[...r];r=new Set([...ht,...w]),a=!0,E=p}else r=w,E=p;else E=C;else break}}}else for(let p of l){let E=new Set([p]);for(let b=m-1;b>=0;b--){let w=u[b];if(E=this._getCombinedNodes(w,E,h),E.size)b===0&&(r.add(p),i>1&&r.size>1&&(a=!0));else break}}else if(t===S&&h===H){let{combo:p}=u[0],E;for(let b of l)if(E=this._matchNodeNext(u,new Set([b]),{combo:p,index:1}),E){r.add(E);break}if(!E){let{leaves:b}=u[0],[w]=l,[y]=this._findWalker(b,w,{targetType:t});for(;y;){if(E=this._matchNodeNext(u,new Set([y]),{combo:p,index:1}),E){r.add(E);break}[y]=this._findWalker(b,y,{targetType:t,force:!0})}}}else{let p;for(let E of l)if(p=this._matchNodePrev(u,E,{index:m-1}),p){r.add(E);break}if(!p&&t===S){let{leaves:E}=u[m],[b]=l,[w]=this._findWalker(E,b,{targetType:t});for(;w;){if(p=this._matchNodePrev(u,w,{index:m-1}),p){r.add(w);break}[w]=this._findWalker(E,w,{targetType:t,force:!0})}}}}}return t===S?(r.delete(this.#e),r.size>1&&(r=new Set(pe(r)))):t===L&&(r.delete(this.#e),a&&r.size>1&&(r=new Set(pe(r)))),r}};var De=new RegExp(`${q}${le}${q}`,"i"),lt=new RegExp(`${q}${ze}${q}`,"i"),ct=new RegExp(`^${Ke}$`),Ie=class{#i;#n;#s;#t;constructor(t,e){this.#i=t,this.#n=e??t.document,this.#s=new we(t),this.#t=tt(t,e)}matches(t,e,n){if(e?.nodeType){if(e.nodeType!==1){let r=new this.#i.TypeError(`Unexpected node ${e.nodeName}`);this.#s.onError(r,n)}}else{let r=new this.#i.TypeError(`Unexpected type ${T(e)}`);this.#s.onError(r,n)}let s=e.ownerDocument;if(s===this.#n&&s.contentType==="text/html"&&e.parentNode){let r={complex:De.test(t),compound:!1,descend:!1,simple:!1,target:D};if(te(t,r))try{return this.#t.match(t,e)}catch{}}let a;try{this.#s.setup(t,e,n),a=this.#s.find(D).size}catch(r){this.#s.onError(r,n)}return!!a}closest(t,e,n){if(e?.nodeType){if(e.nodeType!==1){let r=new this.#i.TypeError(`Unexpected node ${e.nodeName}`);this.#s.onError(r,n)}}else{let r=new this.#i.TypeError(`Unexpected type ${T(e)}`);this.#s.onError(r,n)}let s=e.ownerDocument;if(s===this.#n&&s.contentType==="text/html"&&e.parentNode){let r={complex:De.test(t),compound:!1,descend:!1,simple:!1,target:$};if(te(t,r))try{return this.#t.closest(t,e)}catch{}}let a;try{this.#s.setup(t,e,n);let r=this.#s.find($);if(r.size){let f=e;for(;f;){if(r.has(f)){a=f;break}f=f.parentNode}}}catch(r){this.#s.onError(r,n)}return a??null}querySelector(t,e,n){if(!e?.nodeType){let r=new this.#i.TypeError(`Unexpected type ${T(e)}`);this.#s.onError(r,n)}let s;if(e.nodeType===9?s=e:s=e.ownerDocument,s===this.#n&&s.contentType==="text/html"){let r={complex:!1,compound:!(ct.test(t)||De.test(t)),descend:lt.test(t),simple:ct.test(t),target:S};if(te(t,r))try{return this.#t.first(t,e)}catch{}}let a;try{this.#s.setup(t,e,n);let r=this.#s.find(S);r.size&&([a]=r)}catch(r){this.#s.onError(r,n)}return a??null}querySelectorAll(t,e,n){if(!e?.nodeType){let r=new this.#i.TypeError(`Unexpected type ${T(e)}`);this.#s.onError(r,n)}let s;if(e.nodeType===9?s=e:s=e.ownerDocument,s===this.#n&&s.contentType==="text/html"){let r={complex:!1,compound:!1,descend:lt.test(t),simple:!1,target:L};if(te(t,r))try{return this.#t.select(t,e)}catch{}}let a;try{this.#s.setup(t,e,n);let r=this.#s.find(L);r.size&&(a=[...r])}catch(r){this.#s.onError(r,n)}return a??[]}};0&&(module.exports={DOMSelector});
|
|
3
|
+
/*!
|
|
4
|
+
* DOM Selector - A CSS selector engine.
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @copyright asamuzaK (Kazz)
|
|
7
|
+
* @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}
|
|
8
|
+
*/
|
|
9
|
+
//# sourceMappingURL=index.cjs.map
|