@asamuzakjp/dom-selector 4.6.5 → 5.0.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 CHANGED
@@ -290,45 +290,45 @@ See [benchmark](https://github.com/asamuzaK/domSelector/actions/workflows/benchm
290
290
 
291
291
  ### matches()
292
292
 
293
- |Selector|jsdom v24.1.0 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
293
+ |Selector|jsdom v24.1.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
294
294
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
295
- |simple selector:<br>`matches('.content')`|955,191 ops/sec ±1.19%|7,301 ops/sec ±0.75%|9,322 ops/sec ±0.65%|819,169 ops/sec ±0.43%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
296
- |compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|581,444 ops/sec ±1.46%|7,152 ops/sec ±0.70%|8,836 ops/sec ±1.32%|402,486 ops/sec ±0.77%|jsdom is the fastest and 1.4 times faster than patched-jsdom.|
297
- |compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|7,124 ops/sec ±0.90%|F|129,958 ops/sec ±0.22%|patched-jsdom is the fastest.|
298
- |compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|469,482 ops/sec ±1.48%|7,179 ops/sec ±0.74%|8,851 ops/sec ±0.71%|343,674 ops/sec ±0.48%|jsdom is the fastest and 1.4 times faster than patched-jsdom.|
299
- |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|152,787 ops/sec ±0.23%|F|5,806 ops/sec ±0.82%|131,245 ops/sec ±0.28%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
300
- |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box .block.inner:has(> .content)')`|F|F|5,610 ops/sec ±0.57%|9,285 ops/sec ±0.60%|patched-jsdom is the fastest.|
301
- |complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|407,178 ops/sec ±0.44%|F|6,039 ops/sec ±0.33%|332,047 ops/sec ±0.36%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
295
+ |simple selector:<br>`matches('.content')`|989,454 ops/sec ±1.51%|7,613 ops/sec ±1.10%|9,516 ops/sec ±0.60%|848,327 ops/sec ±0.66%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
296
+ |compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|602,507 ops/sec ±0.32%|7,328 ops/sec ±0.81%|9,052 ops/sec ±0.48%|405,877 ops/sec ±0.15%|jsdom is the fastest and 1.5 times faster than patched-jsdom.|
297
+ |compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|7,365 ops/sec ±0.90%|F|66,159 ops/sec ±0.98%|patched-jsdom is the fastest.|
298
+ |compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|479,695 ops/sec ±1.60%|7,470 ops/sec ±0.57%|8,804 ops/sec ±0.44%|346,257 ops/sec ±0.31%|jsdom is the fastest and 1.4 times faster than patched-jsdom.|
299
+ |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|154,869 ops/sec ±0.80%|F|5,845 ops/sec ±0.34%|132,313 ops/sec ±0.22%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
300
+ |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|5,754 ops/sec ±1.33%|21,105 ops/sec ±1.16%|patched-jsdom is the fastest.|
301
+ |complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|411,631 ops/sec ±0.31%|F|6,123 ops/sec ±0.38%|340,899 ops/sec ±0.19%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
302
302
 
303
303
  ### closest()
304
304
 
305
- |Selector|jsdom v24.1.0 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
305
+ |Selector|jsdom v24.1.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
306
306
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
307
- |simple selector:<br>`closest('.container')`|367,267 ops/sec ±0.24%|7,283 ops/sec ±0.67%|9,298 ops/sec ±0.69%|338,618 ops/sec ±1.73%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
308
- |compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|135,537 ops/sec ±0.34%|F|8,413 ops/sec ±1.50%|120,204 ops/sec ±1.90%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
309
- |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|139,190 ops/sec ±1.50%|F|5,821 ops/sec ±0.64%|119,681 ops/sec ±1.44%|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 .block.inner:has(> .content)')`|F|F|5,695 ops/sec ±0.58%|7,659 ops/sec ±1.85%|patched-jsdom is the fastest.|
311
- |complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|198,275 ops/sec ±0.59%|4,568 ops/sec ±0.73%|5,922 ops/sec ±0.50%|175,254 ops/sec ±0.27%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
307
+ |simple selector:<br>`closest('.container')`|379,529 ops/sec ±0.13%|7,469 ops/sec ±1.56%|9,306 ops/sec ±0.72%|346,182 ops/sec ±1.52%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
308
+ |compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|137,674 ops/sec ±1.76%|F|8,696 ops/sec ±0.72%|125,138 ops/sec ±1.62%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
309
+ |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|142,675 ops/sec ±0.43%|F|5,804 ops/sec ±0.87%|122,213 ops/sec ±1.38%|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)')`|F|F|5,733 ops/sec ±0.87%|17,024 ops/sec ±0.74%|patched-jsdom is the fastest.|
311
+ |complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|200,172 ops/sec ±1.51%|4,808 ops/sec ±1.19%|6,145 ops/sec ±0.53%|176,908 ops/sec ±1.42%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
312
312
 
313
313
  ### querySelector()
314
314
 
315
- |Selector|jsdom v24.1.0 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
315
+ |Selector|jsdom v24.1.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
316
316
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
317
- |simple selector:<br>`querySelector('.content')`|27,778 ops/sec ±1.10%|8,861 ops/sec ±0.73%|11,318 ops/sec ±0.66%|29,314 ops/sec ±1.45%|patched-jsdom is the fastest. patched-jsdom is 1.1 times faster than jsdom.|
318
- |compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|9,731 ops/sec ±1.41%|8,732 ops/sec ±1.50%|9,954 ops/sec ±0.57%|9,492 ops/sec ±1.59%|linkedom is the fastest and 1.0 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
319
- |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|221 ops/sec ±1.70%|F|1,273 ops/sec ±1.13%|272 ops/sec ±1.28%|linkedom is the fastest and 4.7 times faster than patched-jsdom. patched-jsdom is 1.2 times faster than jsdom.|
320
- |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box .block.inner:has(> .content)')`|F|F|1,594 ops/sec ±1.48%|487 ops/sec ±2.03%|linkedom is the fastest and 3.3 times faster than patched-jsdom.|
321
- |complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,108 ops/sec ±2.01%|F|9,977 ops/sec ±0.99%|90,725 ops/sec ±1.26%|patched-jsdom is the fastest. patched-jsdom is 29.2 times faster than jsdom.|
317
+ |simple selector:<br>`querySelector('.content')`|28,846 ops/sec ±0.23%|9,426 ops/sec ±0.83%|10,729 ops/sec ±0.58%|29,550 ops/sec ±0.89%|patched-jsdom is the fastest. patched-jsdom is 1.0 times faster than jsdom.|
318
+ |compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|10,152 ops/sec ±0.29%|9,270 ops/sec ±0.75%|10,907 ops/sec ±0.62%|9,682 ops/sec ±1.47%|linkedom is the fastest and 1.1 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
319
+ |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|229 ops/sec ±1.41%|F|1,319 ops/sec ±1.57%|281 ops/sec ±0.46%|linkedom is the fastest and 4.7 times faster than patched-jsdom. patched-jsdom is 1.2 times faster than jsdom.|
320
+ |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|1,606 ops/sec ±1.47%|803 ops/sec ±1.47%|linkedom is the fastest and 2.0 times faster than patched-jsdom.|
321
+ |complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,246 ops/sec ±1.58%|F|9,831 ops/sec ±0.80%|153,338 ops/sec ±1.76%|patched-jsdom is the fastest. patched-jsdom is 47.2 times faster than jsdom.|
322
322
 
323
323
  ### querySelectorAll()
324
324
 
325
- |Selector|jsdom v24.1.0 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
325
+ |Selector|jsdom v24.1.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
326
326
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
327
- |simple selector:<br>`querySelectorAll('.content')`|2,610 ops/sec ±0.33%|804 ops/sec ±0.47%|1,190 ops/sec ±1.78%|3,190 ops/sec ±0.91%|patched-jsdom is the fastest. patched-jsdom is 1.2 times faster than jsdom.|
328
- |compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|928 ops/sec ±1.31%|753 ops/sec ±0.25%|1,201 ops/sec ±0.18%|1,041 ops/sec ±0.30%|linkedom is the fastest and 1.2 times faster than patched-jsdom. patched-jsdom is 1.1 times faster than jsdom.|
329
- |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|227 ops/sec ±1.32%|F|425 ops/sec ±1.37%|270 ops/sec ±1.39%|linkedom is the fastest and 1.6 times faster than patched-jsdom. patched-jsdom is 1.2 times faster than jsdom.|
330
- |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box .block.inner:has(> .content)')`|F|F|451 ops/sec ±1.73%|535 ops/sec ±2.00%|patched-jsdom is the fastest.|
331
- |complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|302 ops/sec ±0.67%|F|520 ops/sec ±0.32%|254 ops/sec ±1.65%|linkedom is the fastest and 2.0 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
327
+ |simple selector:<br>`querySelectorAll('.content')`|2,660 ops/sec ±1.25%|782 ops/sec ±0.27%|1,234 ops/sec ±1.40%|3,276 ops/sec ±0.90%|patched-jsdom is the fastest. patched-jsdom is 1.2 times faster than jsdom.|
328
+ |compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|977 ops/sec ±1.05%|730 ops/sec ±1.55%|1,191 ops/sec ±1.07%|1,046 ops/sec ±1.11%|linkedom is the fastest and 1.1 times faster than patched-jsdom. patched-jsdom is 1.1 times faster than jsdom.|
329
+ |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|228 ops/sec ±1.21%|F|428 ops/sec ±1.36%|279 ops/sec ±1.28%|linkedom is the fastest and 1.5 times faster than patched-jsdom. patched-jsdom is 1.2 times faster than jsdom.|
330
+ |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|465 ops/sec ±0.20%|924 ops/sec ±0.52%|patched-jsdom is the fastest.|
331
+ |complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|312 ops/sec ±1.25%|F|519 ops/sec ±1.57%|780 ops/sec ±2.24%|patched-jsdom is the fastest. patched-jsdom is 2.5 times faster than jsdom.|
332
332
 
333
333
 
