@whenessel/seql-js 1.6.1 → 1.7.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/dist/seql-js.js CHANGED
@@ -1,4 +1,4 @@
1
- const fe = "1.0", ge = 10, U = {
1
+ const Ae = "1.0", xe = 10, z = {
2
2
  ANCHOR: 0.4,
3
3
  PATH: 0.3,
4
4
  TARGET: 0.2,
@@ -12,9 +12,9 @@ const fe = "1.0", ge = 10, U = {
12
12
  DEPTH_PENALTY_THRESHOLD: 5,
13
13
  DEPTH_PENALTY_FACTOR: 0.05,
14
14
  DEGRADED_SCORE: 0.3
15
- }, gt = {
15
+ }, bt = {
16
16
  MIN_CONFIDENCE_FOR_SKIP: 0.7
17
- }, K = [
17
+ }, tt = [
18
18
  "form",
19
19
  "main",
20
20
  "nav",
@@ -22,7 +22,7 @@ const fe = "1.0", ge = 10, U = {
22
22
  "article",
23
23
  "footer",
24
24
  "header"
25
- ], J = [
25
+ ], et = [
26
26
  "form",
27
27
  "navigation",
28
28
  "main",
@@ -31,7 +31,7 @@ const fe = "1.0", ge = 10, U = {
31
31
  "complementary",
32
32
  "banner",
33
33
  "search"
34
- ], mt = [
34
+ ], St = [
35
35
  // HTML5 Semantic
36
36
  "article",
37
37
  "aside",
@@ -108,7 +108,7 @@ const fe = "1.0", ge = 10, U = {
108
108
  "g",
109
109
  "text",
110
110
  "use"
111
- ], pt = [
111
+ ], yt = [
112
112
  "rect",
113
113
  "path",
114
114
  "circle",
@@ -122,7 +122,7 @@ const fe = "1.0", ge = 10, U = {
122
122
  "defs",
123
123
  "clipPath",
124
124
  "mask"
125
- ], me = [
125
+ ], Ce = [
126
126
  "aria-label",
127
127
  "aria-labelledby",
128
128
  "aria-describedby",
@@ -162,7 +162,7 @@ const fe = "1.0", ge = 10, U = {
162
162
  "data-*": 30,
163
163
  // Any aria-* attribute (if not above)
164
164
  "aria-*": 25
165
- }, V = /* @__PURE__ */ new Set([
165
+ }, Y = /* @__PURE__ */ new Set([
166
166
  "id",
167
167
  // handled separately
168
168
  "class",
@@ -174,20 +174,20 @@ const fe = "1.0", ge = 10, U = {
174
174
  "tabindex",
175
175
  // can change
176
176
  "contenteditable"
177
- ]), bt = {
177
+ ]), At = {
178
178
  maxPathDepth: 10,
179
179
  enableSvgFingerprint: !0,
180
180
  confidenceThreshold: 0,
181
181
  fallbackToBody: !0,
182
182
  includeUtilityClasses: !1,
183
183
  source: "dom-dsl"
184
- }, yt = {
184
+ }, xt = {
185
185
  strictMode: !1,
186
186
  enableFallback: !0,
187
187
  maxCandidates: 20,
188
188
  matchUrlsByPathOnly: !0
189
189
  };
190
- function P(r) {
190
+ function L(r) {
191
191
  if (/^[a-z]+-\d+$/i.test(r) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r) || /^\d+$/.test(r) || /^:[a-z0-9]+:$/i.test(r) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r))
192
192
  return !0;
193
193
  if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r)) {
@@ -197,7 +197,7 @@ function P(r) {
197
197
  }
198
198
  return !!(/^radix-/.test(r) || /^mui-\d+$/.test(r));
199
199
  }
200
- const Q = /* @__PURE__ */ new Set([
200
+ const Z = /* @__PURE__ */ new Set([
201
201
  "aria-labelledby",
202
202
  "aria-describedby",
203
203
  "aria-controls",
@@ -211,10 +211,10 @@ const Q = /* @__PURE__ */ new Set([
211
211
  "aria-errormessage",
212
212
  "aria-flowto"
213
213
  ]);
214
- function Y(r) {
215
- return r.trim().split(/\s+/).some((e) => P(e));
214
+ function K(r) {
215
+ return r.trim().split(/\s+/).some((e) => L(e));
216
216
  }
217
- class St {
217
+ class Ct {
218
218
  constructor(t, e) {
219
219
  this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
220
220
  }
@@ -247,25 +247,25 @@ class St {
247
247
  if (e === "head" || this.isInsideHead(t)) {
248
248
  const c = s?.documentElement;
249
249
  if (c) {
250
- const u = {
250
+ const l = {
251
251
  element: c,
252
252
  score: 1,
253
253
  tier: "A",
254
254
  depth: 0
255
255
  };
256
- return this.cacheResult(t, u), u;
256
+ return this.cacheResult(t, l), l;
257
257
  }
258
258
  }
259
259
  if (e === "body") {
260
260
  const c = s?.documentElement;
261
261
  if (c) {
262
- const u = {
262
+ const l = {
263
263
  element: c,
264
264
  score: 1,
265
265
  tier: "A",
266
266
  depth: 0
267
267
  };
268
- return this.cacheResult(t, u), u;
268
+ return this.cacheResult(t, l), l;
269
269
  }
270
270
  }
271
271
  let n = t.parentElement, a = 0, i = null;
@@ -279,10 +279,10 @@ class St {
279
279
  };
280
280
  const c = this.scoreAnchor(n);
281
281
  if (c > 0) {
282
- const u = this.applyDepthPenalty(c, a), d = this.getTier(n), l = { element: n, score: u, tier: d, depth: a };
283
- if (d === "A")
284
- return l;
285
- (!i || u > i.score) && (i = l);
282
+ const l = this.applyDepthPenalty(c, a), f = this.getTier(n), h = { element: n, score: l, tier: f, depth: a };
283
+ if (f === "A")
284
+ return h;
285
+ (!i || l > i.score) && (i = h);
286
286
  }
287
287
  n = n.parentElement, a++;
288
288
  }
@@ -297,11 +297,11 @@ class St {
297
297
  scoreAnchor(t) {
298
298
  let e = 0;
299
299
  const s = t.tagName.toLowerCase();
300
- K.includes(s) && (e += I.SEMANTIC_TAG);
300
+ tt.includes(s) && (e += I.SEMANTIC_TAG);
301
301
  const n = t.getAttribute("role");
302
- n && J.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
302
+ n && et.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
303
303
  const a = t.id;
304
- return a && !P(a) && (e += I.STABLE_ID), (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test")) && (e += I.TEST_MARKER), Math.min(e, 1);
304
+ return a && !L(a) && (e += I.STABLE_ID), (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test")) && (e += I.TEST_MARKER), Math.min(e, 1);
305
305
  }
306
306
  /**
307
307
  * Applies depth penalty to score
@@ -318,10 +318,10 @@ class St {
318
318
  */
319
319
  getTier(t) {
320
320
  const e = t.tagName.toLowerCase();
321
- if (K.includes(e))
321
+ if (tt.includes(e))
322
322
  return "A";
323
323
  const s = t.getAttribute("role");
324
- return s && J.includes(s) ? "B" : "C";
324
+ return s && et.includes(s) ? "B" : "C";
325
325
  }
326
326
  /**
327
327
  * Checks if element is inside <head> section.
@@ -354,7 +354,7 @@ class St {
354
354
  this.cache && this.cache.setAnchor(t, e);
355
355
  }
356
356
  }
357
- const At = [
357
+ const Tt = [
358
358
  // CSS-in-JS
359
359
  /^css-[a-z0-9]+$/i,
360
360
  /^sc-[a-z0-9]+-\d+$/i,
@@ -374,7 +374,7 @@ const At = [
374
374
  /^_[a-z0-9]{5,}$/i,
375
375
  /\d{5,}/
376
376
  // 5+ digits in a row
377
- ], xt = [
377
+ ], Et = [
378
378
  // === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
379
379
  /^\[/,
380
380
  // Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
@@ -485,7 +485,7 @@ const At = [
485
485
  /^clearfix$/,
486
486
  /^pull-(left|right)$/,
487
487
  /^float-(left|right|none)$/
488
- ], Ct = [
488
+ ], wt = [
489
489
  // === Navigation ===
490
490
  /^(nav|menu|header|footer|sidebar|topbar|navbar|breadcrumb)/,
491
491
  /(navigation|dropdown|megamenu)$/,
@@ -512,41 +512,91 @@ const At = [
512
512
  // === Status ===
513
513
  /^(loading|pending|complete|failed|draft|published)/
514
514
  ];
515
- function O(r) {
516
- return At.some((t) => t.test(r));
515
+ function q(r) {
516
+ return Tt.some((t) => t.test(r));
517
517
  }
518
- function _(r) {
519
- return r.length <= 2 || /^\d/.test(r) ? !0 : xt.some((t) => t.test(r));
518
+ function U(r) {
519
+ return r.length <= 2 || /^\d/.test(r) ? !0 : Et.some((t) => t.test(r));
520
520
  }
521
- function Tt(r) {
522
- return O(r) || _(r) ? !1 : Ct.some((t) => t.test(r));
521
+ function vt(r) {
522
+ return q(r) || U(r) ? !1 : wt.some((t) => t.test(r));
523
523
  }
524
- function Et(r) {
525
- return !O(r) && !_(r);
524
+ function $t(r) {
525
+ return !q(r) && !U(r);
526
526
  }
527
527
  function M(r) {
528
- return r.filter((t) => Et(t));
528
+ return r.filter((t) => $t(t));
529
529
  }
530
- function wt(r) {
531
- if (O(r) || _(r))
530
+ function Nt(r) {
531
+ if (q(r) || U(r))
532
532
  return 0;
533
533
  let t = 0.5;
534
- return Tt(r) && (t = 0.8), r.length < 3 ? t *= 0.3 : r.length < 5 && (t *= 0.6), /\d/.test(r) && (t *= 0.7), Math.min(t, 1);
534
+ return vt(r) && (t = 0.8), r.length < 3 ? t *= 0.3 : r.length < 5 && (t *= 0.6), /\d/.test(r) && (t *= 0.7), Math.min(t, 1);
535
535
  }
536
- function vt(r) {
536
+ function It(r) {
537
537
  const t = [], e = [];
538
538
  for (const s of r)
539
- _(s) || O(s) ? e.push(s) : t.push(s);
539
+ U(s) || q(s) ? e.push(s) : t.push(s);
540
540
  return { semantic: t, utility: e };
541
541
  }
542
- function tt(r) {
543
- return _(r) || O(r);
542
+ function st(r) {
543
+ return U(r) || q(r);
544
+ }
545
+ function Te(r) {
546
+ return Nt(r);
544
547
  }
545
- function pe(r) {
546
- return wt(r);
548
+ const Rt = /* @__PURE__ */ new Set([
549
+ "tr",
550
+ "td",
551
+ "th",
552
+ "thead",
553
+ "tbody",
554
+ "tfoot"
555
+ ]), Dt = /* @__PURE__ */ new Set([
556
+ "data-testid",
557
+ "data-qa",
558
+ "data-cy",
559
+ "data-test",
560
+ "aria-label",
561
+ "name",
562
+ "href"
563
+ ]);
564
+ function Mt(r) {
565
+ if (r.id) return !0;
566
+ if (r.attributes) {
567
+ for (const t of Object.keys(r.attributes))
568
+ if (Dt.has(t)) return !0;
569
+ }
570
+ return !1;
571
+ }
572
+ function Lt(r, t, e) {
573
+ const s = r.parentElement;
574
+ if (!s) return !0;
575
+ for (const n of Array.from(s.children)) {
576
+ if (n === r || n.tagName.toLowerCase() !== t) continue;
577
+ if ((n.textContent?.trim() ?? "") === e) return !1;
578
+ }
579
+ return !0;
580
+ }
581
+ function _(r, t, e) {
582
+ if (Rt.has(r)) return !0;
583
+ if (Mt(t)) return !1;
584
+ if (e) {
585
+ const s = e.parentElement;
586
+ if (s) {
587
+ const n = t.text?.normalized;
588
+ if (n && Lt(e, r, n))
589
+ return !1;
590
+ if (Array.from(s.children).some(
591
+ (i) => i !== e && i.tagName.toLowerCase() === r
592
+ )) return !0;
593
+ }
594
+ return !1;
595
+ }
596
+ return !0;
547
597
  }
548
- const et = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
549
- class $t {
598
+ const rt = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
599
+ class Pt {
550
600
  constructor(t, e) {
551
601
  this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
552
602
  }
@@ -581,19 +631,22 @@ class $t {
581
631
  degraded: !0,
582
632
  degradationReason: "target-not-descendant-of-anchor"
583
633
  };
584
- let u = this.filterNoise(i);
585
- return u = this.ensureUniqueness(i, u, t, e, s), {
586
- path: u.map((l) => {
587
- const h = l.parentElement;
634
+ let l = this.filterNoise(i);
635
+ return l = this.ensureUniqueness(i, l, t, e, s), {
636
+ path: l.map((h) => {
637
+ const d = h.tagName.toLowerCase(), u = s.extract(h);
588
638
  let g;
589
- if (h) {
590
- const m = Array.from(h.children).indexOf(l);
591
- m !== -1 && (g = m + 1);
639
+ if (_(d, u, h)) {
640
+ const m = h.parentElement;
641
+ if (m) {
642
+ const b = Array.from(m.children).indexOf(h);
643
+ b !== -1 && (g = b + 1);
644
+ }
592
645
  }
593
646
  return {
594
- tag: l.tagName.toLowerCase(),
595
- semantics: s.extract(l),
596
- score: s.scoreElement(l),
647
+ tag: d,
648
+ semantics: u,
649
+ score: s.scoreElement(h),
597
650
  nthChild: g
598
651
  };
599
652
  }),
@@ -618,27 +671,27 @@ class $t {
618
671
  if (!o) return e;
619
672
  let c;
620
673
  if (this.cache) {
621
- const d = this.cache.getSelectorResults(i);
622
- d !== void 0 ? c = d : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
674
+ const f = this.cache.getSelectorResults(i);
675
+ f !== void 0 ? c = f : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
623
676
  } else
624
677
  c = o.querySelectorAll(i);
625
678
  if (c.length <= 1)
626
679
  return e;
627
- const u = t.filter((d) => !e.includes(d));
628
- for (const d of u) {
629
- if (a.scoreElement(d) < gt.MIN_CONFIDENCE_FOR_SKIP)
680
+ const l = t.filter((f) => !e.includes(f));
681
+ for (const f of l) {
682
+ if (a.scoreElement(f) < bt.MIN_CONFIDENCE_FOR_SKIP)
630
683
  continue;
631
- const h = this.insertNodeInOrder(e, d, t), g = this.buildTestSelector(s, h, n);
684
+ const d = this.insertNodeInOrder(e, f, t), u = this.buildTestSelector(s, d, n);
632
685
  try {
633
- let f;
686
+ let g;
634
687
  if (this.cache) {
635
- const m = this.cache.getSelectorResults(g);
636
- m !== void 0 ? f = m : (f = Array.from(o.querySelectorAll(g)), this.cache.setSelectorResults(g, f));
688
+ const m = this.cache.getSelectorResults(u);
689
+ m !== void 0 ? g = m : (g = Array.from(o.querySelectorAll(u)), this.cache.setSelectorResults(u, g));
637
690
  } else
638
- f = o.querySelectorAll(g);
639
- if (f.length === 1)
640
- return h;
641
- f.length < c.length && (e = h);
691
+ g = o.querySelectorAll(u);
692
+ if (g.length === 1)
693
+ return d;
694
+ g.length < c.length && (e = d);
642
695
  } catch {
643
696
  }
644
697
  }
@@ -672,9 +725,9 @@ class $t {
672
725
  */
673
726
  elementToSelector(t) {
674
727
  let e = t.tagName.toLowerCase();
675
- t.id && !P(t.id) && (e += `#${et(t.id)}`);
728
+ t.id && !L(t.id) && (e += `#${rt(t.id)}`);
676
729
  for (const s of Array.from(t.classList))
677
- tt(s) || (e += `.${et(s)}`);
730
+ st(s) || (e += `.${rt(s)}`);
678
731
  return e;
679
732
  }
680
733
  /**
@@ -688,7 +741,7 @@ class $t {
688
741
  */
689
742
  shouldInclude(t) {
690
743
  const e = t.tagName.toLowerCase();
691
- return mt.includes(e) ? !0 : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : !1;
744
+ return St.includes(e) ? !0 : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : !1;
692
745
  }
693
746
  /**
694
747
  * Checks if element has meaningful semantic features
@@ -699,12 +752,12 @@ class $t {
699
752
  if (s.name.startsWith("aria-")) return !0;
700
753
  if (t.classList.length > 0) {
701
754
  for (const s of Array.from(t.classList))
702
- if (!tt(s)) return !0;
755
+ if (!st(s)) return !0;
703
756
  }
704
757
  if (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test"))
705
758
  return !0;
706
759
  const e = t.id;
707
- return !!(e && !P(e));
760
+ return !!(e && !L(e));
708
761
  }
709
762
  /**
710
763
  * Checks if element is inside <head> section.
@@ -751,31 +804,34 @@ class $t {
751
804
  degradationReason: "head-not-found-in-path"
752
805
  } : {
753
806
  path: n.map((c) => {
754
- const u = c.parentElement;
755
- let d;
756
- if (u) {
757
- const h = Array.from(u.children).indexOf(c);
758
- h !== -1 && (d = h + 1);
807
+ const l = c.tagName.toLowerCase(), f = s.extract(c);
808
+ let h;
809
+ if (_(l, f, c)) {
810
+ const d = c.parentElement;
811
+ if (d) {
812
+ const g = Array.from(d.children).indexOf(c);
813
+ g !== -1 && (h = g + 1);
814
+ }
759
815
  }
760
816
  return {
761
- tag: c.tagName.toLowerCase(),
762
- semantics: s.extract(c),
817
+ tag: l,
818
+ semantics: f,
763
819
  score: s.scoreElement(c),
764
- nthChild: d
820
+ nthChild: h
765
821
  };
766
822
  }),
767
823
  degraded: !1
768
824
  };
769
825
  }
770
826
  }
771
- function F(r) {
827
+ function j(r) {
772
828
  return r ? r.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
773
829
  }
774
- const Nt = {
830
+ const Ht = {
775
831
  preserveQueryForAbsolute: !0,
776
832
  removeDynamicHashes: !0
777
833
  };
778
- function It(r) {
834
+ function kt(r) {
779
835
  return r ? [
780
836
  /\d{5,}/,
781
837
  // 5+ digits
@@ -789,18 +845,18 @@ function It(r) {
789
845
  // UUID-like
790
846
  ].some((e) => e.test(r)) : !1;
791
847
  }
792
- function Rt(r, t) {
848
+ function _t(r, t) {
793
849
  if (!r) return r;
794
850
  const e = r.startsWith("http://") || r.startsWith("https://"), [s, n] = r.split("#"), [a, i] = s.split("?");
795
851
  let o = a;
796
- return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && It(n) || (o += `#${n}`)), o;
852
+ return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && kt(n) || (o += `#${n}`)), o;
797
853
  }
798
854
  function D(r, t, e = {}) {
799
855
  if (!t) return t;
800
- const s = { ...Nt, ...e };
801
- return r === "href" || r === "src" ? Rt(t, s) : t;
856
+ const s = { ...Ht, ...e };
857
+ return r === "href" || r === "src" ? _t(t, s) : t;
802
858
  }
803
- const Dt = [
859
+ const Ot = [
804
860
  "role",
805
861
  "aria-label",
806
862
  "aria-labelledby",
@@ -811,7 +867,7 @@ const Dt = [
811
867
  "aria-posinset",
812
868
  "aria-setsize",
813
869
  "aria-haspopup"
814
- ], Mt = [
870
+ ], qt = [
815
871
  "aria-selected",
816
872
  "aria-checked",
817
873
  "aria-pressed",
@@ -824,7 +880,7 @@ const Dt = [
824
880
  "aria-grabbed",
825
881
  "aria-live",
826
882
  "aria-atomic"
827
- ], Pt = [
883
+ ], Ut = [
828
884
  "data-state",
829
885
  "data-active",
830
886
  "data-inactive",
@@ -843,7 +899,7 @@ const Dt = [
843
899
  "data-hover",
844
900
  "data-orientation",
845
901
  "data-theme"
846
- ], Ht = [
902
+ ], zt = [
847
903
  "data-radix-",
848
904
  "data-headlessui-",
849
905
  "data-reach-",
@@ -851,7 +907,7 @@ const Dt = [
851
907
  "data-chakra-",
852
908
  "data-mantine-",
853
909
  "data-tw-"
854
- ], Lt = [
910
+ ], Ft = [
855
911
  "data-testid",
856
912
  "data-test-id",
857
913
  "data-test",
@@ -863,7 +919,7 @@ const Dt = [
863
919
  "data-entity-id",
864
920
  "data-product-id",
865
921
  "data-user-id"
866
- ], kt = [
922
+ ], jt = [
867
923
  // Google Analytics / GTM
868
924
  "data-ga",
869
925
  "data-gtm",
@@ -899,7 +955,7 @@ const Dt = [
899
955
  "data-conversion",
900
956
  "data-segment",
901
957
  "data-analytics"
902
- ], qt = [
958
+ ], Wt = [
903
959
  "data-category",
904
960
  // Google Analytics category
905
961
  "data-action",
@@ -908,7 +964,7 @@ const Dt = [
908
964
  // Google Analytics label
909
965
  "data-value"
910
966
  // Google Analytics value
911
- ], Ot = [
967
+ ], Bt = [
912
968
  "id",
913
969
  "name",
914
970
  "type",
@@ -917,7 +973,7 @@ const Dt = [
917
973
  "for",
918
974
  "alt",
919
975
  "href"
920
- ], _t = [
976
+ ], Gt = [
921
977
  "disabled",
922
978
  "checked",
923
979
  "selected",
@@ -925,17 +981,17 @@ const Dt = [
925
981
  "readonly",
926
982
  "required",
927
983
  "value"
928
- ], Ut = [
984
+ ], Vt = [
929
985
  /^radix-/,
930
986
  /^headlessui-/,
931
987
  /^mui-/,
932
988
  /:\w+:/
933
989
  // matches :ru:, :r1:, etc.
934
990
  ];
935
- function zt(r, t) {
936
- return Dt.includes(r) ? !0 : Mt.includes(r) || Pt.includes(r) || Ht.some((e) => r.startsWith(e)) ? !1 : Lt.includes(r) ? !0 : kt.some((e) => r.startsWith(e)) || qt.includes(r) ? !1 : r.startsWith("data-") && r.endsWith("-id") ? !0 : r === "id" ? !Ut.some((e) => e.test(t)) : Ot.includes(r) ? !0 : _t.includes(r) ? !1 : !!r.startsWith("data-");
991
+ function Qt(r, t) {
992
+ return Ot.includes(r) ? !0 : qt.includes(r) || Ut.includes(r) || zt.some((e) => r.startsWith(e)) ? !1 : Ft.includes(r) ? !0 : jt.some((e) => r.startsWith(e)) || Wt.includes(r) ? !1 : r.startsWith("data-") && r.endsWith("-id") ? !0 : r === "id" ? !Vt.some((e) => e.test(t)) : Bt.includes(r) ? !0 : Gt.includes(r) ? !1 : !!r.startsWith("data-");
937
993
  }
938
- class st {
994
+ class nt {
939
995
  constructor(t, e) {
940
996
  this.includeUtilityClasses = t.includeUtilityClasses ?? !1, this.cache = e;
941
997
  }
@@ -951,12 +1007,12 @@ class st {
951
1007
  return i;
952
1008
  }
953
1009
  const e = {}, s = t.id;
954
- if (s && !P(s) && (e.id = s), t.classList.length > 0) {
1010
+ if (s && !L(s) && (e.id = s), t.classList.length > 0) {
955
1011
  const i = Array.from(t.classList);
956
1012
  if (this.includeUtilityClasses)
957
1013
  e.classes = i;
958
1014
  else {
959
- const { semantic: o } = vt(i);
1015
+ const { semantic: o } = It(i);
960
1016
  o.length > 0 && (e.classes = o);
961
1017
  }
962
1018
  }
@@ -985,7 +1041,7 @@ class st {
985
1041
  * @returns True if should be ignored
986
1042
  */
987
1043
  shouldIgnoreAttribute(t) {
988
- return !!(V.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
1044
+ return !!(Y.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
989
1045
  }
990
1046
  /**
991
1047
  * Gets attribute priority
@@ -1020,7 +1076,7 @@ class st {
1020
1076
  const e = {};
1021
1077
  for (const s of Array.from(t.attributes)) {
1022
1078
  const n = s.name;
1023
- if (this.shouldIgnoreAttribute(n) || !zt(n, s.value) || Q.has(n) && Y(s.value) || this.getAttributePriority(n) === 0) continue;
1079
+ if (this.shouldIgnoreAttribute(n) || !Qt(n, s.value) || Z.has(n) && K(s.value) || this.getAttributePriority(n) === 0) continue;
1024
1080
  const i = n === "href" || n === "src" ? D(n, s.value) : s.value;
1025
1081
  !i || i.trim() === "" || this.isDynamicValue(i) || (e[n] = i);
1026
1082
  }
@@ -1032,7 +1088,7 @@ class st {
1032
1088
  extractText(t) {
1033
1089
  const e = this.getDirectTextContent(t);
1034
1090
  if (!e) return null;
1035
- const s = F(e);
1091
+ const s = j(e);
1036
1092
  if (!s) return null;
1037
1093
  const n = 100, a = e.length > n ? e.slice(0, n) + "..." : e, i = s.length > n ? s.slice(0, n) + "..." : s;
1038
1094
  return {
@@ -1080,7 +1136,7 @@ class st {
1080
1136
  ].includes(e);
1081
1137
  }
1082
1138
  }
1083
- class Ft {
1139
+ class Yt {
1084
1140
  /**
1085
1141
  * Generates fingerprint for SVG element
1086
1142
  * @param element - SVG element to fingerprint
@@ -1191,15 +1247,15 @@ class Ft {
1191
1247
  return Math.abs(e).toString(16).padStart(8, "0");
1192
1248
  }
1193
1249
  }
1194
- function jt(r, t = 0) {
1195
- const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e * U.ANCHOR + s * U.PATH + n * U.TARGET + t * U.UNIQUENESS, i = r.anchor.degraded ? 0.2 : 0;
1250
+ function Zt(r, t = 0) {
1251
+ const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e * z.ANCHOR + s * z.PATH + n * z.TARGET + t * z.UNIQUENESS, i = r.anchor.degraded ? 0.2 : 0;
1196
1252
  return Math.max(0, Math.min(1, a - i));
1197
1253
  }
1198
- function be(r, t, e) {
1254
+ function Ee(r, t, e) {
1199
1255
  let s = 0.5;
1200
1256
  return t && (s += 0.2), e && (s += 0.15), s += Math.min(r * 0.05, 0.15), Math.min(s, 1);
1201
1257
  }
1202
- class Wt {
1258
+ class Kt {
1203
1259
  constructor(t) {
1204
1260
  this.cache = /* @__PURE__ */ new Map(), this.maxSize = t;
1205
1261
  }
@@ -1230,9 +1286,9 @@ class Wt {
1230
1286
  return this.cache.size;
1231
1287
  }
1232
1288
  }
1233
- class Bt {
1289
+ class Xt {
1234
1290
  constructor(t = {}) {
1235
- this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Wt(
1291
+ this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Kt(
1236
1292
  t.maxSelectorCacheSize ?? 1e3
1237
1293
  ), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
1238
1294
  eidHits: 0,
@@ -1381,15 +1437,15 @@ class Bt {
1381
1437
  return s > 0 ? t / s : 0;
1382
1438
  }
1383
1439
  }
1384
- function Gt(r) {
1385
- return new Bt(r);
1440
+ function Jt(r) {
1441
+ return new Xt(r);
1386
1442
  }
1387
- let z = null;
1388
- function Z() {
1389
- return z || (z = Gt()), z;
1443
+ let F = null;
1444
+ function X() {
1445
+ return F || (F = Jt()), F;
1390
1446
  }
1391
- function ye() {
1392
- z = null;
1447
+ function we() {
1448
+ F = null;
1393
1449
  }
1394
1450
  function k(r) {
1395
1451
  if (r.ownerDocument)
@@ -1407,7 +1463,7 @@ function k(r) {
1407
1463
  3. You are working with a document node instead of an element`
1408
1464
  );
1409
1465
  }
1410
- function Vt(r, t) {
1466
+ function te(r, t) {
1411
1467
  if (!t)
1412
1468
  return;
1413
1469
  const e = k(r), s = t instanceof Document ? t : k(t);
@@ -1422,63 +1478,64 @@ Common causes:
1422
1478
  Solution: Ensure element and root parameter are from the same document context.`
1423
1479
  );
1424
1480
  }
1425
- function X(r, t = {}) {
1481
+ function J(r, t = {}) {
1426
1482
  if (!r || !r.ownerDocument || !r.isConnected)
1427
1483
  return null;
1428
- const e = { ...bt, ...t };
1484
+ const e = { ...At, ...t };
1429
1485
  if (e.root)
1430
1486
  try {
1431
- Vt(r, e.root);
1487
+ te(r, e.root);
1432
1488
  } catch (x) {
1433
1489
  return console.error("Cross-document generation detected:", x), null;
1434
1490
  }
1435
- const s = e.cache ?? Z(), n = s.getEID(r);
1491
+ const s = e.cache ?? X(), n = s.getEID(r);
1436
1492
  if (n !== void 0)
1437
1493
  return n;
1438
- if (r.tagName.toLowerCase() === "html") {
1439
- const x = new st(e, s), y = Zt(r, e, x);
1494
+ const a = r.tagName.toLowerCase();
1495
+ if (a === "html") {
1496
+ const x = new nt(e, s), y = re(r, e, x);
1440
1497
  return s.setEID(r, y), y;
1441
1498
  }
1442
- const i = new St(e, s), o = new $t(e, s), c = new st(e, s), u = new Ft(), d = i.findAnchor(r);
1443
- if (!d && !e.fallbackToBody)
1499
+ const i = new Ct(e, s), o = new Pt(e, s), c = new nt(e, s), l = new Yt(), f = i.findAnchor(r);
1500
+ if (!f && !e.fallbackToBody)
1444
1501
  return null;
1445
- const l = d?.element ?? r.ownerDocument?.body ?? null;
1446
- if (!l) return null;
1447
- const h = !d || d.tier === "C", g = l.tagName.toLowerCase(), f = l.parentElement;
1448
- let m;
1449
- if (f && g !== "body" && g !== "html") {
1450
- const y = Array.from(f.children).indexOf(l);
1451
- y !== -1 && (m = y + 1);
1452
- }
1453
- const p = c.extract(l), b = {
1454
- tag: l.tagName.toLowerCase(),
1455
- semantics: p,
1456
- score: d?.score ?? I.DEGRADED_SCORE,
1457
- degraded: h,
1458
- nthChild: m
1459
- }, S = o.buildPath(l, r, c), E = c.extract(r);
1460
- e.enableSvgFingerprint && Qt(r) && (E.svg = u.fingerprint(r));
1502
+ const h = f?.element ?? r.ownerDocument?.body ?? null;
1503
+ if (!h) return null;
1504
+ const d = !f || f.tier === "C", u = h.tagName.toLowerCase(), g = c.extract(h), m = h.parentElement;
1505
+ let p;
1506
+ if (m && u !== "body" && u !== "html" && _(u, g, h)) {
1507
+ const y = Array.from(m.children).indexOf(h);
1508
+ y !== -1 && (p = y + 1);
1509
+ }
1510
+ const b = {
1511
+ tag: h.tagName.toLowerCase(),
1512
+ semantics: g,
1513
+ score: f?.score ?? I.DEGRADED_SCORE,
1514
+ degraded: d,
1515
+ nthChild: p
1516
+ }, S = o.buildPath(h, r, c), T = c.extract(r);
1517
+ e.enableSvgFingerprint && ee(r) && (T.svg = l.fingerprint(r));
1461
1518
  const C = r.parentElement;
1462
1519
  let A;
1463
- if (C) {
1520
+ if (C && _(a, T, r)) {
1464
1521
  const y = Array.from(C.children).indexOf(r);
1465
1522
  y !== -1 && (A = y + 1);
1466
1523
  }
1467
1524
  const v = {
1468
1525
  tag: r.tagName.toLowerCase(),
1469
- semantics: E,
1526
+ semantics: T,
1470
1527
  score: c.scoreElement(r),
1471
1528
  nthChild: A
1472
- }, H = [], $ = {
1529
+ }, P = [], $ = {
1473
1530
  onMultiple: "best-score",
1474
1531
  onMissing: "anchor-only",
1475
1532
  maxDepth: 3
1476
- }, T = b.degraded || S.degraded, R = Yt(b.degraded, S), N = {
1533
+ }, E = b.degraded || S.degraded, R = se(b.degraded, S), N = {
1477
1534
  version: "1.0",
1478
1535
  anchor: b,
1479
1536
  path: S.path,
1480
1537
  target: v,
1481
- constraints: H,
1538
+ constraints: P,
1482
1539
  fallback: $,
1483
1540
  meta: {
1484
1541
  confidence: 0,
@@ -1486,16 +1543,16 @@ function X(r, t = {}) {
1486
1543
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1487
1544
  generator: "dom-eid@1.0",
1488
1545
  source: e.source,
1489
- degraded: T,
1546
+ degraded: E,
1490
1547
  degradationReason: R
1491
1548
  }
1492
1549
  };
1493
- return N.meta.confidence = jt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
1550
+ return N.meta.confidence = Zt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
1494
1551
  }
1495
- function Qt(r) {
1552
+ function ee(r) {
1496
1553
  return r.namespaceURI === "http://www.w3.org/2000/svg" || r.tagName.toLowerCase() === "svg" || r instanceof SVGElement;
1497
1554
  }
1498
- function Yt(r, t) {
1555
+ function se(r, t) {
1499
1556
  if (r && t.degraded)
1500
1557
  return "anchor-and-path-degraded";
1501
1558
  if (r)
@@ -1503,7 +1560,7 @@ function Yt(r, t) {
1503
1560
  if (t.degraded)
1504
1561
  return t.degradationReason;
1505
1562
  }
1506
- function Zt(r, t, e, s) {
1563
+ function re(r, t, e, s) {
1507
1564
  const a = {
1508
1565
  tag: "html",
1509
1566
  semantics: e.extract(r),
@@ -1532,42 +1589,42 @@ function Zt(r, t, e, s) {
1532
1589
  }
1533
1590
  };
1534
1591
  }
1535
- class ot {
1592
+ class lt {
1536
1593
  buildSelector(t, e) {
1537
1594
  if (t.target.tag === "html") {
1538
- const l = "html";
1595
+ const h = "html";
1539
1596
  return e?.ensureUnique ? {
1540
- selector: l,
1597
+ selector: h,
1541
1598
  isUnique: !0,
1542
1599
  usedNthOfType: !1,
1543
1600
  extraClassesAdded: 0
1544
- } : l;
1601
+ } : h;
1545
1602
  }
1546
1603
  if (t.anchor.tag === "html" && t.path.length === 0) {
1547
- const h = `html > ${this.buildNodeSelector(t.target.tag, t.target.semantics)}`;
1604
+ const d = `html > ${this.buildNodeSelector(t.target.tag, t.target.semantics)}`;
1548
1605
  return e?.ensureUnique ? {
1549
- selector: h,
1550
- isUnique: this.isUnique(h, e.root ?? document),
1606
+ selector: d,
1607
+ isUnique: this.isUnique(d, e.root ?? document),
1551
1608
  usedNthOfType: !1,
1552
1609
  extraClassesAdded: 0
1553
- } : h;
1610
+ } : d;
1554
1611
  }
1555
1612
  if (t.anchor.tag === "html" && t.path.length > 0 && t.path[0].tag === "head")
1556
1613
  return this.buildHeadSelector(t, e);
1557
1614
  if (t.path.length === 0 && t.anchor.tag === t.target.tag && JSON.stringify(t.anchor.semantics) === JSON.stringify(t.target.semantics)) {
1558
- const l = this.buildNodeSelector(
1615
+ const h = this.buildNodeSelector(
1559
1616
  t.target.tag,
1560
1617
  t.target.semantics,
1561
1618
  { excludeClasses: !1 }
1562
1619
  // Include classes for same-element case
1563
1620
  );
1564
- return e?.ensureUnique ? this.ensureUniqueSelector(l, t, e) : l;
1621
+ return e?.ensureUnique ? this.ensureUniqueSelector(h, t, e) : h;
1565
1622
  }
1566
1623
  const n = [], a = e?.ensureUnique ? this.ensureUniqueAnchor(t, e.root) : this.buildNodeSelector(t.anchor.tag, t.anchor.semantics);
1567
1624
  n.push(a);
1568
- for (const l of t.path) {
1569
- let h = this.buildNodeSelector(l.tag, l.semantics);
1570
- l.nthChild !== void 0 && (["tr", "td", "th", "thead", "tbody", "tfoot"].includes(l.tag) ? h += `:nth-child(${l.nthChild})` : h += `:nth-child(${l.nthChild})`), n.push(h);
1625
+ for (const h of t.path) {
1626
+ let d = this.buildNodeSelector(h.tag, h.semantics);
1627
+ h.nthChild !== void 0 && _(h.tag, h.semantics) && (d += `:nth-child(${h.nthChild})`), n.push(d);
1571
1628
  }
1572
1629
  let i = this.buildNodeSelector(
1573
1630
  t.target.tag,
@@ -1575,43 +1632,43 @@ class ot {
1575
1632
  { excludeClasses: e?.ensureUnique }
1576
1633
  // Exclude classes initially if we need unique
1577
1634
  );
1578
- t.target.nthChild !== void 0 && (["tr", "td", "th", "thead", "tbody", "tfoot"].includes(t.target.tag) ? i += `:nth-child(${t.target.nthChild})` : i += `:nth-child(${t.target.nthChild})`), n.push(i);
1579
- const o = this.isSvgChildElement(t.target.tag), c = t.path.some((l) => l.tag === "svg");
1580
- let u;
1635
+ t.target.nthChild !== void 0 && _(t.target.tag, t.target.semantics) && (i += `:nth-child(${t.target.nthChild})`), n.push(i);
1636
+ const o = this.isSvgChildElement(t.target.tag), c = t.path.some((h) => h.tag === "svg");
1637
+ let l;
1581
1638
  if (o && c) {
1582
- const l = t.path.findIndex((h) => h.tag === "svg");
1583
- if (l !== -1) {
1584
- const h = l + 1, g = n.slice(0, h + 1), f = n.slice(h + 1, -1), m = n[n.length - 1];
1585
- f.length > 0 ? u = g.join(" ") + " > " + f.join(" > ") + " > " + m : u = g.join(" ") + " > " + m;
1639
+ const h = t.path.findIndex((d) => d.tag === "svg");
1640
+ if (h !== -1) {
1641
+ const d = h + 1, u = n.slice(0, d + 1), g = n.slice(d + 1, -1), m = n[n.length - 1];
1642
+ g.length > 0 ? l = u.join(" ") + " > " + g.join(" > ") + " > " + m : l = u.join(" ") + " > " + m;
1586
1643
  } else
1587
- u = n.join(" ");
1644
+ l = n.join(" ");
1588
1645
  } else
1589
- u = n.join(" ");
1646
+ l = n.join(" ");
1590
1647
  if (!e?.ensureUnique)
1591
- return u;
1592
- const d = this.querySelectorSafe(u, e.root ?? document);
1593
- if (d.length === 1)
1648
+ return l;
1649
+ const f = this.querySelectorSafe(l, e.root ?? document);
1650
+ if (f.length === 1)
1594
1651
  return {
1595
- selector: u,
1652
+ selector: l,
1596
1653
  isUnique: !0,
1597
- usedNthOfType: u.includes(":nth-"),
1654
+ usedNthOfType: l.includes(":nth-"),
1598
1655
  extraClassesAdded: 0
1599
1656
  };
1600
- if (d.length === 0 || d.length > 1) {
1601
- const l = this.buildFullDomPathSelector(
1657
+ if (f.length === 0 || f.length > 1) {
1658
+ const h = this.buildFullDomPathSelector(
1602
1659
  t,
1603
1660
  t.target.semantics,
1604
1661
  e.root ?? document
1605
1662
  );
1606
- if (l && this.isUnique(l, e.root ?? document))
1663
+ if (h && this.isUnique(h, e.root ?? document))
1607
1664
  return {
1608
- selector: l,
1665
+ selector: h,
1609
1666
  isUnique: !0,
1610
- usedNthOfType: l.includes(":nth-"),
1667
+ usedNthOfType: h.includes(":nth-"),
1611
1668
  extraClassesAdded: 0
1612
1669
  };
1613
1670
  }
1614
- return this.ensureUniqueSelector(u, t, e);
1671
+ return this.ensureUniqueSelector(l, t, e);
1615
1672
  }
1616
1673
  /**
1617
1674
  * Builds selector for anchor only (used in fallback)
@@ -1626,10 +1683,10 @@ class ot {
1626
1683
  */
1627
1684
  ensureUniqueSelector(t, e, s) {
1628
1685
  const n = s.root ?? document, a = s.maxClasses ?? 4, i = e.target.tag, o = e.target.semantics;
1629
- let c = t, u = 0, d = !1;
1686
+ let c = t, l = 0, f = !1;
1630
1687
  if (this.querySelectorSafe(c, n).length === 0) {
1631
- const f = this.buildFullDomPathSelector(e, o, n);
1632
- if (f && (c = f, this.isUnique(c, n)))
1688
+ const g = this.buildFullDomPathSelector(e, o, n);
1689
+ if (g && (c = g, this.isUnique(c, n)))
1633
1690
  return {
1634
1691
  selector: c,
1635
1692
  isUnique: !0,
@@ -1644,33 +1701,33 @@ class ot {
1644
1701
  usedNthOfType: !1,
1645
1702
  extraClassesAdded: 0
1646
1703
  };
1647
- const h = M(o.classes ?? []);
1648
- for (let f = 0; f < Math.min(h.length, a); f++) {
1649
- const m = h[f];
1650
- if (c += `.${this.escapeCSS(m)}`, u++, this.isUnique(c, n))
1704
+ const d = M(o.classes ?? []);
1705
+ for (let g = 0; g < Math.min(d.length, a); g++) {
1706
+ const m = d[g];
1707
+ if (c += `.${this.escapeCSS(m)}`, l++, this.isUnique(c, n))
1651
1708
  return {
1652
1709
  selector: c,
1653
1710
  isUnique: !0,
1654
1711
  usedNthOfType: !1,
1655
- extraClassesAdded: u
1712
+ extraClassesAdded: l
1656
1713
  };
1657
1714
  }
1658
1715
  if (!this.isUnique(c, n)) {
1659
- const f = this.buildFullDomPathSelector(e, o, n);
1660
- if (f && this.isUnique(f, n))
1716
+ const g = this.buildFullDomPathSelector(e, o, n);
1717
+ if (g && this.isUnique(g, n))
1661
1718
  return {
1662
- selector: f,
1719
+ selector: g,
1663
1720
  isUnique: !0,
1664
- usedNthOfType: f.includes(":nth-of-type("),
1665
- extraClassesAdded: u
1721
+ usedNthOfType: g.includes(":nth-of-type("),
1722
+ extraClassesAdded: l
1666
1723
  };
1667
1724
  }
1668
- const g = this.findNthElementByText(c, o, n);
1669
- return g && (c += this.getNthSelector(g, i), d = !0), {
1725
+ const u = this.findNthElementByText(c, o, n);
1726
+ return u && (c += this.getNthSelector(u, i), f = !0), {
1670
1727
  selector: c,
1671
1728
  isUnique: this.isUnique(c, n),
1672
- usedNthOfType: d,
1673
- extraClassesAdded: u
1729
+ usedNthOfType: f,
1730
+ extraClassesAdded: l
1674
1731
  };
1675
1732
  }
1676
1733
  /**
@@ -1683,15 +1740,15 @@ class ot {
1683
1740
  for (const i of a) {
1684
1741
  const o = this.findTargetWithinAnchor(i, t.target.tag, e);
1685
1742
  if (o.length === 0) continue;
1686
- const c = o.map((u) => {
1687
- const d = this.scorePathMatch(u, i, t.path);
1688
- return { element: u, score: d };
1743
+ const c = o.map((l) => {
1744
+ const f = this.scorePathMatch(l, i, t.path);
1745
+ return { element: l, score: f };
1689
1746
  });
1690
- c.sort((u, d) => d.score - u.score);
1691
- for (const { element: u } of c) {
1692
- const d = this.buildPathFromAnchorToTarget(i, u, t, s);
1693
- if (d && this.isUnique(d, s))
1694
- return d;
1747
+ c.sort((l, f) => f.score - l.score);
1748
+ for (const { element: l } of c) {
1749
+ const f = this.buildPathFromAnchorToTarget(i, l, t, s);
1750
+ if (f && this.isUnique(f, s))
1751
+ return f;
1695
1752
  }
1696
1753
  }
1697
1754
  return null;
@@ -1711,26 +1768,26 @@ class ot {
1711
1768
  n.unshift(a), a = a.parentElement;
1712
1769
  let i = 0;
1713
1770
  const o = Math.min(n.length, s.length);
1714
- for (let u = 0; u < o; u++) {
1715
- const d = n[u], l = s[u];
1716
- if (d.tagName.toLowerCase() === l.tag) {
1717
- if (i += 10, l.nthChild !== void 0) {
1718
- const h = d.parentElement;
1719
- h && (Array.from(h.children).indexOf(d) + 1 === l.nthChild ? i += 20 : i -= 10);
1771
+ for (let l = 0; l < o; l++) {
1772
+ const f = n[l], h = s[l];
1773
+ if (f.tagName.toLowerCase() === h.tag) {
1774
+ if (i += 10, h.nthChild !== void 0) {
1775
+ const d = f.parentElement;
1776
+ d && (Array.from(d.children).indexOf(f) + 1 === h.nthChild ? i += 20 : i -= 10);
1720
1777
  }
1721
1778
  } else
1722
1779
  i -= 5;
1723
- if (l.semantics.classes && l.semantics.classes.length > 0) {
1724
- const h = l.semantics.classes.filter(
1725
- (g) => d.classList.contains(g)
1780
+ if (h.semantics.classes && h.semantics.classes.length > 0) {
1781
+ const d = h.semantics.classes.filter(
1782
+ (u) => f.classList.contains(u)
1726
1783
  );
1727
- i += h.length * 2;
1784
+ i += d.length * 2;
1728
1785
  }
1729
- if (l.semantics.attributes) {
1730
- const h = Object.entries(l.semantics.attributes).filter(
1731
- ([g, f]) => d.getAttribute(g) === f
1786
+ if (h.semantics.attributes) {
1787
+ const d = Object.entries(h.semantics.attributes).filter(
1788
+ ([u, g]) => f.getAttribute(u) === g
1732
1789
  );
1733
- i += h.length * 3;
1790
+ i += d.length * 3;
1734
1791
  }
1735
1792
  }
1736
1793
  const c = Math.abs(n.length - s.length);
@@ -1747,8 +1804,8 @@ class ot {
1747
1804
  return !1;
1748
1805
  }
1749
1806
  return !!(s.classes && s.classes.length > 0 && s.classes.every((o) => a.classList.contains(o)) || s.attributes && Object.entries(s.attributes).every(([o, c]) => {
1750
- const u = a.getAttribute(o);
1751
- return o === "href" || o === "src" ? D(o, u || "") === D(o, c) : u === c;
1807
+ const l = a.getAttribute(o);
1808
+ return o === "href" || o === "src" ? D(o, l || "") === D(o, c) : l === c;
1752
1809
  }) || s.text);
1753
1810
  });
1754
1811
  }
@@ -1766,15 +1823,15 @@ class ot {
1766
1823
  if (s?.semantics?.attributes) {
1767
1824
  const o = this.buildNodeSelector(e, s.semantics, {
1768
1825
  excludeClasses: !0
1769
- }), c = [...n, e].join(" > "), u = this.querySelectorSafe(c, a), d = [...n, o].join(" > "), l = this.querySelectorSafe(d, a);
1770
- if (l.length > 0 && l.length < u.length)
1826
+ }), c = [...n, e].join(" > "), l = this.querySelectorSafe(c, a), f = [...n, o].join(" > "), h = this.querySelectorSafe(f, a);
1827
+ if (h.length > 0 && h.length < l.length)
1771
1828
  return o;
1772
1829
  }
1773
1830
  if (s?.semantics?.classes) {
1774
1831
  const o = M(s.semantics.classes);
1775
1832
  if (o.length > 0) {
1776
- const c = `${e}.${this.escapeCSS(o[0])}`, u = [...n, e].join(" > "), d = this.querySelectorSafe(u, a), l = [...n, c].join(" > "), h = this.querySelectorSafe(l, a);
1777
- if (h.length > 0 && h.length < d.length)
1833
+ const c = `${e}.${this.escapeCSS(o[0])}`, l = [...n, e].join(" > "), f = this.querySelectorSafe(l, a), h = [...n, c].join(" > "), d = this.querySelectorSafe(h, a);
1834
+ if (d.length > 0 && d.length < f.length)
1778
1835
  return c;
1779
1836
  }
1780
1837
  }
@@ -1797,19 +1854,19 @@ class ot {
1797
1854
  // Most flexible - no classes on target, only semantic attributes
1798
1855
  // ============================================================
1799
1856
  () => {
1800
- const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), u = s.target.tag, d = s.target.semantics, l = [];
1857
+ const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), l = s.target.tag, f = s.target.semantics, h = [];
1801
1858
  for (const p of s.path)
1802
- l.push(p.tag);
1803
- const g = [c, ...l, u].filter(Boolean).join(" ");
1804
- if (this.isUnique(g, n))
1805
- return g;
1806
- const f = this.buildNodeSelector(u, d, {
1859
+ h.push(p.tag);
1860
+ const u = [c, ...h, l].filter(Boolean).join(" ");
1861
+ if (this.isUnique(u, n))
1862
+ return u;
1863
+ const g = this.buildNodeSelector(l, f, {
1807
1864
  excludeClasses: !0
1808
1865
  // KEY: no classes on target in Strategy 0
1809
1866
  }), m = [
1810
1867
  c,
1811
- ...l.slice(0, -1),
1812
- f
1868
+ ...h.slice(0, -1),
1869
+ g
1813
1870
  ].join(" ");
1814
1871
  return this.isUnique(m, n) ? m : null;
1815
1872
  },
@@ -1820,16 +1877,16 @@ class ot {
1820
1877
  // Target: ONLY attributes, NO classes
1821
1878
  // ============================================================
1822
1879
  () => {
1823
- const c = [this.buildNodeSelector(s.anchor.tag, s.anchor.semantics)], u = /* @__PURE__ */ new Map();
1824
- let d = 0;
1825
- for (let h = 0; h < a.length - 1; h++) {
1826
- const g = a[h], f = g.tagName.toLowerCase();
1827
- d < s.path.length && s.path[d].tag === f ? (u.set(g, s.path[d]), d++) : u.set(g, null);
1880
+ const c = [this.buildNodeSelector(s.anchor.tag, s.anchor.semantics)], l = /* @__PURE__ */ new Map();
1881
+ let f = 0;
1882
+ for (let d = 0; d < a.length - 1; d++) {
1883
+ const u = a[d], g = u.tagName.toLowerCase();
1884
+ f < s.path.length && s.path[f].tag === g ? (l.set(u, s.path[f]), f++) : l.set(u, null);
1828
1885
  }
1829
- for (let h = 0; h < a.length; h++) {
1830
- const g = a[h], f = g.tagName.toLowerCase();
1831
- if (h < a.length - 1) {
1832
- const b = u.get(g) || null, S = this.disambiguateParent(g, f, b, c, n);
1886
+ for (let d = 0; d < a.length; d++) {
1887
+ const u = a[d], g = u.tagName.toLowerCase();
1888
+ if (d < a.length - 1) {
1889
+ const b = l.get(u) || null, S = this.disambiguateParent(u, g, b, c, n);
1833
1890
  c.push(S);
1834
1891
  continue;
1835
1892
  }
@@ -1838,13 +1895,13 @@ class ot {
1838
1895
  s.target.semantics,
1839
1896
  { excludeClasses: !0 }
1840
1897
  // KEY: no classes on target
1841
- ), p = g.parentElement;
1842
- p && ["td", "th", "tr", "thead", "tbody", "tfoot"].includes(f) && Array.from(p.children).filter(
1843
- (S) => S.tagName.toLowerCase() === f
1844
- ).length > 1 ? c.push(`${m}${this.getNthSelector(g, f)}`) : c.push(m);
1898
+ ), p = u.parentElement;
1899
+ p && ["td", "th", "tr", "thead", "tbody", "tfoot"].includes(g) && Array.from(p.children).filter(
1900
+ (S) => S.tagName.toLowerCase() === g
1901
+ ).length > 1 ? c.push(`${m}${this.getNthSelector(u, g)}`) : c.push(m);
1845
1902
  }
1846
- const l = c.join(" > ");
1847
- return this.isUnique(l, n) ? l : null;
1903
+ const h = c.join(" > ");
1904
+ return this.isUnique(h, n) ? h : null;
1848
1905
  },
1849
1906
  // ============================================================
1850
1907
  // Strategy 2: anchor parent[attrs|class|nth] target[attrs_only]
@@ -1853,48 +1910,48 @@ class ot {
1853
1910
  // Target: ONLY attributes, NO classes
1854
1911
  // ============================================================
1855
1912
  () => {
1856
- const u = [this.buildNodeSelector(s.anchor.tag, s.anchor.semantics)];
1857
- for (let h = 0; h < a.length - 1; h++) {
1858
- const f = a[h].tagName.toLowerCase(), m = s.path[h] || null, p = u.join(" ") + " " + f;
1913
+ const l = [this.buildNodeSelector(s.anchor.tag, s.anchor.semantics)];
1914
+ for (let d = 0; d < a.length - 1; d++) {
1915
+ const g = a[d].tagName.toLowerCase(), m = s.path[d] || null, p = l.join(" ") + " " + g;
1859
1916
  if (this.querySelectorSafe(p, n).length > 1) {
1860
1917
  if (m?.semantics?.attributes) {
1861
- const C = this.buildNodeSelector(f, m.semantics, {
1918
+ const C = this.buildNodeSelector(g, m.semantics, {
1862
1919
  excludeClasses: !0
1863
- }), A = u.join(" ") + " " + C;
1920
+ }), A = l.join(" ") + " " + C;
1864
1921
  if (this.querySelectorSafe(A, n).length === 1 || this.querySelectorSafe(A + " " + s.target.tag, n).length === 1) {
1865
- u.push(C);
1922
+ l.push(C);
1866
1923
  continue;
1867
1924
  }
1868
1925
  }
1869
1926
  if (m?.semantics?.classes) {
1870
1927
  const C = M(m.semantics.classes);
1871
1928
  if (C.length > 0) {
1872
- const A = `${f}.${this.escapeCSS(C[0])}`, v = u.join(" ") + " " + A;
1929
+ const A = `${g}.${this.escapeCSS(C[0])}`, v = l.join(" ") + " " + A;
1873
1930
  if (this.querySelectorSafe(v, n).length === 1 || this.querySelectorSafe(v + " " + s.target.tag, n).length === 1) {
1874
- u.push(A);
1931
+ l.push(A);
1875
1932
  continue;
1876
1933
  }
1877
1934
  }
1878
1935
  }
1879
- const S = a[h], E = S.parentElement;
1880
- if (E && Array.from(E.children).filter(
1881
- (A) => A.tagName.toLowerCase() === f
1936
+ const S = a[d], T = S.parentElement;
1937
+ if (T && Array.from(T.children).filter(
1938
+ (A) => A.tagName.toLowerCase() === g
1882
1939
  ).length > 1) {
1883
- u.push(`${f}${this.getNthSelector(S, f)}`);
1940
+ l.push(`${g}${this.getNthSelector(S, g)}`);
1884
1941
  continue;
1885
1942
  }
1886
1943
  }
1887
- u.push(f);
1944
+ l.push(g);
1888
1945
  }
1889
- const d = this.buildNodeSelector(
1946
+ const f = this.buildNodeSelector(
1890
1947
  s.target.tag,
1891
1948
  s.target.semantics,
1892
1949
  { excludeClasses: !0 }
1893
1950
  // KEY: no classes on target
1894
1951
  );
1895
- u.push(d);
1896
- const l = u.join(" ");
1897
- return this.isUnique(l, n) ? l : null;
1952
+ l.push(f);
1953
+ const h = l.join(" ");
1954
+ return this.isUnique(h, n) ? h : null;
1898
1955
  },
1899
1956
  // ============================================================
1900
1957
  // Strategy 3: anchor path target[attrs + 1_stable_class]
@@ -1902,18 +1959,18 @@ class ot {
1902
1959
  // Only use this if attrs alone are not sufficient
1903
1960
  // ============================================================
1904
1961
  () => {
1905
- const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), u = [];
1906
- for (const g of s.path)
1907
- u.push(g.tag);
1962
+ const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), l = [];
1963
+ for (const u of s.path)
1964
+ l.push(u.tag);
1908
1965
  if (M(s.target.semantics.classes ?? []).length === 0)
1909
1966
  return null;
1910
- const l = this.buildNodeSelector(
1967
+ const h = this.buildNodeSelector(
1911
1968
  s.target.tag,
1912
1969
  s.target.semantics,
1913
1970
  { maxClasses: 1 }
1914
1971
  // KEY: ONE stable class only
1915
- ), h = [c, ...u.slice(0, -1), l].join(" ");
1916
- return this.isUnique(h, n) ? h : null;
1972
+ ), d = [c, ...l.slice(0, -1), h].join(" ");
1973
+ return this.isUnique(d, n) ? d : null;
1917
1974
  },
1918
1975
  // ============================================================
1919
1976
  // Strategy 4: anchor path target[attrs]:nth-of-type(N)
@@ -1921,25 +1978,25 @@ class ot {
1921
1978
  // Only use when all other strategies fail
1922
1979
  // ============================================================
1923
1980
  () => {
1924
- const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), u = [];
1981
+ const c = this.buildNodeSelector(s.anchor.tag, s.anchor.semantics), l = [];
1925
1982
  for (const m of s.path)
1926
- u.push(m.tag);
1927
- const d = a[a.length - 1], l = d.parentElement;
1928
- if (!l || Array.from(l.children).filter(
1983
+ l.push(m.tag);
1984
+ const f = a[a.length - 1], h = f.parentElement;
1985
+ if (!h || Array.from(h.children).filter(
1929
1986
  (m) => m.tagName.toLowerCase() === s.target.tag
1930
1987
  ).length <= 1) return null;
1931
- const g = this.buildNodeSelector(
1988
+ const u = this.buildNodeSelector(
1932
1989
  s.target.tag,
1933
1990
  s.target.semantics,
1934
1991
  { excludeClasses: !0 }
1935
1992
  // No classes, just attrs + nth
1936
- ) + this.getNthSelector(d, s.target.tag), f = [c, ...u.slice(0, -1), g].join(" ");
1937
- return this.isUnique(f, n) ? f : null;
1993
+ ) + this.getNthSelector(f, s.target.tag), g = [c, ...l.slice(0, -1), u].join(" ");
1994
+ return this.isUnique(g, n) ? g : null;
1938
1995
  }
1939
1996
  ];
1940
1997
  for (const c of o) {
1941
- const u = c();
1942
- if (u) return u;
1998
+ const l = c();
1999
+ if (l) return l;
1943
2000
  }
1944
2001
  return null;
1945
2002
  }
@@ -1951,7 +2008,7 @@ class ot {
1951
2008
  buildElementSelector(t) {
1952
2009
  const e = t.tagName.toLowerCase();
1953
2010
  let s = e;
1954
- if (t.id && !P(t.id))
2011
+ if (t.id && !L(t.id))
1955
2012
  return `${e}#${this.escapeCSS(t.id)}`;
1956
2013
  const n = Array.from(t.classList), a = M(n);
1957
2014
  a.length > 0 && (s += a.slice(0, 2).map((o) => `.${this.escapeCSS(o)}`).join(""));
@@ -2026,11 +2083,11 @@ class ot {
2026
2083
  if (n.attributes) {
2027
2084
  const i = this.getSortedAttributes(n.attributes);
2028
2085
  for (const { name: o, value: c } of i) {
2029
- const u = o === "href" || o === "src" ? D(o, c) : c;
2030
- if (u) {
2031
- const d = `${s}[${o}="${this.escapeAttr(u)}"]`;
2032
- if (this.isUnique(d, e))
2033
- return d;
2086
+ const l = o === "href" || o === "src" ? D(o, c) : c;
2087
+ if (l) {
2088
+ const f = `${s}[${o}="${this.escapeAttr(l)}"]`;
2089
+ if (this.isUnique(f, e))
2090
+ return f;
2034
2091
  }
2035
2092
  }
2036
2093
  }
@@ -2098,7 +2155,7 @@ class ot {
2098
2155
  * @returns True if should be ignored
2099
2156
  */
2100
2157
  shouldIgnoreAttribute(t) {
2101
- return !!(V.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
2158
+ return !!(Y.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
2102
2159
  }
2103
2160
  /**
2104
2161
  * Gets attributes sorted by priority
@@ -2107,7 +2164,7 @@ class ot {
2107
2164
  */
2108
2165
  getSortedAttributes(t) {
2109
2166
  return Object.entries(t).filter(([e]) => !this.shouldIgnoreAttribute(e)).filter(
2110
- ([e, s]) => !Q.has(e) || !Y(s)
2167
+ ([e, s]) => !Z.has(e) || !K(s)
2111
2168
  ).map(([e, s]) => ({
2112
2169
  name: e,
2113
2170
  value: s,
@@ -2152,7 +2209,7 @@ class ot {
2152
2209
  * @returns True if element is an SVG child
2153
2210
  */
2154
2211
  isSvgChildElement(t) {
2155
- return pt.includes(t);
2212
+ return yt.includes(t);
2156
2213
  }
2157
2214
  /**
2158
2215
  * Builds CSS selector for elements inside <head>.
@@ -2187,11 +2244,11 @@ class ot {
2187
2244
  };
2188
2245
  }
2189
2246
  }
2190
- function rt(r, t) {
2247
+ function at(r, t) {
2191
2248
  if (!r) return r;
2192
- const e = Jt(t);
2249
+ const e = ie(t);
2193
2250
  try {
2194
- if (Xt(r) || r.startsWith("//") || Kt(r))
2251
+ if (ne(r) || r.startsWith("//") || ae(r))
2195
2252
  return r;
2196
2253
  const s = new URL(r, e);
2197
2254
  if (!e)
@@ -2206,19 +2263,19 @@ function rt(r, t) {
2206
2263
  return r;
2207
2264
  }
2208
2265
  }
2209
- function Xt(r) {
2266
+ function ne(r) {
2210
2267
  return !r.startsWith("http://") && !r.startsWith("https://") && !r.startsWith("//");
2211
2268
  }
2212
- function Kt(r) {
2269
+ function ae(r) {
2213
2270
  return ["javascript:", "mailto:", "tel:", "data:", "blob:", "file:"].some((e) => r.startsWith(e));
2214
2271
  }
2215
- function Jt(r) {
2272
+ function ie(r) {
2216
2273
  if (r)
2217
2274
  return r;
2218
2275
  if (typeof window < "u" && window.location && window.location.href)
2219
2276
  return window.location.href;
2220
2277
  }
2221
- function nt(r) {
2278
+ function it(r) {
2222
2279
  if (!r || typeof r != "string")
2223
2280
  return "";
2224
2281
  if (r.startsWith("javascript:") || r.startsWith("mailto:") || r.startsWith("tel:") || r.startsWith("data:") || r.startsWith("blob:") || r.startsWith("/") || r.startsWith("./") || r.startsWith("../"))
@@ -2230,7 +2287,7 @@ function nt(r) {
2230
2287
  return r;
2231
2288
  }
2232
2289
  }
2233
- class te {
2290
+ class oe {
2234
2291
  /**
2235
2292
  * Filters elements that match the semantics
2236
2293
  * @param elements - Candidate elements
@@ -2261,7 +2318,7 @@ class te {
2261
2318
  (o) => o.nodeType === Node.TEXT_NODE
2262
2319
  ).map((o) => o.textContent?.trim() ?? "").join(" ") || (t.textContent?.trim() ?? "");
2263
2320
  if (!a) return !1;
2264
- const i = F(a);
2321
+ const i = j(a);
2265
2322
  return e.matchMode === "partial" ? i.includes(e.normalized) : i === e.normalized;
2266
2323
  }
2267
2324
  /**
@@ -2273,7 +2330,7 @@ class te {
2273
2330
  (o) => o.nodeType === Node.TEXT_NODE
2274
2331
  ).map((o) => o.textContent?.trim() ?? "").join(" ") || (t.textContent?.trim() ?? "");
2275
2332
  if (!a) return !1;
2276
- const i = F(a);
2333
+ const i = j(a);
2277
2334
  return i.includes(e.normalized) || e.normalized.includes(i);
2278
2335
  }
2279
2336
  /**
@@ -2306,20 +2363,20 @@ class te {
2306
2363
  if (n) {
2307
2364
  const c = D(a, i, {
2308
2365
  preserveQueryForAbsolute: !1
2309
- }), u = D(a, o || "", {
2366
+ }), l = D(a, o || "", {
2310
2367
  preserveQueryForAbsolute: !1
2311
- }), d = nt(c), l = nt(u);
2312
- if (d !== l)
2368
+ }), f = it(c), h = it(l);
2369
+ if (f !== h)
2313
2370
  return !1;
2314
2371
  } else {
2315
- const c = rt(
2372
+ const c = at(
2316
2373
  D(a, i, { preserveQueryForAbsolute: !1 }),
2317
2374
  s
2318
- ), u = rt(
2375
+ ), l = at(
2319
2376
  D(a, o || "", { preserveQueryForAbsolute: !1 }),
2320
2377
  s
2321
2378
  );
2322
- if (c !== u)
2379
+ if (c !== l)
2323
2380
  return !1;
2324
2381
  }
2325
2382
  else if (o !== i)
@@ -2386,7 +2443,7 @@ class te {
2386
2443
  return Math.abs(e).toString(16).padStart(8, "0");
2387
2444
  }
2388
2445
  }
2389
- class ee {
2446
+ class ce {
2390
2447
  /**
2391
2448
  * Applies a single constraint to candidates
2392
2449
  * @param candidates - Current candidate elements
@@ -2476,9 +2533,9 @@ class ee {
2476
2533
  return s[e.length];
2477
2534
  }
2478
2535
  }
2479
- class se {
2536
+ class le {
2480
2537
  constructor() {
2481
- this.cssGenerator = new ot();
2538
+ this.cssGenerator = new lt();
2482
2539
  }
2483
2540
  /**
2484
2541
  * Handles fallback when resolution fails
@@ -2615,14 +2672,14 @@ class se {
2615
2672
  }
2616
2673
  if (e.role && (n += 0.15, t.getAttribute("role") === e.role && (s += 0.15)), e.text) {
2617
2674
  n += 0.1;
2618
- const a = F(t.textContent);
2675
+ const a = j(t.textContent);
2619
2676
  a === e.text.normalized ? s += 0.1 : a.includes(e.text.normalized) && (s += 0.05);
2620
2677
  }
2621
2678
  return n > 0 ? s / n : 0;
2622
2679
  }
2623
2680
  }
2624
- function re(r, t, e = {}) {
2625
- const s = { ...yt, ...e };
2681
+ function he(r, t, e = {}) {
2682
+ const s = { ...xt, ...e };
2626
2683
  let n;
2627
2684
  try {
2628
2685
  t instanceof Document ? n = t : n = k(t);
@@ -2642,34 +2699,34 @@ function re(r, t, e = {}) {
2642
2699
  "options.root does not match dom parameter document. Using document from dom parameter. This may indicate a cross-document operation issue."
2643
2700
  );
2644
2701
  }
2645
- const a = s.documentUrl ?? n.defaultView?.location?.href, i = s.matchUrlsByPathOnly ?? !0, o = new ot(), c = new te(), u = new ee(), d = new se(), l = o.buildSelector(r, {
2702
+ const a = s.documentUrl ?? n.defaultView?.location?.href, i = s.matchUrlsByPathOnly ?? !0, o = new lt(), c = new oe(), l = new ce(), f = new le(), h = o.buildSelector(r, {
2646
2703
  ensureUnique: !1,
2647
2704
  root: n
2648
2705
  });
2649
- let h;
2706
+ let d;
2650
2707
  try {
2651
- h = Array.from(n.querySelectorAll(l));
2708
+ d = Array.from(n.querySelectorAll(h));
2652
2709
  } catch (p) {
2653
2710
  const b = p instanceof Error ? p.message : "Unknown selector error";
2654
2711
  return {
2655
2712
  status: "error",
2656
2713
  elements: [],
2657
- warnings: [`Invalid CSS selector: ${l}`, `Error: ${b}`],
2714
+ warnings: [`Invalid CSS selector: ${h}`, `Error: ${b}`],
2658
2715
  confidence: 0,
2659
2716
  meta: { degraded: !0, degradationReason: "invalid-selector" }
2660
2717
  };
2661
2718
  }
2662
- const g = h.length;
2663
- h.length > s.maxCandidates && (h = h.slice(0, s.maxCandidates));
2664
- const f = c.match(
2665
- h,
2719
+ const u = d.length;
2720
+ d.length > s.maxCandidates && (d = d.slice(0, s.maxCandidates));
2721
+ const g = c.match(
2722
+ d,
2666
2723
  r.target.semantics,
2667
2724
  a,
2668
2725
  i
2669
2726
  );
2670
- if (f.length === 0 && g > 0 && r.target.semantics.text !== void 0) {
2727
+ if (g.length === 0 && u > 0 && r.target.semantics.text !== void 0) {
2671
2728
  const p = c.matchLenient(
2672
- h,
2729
+ d,
2673
2730
  r.target.semantics,
2674
2731
  a,
2675
2732
  i
@@ -2684,11 +2741,11 @@ function re(r, t, e = {}) {
2684
2741
  // Slight confidence penalty
2685
2742
  meta: { degraded: !0, degradationReason: "relaxed-text-matching" }
2686
2743
  };
2687
- const b = at(
2744
+ const b = ot(
2688
2745
  p,
2689
2746
  r,
2690
- u,
2691
- d,
2747
+ l,
2748
+ f,
2692
2749
  n,
2693
2750
  s,
2694
2751
  1
@@ -2703,18 +2760,18 @@ function re(r, t, e = {}) {
2703
2760
  };
2704
2761
  }
2705
2762
  }
2706
- if (f.length === 1)
2763
+ if (g.length === 1)
2707
2764
  return {
2708
2765
  status: "success",
2709
- elements: f,
2766
+ elements: g,
2710
2767
  warnings: [],
2711
2768
  confidence: r.meta.confidence,
2712
2769
  meta: { degraded: !1 }
2713
2770
  };
2714
- if (f.length === 0) {
2715
- const p = g > 0 ? `CSS selector found ${g} candidates but semantic filtering rejected all. This may indicate text content mismatch.` : "CSS selector found no candidates";
2771
+ if (g.length === 0) {
2772
+ const p = u > 0 ? `CSS selector found ${u} candidates but semantic filtering rejected all. This may indicate text content mismatch.` : "CSS selector found no candidates";
2716
2773
  if (s.enableFallback) {
2717
- const b = d.handleFallback(r, n);
2774
+ const b = f.handleFallback(r, n);
2718
2775
  return {
2719
2776
  ...b,
2720
2777
  warnings: [...b.warnings, p]
@@ -2728,25 +2785,25 @@ function re(r, t, e = {}) {
2728
2785
  meta: { degraded: !0, degradationReason: "not-found" }
2729
2786
  };
2730
2787
  }
2731
- return at(
2732
- f,
2788
+ return ot(
2789
+ g,
2733
2790
  r,
2734
- u,
2735
- d,
2791
+ l,
2792
+ f,
2736
2793
  n,
2737
2794
  s,
2738
2795
  1
2739
2796
  // no confidence penalty for exact match path
2740
2797
  );
2741
2798
  }
2742
- function ne(r) {
2799
+ function ue(r) {
2743
2800
  return [...r].sort((t, e) => e.priority - t.priority);
2744
2801
  }
2745
- function at(r, t, e, s, n, a, i) {
2802
+ function ot(r, t, e, s, n, a, i) {
2746
2803
  let o = r;
2747
- const c = ne(t.constraints);
2748
- for (const d of c) {
2749
- if (o = e.applyConstraint(o, d), o.length === 1)
2804
+ const c = ue(t.constraints);
2805
+ for (const f of c) {
2806
+ if (o = e.applyConstraint(o, f), o.length === 1)
2750
2807
  return {
2751
2808
  status: "success",
2752
2809
  elements: o,
@@ -2771,13 +2828,13 @@ function at(r, t, e, s, n, a, i) {
2771
2828
  confidence: t.meta.confidence * 0.7 * i,
2772
2829
  meta: { degraded: !0, degradationReason: "ambiguous" }
2773
2830
  };
2774
- const u = s.handleAmbiguous(o, t);
2831
+ const l = s.handleAmbiguous(o, t);
2775
2832
  return {
2776
- ...u,
2777
- confidence: u.confidence * i
2833
+ ...l,
2834
+ confidence: l.confidence * i
2778
2835
  };
2779
2836
  }
2780
- function Se(r) {
2837
+ function ve(r) {
2781
2838
  const t = [], e = [];
2782
2839
  if (r.version ? r.version !== "1.0" && e.push(`Unknown version: ${r.version}`) : t.push("Missing version field"), r.anchor ? (r.anchor.tag || t.push("Anchor missing tag"), typeof r.anchor.score != "number" && t.push("Anchor missing score"), r.anchor.semantics || t.push("Anchor missing semantics")) : t.push("Missing anchor field"), r.target ? (r.target.tag || t.push("Target missing tag"), typeof r.target.score != "number" && t.push("Target missing score"), r.target.semantics || t.push("Target missing semantics")) : t.push("Missing target field"), !Array.isArray(r.path))
2783
2840
  t.push("Path must be an array");
@@ -2792,33 +2849,55 @@ function Se(r) {
2792
2849
  warnings: e
2793
2850
  };
2794
2851
  }
2795
- function Ae(r) {
2852
+ function $e(r) {
2796
2853
  if (!r || typeof r != "object") return !1;
2797
2854
  const t = r;
2798
2855
  return typeof t.version == "string" && typeof t.anchor == "object" && Array.isArray(t.path) && typeof t.target == "object";
2799
2856
  }
2800
- const ct = {
2857
+ const ht = {
2858
+ id: "i",
2859
+ "data-testid": "tid",
2860
+ "data-qa": "qa",
2861
+ "data-cy": "cy",
2862
+ "data-test": "dt",
2863
+ "aria-label": "al",
2864
+ "aria-labelledby": "alb",
2865
+ "aria-describedby": "adb",
2866
+ name: "n",
2867
+ href: "h",
2868
+ src: "s",
2869
+ type: "t",
2870
+ role: "r",
2871
+ alt: "at",
2872
+ title: "tt",
2873
+ for: "f",
2874
+ placeholder: "ph",
2875
+ text: "x"
2876
+ }, G = Object.fromEntries(
2877
+ Object.entries(ht).map(([r, t]) => [t, r])
2878
+ ), ut = {
2801
2879
  maxClasses: 2,
2802
2880
  maxAttributes: 5,
2803
2881
  includeText: !0,
2804
2882
  maxTextLength: 50,
2805
2883
  simplifyTarget: !0,
2806
- includeConstraints: !0
2884
+ includeConstraints: !0,
2885
+ format: "compact"
2807
2886
  };
2808
- function it(r) {
2887
+ function ct(r) {
2809
2888
  return r === "id" ? 101 : w[r] !== void 0 ? w[r] : r.startsWith("data-") ? w["data-*"] : r.startsWith("aria-") ? w["aria-*"] : 0;
2810
2889
  }
2811
- function ae(r) {
2890
+ function de(r) {
2812
2891
  return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(r);
2813
2892
  }
2814
- function ie(r) {
2893
+ function fe(r) {
2815
2894
  return !!(/@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/.test(r) || /(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/.test(r) || /\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}/.test(r));
2816
2895
  }
2817
- function oe(r, t) {
2818
- const e = { ...ct, ...t }, s = `v${r.version}`, n = j(r.anchor, !1, e), a = r.path.length > 0 ? r.path.map((c) => j(c, !1, e)).join(" > ") + " > " : "", i = j(r.target, !0, e), o = e.includeConstraints ? le(r) : "";
2819
- return `${s}: ${n} :: ${a}${i}${o}`;
2896
+ function ge(r, t) {
2897
+ const e = { ...ut, ...t }, s = e.format === "compact", n = s ? "v1" : `v${r.version}`, a = s ? ":" : ": ", i = s ? "::" : " :: ", o = s ? ">" : " > ", c = e.includeText && r.target.semantics.text ? r.target.semantics.text.normalized : void 0, l = W(r.anchor, !1, e), f = r.path.length > 0 ? r.path.map((u) => W(u, !1, e, c)).join(o) + o : "", h = W(r.target, !0, e), d = e.includeConstraints ? pe(r, e) : "";
2898
+ return `${n}${a}${l}${i}${f}${h}${d}`;
2820
2899
  }
2821
- function ce(r) {
2900
+ function me(r) {
2822
2901
  r = r.trim();
2823
2902
  const t = r.match(/^v(\d+(?:\.\d+)?)\s*:\s*/);
2824
2903
  if (!t)
@@ -2838,13 +2917,13 @@ function ce(r) {
2838
2917
  const c = s.split(/\s*>\s*/).map((p) => p.trim()).filter((p) => p);
2839
2918
  if (c.length === 0)
2840
2919
  throw new Error("Invalid SEQL Selector: missing target node");
2841
- const u = c[c.length - 1], d = c.slice(0, -1), l = W(a, !0), h = d.map((p) => W(p, !1)), g = W(u, !1), f = he(o);
2920
+ const l = c[c.length - 1], f = c.slice(0, -1), h = B(a, !0), d = f.map((p) => B(p, !1)), u = B(l, !1), g = be(o);
2842
2921
  return {
2843
2922
  version: "1.0",
2844
- anchor: l,
2845
- path: h,
2846
- target: g,
2847
- constraints: f,
2923
+ anchor: h,
2924
+ path: d,
2925
+ target: u,
2926
+ constraints: g,
2848
2927
  fallback: {
2849
2928
  onMultiple: "best-score",
2850
2929
  onMissing: "anchor-only",
@@ -2859,65 +2938,71 @@ function ce(r) {
2859
2938
  }
2860
2939
  };
2861
2940
  }
2862
- function j(r, t = !1, e = ct) {
2863
- const { tag: s, semantics: n } = r;
2864
- let a = s;
2865
- const i = [], o = { ...n.attributes };
2866
- n.id && (o.id = n.id), n.role && !o.role && (o.role = n.role);
2867
- const c = Object.entries(o).map(([l, h]) => {
2868
- const g = it(l), f = l === "href" || l === "src" ? D(l, h) : h;
2869
- return { name: l, value: f, priority: g };
2870
- }).filter((l) => l.name !== "id" && l.name !== "class" && V.has(l.name) || Q.has(l.name) && Y(l.value) ? !1 : l.priority > 0 || l.name === "role" || l.name === "id");
2871
- c.sort((l, h) => h.priority - l.priority);
2872
- const u = c.slice(0, e.maxAttributes);
2873
- u.sort((l, h) => l.name.localeCompare(h.name));
2874
- for (const { name: l, value: h } of u)
2875
- i.push(`${l}="${B(h)}"`);
2876
- if (e.includeText && n.text && !ie(n.text.normalized)) {
2877
- const l = n.text.normalized;
2878
- l.length > 0 && l.length <= e.maxTextLength && i.push(`text="${B(l)}"`);
2879
- }
2880
- let d = i;
2881
- if (i.length > 0 && (t && e.simplifyTarget && n.id && (d = i.filter((l) => {
2882
- const h = l.split("=")[0];
2883
- return it(h) >= 60 || h === "text" || h === "id" || h === "role";
2884
- })), d.length > 0 && d.sort((l, h) => l.localeCompare(h))), n.classes && n.classes.length > 0) {
2885
- const l = M(n.classes), h = !!n.id || i.some(
2886
- (f) => f.startsWith("href=") || f.startsWith("data-testid=") || f.startsWith("text=") || f.startsWith("role=")
2887
- );
2888
- if (!(t && e.simplifyTarget && h) && l.length > 0) {
2889
- const f = l.sort().slice(0, e.maxClasses);
2890
- a += f.map((m) => `.${m}`).join("");
2941
+ function W(r, t = !1, e = ut, s) {
2942
+ const { tag: n, semantics: a } = r, i = e.format === "compact";
2943
+ let o = n;
2944
+ const c = [], l = { ...a.attributes };
2945
+ a.id && (l.id = a.id), a.role && !l.role && (l.role = a.role);
2946
+ const f = Object.entries(l).map(([u, g]) => {
2947
+ const m = ct(u), p = u === "href" || u === "src" ? D(u, g) : g;
2948
+ return { name: u, value: p, priority: m };
2949
+ }).filter((u) => u.name !== "id" && u.name !== "class" && Y.has(u.name) || Z.has(u.name) && K(u.value) ? !1 : u.priority > 0 || u.name === "role" || u.name === "id");
2950
+ f.sort((u, g) => g.priority - u.priority);
2951
+ const h = f.slice(0, e.maxAttributes);
2952
+ h.sort((u, g) => u.name.localeCompare(g.name));
2953
+ for (const { name: u, value: g } of h) {
2954
+ const m = i ? ht[u] ?? u : u;
2955
+ c.push(`${m}="${V(g)}"`);
2956
+ }
2957
+ if (e.includeText && a.text && !fe(a.text.normalized)) {
2958
+ const u = a.text.normalized;
2959
+ if (u.length > 0 && u.length <= e.maxTextLength && !(!t && s !== void 0 && u === s)) {
2960
+ const m = i ? "x" : "text";
2961
+ c.push(`${m}="${V(u)}"`);
2962
+ }
2963
+ }
2964
+ let d = c;
2965
+ if (c.length > 0 && t && e.simplifyTarget && a.id && (d = c.filter((u) => {
2966
+ const g = u.split("=")[0], m = G[g] ?? g;
2967
+ return ct(m) >= 60 || m === "text" || m === "id" || m === "role";
2968
+ })), a.classes && a.classes.length > 0) {
2969
+ const u = M(a.classes), g = !!a.id || c.some((p) => {
2970
+ const b = p.split("=")[0], S = G[b] ?? b;
2971
+ return S === "href" || S === "data-testid" || S === "text" || S === "role";
2972
+ });
2973
+ if (!(t && e.simplifyTarget && g) && u.length > 0) {
2974
+ const p = u.sort().slice(0, e.maxClasses);
2975
+ o += p.map((b) => `.${b}`).join("");
2891
2976
  }
2892
2977
  }
2893
- if (d.length > 0 && (a += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
2894
- const l = !!n.id || n.attributes && Object.keys(n.attributes).some(ae);
2895
- t && e.simplifyTarget && l || (a += `#${r.nthChild}`);
2978
+ if (d.length > 0 && (o += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
2979
+ const u = !!a.id || a.attributes && Object.keys(a.attributes).some(de);
2980
+ t && e.simplifyTarget && u || (o += `#${r.nthChild}`);
2896
2981
  }
2897
- return a;
2982
+ return o;
2898
2983
  }
2899
- function le(r) {
2984
+ function pe(r, t) {
2900
2985
  if (!r.constraints || r.constraints.length === 0)
2901
2986
  return "";
2902
- const t = [];
2903
- for (const e of r.constraints)
2904
- switch (e.type) {
2987
+ const e = [];
2988
+ for (const n of r.constraints)
2989
+ switch (n.type) {
2905
2990
  case "uniqueness":
2906
- t.push("unique=true");
2991
+ e.push("unique=true");
2907
2992
  break;
2908
2993
  case "position":
2909
- e.params && e.params.strategy && t.push(`pos=${e.params.strategy}`);
2994
+ n.params && n.params.strategy && e.push(`pos=${n.params.strategy}`);
2910
2995
  break;
2911
2996
  case "text-proximity":
2912
- if (e.params && e.params.reference) {
2913
- const s = B(String(e.params.reference));
2914
- t.push(`text="${s}"`);
2997
+ if (n.params && n.params.reference) {
2998
+ const a = V(String(n.params.reference));
2999
+ e.push(`text="${a}"`);
2915
3000
  }
2916
3001
  break;
2917
3002
  }
2918
- return t.length === 0 ? "" : ` {${t.join(",")}}`;
3003
+ return e.length === 0 ? "" : `${t.format === "verbose" ? " " : ""}{${e.join(",")}}`;
2919
3004
  }
2920
- function W(r, t) {
3005
+ function B(r, t) {
2921
3006
  let e = r;
2922
3007
  const s = {}, n = e.match(/^([a-z][a-z0-9-]*)/);
2923
3008
  if (!n)
@@ -2931,22 +3016,22 @@ function W(r, t) {
2931
3016
  i.length > 0 && (s.classes = i);
2932
3017
  const c = e.match(/^\[([^\]]+)\]/);
2933
3018
  if (c) {
2934
- const l = c[1], h = {}, g = ue(l);
2935
- for (const f of g) {
2936
- const m = f.match(/^([a-z][a-z0-9-]*)(?:=|~=)"((?:[^"\\]|\\.)*)"/);
3019
+ const h = c[1], d = {}, u = Se(h);
3020
+ for (const g of u) {
3021
+ const m = g.match(/^([a-z][a-z0-9-]*)(?:=|~=)"((?:[^"\\]|\\.)*)"/);
2937
3022
  if (m) {
2938
- const [, p, b] = m;
2939
- h[p] = lt(b);
3023
+ const [, p, b] = m, S = G[p] ?? p;
3024
+ d[S] = dt(b);
2940
3025
  }
2941
3026
  }
2942
- Object.keys(h).length > 0 && (h.text && (s.text = {
2943
- raw: h.text,
2944
- normalized: h.text
2945
- }, delete h.text), h.id && (s.id = h.id, delete h.id), h.role && (s.role = h.role, delete h.role), Object.keys(h).length > 0 && (s.attributes = h)), e = e.slice(c[0].length);
3027
+ Object.keys(d).length > 0 && (d.text && (s.text = {
3028
+ raw: d.text,
3029
+ normalized: d.text
3030
+ }, delete d.text), d.id && (s.id = d.id, delete d.id), d.role && (s.role = d.role, delete d.role), Object.keys(d).length > 0 && (s.attributes = d)), e = e.slice(c[0].length);
2946
3031
  }
2947
- let u;
2948
- const d = e.match(/^#(\d+)/);
2949
- if (d && (u = parseInt(d[1], 10), e = e.slice(d[0].length)), e.trim())
3032
+ let l;
3033
+ const f = e.match(/^#(\d+)/);
3034
+ if (f && (l = parseInt(f[1], 10), e = e.slice(f[0].length)), e.trim())
2950
3035
  throw new Error(`Invalid node: unexpected content "${e}" in "${r}"`);
2951
3036
  return t ? {
2952
3037
  tag: a,
@@ -2957,10 +3042,10 @@ function W(r, t) {
2957
3042
  tag: a,
2958
3043
  semantics: s,
2959
3044
  score: 0.7,
2960
- nthChild: u
3045
+ nthChild: l
2961
3046
  };
2962
3047
  }
2963
- function he(r) {
3048
+ function be(r) {
2964
3049
  if (!r.trim())
2965
3050
  return [];
2966
3051
  const t = [], e = r.split(",").map((s) => s.trim());
@@ -2990,7 +3075,7 @@ function he(r) {
2990
3075
  t.push({
2991
3076
  type: "text-proximity",
2992
3077
  params: {
2993
- reference: lt(i),
3078
+ reference: dt(i),
2994
3079
  maxDistance: 5
2995
3080
  },
2996
3081
  priority: 60
@@ -3001,7 +3086,7 @@ function he(r) {
3001
3086
  }
3002
3087
  return t;
3003
3088
  }
3004
- function ue(r) {
3089
+ function Se(r) {
3005
3090
  const t = [];
3006
3091
  let e = "", s = !1;
3007
3092
  for (let n = 0; n < r.length; n++) {
@@ -3010,34 +3095,34 @@ function ue(r) {
3010
3095
  }
3011
3096
  return e.trim() && t.push(e.trim()), t;
3012
3097
  }
3013
- function B(r) {
3098
+ function V(r) {
3014
3099
  return r.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
3015
3100
  }
3016
- function lt(r) {
3101
+ function dt(r) {
3017
3102
  return r.replace(/\\\\/g, "\0").replace(/\\"/g, '"').replace(/\\>/g, ">").replace(/\\:/g, ":").replace(/\x00/g, "\\");
3018
3103
  }
3019
- function xe(r, t, e) {
3020
- const s = X(r, t);
3021
- return s ? oe(s, e) : null;
3104
+ function Ne(r, t, e) {
3105
+ const s = J(r, t);
3106
+ return s ? ge(s, e) : null;
3022
3107
  }
3023
- function Ce(r, t, e) {
3108
+ function Ie(r, t, e) {
3024
3109
  try {
3025
- const s = ce(r), n = {
3110
+ const s = me(r), n = {
3026
3111
  ...e,
3027
3112
  root: e?.root || t
3028
3113
  };
3029
- return re(s, t, n).elements || [];
3114
+ return he(s, t, n).elements || [];
3030
3115
  } catch (s) {
3031
3116
  return console.error("Failed to resolve SEQL Selector:", s), [];
3032
3117
  }
3033
3118
  }
3034
- const de = /* @__PURE__ */ new Set(["script", "style", "noscript", "meta", "link", "head", "title"]);
3035
- function G(r) {
3036
- return r.id && !P(r.id) ? 3 : r.hasAttribute("role") || r.hasAttribute("aria-label") || r.hasAttribute("aria-labelledby") || r.hasAttribute("data-testid") || r.hasAttribute("data-qa") || r.hasAttribute("data-test") ? 2 : 1;
3119
+ const ye = /* @__PURE__ */ new Set(["script", "style", "noscript", "meta", "link", "head", "title"]);
3120
+ function Q(r) {
3121
+ return r.id && !L(r.id) ? 3 : r.hasAttribute("role") || r.hasAttribute("aria-label") || r.hasAttribute("aria-labelledby") || r.hasAttribute("data-testid") || r.hasAttribute("data-qa") || r.hasAttribute("data-test") ? 2 : 1;
3037
3122
  }
3038
- function ht(r, t) {
3123
+ function ft(r, t) {
3039
3124
  const e = r.tagName.toLowerCase();
3040
- return !!(de.has(e) || t && G(r) === 1 && ![
3125
+ return !!(ye.has(e) || t && Q(r) === 1 && ![
3041
3126
  "form",
3042
3127
  "main",
3043
3128
  "nav",
@@ -3053,13 +3138,13 @@ function ht(r, t) {
3053
3138
  "textarea"
3054
3139
  ].includes(e));
3055
3140
  }
3056
- function ut(r) {
3141
+ function gt(r) {
3057
3142
  return [...r].sort((t, e) => {
3058
- const s = G(t);
3059
- return G(e) - s;
3143
+ const s = Q(t);
3144
+ return Q(e) - s;
3060
3145
  });
3061
3146
  }
3062
- function Te(r = {}) {
3147
+ function Re(r = {}) {
3063
3148
  const t = performance.now();
3064
3149
  let {
3065
3150
  root: e,
@@ -3069,16 +3154,16 @@ function Te(r = {}) {
3069
3154
  progressInterval: i = 100,
3070
3155
  skipNonSemantic: o = !0,
3071
3156
  generatorOptions: c = {},
3072
- cache: u,
3073
- signal: d
3157
+ cache: l,
3158
+ signal: f
3074
3159
  } = r;
3075
- const l = u ?? Z(), h = { ...c, cache: l };
3076
- let g;
3160
+ const h = l ?? X(), d = { ...c, cache: h };
3161
+ let u;
3077
3162
  try {
3078
3163
  if (e)
3079
- e instanceof Document, g = Array.from(e.querySelectorAll(s));
3164
+ e instanceof Document, u = Array.from(e.querySelectorAll(s));
3080
3165
  else if (typeof document < "u")
3081
- g = Array.from(document.querySelectorAll(s));
3166
+ u = Array.from(document.querySelectorAll(s));
3082
3167
  else
3083
3168
  throw new Error("Root element or document is required when document is not available");
3084
3169
  } catch {
@@ -3097,66 +3182,66 @@ function Te(r = {}) {
3097
3182
  };
3098
3183
  }
3099
3184
  if (!e) {
3100
- if (g.length === 0)
3185
+ if (u.length === 0)
3101
3186
  throw new Error("Root element or document is required when no elements are found");
3102
- const x = k(g[0]);
3187
+ const x = k(u[0]);
3103
3188
  e = x.body || x.documentElement;
3104
3189
  }
3105
- const f = e instanceof Document ? e : k(e);
3106
- g.forEach((x, y) => {
3107
- if (k(x) !== f)
3190
+ const g = e instanceof Document ? e : k(e);
3191
+ u.forEach((x, y) => {
3192
+ if (k(x) !== g)
3108
3193
  throw new Error(
3109
3194
  `Batch generation requires all elements from the same document. Element at index ${y} is from a different document. If working with iframes, ensure all elements are from the same iframe's contentDocument.`
3110
3195
  );
3111
3196
  });
3112
- const m = g.filter((x) => !ht(x, o)), b = ut(m).slice(0, n), S = [], E = [];
3197
+ const m = u.filter((x) => !ft(x, o)), b = gt(m).slice(0, n), S = [], T = [];
3113
3198
  let C = 0;
3114
3199
  const A = b.length;
3115
3200
  let v = 0;
3116
- for (let x = 0; x < b.length && !d?.aborted; x++) {
3117
- const y = b[x], q = l.getEID(y);
3118
- if (q)
3201
+ for (let x = 0; x < b.length && !f?.aborted; x++) {
3202
+ const y = b[x], O = h.getEID(y);
3203
+ if (O)
3119
3204
  S.push({
3120
3205
  element: y,
3121
- eid: q,
3206
+ eid: O,
3122
3207
  generationTimeMs: 0
3123
3208
  // Cached, no generation time
3124
3209
  });
3125
3210
  else {
3126
- const dt = performance.now();
3211
+ const mt = performance.now();
3127
3212
  try {
3128
- const L = X(y, h), ft = performance.now() - dt;
3129
- L ? S.push({
3213
+ const H = J(y, d), pt = performance.now() - mt;
3214
+ H ? S.push({
3130
3215
  element: y,
3131
- eid: L,
3132
- generationTimeMs: ft
3216
+ eid: H,
3217
+ generationTimeMs: pt
3133
3218
  }) : C++;
3134
- } catch (L) {
3135
- E.push({
3219
+ } catch (H) {
3220
+ T.push({
3136
3221
  element: y,
3137
- error: L instanceof Error ? L.message : String(L)
3222
+ error: H instanceof Error ? H.message : String(H)
3138
3223
  });
3139
3224
  }
3140
3225
  }
3141
3226
  a && x - v >= i && (a(x + 1, A), v = x);
3142
3227
  }
3143
3228
  a && a(A, A);
3144
- const H = performance.now() - t, $ = l.getStats(), T = $.eidHits + $.eidMisses + $.selectorHits + $.selectorMisses, R = $.eidHits + $.selectorHits, N = T > 0 ? R / T : 0;
3229
+ const P = performance.now() - t, $ = h.getStats(), E = $.eidHits + $.eidMisses + $.selectorHits + $.selectorMisses, R = $.eidHits + $.selectorHits, N = E > 0 ? R / E : 0;
3145
3230
  return {
3146
3231
  results: S,
3147
- failed: E,
3232
+ failed: T,
3148
3233
  stats: {
3149
3234
  totalElements: A,
3150
3235
  successful: S.length,
3151
- failed: E.length,
3236
+ failed: T.length,
3152
3237
  skipped: C,
3153
- totalTimeMs: H,
3154
- avgTimePerElementMs: S.length > 0 ? H / S.length : 0,
3238
+ totalTimeMs: P,
3239
+ avgTimePerElementMs: S.length > 0 ? P / S.length : 0,
3155
3240
  cacheHitRate: N
3156
3241
  }
3157
3242
  };
3158
3243
  }
3159
- function Ee(r, t = {}) {
3244
+ function De(r, t = {}) {
3160
3245
  const e = performance.now(), {
3161
3246
  limit: s = 1 / 0,
3162
3247
  onProgress: n,
@@ -3164,13 +3249,13 @@ function Ee(r, t = {}) {
3164
3249
  skipNonSemantic: i = !0,
3165
3250
  generatorOptions: o = {},
3166
3251
  cache: c,
3167
- signal: u
3168
- } = t, d = c ?? Z(), l = { ...o, cache: d }, h = r.filter((T) => !ht(T, i)), f = ut(h).slice(0, s), m = [], p = [];
3252
+ signal: l
3253
+ } = t, f = c ?? X(), h = { ...o, cache: f }, d = r.filter((E) => !ft(E, i)), g = gt(d).slice(0, s), m = [], p = [];
3169
3254
  let b = 0;
3170
- const S = f.length;
3171
- let E = 0;
3172
- for (let T = 0; T < f.length && !u?.aborted; T++) {
3173
- const R = f[T], N = d.getEID(R);
3255
+ const S = g.length;
3256
+ let T = 0;
3257
+ for (let E = 0; E < g.length && !l?.aborted; E++) {
3258
+ const R = g[E], N = f.getEID(R);
3174
3259
  if (N)
3175
3260
  m.push({
3176
3261
  element: R,
@@ -3180,11 +3265,11 @@ function Ee(r, t = {}) {
3180
3265
  else {
3181
3266
  const x = performance.now();
3182
3267
  try {
3183
- const y = X(R, l), q = performance.now() - x;
3268
+ const y = J(R, h), O = performance.now() - x;
3184
3269
  y ? m.push({
3185
3270
  element: R,
3186
3271
  eid: y,
3187
- generationTimeMs: q
3272
+ generationTimeMs: O
3188
3273
  }) : b++;
3189
3274
  } catch (y) {
3190
3275
  p.push({
@@ -3193,10 +3278,10 @@ function Ee(r, t = {}) {
3193
3278
  });
3194
3279
  }
3195
3280
  }
3196
- n && T - E >= a && (n(T + 1, S), E = T);
3281
+ n && E - T >= a && (n(E + 1, S), T = E);
3197
3282
  }
3198
3283
  n && n(S, S);
3199
- const C = performance.now() - e, A = d.getStats(), v = A.eidHits + A.eidMisses + A.selectorHits + A.selectorMisses, H = A.eidHits + A.selectorHits, $ = v > 0 ? H / v : 0;
3284
+ const C = performance.now() - e, A = f.getStats(), v = A.eidHits + A.eidMisses + A.selectorHits + A.selectorMisses, P = A.eidHits + A.selectorHits, $ = v > 0 ? P / v : 0;
3200
3285
  return {
3201
3286
  results: m,
3202
3287
  failed: p,
@@ -3212,41 +3297,41 @@ function Ee(r, t = {}) {
3212
3297
  };
3213
3298
  }
3214
3299
  export {
3215
- St as AnchorFinder,
3216
- ee as ConstraintsEvaluator,
3217
- ot as CssGenerator,
3218
- bt as DEFAULT_GENERATOR_OPTIONS,
3219
- yt as DEFAULT_RESOLVER_OPTIONS,
3220
- Bt as EIDCache,
3221
- fe as EID_VERSION,
3222
- se as FallbackHandler,
3223
- ge as MAX_PATH_DEPTH,
3224
- $t as PathBuilder,
3225
- J as ROLE_ANCHOR_VALUES,
3226
- K as SEMANTIC_ANCHOR_TAGS,
3227
- me as SEMANTIC_ATTRIBUTES,
3228
- mt as SEMANTIC_TAGS,
3229
- st as SemanticExtractor,
3230
- te as SemanticsMatcher,
3231
- Ft as SvgFingerprinter,
3232
- jt as calculateConfidence,
3233
- be as calculateElementScore,
3234
- Gt as createEIDCache,
3235
- vt as filterClasses,
3236
- X as generateEID,
3237
- Te as generateEIDBatch,
3238
- Ee as generateEIDForElements,
3239
- xe as generateSEQL,
3240
- pe as getClassScore,
3241
- Z as getGlobalCache,
3242
- Ae as isEID,
3243
- tt as isUtilityClass,
3244
- F as normalizeText,
3245
- ce as parseSEQL,
3246
- ye as resetGlobalCache,
3247
- re as resolve,
3248
- Ce as resolveSEQL,
3249
- oe as stringifySEQL,
3250
- Se as validateEID
3300
+ Ct as AnchorFinder,
3301
+ ce as ConstraintsEvaluator,
3302
+ lt as CssGenerator,
3303
+ At as DEFAULT_GENERATOR_OPTIONS,
3304
+ xt as DEFAULT_RESOLVER_OPTIONS,
3305
+ Xt as EIDCache,
3306
+ Ae as EID_VERSION,
3307
+ le as FallbackHandler,
3308
+ xe as MAX_PATH_DEPTH,
3309
+ Pt as PathBuilder,
3310
+ et as ROLE_ANCHOR_VALUES,
3311
+ tt as SEMANTIC_ANCHOR_TAGS,
3312
+ Ce as SEMANTIC_ATTRIBUTES,
3313
+ St as SEMANTIC_TAGS,
3314
+ nt as SemanticExtractor,
3315
+ oe as SemanticsMatcher,
3316
+ Yt as SvgFingerprinter,
3317
+ Zt as calculateConfidence,
3318
+ Ee as calculateElementScore,
3319
+ Jt as createEIDCache,
3320
+ It as filterClasses,
3321
+ J as generateEID,
3322
+ Re as generateEIDBatch,
3323
+ De as generateEIDForElements,
3324
+ Ne as generateSEQL,
3325
+ Te as getClassScore,
3326
+ X as getGlobalCache,
3327
+ $e as isEID,
3328
+ st as isUtilityClass,
3329
+ j as normalizeText,
3330
+ me as parseSEQL,
3331
+ we as resetGlobalCache,
3332
+ he as resolve,
3333
+ Ie as resolveSEQL,
3334
+ ge as stringifySEQL,
3335
+ ve as validateEID
3251
3336
  };
3252
3337
  //# sourceMappingURL=seql-js.js.map