334
334
  ## Acknowledgments
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},n=(r,e,t,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!l.call(r,o)&&o!==t&&a(r,o,{get:()=>e[o],enumerable:!(c=f(e,o))||c.enumerable});return r};var p=r=>n(a({},"__esModule",{value:!0}),r);var s={};m(s,{DOMSelector:()=>d.Finder});module.exports=p(s);var d=require("./js/finder.js");/*!
1
+ var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var E=(h,e)=>{for(var t in e)p(h,t,{get:e[t],enumerable:!0})},d=(h,e,t,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!T.call(h,i)&&i!==t&&p(h,i,{get:()=>e[i],enumerable:!(c=u(e,i))||c.enumerable});return h};var _=h=>d(p({},"__esModule",{value:!0}),h);var x={};E(x,{DOMSelector:()=>y});module.exports=_(x);var l=require("./js/dom-util.js"),m=require("./js/finder.js"),f=require("./js/nwsapi.js"),s=require("./js/constant.js");/*!
2
2
  * DOM Selector - A CSS selector engine.
3
3
  * @license MIT
4
4
  * @copyright asamuzaK (Kazz)
5
5
  * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}
6
- */0&&(module.exports={DOMSelector});
6
+ */class y extends m.Finder{#t;#e;constructor(e,t){super(e,t),this.#t=t??e.document,this.#e=(0,f.initNwsapi)(this.#t)}matches(e,t,c){let i;try{if(t?.nodeType!==s.ELEMENT_NODE){const n=`Unexpected node ${t?.nodeName}`;throw new TypeError(n)}const r=t.ownerDocument;if(r===this.#t&&r.contentType==="text/html"){const n={complex:s.REG_COMPLEX.test(e),descendant:!0,target:s.TARGET_SELF};if((0,f.filterSelector)(e,n))return this.#e.match(e,t)}this._setup(e,t,c),i=this._find(s.TARGET_SELF).size}catch(r){this._onError(r)}return!!i}closest(e,t,c){let i;try{if(t?.nodeType!==s.ELEMENT_NODE){const n=`Unexpected node ${t?.nodeName}`;throw new TypeError(n)}const r=t.ownerDocument;if(r===this.#t&&r.contentType==="text/html"){const n={complex:s.REG_COMPLEX.test(e),descendant:!0,target:s.TARGET_LINEAL};if((0,f.filterSelector)(e,n))return this.#e.closest(e,t)}this._setup(e,t,c);const o=this._find(s.TARGET_LINEAL);if(o.size){let n=t;for(;n;){if(o.has(n)){i=n;break}n=n.parentNode}}}catch(r){this._onError(r)}return i??null}querySelector(e,t,c){let i;try{let r;if(t?.nodeType===s.DOCUMENT_NODE?r=t:r=t?.ownerDocument,r===this.#t&&r?.contentType==="text/html"&&(0,f.filterSelector)(e,{complex:!1,descendant:!1,target:s.TARGET_FIRST}))return this.#e.first(e,t);this._setup(e,t,c);const o=this._find(s.TARGET_FIRST);o.delete(t),o.size&&([i]=(0,l.sortNodes)(o))}catch(r){this._onError(r)}return i??null}querySelectorAll(e,t,c){let i;try{let r;if(t?.nodeType===s.DOCUMENT_NODE?r=t:r=t?.ownerDocument,r===this.#t&&r?.contentType==="text/html"&&(0,f.filterSelector)(e,{complex:!1,descendant:!0,target:s.TARGET_ALL}))return this.#e.select(e,t);this._setup(e,t,c);const o=this._find(s.TARGET_ALL);o.delete(t),o.size&&(i=[...o])}catch(r){this._onError(r)}return i??[]}}0&&(module.exports={DOMSelector});
7
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.js"],
4
- "sourcesContent": ["/*!\n * DOM Selector - A CSS selector engine.\n * @license MIT\n * @copyright asamuzaK (Kazz)\n * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}\n */\n\n/* export */\nexport { Finder as DOMSelector } from './js/finder.js';\n"],
5
- "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2CAAAE,EAAAF,GAQA,IAAAG,EAAsC,0BARtC;AAAA;AAAA;AAAA;AAAA;",
6
- "names": ["src_exports", "__export", "__toCommonJS", "import_finder"]
4
+ "sourcesContent": ["/*!\n * DOM Selector - A CSS selector engine.\n * @license MIT\n * @copyright asamuzaK (Kazz)\n * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}\n */\n\n/* import */\nimport { sortNodes } from './js/dom-util.js';\nimport { Finder } from './js/finder.js';\nimport { filterSelector, initNwsapi } from './js/nwsapi.js';\n\n/* constants */\nimport {\n DOCUMENT_NODE, ELEMENT_NODE, REG_COMPLEX, TARGET_ALL, TARGET_FIRST,\n TARGET_LINEAL, TARGET_SELF\n} from './js/constant.js';\n\nexport class DOMSelector extends Finder {\n /* private fields */\n #document;\n #nwsapi;\n\n /**\n * construct\n * @param {object} window - window\n * @param {object} document - document\n */\n constructor(window, document) {\n super(window, document);\n this.#document = document ?? window.document;\n this.#nwsapi = initNwsapi(this.#document);\n }\n\n /**\n * matches\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {boolean} - `true` if matched `false` otherwise\n */\n matches(selector, node, opt) {\n let res;\n try {\n if (node?.nodeType !== ELEMENT_NODE) {\n const msg = `Unexpected node ${node?.nodeName}`;\n throw new TypeError(msg);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n descendant: true,\n target: TARGET_SELF\n };\n if (filterSelector(selector, filterOpt)) {\n return this.#nwsapi.match(selector, node);\n }\n }\n this._setup(selector, node, opt);\n const nodes = this._find(TARGET_SELF);\n res = nodes.size;\n } catch (e) {\n this._onError(e);\n }\n return !!res;\n }\n\n /**\n * closest\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n closest(selector, node, opt) {\n let res;\n try {\n if (node?.nodeType !== ELEMENT_NODE) {\n const msg = `Unexpected node ${node?.nodeName}`;\n throw new TypeError(msg);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n descendant: true,\n target: TARGET_LINEAL\n };\n if (filterSelector(selector, filterOpt)) {\n return this.#nwsapi.closest(selector, node);\n }\n }\n this._setup(selector, node, opt);\n const nodes = this._find(TARGET_LINEAL);\n if (nodes.size) {\n let refNode = node;\n while (refNode) {\n if (nodes.has(refNode)) {\n res = refNode;\n break;\n }\n refNode = refNode.parentNode;\n }\n }\n } catch (e) {\n this._onError(e);\n }\n return res ?? null;\n }\n\n /**\n * query selector\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n querySelector(selector, node, opt) {\n let res;\n try {\n let document;\n if (node?.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node?.ownerDocument;\n }\n if (document === this.#document &&\n document?.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n descendant: false,\n target: TARGET_FIRST\n };\n if (filterSelector(selector, filterOpt)) {\n return this.#nwsapi.first(selector, node);\n }\n }\n this._setup(selector, node, opt);\n const nodes = this._find(TARGET_FIRST);\n nodes.delete(node);\n if (nodes.size) {\n [res] = sortNodes(nodes);\n }\n } catch (e) {\n this._onError(e);\n }\n return res ?? null;\n }\n\n /**\n * query selector all\n * NOTE: returns Array, not NodeList\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {Array.<object|undefined>} - collection of matched nodes\n */\n querySelectorAll(selector, node, opt) {\n let res;\n try {\n let document;\n if (node?.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node?.ownerDocument;\n }\n if (document === this.#document &&\n document?.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n descendant: true,\n target: TARGET_ALL\n };\n if (filterSelector(selector, filterOpt)) {\n return this.#nwsapi.select(selector, node);\n }\n }\n this._setup(selector, node, opt);\n const nodes = this._find(TARGET_ALL);\n nodes.delete(node);\n if (nodes.size) {\n res = [...nodes];\n }\n } catch (e) {\n this._onError(e);\n }\n return res ?? [];\n }\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["src_exports", "__export", "DOMSelector", "__toCommonJS", "import_dom_util", "import_finder", "import_nwsapi", "import_constant", "#document", "#nwsapi", "window", "document", "selector", "node", "opt", "res", "msg", "filterOpt", "e", "nodes", "refNode"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var n in t)T(o,n,{get:t[n],enumerable:!0})},H=(o,t,n,I)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!d.call(o,s)&&s!==n&&T(o,s,{get:()=>t[s],enumerable:!(I=F(t,s))||I.enumerable});return o};var u=o=>H(T({},"__esModule",{value:!0}),o);var zt={};Y(zt,{ALPHA_NUM:()=>R,ANB:()=>G,AN_PLUS_B:()=>B,BIT_01:()=>q,BIT_02:()=>J,BIT_04:()=>tt,BIT_08:()=>ot,BIT_16:()=>et,BIT_32:()=>st,BIT_FFFF:()=>rt,BIT_HYPHEN:()=>Et,CHILD_IDX:()=>A,COMBINATOR:()=>m,COMBO:()=>O,COMPLEX:()=>L,COMPLEX_L:()=>N,COMPOUND:()=>E,COMPOUND_A:()=>C,COMPOUND_B:()=>S,COMPOUND_I:()=>l,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>Rt,DOCUMENT_NODE:()=>Tt,DOCUMENT_POSITION_CONTAINED_BY:()=>Ct,DOCUMENT_POSITION_CONTAINS:()=>Lt,DOCUMENT_POSITION_PRECEDING:()=>$t,DUO:()=>nt,ELEMENT_NODE:()=>pt,EMPTY:()=>w,HEX:()=>ct,IDENTIFIER:()=>g,LANG_PART:()=>D,LOGICAL_COMPLEX:()=>a,LOGICAL_COMPOUND:()=>M,LOGICAL_KEY:()=>p,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>i,NOT_SUPPORTED_ERR:()=>h,NTH:()=>X,N_TH:()=>_,PSEUDO_CLASSES:()=>x,RAW:()=>b,REG_ANCHOR:()=>Gt,REG_CHILD_INDEXED:()=>Pt,REG_COMPLEX:()=>it,REG_DIR:()=>lt,REG_FORM:()=>at,REG_FORM_CTRL:()=>Mt,REG_FORM_VALID:()=>Ft,REG_HEX:()=>Ut,REG_INTERACT:()=>dt,REG_INVALID_SELECTOR:()=>Yt,REG_LANG:()=>Ht,REG_LANG_QUOTED:()=>ut,REG_LOGICAL_COMPLEX:()=>Bt,REG_LOGICAL_COMPOUND:()=>mt,REG_LOGICAL_EMPTY:()=>wt,REG_LOGICAL_KEY:()=>gt,REG_LOGICAL_PSEUDO:()=>ht,REG_SHADOW_HOST:()=>Xt,REG_SHADOW_MODE:()=>bt,REG_SHADOW_PSEUDO:()=>ft,REG_TYPE_CHECK:()=>Wt,REG_TYPE_DATE:()=>yt,REG_TYPE_RANGE:()=>kt,REG_TYPE_RESET:()=>Kt,REG_TYPE_SUBMIT:()=>Zt,REG_TYPE_TEXT:()=>vt,SELECTOR:()=>f,SELECTOR_ATTR:()=>W,SELECTOR_CLASS:()=>y,SELECTOR_ID:()=>k,SELECTOR_LIST:()=>K,SELECTOR_PSEUDO_CLASS:()=>Z,SELECTOR_PSEUDO_ELEMENT:()=>v,SELECTOR_TYPE:()=>z,SHOW_ALL:()=>St,SHOW_DOCUMENT:()=>Nt,SHOW_DOCUMENT_FRAGMENT:()=>It,SHOW_ELEMENT:()=>At,STRING:()=>V,SUB_TYPE:()=>r,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>e,TAG_TYPE_I:()=>$,TEXT_NODE:()=>Ot,TYPE_FROM:()=>xt,TYPE_TO:()=>_t,U_FFFD:()=>j,WALKER_FILTER:()=>Dt});module.exports=u(zt);const B="AnPlusB",m="Combinator",w="__EMPTY__",g="Identifier",h="NotSupportedError",X="Nth",b="Raw",f="Selector",W="AttributeSelector",y="ClassSelector",k="IdSelector",K="SelectorList",Z="PseudoClassSelector",v="PseudoElementSelector",z="TypeSelector",V="String",Q="SyntaxError",j="\uFFFD",q=1,J=2,tt=4,ot=8,et=16,st=32,rt=65535,Et=45,nt=2,ct=16,xt=8,_t=-1,pt=1,Ot=3,Tt=9,Rt=11,$t=2,Lt=8,Ct=16,St=4294967295,Nt=256,It=1024,At=1,Dt=1281,R="[A-Z\\d]+",A="(?:first|last|only)-(?:child|of-type)",c="(?:0|[1-9]\\d*)",D=`(?:-${R})*`,x=`(?:any-)?link|${A}|checked|empty|indeterminate|root|target|visited`,G=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${G})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",$="\\*|[A-Z][\\w-]*",p="(?:is|not)",E=`(?:${e}|(?:${e})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",L=`${E}(?:${O}${E})*`,P=`:is\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,i=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,C=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,S=`(?:${e}|(?:${e})?(?:${r}|${i})+)`,l=`(?:${$}|(?:${$})?(?:${r})+)`,N=`${S}(?:${O}${S})*`,a=`${p}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,M=`${p}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,Gt=/^a(?:rea)?$/,Pt=new RegExp(`:(?!${x}|${_})`),it=new RegExp(`${O}${l}`,"i"),lt=/^(?:ltr|rtl)$/,at=/^(?:button|fieldset|form|input|select|textarea)$/,Mt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ft=/^(?:button|form|input|select|textarea)$/,Ut=/^([\da-f]{1,6}\s?)/i,dt=/^(?:details|dialog)$/,Yt=/^$|^\s*>|,\s*$/,Ht=new RegExp(`^(?:\\*-)?${R}${D}$`,"i"),ut=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,Bt=new RegExp(`:(?!${x}|${_}|${a})`),mt=new RegExp(`:(?!${x}|${_}|${M})`),wt=/(:(is|where)\(\s*\))/,gt=new RegExp(`:${p}\\(`),ht=/^(?:has|is|not|where)$/,Xt=/^host(?:-context)?$/,bt=/^(?:close|open)$/,ft=/^part|slotted$/,Wt=/^(?:checkbox|radio)$/,yt=/^(?:date(?:time-local)?|month|time|week)$/,kt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Kt=/^(?:button|reset)$/,Zt=/^(?:image|submit)$/,vt=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
1
+ var O=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var n in t)O(o,n,{get:t[n],enumerable:!0})},H=(o,t,n,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!d.call(o,s)&&s!==n&&O(o,s,{get:()=>t[s],enumerable:!(N=F(t,s))||N.enumerable});return o};var u=o=>H(O({},"__esModule",{value:!0}),o);var qt={};Y(qt,{ALPHA_NUM:()=>R,ANB:()=>D,AN_PLUS_B:()=>B,BIT_01:()=>et,BIT_02:()=>st,BIT_04:()=>rt,BIT_08:()=>Et,BIT_16:()=>nt,BIT_32:()=>ct,BIT_FFFF:()=>xt,BIT_HYPHEN:()=>_t,CHILD_IDX:()=>I,COMBINATOR:()=>m,COMBO:()=>T,COMPLEX:()=>L,COMPLEX_L:()=>C,COMPOUND:()=>E,COMPOUND_A:()=>A,COMPOUND_B:()=>S,COMPOUND_I:()=>i,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>St,DOCUMENT_NODE:()=>At,DOCUMENT_POSITION_CONTAINED_BY:()=>It,DOCUMENT_POSITION_CONTAINS:()=>Nt,DOCUMENT_POSITION_PRECEDING:()=>Ct,DUO:()=>pt,ELEMENT_NODE:()=>$t,EMPTY:()=>w,HEX:()=>Tt,IDENTIFIER:()=>g,LANG_PART:()=>G,LOGICAL_COMPLEX:()=>a,LOGICAL_COMPOUND:()=>M,LOGICAL_KEY:()=>p,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>l,NOT_SUPPORTED_ERR:()=>h,NTH:()=>X,N_TH:()=>_,PSEUDO_CLASSES:()=>x,RAW:()=>f,REG_ANCHOR:()=>at,REG_CHILD_INDEXED:()=>Mt,REG_COMPLEX:()=>Ft,REG_DIR:()=>Ut,REG_FORM:()=>dt,REG_FORM_CTRL:()=>Yt,REG_FORM_VALID:()=>Ht,REG_HEX:()=>ut,REG_INTERACT:()=>Bt,REG_INVALID_SELECTOR:()=>mt,REG_LANG:()=>wt,REG_LANG_QUOTED:()=>gt,REG_LOGICAL_COMPLEX:()=>ht,REG_LOGICAL_COMPOUND:()=>Xt,REG_LOGICAL_EMPTY:()=>ft,REG_LOGICAL_KEY:()=>bt,REG_LOGICAL_PSEUDO:()=>Wt,REG_SHADOW_HOST:()=>yt,REG_SHADOW_MODE:()=>kt,REG_SHADOW_PSEUDO:()=>Kt,REG_TYPE_CHECK:()=>Zt,REG_TYPE_DATE:()=>vt,REG_TYPE_RANGE:()=>zt,REG_TYPE_RESET:()=>Vt,REG_TYPE_SUBMIT:()=>Qt,REG_TYPE_TEXT:()=>jt,SELECTOR:()=>b,SELECTOR_ATTR:()=>W,SELECTOR_CLASS:()=>y,SELECTOR_ID:()=>k,SELECTOR_LIST:()=>K,SELECTOR_PSEUDO_CLASS:()=>Z,SELECTOR_PSEUDO_ELEMENT:()=>v,SELECTOR_TYPE:()=>z,SHOW_ALL:()=>Gt,SHOW_DOCUMENT:()=>Dt,SHOW_DOCUMENT_FRAGMENT:()=>Pt,SHOW_ELEMENT:()=>lt,STRING:()=>V,SUB_TYPE:()=>r,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>e,TAG_TYPE_I:()=>$,TARGET_ALL:()=>j,TARGET_FIRST:()=>q,TARGET_LINEAL:()=>J,TARGET_SELF:()=>tt,TEXT_NODE:()=>Lt,TYPE_FROM:()=>Ot,TYPE_TO:()=>Rt,U_FFFD:()=>ot,WALKER_FILTER:()=>it});module.exports=u(qt);const B="AnPlusB",m="Combinator",w="__EMPTY__",g="Identifier",h="NotSupportedError",X="Nth",f="Raw",b="Selector",W="AttributeSelector",y="ClassSelector",k="IdSelector",K="SelectorList",Z="PseudoClassSelector",v="PseudoElementSelector",z="TypeSelector",V="String",Q="SyntaxError",j="all",q="first",J="lineal",tt="self",ot="\uFFFD",et=1,st=2,rt=4,Et=8,nt=16,ct=32,xt=65535,_t=45,pt=2,Tt=16,Ot=8,Rt=-1,$t=1,Lt=3,At=9,St=11,Ct=2,Nt=8,It=16,Gt=4294967295,Dt=256,Pt=1024,lt=1,it=1281,R="[A-Z\\d]+",I="(?:first|last|only)-(?:child|of-type)",c="(?:0|[1-9]\\d*)",G=`(?:-${R})*`,x=`(?:any-)?link|${I}|checked|empty|indeterminate|root|target|visited`,D=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${D})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",$="\\*|[A-Z][\\w-]*",p="(?:is|not)",E=`(?:${e}|(?:${e})?(?:${r})+)`,T="\\s?[\\s>~+]\\s?",L=`${E}(?:${T}${E})*`,P=`:is\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,l=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,A=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,S=`(?:${e}|(?:${e})?(?:${r}|${l})+)`,i=`(?:${$}|(?:${$})?(?:${r})+)`,C=`${S}(?:${T}${S})*`,a=`${p}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,M=`${p}\\(\\s*${A}(?:\\s*,\\s*${A})*\\s*\\)`,at=/^a(?:rea)?$/,Mt=new RegExp(`:(?!${x}|${_})`),Ft=new RegExp(`${T}${i}`,"i"),Ut=/^(?:ltr|rtl)$/,dt=/^(?:button|fieldset|form|input|select|textarea)$/,Yt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ht=/^(?:button|form|input|select|textarea)$/,ut=/^([\da-f]{1,6}\s?)/i,Bt=/^(?:details|dialog)$/,mt=/^$|^\s*>|,\s*$/,wt=new RegExp(`^(?:\\*-)?${R}${G}$`,"i"),gt=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,ht=new RegExp(`:(?!${x}|${_}|${a})`),Xt=new RegExp(`:(?!${x}|${_}|${M})`),ft=/(:(is|where)\(\s*\))/,bt=new RegExp(`:${p}\\(`),Wt=/^(?:has|is|not|where)$/,yt=/^host(?:-context)?$/,kt=/^(?:close|open)$/,Kt=/^part|slotted$/,Zt=/^(?:checkbox|radio)$/,vt=/^(?:date(?:time-local)?|month|time|week)$/,zt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Vt=/^(?:button|reset)$/,Qt=/^(?:image|submit)$/,jt=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,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 CHILD_IDX = '(?:first|last|only)-(?:child|of-type)';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const PSEUDO_CLASSES =\n `(?:any-)?link|${CHILD_IDX}|checked|empty|indeterminate|root|target|visited`;\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, note that [foo|=bar] is excluded\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: :has() and :where() are excluded\nexport const LOGICAL_KEY = '(?:is|not)';\nexport const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const COMBO = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;\nexport const NESTED_LOGICAL_A =\n `:is\\\\(\\\\s*${COMPOUND}(?:\\\\s*,\\\\s*${COMPOUND})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_B =\n `:is\\\\(\\\\s*${COMPLEX}(?:\\\\s*,\\\\s*${COMPLEX})*\\\\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_I =\n `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;\nexport const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;\nexport const LOGICAL_COMPLEX =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_L}(?:\\\\s*,\\\\s*${COMPLEX_L})*\\\\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(`:(?!${PSEUDO_CLASSES}|${N_TH})`);\nexport const REG_COMPLEX = new RegExp(`${COMBO}${COMPOUND_I}`, 'i');\nexport const REG_DIR = /^(?:ltr|rtl)$/;\nexport const REG_FORM = /^(?:button|fieldset|form|input|select|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 =\n new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPLEX})`);\nexport const REG_LOGICAL_COMPOUND =\n new RegExp(`:(?!${PSEUDO_CLASSES}|${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", "CHILD_IDX", "COMBINATOR", "COMBO", "COMPLEX", "COMPLEX_L", "COMPOUND", "COMPOUND_A", "COMPOUND_B", "COMPOUND_I", "DIGIT", "DOCUMENT_FRAGMENT_NODE", "DOCUMENT_NODE", "DOCUMENT_POSITION_CONTAINED_BY", "DOCUMENT_POSITION_CONTAINS", "DOCUMENT_POSITION_PRECEDING", "DUO", "ELEMENT_NODE", "EMPTY", "HEX", "IDENTIFIER", "LANG_PART", "LOGICAL_COMPLEX", "LOGICAL_COMPOUND", "LOGICAL_KEY", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NOT_SUPPORTED_ERR", "NTH", "N_TH", "PSEUDO_CLASSES", "RAW", "REG_ANCHOR", "REG_CHILD_INDEXED", "REG_COMPLEX", "REG_DIR", "REG_FORM", "REG_FORM_CTRL", "REG_FORM_VALID", "REG_HEX", "REG_INTERACT", "REG_INVALID_SELECTOR", "REG_LANG", "REG_LANG_QUOTED", "REG_LOGICAL_COMPLEX", "REG_LOGICAL_COMPOUND", "REG_LOGICAL_EMPTY", "REG_LOGICAL_KEY", "REG_LOGICAL_PSEUDO", "REG_SHADOW_HOST", "REG_SHADOW_MODE", "REG_SHADOW_PSEUDO", "REG_TYPE_CHECK", "REG_TYPE_DATE", "REG_TYPE_RANGE", "REG_TYPE_RESET", "REG_TYPE_SUBMIT", "REG_TYPE_TEXT", "SELECTOR", "SELECTOR_ATTR", "SELECTOR_CLASS", "SELECTOR_ID", "SELECTOR_LIST", "SELECTOR_PSEUDO_CLASS", "SELECTOR_PSEUDO_ELEMENT", "SELECTOR_TYPE", "SHOW_ALL", "SHOW_DOCUMENT", "SHOW_DOCUMENT_FRAGMENT", "SHOW_ELEMENT", "STRING", "SUB_TYPE", "SYNTAX_ERR", "TAG_TYPE", "TAG_TYPE_I", "TEXT_NODE", "TYPE_FROM", "TYPE_TO", "U_FFFD", "WALKER_FILTER", "__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 TARGET_ALL = 'all';\nexport const TARGET_FIRST = 'first';\nexport const TARGET_LINEAL = 'lineal';\nexport const TARGET_SELF = 'self';\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 CHILD_IDX = '(?:first|last|only)-(?:child|of-type)';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const PSEUDO_CLASSES =\n `(?:any-)?link|${CHILD_IDX}|checked|empty|indeterminate|root|target|visited`;\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, note that [foo|=bar] is excluded\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: :has() and :where() are excluded\nexport const LOGICAL_KEY = '(?:is|not)';\nexport const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const COMBO = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;\nexport const NESTED_LOGICAL_A =\n `:is\\\\(\\\\s*${COMPOUND}(?:\\\\s*,\\\\s*${COMPOUND})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_B =\n `:is\\\\(\\\\s*${COMPLEX}(?:\\\\s*,\\\\s*${COMPLEX})*\\\\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_I =\n `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;\nexport const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;\nexport const LOGICAL_COMPLEX =\n `${LOGICAL_KEY}\\\\(\\\\s*${COMPLEX_L}(?:\\\\s*,\\\\s*${COMPLEX_L})*\\\\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(`:(?!${PSEUDO_CLASSES}|${N_TH})`);\nexport const REG_COMPLEX = new RegExp(`${COMBO}${COMPOUND_I}`, 'i');\nexport const REG_DIR = /^(?:ltr|rtl)$/;\nexport const REG_FORM = /^(?:button|fieldset|form|input|select|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 =\n new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPLEX})`);\nexport const REG_LOGICAL_COMPOUND =\n new RegExp(`:(?!${PSEUDO_CLASSES}|${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", "CHILD_IDX", "COMBINATOR", "COMBO", "COMPLEX", "COMPLEX_L", "COMPOUND", "COMPOUND_A", "COMPOUND_B", "COMPOUND_I", "DIGIT", "DOCUMENT_FRAGMENT_NODE", "DOCUMENT_NODE", "DOCUMENT_POSITION_CONTAINED_BY", "DOCUMENT_POSITION_CONTAINS", "DOCUMENT_POSITION_PRECEDING", "DUO", "ELEMENT_NODE", "EMPTY", "HEX", "IDENTIFIER", "LANG_PART", "LOGICAL_COMPLEX", "LOGICAL_COMPOUND", "LOGICAL_KEY", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NOT_SUPPORTED_ERR", "NTH", "N_TH", "PSEUDO_CLASSES", "RAW", "REG_ANCHOR", "REG_CHILD_INDEXED", "REG_COMPLEX", "REG_DIR", "REG_FORM", "REG_FORM_CTRL", "REG_FORM_VALID", "REG_HEX", "REG_INTERACT", "REG_INVALID_SELECTOR", "REG_LANG", "REG_LANG_QUOTED", "REG_LOGICAL_COMPLEX", "REG_LOGICAL_COMPOUND", "REG_LOGICAL_EMPTY", "REG_LOGICAL_KEY", "REG_LOGICAL_PSEUDO", "REG_SHADOW_HOST", "REG_SHADOW_MODE", "REG_SHADOW_PSEUDO", "REG_TYPE_CHECK", "REG_TYPE_DATE", "REG_TYPE_RANGE", "REG_TYPE_RESET", "REG_TYPE_SUBMIT", "REG_TYPE_TEXT", "SELECTOR", "SELECTOR_ATTR", "SELECTOR_CLASS", "SELECTOR_ID", "SELECTOR_LIST", "SELECTOR_PSEUDO_CLASS", "SELECTOR_PSEUDO_ELEMENT", "SELECTOR_TYPE", "SHOW_ALL", "SHOW_DOCUMENT", "SHOW_DOCUMENT_FRAGMENT", "SHOW_ELEMENT", "STRING", "SUB_TYPE", "SYNTAX_ERR", "TAG_TYPE", "TAG_TYPE_I", "TARGET_ALL", "TARGET_FIRST", "TARGET_LINEAL", "TARGET_SELF", "TEXT_NODE", "TYPE_FROM", "TYPE_TO", "U_FFFD", "WALKER_FILTER", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var z=Object.create;var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(g,l)=>{for(var e in l)M(g,e,{get:l[e],enumerable:!0})},P=(g,l,e,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of W(l))!j.call(g,c)&&c!==e&&M(g,c,{get:()=>l[c],enumerable:!(h=H(l,c))||h.enumerable});return g};var Y=(g,l,e)=>(e=g!=null?z(B(g)):{},P(l||!g||!g.__esModule?M(e,"default",{value:g,enumerable:!0}):e,g)),V=g=>P(M({},"__esModule",{value:!0}),g);var K={};q(K,{Finder:()=>X});module.exports=V(K);var I=Y(require("@asamuzakjp/nwsapi"),1),k=require("./dom-util.js"),O=require("./matcher.js"),y=require("./parser.js"),n=require("./constant.js");const x="next",A="prev",L="all",E="first",C="lineal",R="self";class X{#a;#c;#s;#o;#w;#n;#b;#e;#f;#k;#h;#m;#N;#t;#d;#u;#r;#p;#i;#l;constructor(l,e){this.#l=l,this.#n=e??l.document,this.#c=new WeakMap,this.#o=new WeakMap,this.#N=new WeakMap,this.#h=this._initNwsapi(l,e)}_onError(l){if(!this.#k)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===n.NOT_SUPPORTED_ERR)this.#i&&console.warn(l.message);else throw new this.#l.DOMException(l.message,l.name);else throw l}_setup(l,e,h={}){const{event:c,noexcept:a,warn:o}=h;return this.#k=!!a,this.#i=!!o,this.#b=this._setEvent(c),this.#e=e,[this.#s,this.#t,this.#r]=(0,k.resolveContent)(e),this.#d=(0,k.isInShadowTree)(e),[this.#a,this.#f]=this._correspond(l),this.#p=new WeakMap,e}_initNwsapi(){const l=(0,I.default)({DOMException:this.#l.DOMException,document:this.#n});return l.configure({LOGERRORS:!1}),l}_setEvent(l){return l instanceof this.#l.KeyboardEvent||l instanceof this.#l.MouseEvent?l:null}_correspond(l){const e=[];this.#w=!1;let h;if(this.#o.has(this.#s)){const c=this.#o.get(this.#s);if(c&&c.has(`${l}`)){const a=c.get(`${l}`);this.#w=a.descendant,h=a.ast}}if(h){const c=h.length;for(let a=0;a<c;a++)h[a].collected=!1,h[a].dir=null,h[a].filtered=!1,h[a].find=!1,e[a]=[]}else{let c;try{c=(0,y.parseSelector)(l)}catch(b){this._onError(b)}const{branches:a,info:{hasDefinedPseudo:o,hasHasPseudoFunc:r,hasHyphenSepAttr:u,hasNthChildOfSelector:d,hasPseudoFunc:i}}=(0,y.walkAST)(c);let t;o||r||u||d&&i?t=!1:t=!0;let s=!1,f=0;h=[];for(const[...b]of a){const m=[];let p=b.shift();if(p&&p.type!==n.COMBINATOR){const w=new Set;for(;p;){if(p.type===n.COMBINATOR){const[N]=b;if(N.type===n.COMBINATOR){const S=`Invalid selector ${l}`;throw new DOMException(S,n.SYNTAX_ERR)}const _=p.name;/^[\s>]$/.test(_)&&(s=!0),m.push({combo:p,leaves:(0,y.sortAST)(w)}),w.clear()}else if(p){let{name:N}=p;N&&typeof N=="string"&&(N=(0,y.unescapeSelector)(N),typeof N=="string"&&N!==p.name&&(p.name=N),/[|:]/.test(N)&&(p.namespace=!0)),w.add(p)}if(b.length)p=b.shift();else{m.push({combo:null,leaves:(0,y.sortAST)(w)}),w.clear();break}}}h.push({branch:m,collected:!1,dir:null,filtered:!1,find:!1}),e[f]=[],f++}if(t){let b;this.#o.has(this.#s)?b=this.#o.get(this.#s):b=new Map,b.set(`${l}`,{ast:h,descendant:s}),this.#o.set(this.#s,b)}this.#w=s}return[h,e]}_createTreeWalker(l){let e;return this.#p.has(l)?e=this.#p.get(l):(e=this.#n.createTreeWalker(l,n.WALKER_FILTER),this.#p.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#u=!1,this.#m}_collectNthChild(l,e,h){const{a:c,b:a,reverse:o,selector:r}=l,{parentNode:u}=e,d=new Set;let i;if(r)if(this.#c.has(r))i=this.#c.get(r);else{const{branches:t}=(0,y.walkAST)(r);i=t,this.#c.set(r,i)}if(u){const t=this.#r;let s=(0,k.traverseNode)(u,t);s=t.firstChild();let f=0;for(;s;)f++,s=t.nextSibling();const b=new Set;if(i)for(s=(0,k.traverseNode)(u,t),s=t.firstChild();s;){const{display:m,visibility:p}=this.#l.getComputedStyle(s);if(m!=="none"&&p!=="hidden"){let w;for(const N of i)if(w=this._matchLeaves(N,s,h),!w)break;w&&b.add(s)}s=t.nextSibling()}if(c===0){if(a>0&&a<=f){if(b.size){s=(0,k.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(b.has(s)){if(m===a-1){d.add(s);break}m++}o?s=t.previousSibling():s=t.nextSibling()}}else if(!r){s=(0,k.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(m===a-1){d.add(s);break}o?s=t.previousSibling():s=t.nextSibling(),m++}}}}else{let m=a-1;if(c>0)for(;m<0;)m+=c;if(m>=0&&m<f){s=(0,k.traverseNode)(u,t),o?s=t.lastChild():s=t.firstChild();let p=0,w=c>0?0:a-1;for(;s&&(s&&m>=0&&m<f);)b.size?b.has(s)&&(w===m&&(d.add(s),m+=c),c>0?w++:w--):p===m&&(r||d.add(s),m+=c),o?s=t.previousSibling():s=t.nextSibling(),p++}}if(o&&d.size>1){const m=[...d];return new Set(m.reverse())}}else if(e===this.#t&&c+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:h,b:c,reverse:a}=l,{localName:o,parentNode:r,prefix:u}=e,d=new Set;if(r){const i=this.#r;let t=(0,k.traverseNode)(r,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(c>0&&c<=s){t=(0,k.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let f=0;for(;t;){const{localName:b,prefix:m}=t;if(b===o&&m===u){if(f===c-1){d.add(t);break}f++}a?t=i.previousSibling():t=i.nextSibling()}}}else{let f=c-1;if(h>0)for(;f<0;)f+=h;if(f>=0&&f<s){t=(0,k.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let b=h>0?0:c-1;for(;t;){const{localName:m,prefix:p}=t;if(m===o&&p===u){if(b===f&&(d.add(t),f+=h),f<0||f>=s)break;h>0?b++:b--}a?t=i.previousSibling():t=i.nextSibling()}}}if(a&&d.size>1){const f=[...d];return new Set(f.reverse())}}else e===this.#t&&h+c===1&&d.add(e);return d}_matchAnPlusB(l,e,h,c){const{nth:{a,b:o,name:r},selector:u}=l,d=new Map;if(r?(r==="even"?(d.set("a",2),d.set("b",0)):r==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof o=="string"&&/-?\d+/.test(o)?d.set("b",o*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){u&&d.set("selector",u);const i=Object.fromEntries(d);return this._collectNthChild(i,e,c)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(l,e,h={}){let c;if(Array.isArray(l)&&l.length){const a=l.map(s=>s),[o]=a,{type:r}=o;let u;r===n.COMBINATOR?u=a.shift():u={name:" ",type:n.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:f}=s;if(f===n.COMBINATOR)break;d.push(a.shift())}const i={combo:u,leaves:d};h.dir=x;const t=this._matchCombinator(i,e,h);if(t.size)if(a.length){for(const s of t)if(c=this._matchHasPseudoFunc(a,s,h),c)break}else c=!0}return!!c}_matchLogicalPseudoFunc(l,e,h={}){const{astName:c="",branches:a=[],selector:o="",twigBranches:r=[]}=l;let u;if(c==="has")if(o.includes(":has("))u=null;else{let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(u=e)}else{const d=/^(?:is|where)$/.test(c);h.forgive=d;const i=r.length;let t;for(let s=0;s<i;s++){const f=r[s],b=f.length-1,{leaves:m}=f[b];if(t=this._matchLeaves(m,e,h),t&&b>0){let p=new Set([e]);for(let w=b-1;w>=0;w--){const N=f[w],_=[];h.dir=A;for(const S of p){const v=this._matchCombinator(N,S,h);v.size&&_.push(...v)}if(_.length)w===0?t=!0:p=new Set(_);else{t=!1;break}}}if(t)break}c==="not"?t||(u=e):t&&(u=e)}return u??null}_matchPseudoClassSelector(l,e,h={}){const{children:c,name:a}=l,{localName:o,parentNode:r}=e,{forgive:u,warn:d=this.#i}=h,i=new Set;if(n.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#c.has(l))t=this.#c.get(l);else{const{branches:f}=(0,y.walkAST)(l),b=[],m=[];for(const[...p]of f){for(const S of p){const v=(0,y.generateCSS)(S);b.push(v)}const w=[],N=new Set;let _=p.shift();for(;_;)if(_.type===n.COMBINATOR?(w.push({combo:_,leaves:[...N]}),N.clear()):_&&N.add(_),p.length)_=p.shift();else{w.push({combo:null,leaves:[...N]}),N.clear();break}m.push(w)}t={astName:a,branches:f,twigBranches:m,selector:b.join(",")},this.#c.set(l,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(c))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=c;return this._matchAnPlusB(t,e,a,h)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&i.add(t);break}case"state":{if((0,k.isCustomElement)(e)){const[{value:t}]=c;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(!u){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{n.REG_ANCHOR.test(o)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(n.REG_ANCHOR.test(o)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:f}=new URL(this.#s.URL),b=new URL(e.getAttribute("href"),t);b.origin===s&&b.pathname===f&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#b??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:f}=this.#b??{};(f==="mousedown"||f==="pointerdown")&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let f=this.#s.getElementById(s);for(;f;){if(f===e){i.add(e);break}f=f.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#d&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#b??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(a==="focus"||s==="keydown"&&e.contains(t))){let f=e,b=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){b=!1;break}else{const{display:m,visibility:p}=this.#l.getComputedStyle(f);if(b=!(m==="none"||p==="hidden"),!b)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}b&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let f=e,b=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){b=!1;break}else{const{display:m,visibility:p}=this.#l.getComputedStyle(f);if(b=!(m==="none"||p==="hidden"),!b)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}b&&i.add(e)}break}case"open":{n.REG_INTERACT.test(o)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{n.REG_INTERACT.test(o)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(n.REG_FORM_CTRL.test(o)||(0,k.isCustomElement)(e,{formAssociated:!0})){if(e.disabled||e.hasAttribute("disabled"))i.add(e);else if(e.localName==="option")r.localName==="optgroup"&&(r.disabled||r.hasAttribute("disabled"))&&i.add(e);else if(e.localName!=="optgroup"){let t,s=r;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const f=this.#r;let b=(0,k.traverseNode)(s,f);for(b=f.firstChild();b&&b.localName!=="legend";)b=f.nextSibling();b&&b.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===n.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t&&i.add(e)}}break}case"enabled":{if((n.REG_FORM_CTRL.test(o)||(0,k.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled")))if(e.localName==="optgroup")i.add(e);else if(e.localName==="option")(r.localName!=="optgroup"||!(r.disabled||r.hasAttribute("disabled")))&&i.add(e);else{let t,s=r;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const f=this.#r;let b=(0,k.traverseNode)(s,f);for(b=f.firstChild();b&&b.localName!=="legend";)b=f.nextSibling();b&&b.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===n.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t||i.add(e)}break}case"read-only":{switch(o){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,k.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(o){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,k.isContentEditable)(e)&&i.add(e)}break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;o==="textarea"?s=e:o==="input"&&(e.hasAttribute("type")?n.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&o==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&o==="input"&&e.type==="checkbox"||o==="progress"&&!e.hasAttribute("value"))i.add(e);else if(o==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#s.documentElement);const f=s.getElementsByTagName("input"),b=f.length;let m;for(let p=0;p<b;p++){const w=f[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(m=!!w.checked):w.hasAttribute("name")||(m=!!w.checked),m))break}m||i.add(e)}break}case"default":{if(o==="button"&&!(e.hasAttribute("type")&&n.REG_TYPE_RESET.test(e.getAttribute("type")))||o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#r;let f=(0,k.traverseNode)(t,s);for(f=s.firstChild();f&&t.contains(f);){const b=f.localName;let m;if(b==="button"?m=!(f.hasAttribute("type")&&n.REG_TYPE_RESET.test(f.getAttribute("type"))):b==="input"&&(m=f.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(f.getAttribute("type"))),m){f===e&&i.add(e);break}f=s.nextNode()}}}else(o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))&&e.hasAttribute("checked")||o==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(o==="fieldset"){const t=this.#r;let s=(0,k.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f&&i.add(e)}break}case"invalid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(o==="fieldset"){const t=this.#r;let s=(0,k.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f||i.add(e)}break}case"in-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#n.createTreeWalker(e,n.SHOW_ALL);let s=t.firstChild(),f;for(;s&&(f=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!f);)s=t.nextSibling();f&&i.add(e)}else i.add(e);break}case"first-child":{(r&&e===r.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(r&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(r&&e===r.firstElementChild&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||o.includes("-")?(0,k.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"autofill":case"blank":case"buffering":case"current":case"fullscreen":case"future":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}}else if(!u){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,n.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(l,e){const{children:h,name:c}=l;let a;if(Array.isArray(h)){const{branches:o}=(0,y.walkAST)(h[0]),[r]=o,[...u]=r,{host:d}=e;if(c==="host"){let i;for(const t of u){const{type:s}=t;if(s===n.COMBINATOR){const b=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(b,n.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(a=e)}else if(c==="host-context"){let i=d,t;for(;i;){for(const s of u){const{type:f}=s;if(f===n.COMBINATOR){const m=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(m,n.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(a=e)}}else if(c==="host")a=e;else{const o=`Invalid selector :${c}`;throw new DOMException(o,n.SYNTAX_ERR)}return a??null}_matchSelector(l,e,h){const{type:c}=l,a=new Set;if(l.name===n.EMPTY)return a;const o=(0,y.unescapeSelector)(l.name);if(typeof o=="string"&&o!==l.name&&(l.name=o),e.nodeType===n.ELEMENT_NODE)switch(c){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(o,h);break}case n.SELECTOR_ID:{e.id===o&&a.add(e);break}case n.SELECTOR_CLASS:{e.classList.contains(o)&&a.add(e);break}case n.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,h);default:{const r=O.matcher.matchSelector(l,e,h);r&&a.add(r)}}else if(this.#d&&c===n.SELECTOR_PSEUDO_CLASS&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(o!=="has"&&n.REG_LOGICAL_PSEUDO.test(o))return this._matchPseudoClassSelector(l,e,h);if(n.REG_SHADOW_HOST.test(o)){const r=this._matchShadowHostPseudoClass(l,e,h);r&&a.add(r)}}return a}_matchLeaves(l,e,h){const{attributes:c,localName:a,nodeType:o}=e;let r=this.#N.get(l),u;if(r&&r.has(e)){const{attr:d,matched:i}=r.get(e);c?.length===d&&(u=i)}if(typeof u!="boolean"){let d;o===n.ELEMENT_NODE&&n.REG_FORM.test(a)?d=!1:d=!0;for(const i of l){const{name:t,type:s}=i;if(s===n.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),u=this._matchSelector(i,e,h).has(e),!u)break}d&&(r||(r=new WeakMap),r.set(e,{attr:c?.length,matched:u}),this.#N.set(l,r))}return!!u}_matchHTMLCollection(l,e={}){const{compound:h,filterLeaves:c}=e,a=new Set,o=l.length;if(o)if(h)for(let r=0;r<o;r++){const u=l[r];this._matchLeaves(c,u,e)&&a.add(u)}else{const r=[].slice.call(l);return new Set(r)}return a}_findDescendantNodes(l,e,h){const[c,...a]=l,o=a.length>0,{type:r}=c,u=(0,y.unescapeSelector)(c.name);typeof u=="string"&&u!==c.name&&(c.name=u);let d=new Set,i=!1;if(this.#d)i=!0;else switch(r){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,h);break}case n.SELECTOR_ID:{if(this.#t.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(u);t&&t!==e&&e.contains(t)&&(o?this._matchLeaves(a,t,h)&&d.add(t):d.add(t))}break}case n.SELECTOR_CLASS:{const t=e.getElementsByClassName(u);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a});break}case n.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(l,e,h={}){const{combo:c,leaves:a}=l,{name:o}=c,{parentNode:r}=e,{dir:u}=h,d=new Set;if(u===x)switch(o){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,k.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,k.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(a,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let f=(0,k.traverseNode)(e,s);for(f=s.nextNode();f&&e.contains(f);)this._matchLeaves(a,f,h)&&d.add(f),f=s.nextNode()}}}else switch(o){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,k.traverseNode)(r,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{r&&this._matchLeaves(a,r,h)&&d.add(r);break}case" ":default:{const i=[];let t=r;for(;t;)this._matchLeaves(a,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(l,e){const{node:h}=e,c=this.#m;let a=(0,k.traverseNode)(h,c),o;if(a)for((a.nodeType!==n.ELEMENT_NODE||a===h&&a!==this.#t)&&(a=c.nextNode());a;){if(this._matchLeaves(l,a,{warn:this.#i})){o=a;break}a=c.nextNode()}return o??null}_matchSelf(l){const e=[],h=this._matchLeaves(l,this.#e,{warn:this.#i});let c=!1;return h&&(e.push(this.#e),c=!0),[e,c]}_findLineal(l,e={}){const{complex:h}=e,c=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),o=!1;if(a&&(c.push(this.#e),o=!0),!a||h){let r=this.#e.parentNode;for(;r&&(a=this._matchLeaves(l,r,{warn:this.#i}),a&&(c.push(r),o=!0),r.parentNode);)r=r.parentNode}return[c,o]}_findFirst(l){const e=[],h=this._findNode(l,{node:this.#e});let c=!1;return h&&(e.push(h),c=!0),[e,c]}_findFromHTMLCollection(l,e={}){const{complex:h,compound:c,filterLeaves:a,targetType:o}=e;let r=[],u=!1,d=!1;const i=l.length;if(i)if(this.#e.nodeType===n.ELEMENT_NODE)for(let t=0;t<i;t++){const s=l[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(c){if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else if(r.push(s),u=!0,o===E)break}}else if(h)if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else r=[].slice.call(l),u=!0,d=!0;else if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),u=!0,o===E))break}else r=[].slice.call(l),u=!0,d=!0;return[r,u,d]}_findEntryNodes(l,e,h){const{leaves:c}=l,[a,...o]=c,r=o.length>0,{name:u,type:d}=a;let i=[],t=!1,s=!1,f=!1;switch(d){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,{warn:this.#i});break}case n.SELECTOR_ID:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(e===E&&this.#t.nodeType!==n.ELEMENT_NODE){const b=this.#t.getElementById(u);b&&(r?this._matchLeaves(o,b,{warn:this.#i})&&(i.push(b),s=!0):(i.push(b),s=!0))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_CLASS:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#t.nodeType===n.DOCUMENT_NODE){const b=this.#t.getElementsByClassName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_TYPE:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===n.DOCUMENT_NODE&&!/[*|]/.test(u)){const b=this.#t.getElementsByTagName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}default:if(e!==C&&n.REG_SHADOW_HOST.test(u)){if(this.#d&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE){const b=this._matchShadowHostPseudoClass(a,this.#e);b&&(i.push(b),s=!0)}}else e===R?[i,s]=this._matchSelf(c):e===C?[i,s]=this._findLineal(c,{complex:h}):e===E?[i,s]=this._findFirst(c):f=!0}return{collected:t,compound:r,filtered:s,nodes:i,pending:f}}_collectNodes(l){const e=this.#a.values();if(l===L||l===E){const h=new Set;let c=0;for(const{branch:a}of e){const o=a.length,r=o>1,u=a[0];let d,i;if(r){const{combo:p,leaves:[{name:w,type:N}]}=u,_=a[o-1],{leaves:[{name:S,type:v}]}=_;if(v===n.SELECTOR_PSEUDO_ELEMENT||v===n.SELECTOR_ID)d=A,i=_;else if(N===n.SELECTOR_PSEUDO_ELEMENT||N===n.SELECTOR_ID)d=x,i=u;else if(l===L)if(w==="*"&&N===n.SELECTOR_TYPE)d=A,i=_;else if(S==="*"&&v===n.SELECTOR_TYPE)d=x,i=u;else if(o===2){const{name:T}=p;/^[+~]$/.test(T)?(d=A,i=_):(d=x,i=u)}else d=x,i=u;else if(S==="*"&&v===n.SELECTOR_TYPE)d=x,i=u;else if(w==="*"&&N===n.SELECTOR_TYPE)d=A,i=_;else{let T;for(const{combo:D,leaves:[U]}of a){const{name:$,type:F}=U;if(F===n.SELECTOR_PSEUDO_CLASS&&$==="dir"){T=!1;break}if(!T&&D){const{name:G}=D;/^[+~]$/.test(G)&&(T=!0)}}T?(d=x,i=u):(d=A,i=_)}}else d=A,i=u;const{collected:t,compound:s,filtered:f,nodes:b,pending:m}=this._findEntryNodes(i,l,r);b.length?(this.#a[c].find=!0,this.#f[c]=b):m&&h.add(new Map([["index",c],["twig",i]])),this.#a[c].collected=t,this.#a[c].dir=d,this.#a[c].filtered=f||!s,c++}if(h.size){let a,o;this.#e!==this.#t&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,o=this.#m):(a=this.#t,o=this.#r);let r=(0,k.traverseNode)(a,o);for(;r;){let u=!1;if(this.#e.nodeType===n.ELEMENT_NODE?r===this.#e?u=!0:u=this.#e.contains(r):u=!0,u)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,r,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#f[s].push(r)}}r!==o.currentNode&&(r=(0,k.traverseNode)(r,o)),r=o.nextNode()}}}else{let h=0;for(const{branch:c}of e){const a=c[c.length-1],o=c.length>1,{compound:r,filtered:u,nodes:d}=this._findEntryNodes(a,l,o);d.length&&(this.#a[h].find=!0,this.#f[h]=d),this.#a[h].dir=A,this.#a[h].filtered=u||!r,h++}}return[this.#a,this.#f]}_getCombinedNodes(l,e,h){const c=[];for(const a of e){const o=this._matchCombinator(l,a,{dir:h,warn:this.#i});o.size&&c.push(...o)}return c.length?new Set(c):new Set}_matchNodeNext(l,e,h){const{combo:c,index:a}=h,{combo:o,leaves:r}=l[a],u={combo:c,leaves:r},d=this._getCombinedNodes(u,e,x);let i;if(d.size)if(a===l.length-1){const[t]=(0,k.sortNodes)(d);i=t}else i=this._matchNodeNext(l,d,{combo:o,index:a+1});return i??null}_matchNodePrev(l,e,h){const{index:c}=h,a=l[c],o=new Set([e]),r=this._getCombinedNodes(a,o,A);let u;if(r.size){if(c===0)u=e;else for(const d of r)if(this._matchNodePrev(l,d,{index:c-1}))return e}return u??null}_find(l){(l===L||l===E)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(l),c=e.length;let a=new Set;for(let o=0;o<c;o++){const{branch:r,collected:u,dir:d,find:i}=e[o],t=r.length;if(t&&i){const s=h[o],f=s.length,b=t-1;if(b===0)if((l===L||l===E)&&this.#e.nodeType===n.ELEMENT_NODE)for(let m=0;m<f;m++){const p=s[m];if(p!==this.#e&&this.#e.contains(p)&&(a.add(p),l!==L))break}else if(l===L)if(a.size){const m=[...a];a=new Set([...m,...s]),this.#u=!0}else a=new Set(s);else{const[m]=s;a.add(m)}else if(l===L)if(d===x){let{combo:m}=r[0];for(const p of s){let w=new Set([p]);for(let N=1;N<t;N++){const{combo:_,leaves:S}=r[N],v={combo:m,leaves:S};if(w=this._getCombinedNodes(v,w,d),w.size)if(N===b)if(a.size){const T=[...a];a=new Set([...T,...w]),this.#u=!0}else a=w;else m=_;else break}}}else for(const m of s){let p=new Set([m]);for(let w=b-1;w>=0;w--){const N=r[w];if(p=this._getCombinedNodes(N,p,d),p.size)w===0&&(a.add(m),t>1&&a.size>1&&(this.#u=!0));else break}}else if(l===E&&d===x){const{combo:m}=r[0];let p;for(const w of s)if(p=this._matchNodeNext(r,new Set([w]),{combo:m,index:1}),p){a.add(p);break}if(!p&&!u){const{leaves:w}=r[0],[N]=s;let _=this._findNode(w,{node:N});for(;_;){if(p=this._matchNodeNext(r,new Set([_]),{combo:m,index:1}),p){a.add(p);break}_=this._findNode(w,{node:_})}}}else{let m;for(const p of s)if(m=this._matchNodePrev(r,p,{index:b-1}),m){a.add(p);break}if(!m&&!u&&l===E){const{leaves:p}=r[b],[w]=s;let N=this._findNode(p,{node:w});for(;N;){if(m=this._matchNodePrev(r,N,{index:b-1}),m){a.add(N);break}N=this._findNode(p,{node:N})}}}}}return a}matches(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#n&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.match(l,e)}this._setup(l,e,h),c=this._find(R).size}catch(a){this._onError(a)}return!!c}closest(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#n&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.closest(l,e)}this._setup(l,e,h);const o=this._find(C);if(o.size){let r=this.#e;for(;r;){if(o.has(r)){c=r;break}r=r.parentNode}}}catch(a){this._onError(a)}return c??null}querySelector(l,e,h){let c;try{(0,k.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#n&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!1}))return this.#h.first(l,e);this._setup(l,e,h);const o=this._find(E);o.delete(this.#e),o.size&&([c]=(0,k.sortNodes)(o))}catch(a){this._onError(a)}return c??null}querySelectorAll(l,e,h){let c;try{(0,k.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#n&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!0,qsa:!0}))return this.#h.select(l,e);this._setup(l,e,h);const o=this._find(L);o.delete(this.#e),o.size&&(this.#u?c=(0,k.sortNodes)(o):c=[...o])}catch(a){this._onError(a)}return c??[]}}0&&(module.exports={Finder});
1
+ var T=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var U=(x,o)=>{for(var e in o)T(x,e,{get:o[e],enumerable:!0})},F=(x,o,e,h)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of I(o))!$.call(x,n)&&n!==e&&T(x,n,{get:()=>o[n],enumerable:!(h=D(o,n))||h.enumerable});return x};var G=x=>F(T({},"__esModule",{value:!0}),x);var H={};U(H,{Finder:()=>W});module.exports=G(H);var k=require("./dom-util.js"),L=require("./matcher.js"),g=require("./parser.js"),a=require("./constant.js");const v="next",S="prev";class W{#a;#c;#s;#n;#m;#p;#d;#o;#e;#f;#k;#b;#w;#t;#h;#r;#u;#i;#l;constructor(o,e){this.#l=o,this.#p=e??o.document,this.#c=new WeakMap,this.#n=new WeakMap,this.#w=new WeakMap}_onError(o){if(!this.#k)if(o instanceof DOMException||o instanceof this.#l.DOMException)if(o.name===a.NOT_SUPPORTED_ERR)this.#i&&console.warn(o.message);else throw new this.#l.DOMException(o.message,o.name);else throw o}_setup(o,e,h={}){const{event:n,noexcept:l,warn:c}=h;return this.#k=!!l,this.#i=!!c,this.#d=this._setEvent(n),this.#e=e,[this.#s,this.#t,this.#r]=(0,k.resolveContent)(e),this.#h=(0,k.isInShadowTree)(e),[this.#a,this.#f]=this._correspond(o),this.#u=new WeakMap,this.#o=!1,e}_setEvent(o){return o instanceof this.#l.KeyboardEvent||o instanceof this.#l.MouseEvent?o:null}_correspond(o){const e=[];this.#m=!1;let h;if(this.#n.has(this.#s)){const n=this.#n.get(this.#s);if(n&&n.has(`${o}`)){const l=n.get(`${o}`);h=l.ast,this.#m=l.descendant}}if(h){const n=h.length;for(let l=0;l<n;l++)h[l].collected=!1,h[l].dir=null,h[l].filtered=!1,h[l].find=!1,e[l]=[]}else{let n;try{n=(0,g.parseSelector)(o)}catch(d){this._onError(d)}const{branches:l}=(0,g.walkAST)(n);let c=!1,f=0;h=[];for(const[...d]of l){const i=[];let t=d.shift();if(t&&t.type!==a.COMBINATOR){const s=new Set;for(;t;){if(t.type===a.COMBINATOR){const[r]=d;if(r.type===a.COMBINATOR){const m=`Invalid selector ${o}`;throw new DOMException(m,a.SYNTAX_ERR)}const u=t.name;/^[\s>]$/.test(u)&&(c=!0),i.push({combo:t,leaves:(0,g.sortAST)(s)}),s.clear()}else if(t){let{name:r}=t;r&&typeof r=="string"&&(r=(0,g.unescapeSelector)(r),typeof r=="string"&&r!==t.name&&(t.name=r),/[|:]/.test(r)&&(t.namespace=!0)),s.add(t)}if(d.length)t=d.shift();else{i.push({combo:null,leaves:(0,g.sortAST)(s)}),s.clear();break}}}h.push({branch:i,collected:!1,dir:null,filtered:!1,find:!1}),e[f]=[],f++}let b;this.#n.has(this.#s)?b=this.#n.get(this.#s):b=new Map,b.set(`${o}`,{ast:h,descendant:c}),this.#n.set(this.#s,b),this.#m=c}return[h,e]}_createTreeWalker(o){let e;return this.#u.has(o)?e=this.#u.get(o):(e=this.#p.createTreeWalker(o,a.WALKER_FILTER),this.#u.set(o,e)),e}_prepareQuerySelectorWalker(){return this.#b=this._createTreeWalker(this.#e),this.#b}_collectNthChild(o,e,h){const{a:n,b:l,reverse:c,selector:f}=o,{parentNode:b}=e,d=new Set;let i;if(f)if(this.#c.has(f))i=this.#c.get(f);else{const{branches:t,info:s}=(0,g.walkAST)(f);i=t,this.#c.set(f,i),s.hasLogicalPseudoFunc&&(this.#o=!0)}if(b){const t=this.#r;let s=(0,k.traverseNode)(b,t);s=t.firstChild();let r=0;for(;s;)r++,s=t.nextSibling();const u=new Set;if(i)for(s=(0,k.traverseNode)(b,t),s=t.firstChild();s;){const{display:m,visibility:w}=this.#l.getComputedStyle(s);if(m!=="none"&&w!=="hidden"){let p;for(const N of i)if(p=this._matchLeaves(N,s,h),!p)break;p&&u.add(s)}s=t.nextSibling()}if(n===0){if(l>0&&l<=r){if(u.size){s=(0,k.traverseNode)(b,t),c?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(u.has(s)){if(m===l-1){d.add(s);break}m++}c?s=t.previousSibling():s=t.nextSibling()}}else if(!f){s=(0,k.traverseNode)(b,t),c?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(m===l-1){d.add(s);break}c?s=t.previousSibling():s=t.nextSibling(),m++}}}}else{let m=l-1;if(n>0)for(;m<0;)m+=n;if(m>=0&&m<r){s=(0,k.traverseNode)(b,t),c?s=t.lastChild():s=t.firstChild();let w=0,p=n>0?0:l-1;for(;s&&(s&&m>=0&&m<r);)u.size?u.has(s)&&(p===m&&(d.add(s),m+=n),n>0?p++:p--):w===m&&(f||d.add(s),m+=n),c?s=t.previousSibling():s=t.nextSibling(),w++}}if(c&&d.size>1){const m=[...d];return new Set(m.reverse())}}else if(e===this.#t&&n+l===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(o,e){const{a:h,b:n,reverse:l}=o,{localName:c,parentNode:f,prefix:b}=e,d=new Set;if(f){const i=this.#r;let t=(0,k.traverseNode)(f,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(n>0&&n<=s){t=(0,k.traverseNode)(f,i),l?t=i.lastChild():t=i.firstChild();let r=0;for(;t;){const{localName:u,prefix:m}=t;if(u===c&&m===b){if(r===n-1){d.add(t);break}r++}l?t=i.previousSibling():t=i.nextSibling()}}}else{let r=n-1;if(h>0)for(;r<0;)r+=h;if(r>=0&&r<s){t=(0,k.traverseNode)(f,i),l?t=i.lastChild():t=i.firstChild();let u=h>0?0:n-1;for(;t;){const{localName:m,prefix:w}=t;if(m===c&&w===b){if(u===r&&(d.add(t),r+=h),r<0||r>=s)break;h>0?u++:u--}l?t=i.previousSibling():t=i.nextSibling()}}}if(l&&d.size>1){const r=[...d];return new Set(r.reverse())}}else e===this.#t&&h+n===1&&d.add(e);return d}_matchAnPlusB(o,e,h,n){const{nth:{a:l,b:c,name:f},selector:b}=o,d=new Map;if(f?(f==="even"?(d.set("a",2),d.set("b",0)):f==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof l=="string"&&/-?\d+/.test(l)?d.set("a",l*1):d.set("a",0),typeof c=="string"&&/-?\d+/.test(c)?d.set("b",c*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){b&&d.set("selector",b);const i=Object.fromEntries(d);return this._collectNthChild(i,e,n)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(o,e,h={}){let n;if(Array.isArray(o)&&o.length){const l=o.map(s=>s),[c]=l,{type:f}=c;let b;f===a.COMBINATOR?b=l.shift():b={name:" ",type:a.COMBINATOR};const d=[];for(;l.length;){const[s]=l,{type:r}=s;if(r===a.COMBINATOR)break;d.push(l.shift())}const i={combo:b,leaves:d};h.dir=v;const t=this._matchCombinator(i,e,h);if(t.size)if(l.length){for(const s of t)if(n=this._matchHasPseudoFunc(l,s,h),n)break}else n=!0}return!!n}_matchLogicalPseudoFunc(o,e,h={}){const{astName:n="",branches:l=[],selector:c="",twigBranches:f=[]}=o;let b;if(n==="has")if(c.includes(":has("))b=null;else{let d;for(const i of l)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(b=e)}else{const d=/^(?:is|where)$/.test(n);h.forgive=d;const i=f.length;let t;for(let s=0;s<i;s++){const r=f[s],u=r.length-1,{leaves:m}=r[u];if(t=this._matchLeaves(m,e,h),t&&u>0){let w=new Set([e]);for(let p=u-1;p>=0;p--){const N=r[p],_=[];h.dir=S;for(const y of w){const E=this._matchCombinator(N,y,h);E.size&&_.push(...E)}if(_.length)p===0?t=!0:w=new Set(_);else{t=!1;break}}}if(t)break}n==="not"?t||(b=e):t&&(b=e)}return b??null}_matchPseudoClassSelector(o,e,h={}){const{children:n,name:l}=o,{localName:c,parentNode:f}=e,{forgive:b,warn:d=this.#i}=h,i=new Set;if(a.REG_LOGICAL_PSEUDO.test(l)){let t;if(this.#c.has(o))t=this.#c.get(o);else{const{branches:r}=(0,g.walkAST)(o),u=[],m=[];for(const[...w]of r){for(const y of w){const E=(0,g.generateCSS)(y);u.push(E)}const p=[],N=new Set;let _=w.shift();for(;_;)if(_.type===a.COMBINATOR?(p.push({combo:_,leaves:[...N]}),N.clear()):_&&N.add(_),w.length)_=w.shift();else{p.push({combo:null,leaves:[...N]}),N.clear();break}m.push(p)}t={astName:l,branches:r,twigBranches:m,selector:u.join(",")},this.#c.set(o,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(n))if(/^nth-(?:last-)?(?:child|of-type)$/.test(l)){const[t]=n;return this._matchAnPlusB(t,e,l,h)}else switch(l){case"dir":case"lang":{const t=L.matcher.matchSelector(o,e);t&&i.add(t);break}case"state":{if((0,k.isCustomElement)(e)){const[{value:t}]=n;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${l}()`;throw new DOMException(t,a.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${l}()`;throw new DOMException(t,a.NOT_SUPPORTED_ERR)}break}default:if(!b){const t=`Unknown pseudo-class :${l}()`;throw new DOMException(t,a.SYNTAX_ERR)}}else switch(l){case"any-link":case"link":{a.REG_ANCHOR.test(c)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(a.REG_ANCHOR.test(c)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:r}=new URL(this.#s.URL),u=new URL(e.getAttribute("href"),t);u.origin===s&&u.pathname===r&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#d??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:r}=this.#d??{};(r==="mousedown"||r==="pointerdown")&&t&a.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let r=this.#s.getElementById(s);for(;r;){if(r===e){i.add(e);break}r=r.parentNode}}break}case"scope":{this.#e.nodeType===a.ELEMENT_NODE?!this.#h&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#d??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(l==="focus"||s==="keydown"&&e.contains(t))){let r=e,u=!0;for(;r;){if(r.disabled||r.hasAttribute("disabled")||r.hidden||r.hasAttribute("hidden")){u=!1;break}else{const{display:m,visibility:w}=this.#l.getComputedStyle(r);if(u=!(m==="none"||w==="hidden"),!u)break}if(r.parentNode&&r.parentNode.nodeType===a.ELEMENT_NODE)r=r.parentNode;else break}u&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let r=e,u=!0;for(;r;){if(r.disabled||r.hasAttribute("disabled")||r.hidden||r.hasAttribute("hidden")){u=!1;break}else{const{display:m,visibility:w}=this.#l.getComputedStyle(r);if(u=!(m==="none"||w==="hidden"),!u)break}if(r.parentNode&&r.parentNode.nodeType===a.ELEMENT_NODE)r=r.parentNode;else break}u&&i.add(e)}break}case"open":{a.REG_INTERACT.test(c)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{a.REG_INTERACT.test(c)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(a.REG_FORM_CTRL.test(c)||(0,k.isCustomElement)(e,{formAssociated:!0})){if(e.disabled||e.hasAttribute("disabled"))i.add(e);else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&i.add(e);else if(e.localName!=="optgroup"){let t,s=f;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const r=this.#r;let u=(0,k.traverseNode)(s,r);for(u=r.firstChild();u&&u.localName!=="legend";)u=r.nextSibling();u&&u.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===a.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t&&i.add(e)}}break}case"enabled":{if((a.REG_FORM_CTRL.test(c)||(0,k.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled")))if(e.localName==="optgroup")i.add(e);else if(e.localName==="option")(f.localName!=="optgroup"||!(f.disabled||f.hasAttribute("disabled")))&&i.add(e);else{let t,s=f;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const r=this.#r;let u=(0,k.traverseNode)(s,r);for(u=r.firstChild();u&&u.localName!=="legend";)u=r.nextSibling();u&&u.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===a.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}t||i.add(e)}break}case"read-only":{switch(c){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||a.REG_TYPE_DATE.test(e.type)||a.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,k.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(c){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||a.REG_TYPE_DATE.test(e.type)||a.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,k.isContentEditable)(e)&&i.add(e)}break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;c==="textarea"?s=e:c==="input"&&(e.hasAttribute("type")?a.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&c==="input"&&e.hasAttribute("type")&&a.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&c==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&c==="input"&&e.type==="checkbox"||c==="progress"&&!e.hasAttribute("value"))i.add(e);else if(c==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#s.documentElement);const r=s.getElementsByTagName("input"),u=r.length;let m;for(let w=0;w<u;w++){const p=r[w];if(p.getAttribute("type")==="radio"&&(t?p.getAttribute("name")===t&&(m=!!p.checked):p.hasAttribute("name")||(m=!!p.checked),m))break}m||i.add(e)}break}case"default":{if(c==="button"&&!(e.hasAttribute("type")&&a.REG_TYPE_RESET.test(e.getAttribute("type")))||c==="input"&&e.hasAttribute("type")&&a.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#r;let r=(0,k.traverseNode)(t,s);for(r=s.firstChild();r&&t.contains(r);){const u=r.localName;let m;if(u==="button"?m=!(r.hasAttribute("type")&&a.REG_TYPE_RESET.test(r.getAttribute("type"))):u==="input"&&(m=r.hasAttribute("type")&&a.REG_TYPE_SUBMIT.test(r.getAttribute("type"))),m){r===e&&i.add(e);break}r=s.nextNode()}}}else(c==="input"&&e.hasAttribute("type")&&a.REG_TYPE_CHECK.test(e.getAttribute("type"))&&e.hasAttribute("checked")||c==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":{if(a.REG_FORM_VALID.test(c))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(c==="fieldset"){const t=this.#r;let s=(0,k.traverseNode)(e,t);s=t.firstChild();let r;if(!s)r=!0;else for(;s&&e.contains(s)&&!(a.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?r=s.maxLength>=s.value.length:r=!0:r=!1,!r));)s=t.nextNode();r&&i.add(e)}break}case"invalid":{if(a.REG_FORM_VALID.test(c))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(c==="fieldset"){const t=this.#r;let s=(0,k.traverseNode)(e,t);s=t.firstChild();let r;if(!s)r=!0;else for(;s&&e.contains(s)&&!(a.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?r=s.maxLength>=s.value.length:r=!0:r=!1,!r));)s=t.nextNode();r||i.add(e)}break}case"in-range":{c==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&a.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{c==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&a.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(c))t=e;else if(c==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||a.REG_TYPE_CHECK.test(s)||a.REG_TYPE_DATE.test(s)||a.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(c))t=e;else if(c==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||a.REG_TYPE_CHECK.test(s)||a.REG_TYPE_DATE.test(s)||a.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#p.createTreeWalker(e,a.SHOW_ALL);let s=t.firstChild(),r;for(;s&&(r=s.nodeType!==a.ELEMENT_NODE&&s.nodeType!==a.TEXT_NODE,!!r);)s=t.nextSibling();r&&i.add(e)}else i.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||c.includes("-")?(0,k.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${l}`;throw new DOMException(t,a.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 :${l}`;throw new DOMException(t,a.NOT_SUPPORTED_ERR)}break}default:if(l.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${l}`;throw new DOMException(t,a.NOT_SUPPORTED_ERR)}}else if(!b){const t=`Unknown pseudo-class :${l}`;throw new DOMException(t,a.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(o,e){const{children:h,name:n}=o;let l;if(Array.isArray(h)){const{branches:c}=(0,g.walkAST)(h[0]),[f]=c,[...b]=f,{host:d}=e;if(n==="host"){let i;for(const t of b){const{type:s}=t;if(s===a.COMBINATOR){const u=`Invalid selector ${(0,g.generateCSS)(o)}`;throw new DOMException(u,a.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(l=e)}else if(n==="host-context"){let i=d,t;for(;i;){for(const s of b){const{type:r}=s;if(r===a.COMBINATOR){const m=`Invalid selector ${(0,g.generateCSS)(o)}`;throw new DOMException(m,a.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(l=e)}}else if(n==="host")l=e;else{const c=`Invalid selector :${n}`;throw new DOMException(c,a.SYNTAX_ERR)}return l??null}_matchSelector(o,e,h){const{type:n}=o,l=new Set;if(o.name===a.EMPTY)return l;const c=(0,g.unescapeSelector)(o.name);if(typeof c=="string"&&c!==o.name&&(o.name=c),e.nodeType===a.ELEMENT_NODE)switch(n){case a.SELECTOR_PSEUDO_ELEMENT:{L.matcher.matchPseudoElementSelector(c,h);break}case a.SELECTOR_ID:{e.id===c&&l.add(e);break}case a.SELECTOR_CLASS:{e.classList.contains(c)&&l.add(e);break}case a.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(o,e,h);default:{const f=L.matcher.matchSelector(o,e,h);f&&l.add(f)}}else if(this.#h&&n===a.SELECTOR_PSEUDO_CLASS&&e.nodeType===a.DOCUMENT_FRAGMENT_NODE){if(c!=="has"&&a.REG_LOGICAL_PSEUDO.test(c))return this._matchPseudoClassSelector(o,e,h);if(a.REG_SHADOW_HOST.test(c)){const f=this._matchShadowHostPseudoClass(o,e,h);f&&l.add(f)}}return l}_matchLeaves(o,e,h){let n,l=this.#w.get(o);if(l&&l.has(e)){const{matched:c}=l.get(e);n=c}if(typeof n!="boolean"){for(const f of o){switch(f.type){case a.SELECTOR_ATTR:case a.SELECTOR_ID:{this.#o=!0;break}case a.SELECTOR_PSEUDO_CLASS:{/^(?:(?:any-)?link|defined|dir|has)$/.test(f.name)&&(this.#o=!0);break}default:}if(n=this._matchSelector(f,e,h).has(e),!n)break}let c=!0;e.nodeType===a.ELEMENT_NODE&&a.REG_FORM.test(e.localName)&&(c=!1),c&&!this.#o&&(l||(l=new WeakMap),l.set(e,{matched:n}),this.#w.set(o,l))}return!!n}_matchHTMLCollection(o,e={}){const{compound:h,filterLeaves:n}=e,l=new Set,c=o.length;if(c)if(h)for(let f=0;f<c;f++){const b=o[f];this._matchLeaves(n,b,e)&&l.add(b)}else{const f=[].slice.call(o);return new Set(f)}return l}_findDescendantNodes(o,e,h){const[n,...l]=o,c=l.length>0,{type:f}=n,b=(0,g.unescapeSelector)(n.name);typeof b=="string"&&b!==n.name&&(n.name=b);let d=new Set,i=!1;if(this.#h)i=!0;else switch(f){case a.SELECTOR_PSEUDO_ELEMENT:{L.matcher.matchPseudoElementSelector(b,h);break}case a.SELECTOR_ID:{if(this.#t.nodeType===a.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(b);t&&t!==e&&e.contains(t)&&(c?this._matchLeaves(l,t,h)&&d.add(t):d.add(t))}break}case a.SELECTOR_CLASS:{const t=e.getElementsByClassName(b);d=this._matchHTMLCollection(t,{compound:c,filterLeaves:l});break}case a.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(b)){const t=e.getElementsByTagName(b);d=this._matchHTMLCollection(t,{compound:c,filterLeaves:l})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(o,e,h={}){const{combo:n,leaves:l}=o,{name:c}=n,{parentNode:f}=e,{dir:b}=h,d=new Set;if(b===v)switch(c){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(l,i,h)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,k.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(l,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,k.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(l,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(l,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let r=(0,k.traverseNode)(e,s);for(r=s.nextNode();r&&e.contains(r);)this._matchLeaves(l,r,h)&&d.add(r),r=s.nextNode()}}}else switch(c){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(l,i,h)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,k.traverseNode)(f,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(l,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{f&&this._matchLeaves(l,f,h)&&d.add(f);break}case" ":default:{const i=[];let t=f;for(;t;)this._matchLeaves(l,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(o,e){const{node:h}=e,n=this.#b;let l=(0,k.traverseNode)(h,n),c;if(l)for((l.nodeType!==a.ELEMENT_NODE||l===h&&l!==this.#t)&&(l=n.nextNode());l;){if(this._matchLeaves(o,l,{warn:this.#i})){c=l;break}l=n.nextNode()}return c??null}_matchSelf(o){const e=[],h=this._matchLeaves(o,this.#e,{warn:this.#i});let n=!1;return h&&(e.push(this.#e),n=!0),[e,n]}_findLineal(o,e={}){const{complex:h}=e,n=[];let l=this._matchLeaves(o,this.#e,{warn:this.#i}),c=!1;if(l&&(n.push(this.#e),c=!0),!l||h){let f=this.#e.parentNode;for(;f&&(l=this._matchLeaves(o,f,{warn:this.#i}),l&&(n.push(f),c=!0),f.parentNode);)f=f.parentNode}return[n,c]}_findFirst(o){const e=[],h=this._findNode(o,{node:this.#e});let n=!1;return h&&(e.push(h),n=!0),[e,n]}_findFromHTMLCollection(o,e={}){const{complex:h,compound:n,filterLeaves:l,targetType:c}=e;let f=[],b=!1,d=!1;const i=o.length;if(i)if(this.#e.nodeType===a.ELEMENT_NODE)for(let t=0;t<i;t++){const s=o[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(n){if(this._matchLeaves(l,s,{warn:this.#i})&&(f.push(s),b=!0,c===a.TARGET_FIRST))break}else if(f.push(s),b=!0,c===a.TARGET_FIRST)break}}else if(h)if(n)for(let t=0;t<i;t++){const s=o[t];if(this._matchLeaves(l,s,{warn:this.#i})&&(f.push(s),b=!0,c===a.TARGET_FIRST))break}else f=[].slice.call(o),b=!0,d=!0;else if(n)for(let t=0;t<i;t++){const s=o[t];if(this._matchLeaves(l,s,{warn:this.#i})&&(f.push(s),b=!0,c===a.TARGET_FIRST))break}else f=[].slice.call(o),b=!0,d=!0;return[f,b,d]}_findEntryNodes(o,e,h){const{leaves:n}=o,[l,...c]=n,f=c.length>0,{name:b,type:d}=l;let i=[],t=!1,s=!1,r=!1;switch(d){case a.SELECTOR_PSEUDO_ELEMENT:{L.matcher.matchPseudoElementSelector(b,{warn:this.#i});break}case a.SELECTOR_ID:{if(e===a.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===a.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:h});else if(e===a.TARGET_FIRST&&this.#t.nodeType!==a.ELEMENT_NODE){const u=this.#t.getElementById(b);u&&(f?this._matchLeaves(c,u,{warn:this.#i})&&(i.push(u),s=!0):(i.push(u),s=!0))}else e===a.TARGET_FIRST?[i,s]=this._findFirst(n):r=!0;break}case a.SELECTOR_CLASS:{if(e===a.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===a.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:h});else if(this.#t.nodeType===a.DOCUMENT_NODE){const u=this.#t.getElementsByClassName(b);u.length&&([i,s,t]=this._findFromHTMLCollection(u,{complex:h,compound:f,filterLeaves:c,targetType:e}))}else e===a.TARGET_FIRST?[i,s]=this._findFirst(n):r=!0;break}case a.SELECTOR_TYPE:{if(e===a.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===a.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===a.DOCUMENT_NODE&&!/[*|]/.test(b)){const u=this.#t.getElementsByTagName(b);u.length&&([i,s,t]=this._findFromHTMLCollection(u,{complex:h,compound:f,filterLeaves:c,targetType:e}))}else e===a.TARGET_FIRST?[i,s]=this._findFirst(n):r=!0;break}default:if(e!==a.TARGET_LINEAL&&a.REG_SHADOW_HOST.test(b)){if(this.#h&&this.#e.nodeType===a.DOCUMENT_FRAGMENT_NODE){const u=this._matchShadowHostPseudoClass(l,this.#e);u&&(i.push(u),s=!0)}}else e===a.TARGET_SELF?[i,s]=this._matchSelf(n):e===a.TARGET_LINEAL?[i,s]=this._findLineal(n,{complex:h}):e===a.TARGET_FIRST?[i,s]=this._findFirst(n):r=!0}return{collected:t,compound:f,filtered:s,nodes:i,pending:r}}_collectNodes(o){const e=this.#a.values();if(o===a.TARGET_ALL||o===a.TARGET_FIRST){const h=new Set;let n=0;for(const{branch:l}of e){const c=l.length,f=c>1,b=l[0];let d,i;if(f){const{combo:w,leaves:[{name:p,type:N}]}=b,_=l[c-1],{leaves:[{name:y,type:E}]}=_;if(E===a.SELECTOR_PSEUDO_ELEMENT||E===a.SELECTOR_ID)d=S,i=_;else if(N===a.SELECTOR_PSEUDO_ELEMENT||N===a.SELECTOR_ID)d=v,i=b;else if(o===a.TARGET_ALL)if(p==="*"&&N===a.SELECTOR_TYPE)d=S,i=_;else if(y==="*"&&E===a.SELECTOR_TYPE)d=v,i=b;else if(c===2){const{name:A}=w;/^[+~]$/.test(A)?(d=S,i=_):(d=v,i=b)}else d=v,i=b;else if(y==="*"&&E===a.SELECTOR_TYPE)d=v,i=b;else if(p==="*"&&N===a.SELECTOR_TYPE)d=S,i=_;else{let A;for(const{combo:C,leaves:[O]}of l){const{name:R,type:M}=O;if(M===a.SELECTOR_PSEUDO_CLASS&&R==="dir"){A=!1;break}if(!A&&C){const{name:P}=C;/^[+~]$/.test(P)&&(A=!0)}}A?(d=v,i=b):(d=S,i=_)}}else d=S,i=b;const{collected:t,compound:s,filtered:r,nodes:u,pending:m}=this._findEntryNodes(i,o,f);u.length?(this.#a[n].find=!0,this.#f[n]=u):m&&h.add(new Map([["index",n],["twig",i]])),this.#a[n].collected=t,this.#a[n].dir=d,this.#a[n].filtered=r||!s,n++}if(h.size){let l,c;this.#e!==this.#t&&this.#e.nodeType===a.ELEMENT_NODE?(l=this.#e,c=this.#b):(l=this.#t,c=this.#r);let f=(0,k.traverseNode)(l,c);for(;f;){let b=!1;if(this.#e.nodeType===a.ELEMENT_NODE?f===this.#e?b=!0:b=this.#e.contains(f):b=!0,b)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,f,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#f[s].push(f)}}f!==c.currentNode&&(f=(0,k.traverseNode)(f,c)),f=c.nextNode()}}}else{let h=0;for(const{branch:n}of e){const l=n[n.length-1],c=n.length>1,{compound:f,filtered:b,nodes:d}=this._findEntryNodes(l,o,c);d.length&&(this.#a[h].find=!0,this.#f[h]=d),this.#a[h].dir=S,this.#a[h].filtered=b||!f,h++}}return[this.#a,this.#f]}_getCombinedNodes(o,e,h){const n=[];for(const l of e){const c=this._matchCombinator(o,l,{dir:h,warn:this.#i});c.size&&n.push(...c)}return n.length?new Set(n):new Set}_matchNodeNext(o,e,h){const{combo:n,index:l}=h,{combo:c,leaves:f}=o[l],b={combo:n,leaves:f},d=this._getCombinedNodes(b,e,v);let i;if(d.size)if(l===o.length-1){const[t]=(0,k.sortNodes)(d);i=t}else i=this._matchNodeNext(o,d,{combo:c,index:l+1});return i??null}_matchNodePrev(o,e,h){const{index:n}=h,l=o[n],c=new Set([e]),f=this._getCombinedNodes(l,c,S);let b;if(f.size){if(n===0)b=e;else for(const d of f)if(this._matchNodePrev(o,d,{index:n-1}))return e}return b??null}_find(o){(o===a.TARGET_ALL||o===a.TARGET_FIRST)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(o),n=e.length;let l,c=new Set;for(let f=0;f<n;f++){const{branch:b,collected:d,dir:i,find:t}=e[f],s=b.length;if(s&&t){const r=h[f],u=r.length,m=s-1;if(m===0)if((o===a.TARGET_ALL||o===a.TARGET_FIRST)&&this.#e.nodeType===a.ELEMENT_NODE)for(let w=0;w<u;w++){const p=r[w];if(p!==this.#e&&this.#e.contains(p)&&(c.add(p),o!==a.TARGET_ALL))break}else if(o===a.TARGET_ALL)if(c.size){const w=[...c];c=new Set([...w,...r]),l=!0}else c=new Set(r);else{const[w]=r;c.add(w)}else if(o===a.TARGET_ALL)if(i===v){let{combo:w}=b[0];for(const p of r){let N=new Set([p]);for(let _=1;_<s;_++){const{combo:y,leaves:E}=b[_],A={combo:w,leaves:E};if(N=this._getCombinedNodes(A,N,i),N.size)if(_===m)if(c.size){const C=[...c];c=new Set([...C,...N]),l=!0}else c=N;else w=y;else break}}}else for(const w of r){let p=new Set([w]);for(let N=m-1;N>=0;N--){const _=b[N];if(p=this._getCombinedNodes(_,p,i),p.size)N===0&&(c.add(w),s>1&&c.size>1&&(l=!0));else break}}else if(o===a.TARGET_FIRST&&i===v){const{combo:w}=b[0];let p;for(const N of r)if(p=this._matchNodeNext(b,new Set([N]),{combo:w,index:1}),p){c.add(p);break}if(!p&&!d){const{leaves:N}=b[0],[_]=r;let y=this._findNode(N,{node:_});for(;y;){if(p=this._matchNodeNext(b,new Set([y]),{combo:w,index:1}),p){c.add(p);break}y=this._findNode(N,{node:y})}}}else{let w;for(const p of r)if(w=this._matchNodePrev(b,p,{index:m-1}),w){c.add(p);break}if(!w&&!d&&o===a.TARGET_FIRST){const{leaves:p}=b[m],[N]=r;let _=this._findNode(p,{node:N});for(;_;){if(w=this._matchNodePrev(b,_,{index:m-1}),w){c.add(_);break}_=this._findNode(p,{node:_})}}}}}return o===a.TARGET_ALL&&l&&(c=new Set((0,k.sortNodes)(c))),c}}0&&(module.exports={Finder});
2
2
  //# sourceMappingURL=finder.js.map